##// END OF EJS Templates
convert: add new, non-clowny interface for shelling out to git (SEC)...
Mateusz Kwapich -
r28659:197eed39 stable
parent child Browse files
Show More
@@ -11,7 +11,7 b' from mercurial import util, config, erro'
11 from mercurial.node import hex, nullid
11 from mercurial.node import hex, nullid
12 from mercurial.i18n import _
12 from mercurial.i18n import _
13
13
14 from common import NoRepo, commit, converter_source, checktool
14 from common import NoRepo, commit, converter_source, checktool, commandline
15
15
16 class submodule(object):
16 class submodule(object):
17 def __init__(self, path, node, url):
17 def __init__(self, path, node, url):
@@ -25,7 +25,7 b' class submodule(object):'
25 def hgsubstate(self):
25 def hgsubstate(self):
26 return "%s %s" % (self.node, self.path)
26 return "%s %s" % (self.node, self.path)
27
27
28 class convert_git(converter_source):
28 class convert_git(converter_source, commandline):
29 # Windows does not support GIT_DIR= construct while other systems
29 # Windows does not support GIT_DIR= construct while other systems
30 # cannot remove environment variable. Just assume none have
30 # cannot remove environment variable. Just assume none have
31 # both issues.
31 # both issues.
@@ -71,6 +71,21 b' class convert_git(converter_source):'
71 def gitpipe(self, s):
71 def gitpipe(self, s):
72 return util.popen3('GIT_DIR=%s %s' % (self.path, s))
72 return util.popen3('GIT_DIR=%s %s' % (self.path, s))
73
73
74 def _gitcmd(self, cmd, *args, **kwargs):
75 return cmd('--git-dir=%s' % self.path, *args, **kwargs)
76
77 def gitrun0(self, *args, **kwargs):
78 return self._gitcmd(self.run0, *args, **kwargs)
79
80 def gitrun(self, *args, **kwargs):
81 return self._gitcmd(self.run, *args, **kwargs)
82
83 def gitrunlines0(self, *args, **kwargs):
84 return self._gitcmd(self.runlines0, *args, **kwargs)
85
86 def gitrunlines(self, *args, **kwargs):
87 return self._gitcmd(self.runlines, *args, **kwargs)
88
74 def popen_with_stderr(self, s):
89 def popen_with_stderr(self, s):
75 p = subprocess.Popen(s, shell=True, bufsize=-1,
90 p = subprocess.Popen(s, shell=True, bufsize=-1,
76 close_fds=util.closefds,
91 close_fds=util.closefds,
@@ -88,6 +103,7 b' class convert_git(converter_source):'
88
103
89 def __init__(self, ui, path, revs=None):
104 def __init__(self, ui, path, revs=None):
90 super(convert_git, self).__init__(ui, path, revs=revs)
105 super(convert_git, self).__init__(ui, path, revs=revs)
106 commandline.__init__(self, ui, 'git')
91
107
92 if os.path.isdir(path + "/.git"):
108 if os.path.isdir(path + "/.git"):
93 path += "/.git"
109 path += "/.git"
General Comments 0
You need to be logged in to leave comments. Login now