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