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

login
register
mail settings
Submitter Brodie Rao
Date Nov. 16, 2013, 2:27 a.m.
Message ID <8b79a928000fbf6f28fd.1384568859@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/2965/
State Superseded
Headers show

Comments

Brodie Rao - Nov. 16, 2013, 2:27 a.m.
# HG changeset patch
# User Brodie Rao <brodie@sf.io>
# Date 1379318909 25200
#      Mon Sep 16 01:08:29 2013 -0700
# Node ID 8b79a928000fbf6f28fd72a48b1b066721aaf3d7
# Parent  9a6a65043164e404bf24d1b9b419f6cefe8b883a
branchmap: introduce iterbranches() method

Patch

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,