Patchwork [7,of,9,cah] revlog: backout 514d32de6646 - commonancestors

login
register
mail settings
Submitter Mads Kiilerich
Date April 17, 2014, 6:07 p.m.
Message ID <4a6c8b6b10d3690bfc1b.1397758079@localhost.localdomain>
Download mbox | patch
Permalink /patch/4401/
State Accepted
Commit 4a6c8b6b10d3690bfc1bb5de789d6ebb475ebb81
Headers show

Comments

Mads Kiilerich - April 17, 2014, 6:07 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1397757699 -7200
#      Thu Apr 17 20:01:39 2014 +0200
# Node ID 4a6c8b6b10d3690bfc1bb5de789d6ebb475ebb81
# Parent  53433d8f1faa14193e5d6eb2f669f85072065cd1
revlog: backout 514d32de6646 - commonancestors

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -743,21 +743,17 @@  class revlog(object):
             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"""
+    def ancestor(self, a, b):
+        """calculate the least common ancestor of nodes a and b"""
+
         a, b = self.rev(a), self.rev(b)
         try:
             ancs = self.index.ancestors(a, b)
-        except (AttributeError, OverflowError): # C implementation failed
+        except (AttributeError, OverflowError):
             ancs = ancestor.ancestors(self.parentrevs, a, b)
-        return map(self.node, ancs)
-
-    def ancestor(self, a, b):
-        """calculate a least common ancestor of nodes a and b"""
-        ancs = self.commonancestors(a, b)
         if ancs:
             # choose a consistent winner when there's a tie
-            return min(ancs)
+            return min(map(self.node, ancs))
         return nullid
 
     def _match(self, id):