# HG changeset patch # User Pulkit Goyal # Date 1551191193 -10800 # 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 -r 941685500125 -r 8ad46ac6728e mercurial/branchmap.py --- 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: