Mercurial > public > mercurial-scm > hg-stable
diff mercurial/patch.py @ 37458:00e4bd97b095
procutil: always popen() in binary mode
On Python 3, non-binary stream is useless. Let's convert line ending by
ourselves.
Note that we don't need fromnativeeol() in patch._externalpatch() since
any whitespace characters are rstrip()-ed.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 07 Apr 2018 20:50:38 +0900 |
parents | 19becdf565ef |
children | bbd240f81ac5 |
line wrap: on
line diff
--- a/mercurial/patch.py Sat Apr 07 13:46:32 2018 +0900 +++ b/mercurial/patch.py Sat Apr 07 20:50:38 2018 +0900 @@ -2103,8 +2103,9 @@ cwd = repo.root if cwd: args.append('-d %s' % procutil.shellquote(cwd)) - fp = procutil.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, - procutil.shellquote(patchname))) + cmd = ('%s %s -p%d < %s' + % (patcher, ' '.join(args), strip, procutil.shellquote(patchname))) + fp = procutil.popen(cmd, 'rb') try: for line in util.iterfile(fp): line = line.rstrip()