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