changeset 21104:40ace21cb3a1

revlog: introduce commonancestorsheads method Very similar to commonancestors but giving all the common ancestors heads.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 17 Apr 2014 20:01:35 +0200
parents 628c16489d1c
children 12312f066d93
files mercurial/revlog.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Apr 17 19:58:08 2014 +0200
+++ b/mercurial/revlog.py	Thu Apr 17 20:01:35 2014 +0200
@@ -734,6 +734,15 @@
                 break
         return False
 
+    def commonancestorsheads(self, a, b):
+        """calculate all the heads of the common ancestors of nodes a and b"""
+        a, b = self.rev(a), self.rev(b)
+        try:
+            ancs = self.index.commonancestorsheads(a, b)
+        except (AttributeError, OverflowError): # C implementation failed
+            ancs = ancestor.commonancestorsheads(self.parentrevs, a, b)
+        return map(self.node, ancs)
+
     def commonancestors(self, a, b):
         """calculate the least common ancestors of nodes a and b"""
         a, b = self.rev(a), self.rev(b)