# HG changeset patch # User Jun Wu # Date 1479165246 0 # Node ID 564b33acc21f3d2773d8a990114e157921229460 # Parent 78a58dcf88535162b03827f750ecf241325d57d4 patch: migrate to util.iterfile diff -r 78a58dcf8853 -r 564b33acc21f mercurial/patch.py --- a/mercurial/patch.py Mon Nov 14 23:12:11 2016 +0000 +++ b/mercurial/patch.py Mon Nov 14 23:14:06 2016 +0000 @@ -1069,7 +1069,7 @@ # Remove comment lines patchfp = open(patchfn) ncpatchfp = stringio() - for line in patchfp: + for line in util.iterfile(patchfp): if not line.startswith('#'): ncpatchfp.write(line) patchfp.close() @@ -2012,7 +2012,7 @@ fp = util.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, util.shellquote(patchname))) try: - for line in fp: + for line in util.iterfile(fp): line = line.rstrip() ui.note(line + '\n') if line.startswith('patching file '):