[PATCH 07 of 12] branchmap: introduce iterbranches() method

Brodie Rao brodie at sf.io
Fri Nov 15 20:27:39 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 8b79a928000fbf6f28fd72a48b1b066721aaf3d7
# Parent  9a6a65043164e404bf24d1b9b419f6cefe8b883a
branchmap: introduce iterbranches() method

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