##// END OF EJS Templates
convert: rewrite gitpipe to use common.commandline (SEC)...
Mateusz Kwapich -
r28662:80cac1de stable
parent child Browse files
Show More
@@ -341,6 +341,9 b' class commandline(object):'
341 341 def _run2(self, cmd, *args, **kwargs):
342 342 return self._dorun(util.popen2, cmd, *args, **kwargs)
343 343
344 def _run3(self, cmd, *args, **kwargs):
345 return self._dorun(util.popen3, cmd, *args, **kwargs)
346
344 347 def _dorun(self, openfunc, cmd, *args, **kwargs):
345 348 cmdline = self._cmdline(cmd, *args, **kwargs)
346 349 self.ui.debug('running: %s\n' % (cmdline,))
@@ -29,21 +29,6 b' class convert_git(converter_source, comm'
29 29 # Windows does not support GIT_DIR= construct while other systems
30 30 # cannot remove environment variable. Just assume none have
31 31 # both issues.
32 if util.safehasattr(os, 'unsetenv'):
33 def gitpipe(self, s):
34 prevgitdir = os.environ.get('GIT_DIR')
35 os.environ['GIT_DIR'] = self.path
36 try:
37 return util.popen3(s)
38 finally:
39 if prevgitdir is None:
40 del os.environ['GIT_DIR']
41 else:
42 os.environ['GIT_DIR'] = prevgitdir
43
44 else:
45 def gitpipe(self, s):
46 return util.popen3('GIT_DIR=%s %s' % (self.path, s))
47 32
48 33 def _gitcmd(self, cmd, *args, **kwargs):
49 34 return cmd('--git-dir=%s' % self.path, *args, **kwargs)
@@ -60,6 +45,9 b' class convert_git(converter_source, comm'
60 45 def gitrunlines(self, *args, **kwargs):
61 46 return self._gitcmd(self.runlines, *args, **kwargs)
62 47
48 def gitpipe(self, *args, **kwargs):
49 return self._gitcmd(self._run3, *args, **kwargs)
50
63 51 def gitread(self, s):
64 52 fh = self.gitopen(s)
65 53 data = fh.read()
@@ -92,7 +80,7 b' class convert_git(converter_source, comm'
92 80 self.path = path
93 81 self.submodules = []
94 82
95 self.catfilepipe = self.gitpipe('git cat-file --batch')
83 self.catfilepipe = self.gitpipe('cat-file', '--batch')
96 84
97 85 def after(self):
98 86 for f in self.catfilepipe:
General Comments 0
You need to be logged in to leave comments. Login now