Patchwork [3,of,4] comments: describe ancestor consistently - avoid 'least common ancestor'

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 31, 2014, 3:07 p.m.
Message ID <04bb92b2a16df80368e4.1409497629@localhost.localdomain>
Download mbox | patch
Permalink /patch/5671/
State Accepted
Headers show

Comments

Mads Kiilerich - Aug. 31, 2014, 3:07 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1408403590 -7200
#      Tue Aug 19 01:13:10 2014 +0200
# Node ID 04bb92b2a16df80368e47ea1aafc82e2e81f7d98
# Parent  78ca134e8f7d682d4296444dc0623591ac4f5db9
comments: describe ancestor consistently - avoid 'least common ancestor'

"best" is as defined by mercurial.ancestor.ancestors: furthest from a root (as
measured by longest path).

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -542,9 +542,11 @@  class changectx(basectx):
                        changectx=self, filelog=filelog)
 
     def ancestor(self, c2, warn=False):
-        """
-        return the "best" ancestor context of self and c2
-        """
+        """return the "best" ancestor context of self and c2
+
+        If there are multiple candidates, it will show a message and check
+        merge.preferancestor configuration before falling back to the
+        revlog ancestor."""
         # deal with workingctxs
         n2 = c2._node
         if n2 is None:
@@ -1146,7 +1148,7 @@  class committablectx(basectx):
             return ''
 
     def ancestor(self, c2):
-        """return the ancestor context of self and c2"""
+        """return the "best" ancestor context of self and c2"""
         return self._parents[0].ancestor(c2) # punt on two parents for now
 
     def walk(self, match):
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -746,7 +746,7 @@  class revlog(object):
         return map(self.node, ancs)
 
     def ancestor(self, a, b):
-        """calculate the least common ancestor of nodes a and b"""
+        """calculate the "best" common ancestor of nodes a and b"""
 
         a, b = self.rev(a), self.rev(b)
         try:
diff --git a/tests/test-merge-default.t b/tests/test-merge-default.t
--- a/tests/test-merge-default.t
+++ b/tests/test-merge-default.t
@@ -97,8 +97,7 @@  Should fail because merge with other bra
 
 
 Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that
-are not ancestors of 7, regardless of where their least common
-ancestor is.
+are not ancestors of 7, regardless of where their common ancestors are.
 
 Merge preview not affected by common ancestor: