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

login
register
mail settings
Submitter Brodie Rao
Date Nov. 16, 2013, 4:18 a.m.
Message ID <d0b73a908d4aefd10bde.1384575532@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/2984/
State Accepted
Commit d5d25e5416372b090cc7dd23d86d6ee6d0e3001f
Headers show

Comments

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

Patch

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,