[PATCH 06 of 13 V2] branchmap: introduce branchheads() method

Brodie Rao brodie at sf.io
Fri Nov 15 22:18:50 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 6f437923d70ead5e8bb7aa18177a8cb2968332cd
# Parent  6b2a5372b1bbffa4eac972e49d15f2283b5c2dd7
branchmap: introduce branchheads() method

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -168,6 +168,12 @@ class branchcache(dict):
     def branchtip(self, branch):
         return self._branchtip(self[branch])[0]
 
+    def branchheads(self, branch, closed=False):
+        heads = self[branch]
+        if not closed:
+            heads = [h for h in heads if h not in self._closednodes]
+        return 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