# HG changeset patch # User Patrick Mezard # Date 2010-01-02 15:03:25 # Node ID 29e3c4a7699bed18427a9648a3cb35ab941d976f # Parent 20d849251fe65e7ffcd9b7c536381c0a325dc0fe subrepo: normalize svn output line-endings diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -261,7 +261,7 @@ class svnsubrepo(object): cmd = ['svn'] + commands + [self._path] cmd = [util.shellquote(arg) for arg in cmd] cmd = util.quotecommand(' '.join(cmd)) - write, read, err = util.popen3(cmd) + write, read, err = util.popen3(cmd, newlines=True) retdata = read.read() err = err.read().strip() if err: diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -38,19 +38,23 @@ def _fastsha1(s): import subprocess closefds = os.name == 'posix' -def popen2(cmd): + +def popen2(cmd, newlines=False): # Setting bufsize to -1 lets the system decide the buffer size. # The default for bufsize is 0, meaning unbuffered. This leads to # poor performance on Mac OS X: http://bugs.python.org/issue4194 p = subprocess.Popen(cmd, shell=True, bufsize=-1, close_fds=closefds, - stdin=subprocess.PIPE, stdout=subprocess.PIPE) + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + universal_newlines=newlines) return p.stdin, p.stdout -def popen3(cmd): + +def popen3(cmd, newlines=False): p = subprocess.Popen(cmd, shell=True, bufsize=-1, close_fds=closefds, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + universal_newlines=newlines) return p.stdin, p.stdout, p.stderr def version():