Show More
@@ -43,14 +43,13 b' class convert_cvs(converter_source):' | |||||
43 | cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev) |
|
43 | cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev) | |
44 | except util.Abort: |
|
44 | except util.Abort: | |
45 | raise util.Abort('revision %s is not a patchset number or date' % self.rev) |
|
45 | raise util.Abort('revision %s is not a patchset number or date' % self.rev) | |
46 | cmd += " 2>&1" |
|
|||
47 |
|
46 | |||
48 | d = os.getcwd() |
|
47 | d = os.getcwd() | |
49 | try: |
|
48 | try: | |
50 | os.chdir(self.path) |
|
49 | os.chdir(self.path) | |
51 | id = None |
|
50 | id = None | |
52 | state = 0 |
|
51 | state = 0 | |
53 |
for l in |
|
52 | for l in util.popen(cmd): | |
54 | if state == 0: # header |
|
53 | if state == 0: # header | |
55 | if l.startswith("PatchSet"): |
|
54 | if l.startswith("PatchSet"): | |
56 | id = l[9:-2] |
|
55 | id = l[9:-2] |
@@ -65,9 +65,9 b' class darcs_source(converter_source):' | |||||
65 | cmdline += args |
|
65 | cmdline += args | |
66 | cmdline = [util.shellquote(arg) for arg in cmdline] |
|
66 | cmdline = [util.shellquote(arg) for arg in cmdline] | |
67 | cmdline += ['<', util.nulldev] |
|
67 | cmdline += ['<', util.nulldev] | |
68 |
cmdline = |
|
68 | cmdline = ' '.join(cmdline) | |
69 | self.ui.debug(cmdline, '\n') |
|
69 | self.ui.debug(cmdline, '\n') | |
70 |
return |
|
70 | return util.popen(cmdline) | |
71 |
|
71 | |||
72 | def run(self, cmd, *args, **kwargs): |
|
72 | def run(self, cmd, *args, **kwargs): | |
73 | fp = self._run(cmd, *args, **kwargs) |
|
73 | fp = self._run(cmd, *args, **kwargs) |
@@ -14,7 +14,7 b' class convert_git(converter_source):' | |||||
14 | prevgitdir = os.environ.get('GIT_DIR') |
|
14 | prevgitdir = os.environ.get('GIT_DIR') | |
15 | os.environ['GIT_DIR'] = self.path |
|
15 | os.environ['GIT_DIR'] = self.path | |
16 | try: |
|
16 | try: | |
17 |
return |
|
17 | return util.popen(s) | |
18 | finally: |
|
18 | finally: | |
19 | if prevgitdir is None: |
|
19 | if prevgitdir is None: | |
20 | del os.environ['GIT_DIR'] |
|
20 | del os.environ['GIT_DIR'] | |
@@ -22,7 +22,7 b' class convert_git(converter_source):' | |||||
22 | os.environ['GIT_DIR'] = prevgitdir |
|
22 | os.environ['GIT_DIR'] = prevgitdir | |
23 | else: |
|
23 | else: | |
24 | def gitcmd(self, s): |
|
24 | def gitcmd(self, s): | |
25 |
return |
|
25 | return util.popen('GIT_DIR=%s %s' % (self.path, s)) | |
26 |
|
26 | |||
27 | def __init__(self, ui, path, rev=None): |
|
27 | def __init__(self, ui, path, rev=None): | |
28 | super(convert_git, self).__init__(ui, path, rev=rev) |
|
28 | super(convert_git, self).__init__(ui, path, rev=rev) | |
@@ -42,8 +42,7 b' class convert_git(converter_source):' | |||||
42 |
|
42 | |||
43 | def catfile(self, rev, type): |
|
43 | def catfile(self, rev, type): | |
44 | if rev == "0" * 40: raise IOError() |
|
44 | if rev == "0" * 40: raise IOError() | |
45 |
fh = self.gitcmd("git-cat-file %s %s |
|
45 | fh = self.gitcmd("git-cat-file %s %s" % (type, rev)) | |
46 | util.nulldev)) |
|
|||
47 | return fh.read() |
|
46 | return fh.read() | |
48 |
|
47 | |||
49 | def getfile(self, name, rev): |
|
48 | def getfile(self, name, rev): | |
@@ -108,8 +107,7 b' class convert_git(converter_source):' | |||||
108 |
|
107 | |||
109 | def gettags(self): |
|
108 | def gettags(self): | |
110 | tags = {} |
|
109 | tags = {} | |
111 |
fh = self.gitcmd('git-ls-remote --tags "%s" |
|
110 | fh = self.gitcmd('git-ls-remote --tags "%s"' % self.path) | |
112 | util.nulldev)) |
|
|||
113 | prefix = 'refs/tags/' |
|
111 | prefix = 'refs/tags/' | |
114 | for line in fh: |
|
112 | for line in fh: | |
115 | line = line.strip() |
|
113 | line = line.strip() |
@@ -249,7 +249,7 b' def externalpatch(patcher, args, patchna' | |||||
249 | fuzz = False |
|
249 | fuzz = False | |
250 | if cwd: |
|
250 | if cwd: | |
251 | args.append('-d %s' % util.shellquote(cwd)) |
|
251 | args.append('-d %s' % util.shellquote(cwd)) | |
252 |
fp = |
|
252 | fp = util.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, | |
253 | util.shellquote(patchname))) |
|
253 | util.shellquote(patchname))) | |
254 |
|
254 | |||
255 | for line in fp: |
|
255 | for line in fp: |
@@ -1011,6 +1011,13 b" if os.name == 'nt':" | |||||
1011 | # through the current COMSPEC. cmd.exe suppress enclosing quotes. |
|
1011 | # through the current COMSPEC. cmd.exe suppress enclosing quotes. | |
1012 | return '"' + cmd + '"' |
|
1012 | return '"' + cmd + '"' | |
1013 |
|
1013 | |||
|
1014 | def popen(command): | |||
|
1015 | # Work around "popen spawned process may not write to stdout | |||
|
1016 | # under windows" | |||
|
1017 | # http://bugs.python.org/issue1366 | |||
|
1018 | command += " 2> %s" % nulldev | |||
|
1019 | return os.popen(quotecommand(command)) | |||
|
1020 | ||||
1014 | def explain_exit(code): |
|
1021 | def explain_exit(code): | |
1015 | return _("exited with status %d") % code, code |
|
1022 | return _("exited with status %d") % code, code | |
1016 |
|
1023 | |||
@@ -1168,6 +1175,9 b' else:' | |||||
1168 | def quotecommand(cmd): |
|
1175 | def quotecommand(cmd): | |
1169 | return cmd |
|
1176 | return cmd | |
1170 |
|
1177 | |||
|
1178 | def popen(command): | |||
|
1179 | return os.popen(command) | |||
|
1180 | ||||
1171 | def testpid(pid): |
|
1181 | def testpid(pid): | |
1172 | '''return False if pid dead, True if running or not sure''' |
|
1182 | '''return False if pid dead, True if running or not sure''' | |
1173 | if os.sys.platform == 'OpenVMS': |
|
1183 | if os.sys.platform == 'OpenVMS': |
@@ -50,7 +50,7 b' def remember_version(version=None):' | |||||
50 | """Store version information.""" |
|
50 | """Store version information.""" | |
51 | global remembered_version |
|
51 | global remembered_version | |
52 | if not version and os.path.isdir(".hg"): |
|
52 | if not version and os.path.isdir(".hg"): | |
53 |
f = |
|
53 | f = util.popen("hg identify") # use real hg installation | |
54 | ident = f.read()[:-1] |
|
54 | ident = f.read()[:-1] | |
55 | if not f.close() and ident: |
|
55 | if not f.close() and ident: | |
56 | ids = ident.split(' ', 1) |
|
56 | ids = ident.split(' ', 1) |
General Comments 0
You need to be logged in to leave comments.
Login now