changeset 30397:564b33acc21f

patch: migrate to util.iterfile
author Jun Wu <quark@fb.com>
date Mon, 14 Nov 2016 23:14:06 +0000
parents 78a58dcf8853
children b63bef41a7b6
files mercurial/patch.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 '):