--- 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 '):