[PATCH 05 of 12] branchmap: introduce branchheads() method
Brodie Rao
brodie at sf.io
Fri Nov 15 20:27:37 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 7b9b47384721d01206f4bed187374f48b03e742d
# Parent 219c711dbd1540d7b4e88765f9c032738156386d
branchmap: introduce branchheads() method
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -149,6 +149,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