[PATCH 03 of 12] branchmap: introduce branchtip() method
Brodie Rao
brodie at sf.io
Fri Nov 15 20:27:35 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 4089d25214631ffe66f18e5de52febe3ed3992a0
# Parent baa013be987aeea0da0a95f7a55496941c7d4e2c
branchmap: introduce branchtip() method
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -136,6 +136,19 @@ class branchcache(dict):
except IndexError:
return False
+ def _branchtip(self, heads):
+ tip = heads[-1]
+ closed = True
+ for h in reversed(heads):
+ if h not in self._closednodes:
+ tip = h
+ closed = False
+ break
+ return tip, closed
+
+ def branchtip(self, branch):
+ return self._branchtip(self[branch])[0]
+
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