Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 49032:fd5b8e696b75
py3: stop using util.iterfile()
The Python 3 implementation is a no-op. So this is equivalent.
We still keep util.iterfile() around for backwards API compatibility to
help the Python 3 migration. It can be deleted in a future release.
Differential Revision: https://phab.mercurial-scm.org/D12347
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 21 Feb 2022 12:42:48 -0700 |
parents | 2cce2fa5bcf7 |
children | 642e31cb55f0 |
comparison
equal
deleted
inserted
replaced
49031:2974cdda819b | 49032:fd5b8e696b75 |
---|---|
1257 ui.warn(_(b"editor exited with exit code %d\n") % ret) | 1257 ui.warn(_(b"editor exited with exit code %d\n") % ret) |
1258 continue | 1258 continue |
1259 # Remove comment lines | 1259 # Remove comment lines |
1260 patchfp = open(patchfn, 'rb') | 1260 patchfp = open(patchfn, 'rb') |
1261 ncpatchfp = stringio() | 1261 ncpatchfp = stringio() |
1262 for line in util.iterfile(patchfp): | 1262 for line in patchfp: |
1263 line = util.fromnativeeol(line) | 1263 line = util.fromnativeeol(line) |
1264 if not line.startswith(b'#'): | 1264 if not line.startswith(b'#'): |
1265 ncpatchfp.write(line) | 1265 ncpatchfp.write(line) |
1266 patchfp.close() | 1266 patchfp.close() |
1267 ncpatchfp.seek(0) | 1267 ncpatchfp.seek(0) |
2341 procutil.shellquote(patchname), | 2341 procutil.shellquote(patchname), |
2342 ) | 2342 ) |
2343 ui.debug(b'Using external patch tool: %s\n' % cmd) | 2343 ui.debug(b'Using external patch tool: %s\n' % cmd) |
2344 fp = procutil.popen(cmd, b'rb') | 2344 fp = procutil.popen(cmd, b'rb') |
2345 try: | 2345 try: |
2346 for line in util.iterfile(fp): | 2346 for line in fp: |
2347 line = line.rstrip() | 2347 line = line.rstrip() |
2348 ui.note(line + b'\n') | 2348 ui.note(line + b'\n') |
2349 if line.startswith(b'patching file '): | 2349 if line.startswith(b'patching file '): |
2350 pf = util.parsepatchoutput(line) | 2350 pf = util.parsepatchoutput(line) |
2351 printed_file = False | 2351 printed_file = False |