[PATCH 08 of 13 V2] branchmap: introduce iterbranches() method

Brodie Rao brodie at sf.io
Fri Nov 15 22:18:52 CST 2013


# HG changeset patch
# User Brodie Rao <brodie at sf.io>
# Date 1379318909 25200
#      Mon Sep 16 01:08:29 2013 -0700
# Node ID d0b73a908d4aefd10bde5800d27316806de47f8e
# Parent  4adc456149d0769612ef703d3a2db56e650042e0
branchmap: introduce iterbranches() method

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -174,6 +174,10 @@ class branchcache(dict):
             heads = [h for h in heads if h not in self._closednodes]
         return heads
 
+    def iterbranches(self):
+        for bn, heads in self.iteritems():
+            yield (bn, heads) + self._branchtip(heads)
+
     def copy(self):
         """return an deep copy of the branchcache object"""
         return branchcache(self, self.tipnode, self.tiprev, self.filteredhash,


More information about the Mercurial-devel mailing list