[PATCH 3 of 6] patch: migrate to util.iterfile

Jun Wu quark at fb.com
Mon Nov 14 18:35:55 EST 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1479165246 0
#      Mon Nov 14 23:14:06 2016 +0000
# Node ID d1637df5ffd91e95da25213f06f346adb3269ace
# Parent  8097b8c66952003addd5b683a14265c1d3cc201f
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r d1637df5ffd9
patch: migrate to util.iterfile

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1070,5 +1070,5 @@ the hunk is left unchanged.
                     patchfp = open(patchfn)
                     ncpatchfp = stringio()
-                    for line in patchfp:
+                    for line in util.iterfile(patchfp):
                         if not line.startswith('#'):
                             ncpatchfp.write(line)
@@ -2013,5 +2013,5 @@ def _externalpatch(ui, repo, patcher, pa
                                        util.shellquote(patchname)))
     try:
-        for line in fp:
+        for line in util.iterfile(fp):
             line = line.rstrip()
             ui.note(line + '\n')


More information about the Mercurial-devel mailing list