Show More
@@ -252,7 +252,7 b' class convert_cvs(converter_source):' | |||
|
252 | 252 | # popen2 does not support argument lists under Windows |
|
253 | 253 | cmd = [util.shellquote(arg) for arg in cmd] |
|
254 | 254 | cmd = util.quotecommand(' '.join(cmd)) |
|
255 |
self.writep, self.readp = |
|
|
255 | self.writep, self.readp = util.popen2(cmd, 'b') | |
|
256 | 256 | |
|
257 | 257 | self.realroot = root |
|
258 | 258 |
@@ -914,7 +914,7 b' class svn_source(converter_source):' | |||
|
914 | 914 | arg = encodeargs(args) |
|
915 | 915 | hgexe = util.hgexecutable() |
|
916 | 916 | cmd = '%s debugsvnlog' % util.shellquote(hgexe) |
|
917 |
stdin, stdout = |
|
|
917 | stdin, stdout = util.popen2(cmd, 'b') | |
|
918 | 918 | stdin.write(arg) |
|
919 | 919 | stdin.close() |
|
920 | 920 | return logstream(stdout) |
@@ -9,7 +9,7 b'' | |||
|
9 | 9 | from i18n import _ |
|
10 | 10 | from node import hex, nullid, short |
|
11 | 11 | import base85, cmdutil, mdiff, util, revlog, diffhelpers, copies |
|
12 |
import cStringIO, email.Parser, os, |
|
|
12 | import cStringIO, email.Parser, os, re, errno | |
|
13 | 13 | import sys, tempfile, zlib |
|
14 | 14 | |
|
15 | 15 | class PatchError(Exception): |
@@ -1308,7 +1308,7 b' def diffstat(patchlines):' | |||
|
1308 | 1308 | return |
|
1309 | 1309 | fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt") |
|
1310 | 1310 | try: |
|
1311 |
p = |
|
|
1311 | p = util.Popen3('diffstat -p1 -w79 2>/dev/null > ' + name) | |
|
1312 | 1312 | try: |
|
1313 | 1313 | for line in patchlines: |
|
1314 | 1314 | p.tochild.write(line + "\n") |
@@ -61,7 +61,7 b' class sshrepository(repo.repository):' | |||
|
61 | 61 | |
|
62 | 62 | cmd = util.quotecommand(cmd) |
|
63 | 63 | ui.note(_('running %s\n') % cmd) |
|
64 |
self.pipeo, self.pipei, self.pipee = |
|
|
64 | self.pipeo, self.pipei, self.pipee = util.popen3(cmd, 'b') | |
|
65 | 65 | |
|
66 | 66 | # skip any noise generated by remote shell |
|
67 | 67 | self.do_cmd("hello") |
@@ -50,6 +50,33 b' def sha1(s):' | |||
|
50 | 50 | return _sha1(s) |
|
51 | 51 | |
|
52 | 52 | try: |
|
53 | import subprocess | |
|
54 | def popen2(cmd, mode='t', bufsize=-1): | |
|
55 | p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True, | |
|
56 | stdin=subprocess.PIPE, stdout=subprocess.PIPE) | |
|
57 | return p.stdin, p.stdout | |
|
58 | def popen3(cmd, mode='t', bufsize=-1): | |
|
59 | p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True, | |
|
60 | stdin=subprocess.PIPE, stdout=subprocess.PIPE, | |
|
61 | stderr=subprocess.PIPE) | |
|
62 | return p.stdin, p.stdout, p.stderr | |
|
63 | def Popen3(cmd, capturestderr=False, bufsize=-1): | |
|
64 | stderr = capturestderr and subprocess.PIPE or None | |
|
65 | p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True, | |
|
66 | stdin=subprocess.PIPE, stdout=subprocess.PIPE, | |
|
67 | stderr=stderr) | |
|
68 | p.fromchild = p.stdout | |
|
69 | p.tochild = p.stdin | |
|
70 | p.childerr = p.stderr | |
|
71 | return p | |
|
72 | except ImportError: | |
|
73 | subprocess = None | |
|
74 | import popen2 as _popen2 | |
|
75 | popen2 = _popen2.popen2 | |
|
76 | Popen3 = _popen2.Popen3 | |
|
77 | ||
|
78 | ||
|
79 | try: | |
|
53 | 80 | _encoding = os.environ.get("HGENCODING") |
|
54 | 81 | if sys.platform == 'darwin' and not _encoding: |
|
55 | 82 | # On darwin, getpreferredencoding ignores the locale environment and |
@@ -183,7 +210,7 b' def cachefunc(func):' | |||
|
183 | 210 | |
|
184 | 211 | def pipefilter(s, cmd): |
|
185 | 212 | '''filter string S through command CMD, returning its output''' |
|
186 |
(pin, pout) = |
|
|
213 | (pin, pout) = popen2(cmd, 'b') | |
|
187 | 214 | def writer(): |
|
188 | 215 | try: |
|
189 | 216 | pin.write(s) |
General Comments 0
You need to be logged in to leave comments.
Login now