Patchwork [6,of,6] convert: migrate to util.iterfile

login
register
mail settings
Submitter Jun Wu
Date Nov. 14, 2016, 11:35 p.m.
Message ID <e6c69631dab2ae0eeb7e.1479166558@x1c>
Download mbox | patch
Permalink /patch/17574/
State Accepted
Headers show

Comments

Jun Wu - Nov. 14, 2016, 11:35 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1479165435 0
#      Mon Nov 14 23:17:15 2016 +0000
# Node ID e6c69631dab2ae0eeb7ea910fd0ee6445472a42b
# Parent  23ebc9cb6d773d549b6822da154da3c0125b90c5
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r e6c69631dab2
convert: migrate to util.iterfile

Patch

diff --git a/hgext/convert/common.py b/hgext/convert/common.py
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -455,5 +455,5 @@  class mapfile(dict):
                 raise
             return
-        for i, line in enumerate(fp):
+        for i, line in enumerate(util.iterfile(fp)):
             line = line.splitlines()[0].rstrip()
             if not line:
diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -202,5 +202,5 @@  class converter(object):
         try:
             fp = open(path, 'r')
-            for i, line in enumerate(fp):
+            for i, line in enumerate(util.iterfile(fp)):
                 line = line.splitlines()[0].rstrip()
                 if not line: