D6152: branchcache: rename itervalues() to iterheads()

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Mar 23 11:40:58 EDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG662ffdde5adf: branchcache: rename itervalues() to iterheads() (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6152?vs=14553&id=14584

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

AFFECTED FILES
  hgext/mq.py
  mercurial/branchmap.py
  mercurial/bundle2.py
  mercurial/revset.py

CHANGE DETAILS

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1240,7 +1240,7 @@
     getargs(x, 0, 0, _("head takes no arguments"))
     hs = set()
     cl = repo.changelog
-    for ls in repo.branchmap().itervalues():
+    for ls in repo.branchmap().iterheads():
         hs.update(cl.rev(h) for h in ls)
     return subset & baseset(hs)
 
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1980,7 +1980,7 @@
         op.gettransaction()
 
     currentheads = set()
-    for ls in op.repo.branchmap().itervalues():
+    for ls in op.repo.branchmap().iterheads():
         currentheads.update(ls)
 
     for h in heads:
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -178,9 +178,6 @@
     def iteritems(self):
         return self.entries.iteritems()
 
-    def itervalues(self):
-        return self.entries.itervalues()
-
     @classmethod
     def fromfile(cls, repo):
         f = None
@@ -287,6 +284,10 @@
         for bn, heads in self.iteritems():
             yield (bn, heads) + self._branchtip(heads)
 
+    def iterheads(self):
+        """ returns all the heads """
+        return self.entries.itervalues()
+
     def copy(self):
         """return an deep copy of the branchcache object"""
         return branchcache(
@@ -369,7 +370,7 @@
             # cache key are not valid anymore
             self.tipnode = nullid
             self.tiprev = nullrev
-            for heads in self.itervalues():
+            for heads in self.iterheads():
                 tiprev = max(cl.rev(node) for node in heads)
                 if tiprev > self.tiprev:
                     self.tipnode = cl.node(tiprev)
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1394,7 +1394,7 @@
         diffopts = self.diffopts()
         with repo.wlock():
             heads = []
-            for hs in repo.branchmap().itervalues():
+            for hs in repo.branchmap().iterheads():
                 heads.extend(hs)
             if not heads:
                 heads = [nullid]



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


More information about the Mercurial-devel mailing list