D6028: branchmap: prevent reading the file twice through different iterators

2019-02-27 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8ad46ac6728e: branchmap: prevent reading the file twice 
through different iterators (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6028?vs=14246=14251

REVISION DETAIL
  https://phab.mercurial-scm.org/D6028

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -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:



To: pulkit, #hg-reviewers, lothiraldan
Cc: lothiraldan, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6028: branchmap: prevent reading the file twice through different iterators

2019-02-27 Thread lothiraldan (Boris Feld)
lothiraldan added subscribers: yuja, lothiraldan.
lothiraldan accepted this revision.
lothiraldan added a comment.


  Queued thanks, the test now pass both locally and on gcc112. @yuja nice catch!

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6028

To: pulkit, #hg-reviewers, lothiraldan
Cc: lothiraldan, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6028: branchmap: prevent reading the file twice through different iterators

2019-02-26 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Otherwise, test-static-http.t breaks.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6028

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -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:



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel