changeset 41808:8ad46ac6728e

branchmap: prevent reading the file twice through different iterators Otherwise, test-static-http.t breaks. Differential Revision: https://phab.mercurial-scm.org/D6028
author Pulkit Goyal <pulkit@yandex-team.ru>
date Tue, 26 Feb 2019 17:26:33 +0300
parents 941685500125
children e0a3ee3fdb33
files mercurial/branchmap.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Mon Feb 25 12:42:48 2019 -0800
+++ b/mercurial/branchmap.py	Tue Feb 26 17:26:33 2019 +0300
@@ -179,7 +179,7 @@
             if not bcache.validfor(repo):
                 # invalidate the cache
                 raise ValueError(r'tip differs')
-            bcache.load(repo, f)
+            bcache.load(repo, lineiter)
         except (IOError, OSError):
             return None
 
@@ -198,10 +198,10 @@
 
         return bcache
 
-    def load(self, repo, f):
-        """ fully loads the branchcache by reading from the file f """
+    def load(self, repo, lineiter):
+        """ fully loads the branchcache by reading from the file using the line
+        iterator passed"""
         cl = repo.changelog
-        lineiter = iter(f)
         for line in lineiter:
             line = line.rstrip('\n')
             if not line: