Patchwork D6236: branchcache: lazily validate nodes in iteritems()

login
register
mail settings
Submitter phabricator
Date April 15, 2019, 4:26 p.m.
Message ID <differential-rev-PHID-DREV-sswzlihuc6tv2wqyzl3c-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39613/
State Superseded
Headers show

Comments

phabricator - April 15, 2019, 4:26 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This saves ~0.30 sec on creating a new branch on our internal repo.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -218,8 +218,9 @@ 
         return key in self._entries
 
     def iteritems(self):
-        self._verifyall()
-        return self._entries.iteritems()
+        for k, v in self._entries.iteritems():
+            self._verifybranch(k)
+            yield k, v
 
     def hasbranch(self, label):
         """ checks whether a branch of this name exists or not """