changeset 20188:3a3727829607

branchmap: introduce branchheads() method
author Brodie Rao <brodie@sf.io>
date Mon, 16 Sep 2013 01:08:29 -0700
parents 4d6d5ef88538
children 1831993d0902
files mercurial/branchmap.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Mon Sep 16 01:08:29 2013 -0700
+++ b/mercurial/branchmap.py	Mon Sep 16 01:08:29 2013 -0700
@@ -179,6 +179,12 @@
     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,