Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
37457:d83191e9749b | 37458:00e4bd97b095 |
---|---|
2101 fuzz = False | 2101 fuzz = False |
2102 args = [] | 2102 args = [] |
2103 cwd = repo.root | 2103 cwd = repo.root |
2104 if cwd: | 2104 if cwd: |
2105 args.append('-d %s' % procutil.shellquote(cwd)) | 2105 args.append('-d %s' % procutil.shellquote(cwd)) |
2106 fp = procutil.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, | 2106 cmd = ('%s %s -p%d < %s' |
2107 procutil.shellquote(patchname))) | 2107 % (patcher, ' '.join(args), strip, procutil.shellquote(patchname))) |
2108 fp = procutil.popen(cmd, 'rb') | |
2108 try: | 2109 try: |
2109 for line in util.iterfile(fp): | 2110 for line in util.iterfile(fp): |
2110 line = line.rstrip() | 2111 line = line.rstrip() |
2111 ui.note(line + '\n') | 2112 ui.note(line + '\n') |
2112 if line.startswith('patching file '): | 2113 if line.startswith('patching file '): |