# HG changeset patch # User Pulkit Goyal # Date 2019-02-26 14:26:33 # Node ID 8ad46ac6728ec1e4ddf805950025fde20c8afcc5 # Parent 941685500125d3f2a4c0d104a3d5b09c17827c08 branchmap: prevent reading the file twice through different iterators Otherwise, test-static-http.t breaks. Differential Revision: https://phab.mercurial-scm.org/D6028 diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -179,7 +179,7 @@ class branchcache(dict): 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 @@ class branchcache(dict): 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: