comparison mercurial/util.py @ 10197:29e3c4a7699b

subrepo: normalize svn output line-endings
author Patrick Mezard <pmezard@gmail.com>
date Sat, 02 Jan 2010 16:03:25 +0100
parents 2770d03ae49f
children c2e2a5e6c36b
comparison
equal deleted inserted replaced
10196:20d849251fe6 10197:29e3c4a7699b
36 _fastsha1 = sha1 = _sha1 36 _fastsha1 = sha1 = _sha1
37 return _sha1(s) 37 return _sha1(s)
38 38
39 import subprocess 39 import subprocess
40 closefds = os.name == 'posix' 40 closefds = os.name == 'posix'
41 def popen2(cmd): 41
42 def popen2(cmd, newlines=False):
42 # Setting bufsize to -1 lets the system decide the buffer size. 43 # Setting bufsize to -1 lets the system decide the buffer size.
43 # The default for bufsize is 0, meaning unbuffered. This leads to 44 # The default for bufsize is 0, meaning unbuffered. This leads to
44 # poor performance on Mac OS X: http://bugs.python.org/issue4194 45 # poor performance on Mac OS X: http://bugs.python.org/issue4194
45 p = subprocess.Popen(cmd, shell=True, bufsize=-1, 46 p = subprocess.Popen(cmd, shell=True, bufsize=-1,
46 close_fds=closefds, 47 close_fds=closefds,
47 stdin=subprocess.PIPE, stdout=subprocess.PIPE) 48 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
49 universal_newlines=newlines)
48 return p.stdin, p.stdout 50 return p.stdin, p.stdout
49 def popen3(cmd): 51
52 def popen3(cmd, newlines=False):
50 p = subprocess.Popen(cmd, shell=True, bufsize=-1, 53 p = subprocess.Popen(cmd, shell=True, bufsize=-1,
51 close_fds=closefds, 54 close_fds=closefds,
52 stdin=subprocess.PIPE, stdout=subprocess.PIPE, 55 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
53 stderr=subprocess.PIPE) 56 stderr=subprocess.PIPE,
57 universal_newlines=newlines)
54 return p.stdin, p.stdout, p.stderr 58 return p.stdin, p.stdout, p.stderr
55 59
56 def version(): 60 def version():
57 """Return version information if available.""" 61 """Return version information if available."""
58 try: 62 try: