changeset 39138:8547c8590ac1

branchmap: explicitly convert file into iterator Follows up 2a4bfbb52111. This is required for httprangereader, which is not an iterable itself.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 17 Aug 2018 10:51:05 +0900
parents dd1614906a20
children 13a1901176f1
files mercurial/branchmap.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Fri Aug 17 10:25:39 2018 +0900
+++ b/mercurial/branchmap.py	Fri Aug 17 10:51:05 2018 +0900
@@ -41,7 +41,8 @@
     f = None
     try:
         f = repo.cachevfs(_filename(repo))
-        cachekey = next(f).rstrip('\n').split(" ", 2)
+        lineiter = iter(f)
+        cachekey = next(lineiter).rstrip('\n').split(" ", 2)
         last, lrev = cachekey[:2]
         last, lrev = bin(last), int(lrev)
         filteredhash = None
@@ -53,7 +54,7 @@
             # invalidate the cache
             raise ValueError(r'tip differs')
         cl = repo.changelog
-        for l in f:
+        for l in lineiter:
             l = l.rstrip('\n')
             if not l:
                 continue