Patchwork [2,of,2,stable] changectx: ancestor should only prefer merge.preferancestor if it is a revision

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 15, 2014, 12:51 a.m.
Message ID <3ceb2a936a2cf8672e53.1408063908@mk-desktop>
Download mbox | patch
Permalink /patch/5405/
State Accepted
Headers show

Comments

Mads Kiilerich - Aug. 15, 2014, 12:51 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1408063604 -7200
#      Fri Aug 15 02:46:44 2014 +0200
# Branch stable
# Node ID 3ceb2a936a2cf8672e53b60d8c029175c498c8ca
# Parent  c6a530bf80a3cc127fadf7a94d96ddbf4074e837
changectx: ancestor should only prefer merge.preferancestor if it is a revision

The value '*' do currently designate that bid merge should be used. The best
way to test bid merge is to set preferancestor=* in the configuration file ...
but then it would abort with unknown revision '*' when other code paths ended
up in changectx.ancestor .

Instead, just skip and ignore the value '*' when looking for a preferred
ancestor.
Matt Mackall - Aug. 15, 2014, 3:10 a.m.
On Fri, 2014-08-15 at 02:51 +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1408063604 -7200
> #      Fri Aug 15 02:46:44 2014 +0200
> # Branch stable
> # Node ID 3ceb2a936a2cf8672e53b60d8c029175c498c8ca
> # Parent  c6a530bf80a3cc127fadf7a94d96ddbf4074e837
> changectx: ancestor should only prefer merge.preferancestor if it is a revision

These are queued for stable, thanks.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -553,6 +553,8 @@  class changectx(basectx):
             anc = cahs[0]
         else:
             for r in self._repo.ui.configlist('merge', 'preferancestor'):
+                if r == '*':
+                    continue
                 ctx = changectx(self._repo, r)
                 anc = ctx.node()
                 if anc in cahs:
diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -341,4 +341,15 @@  http://stackoverflow.com/questions/93500
   b
   c
 
+Verify that the old context ancestor works with / despite preferancestor:
+
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor=1 -T '{rev}\n'
+  1
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor=2 -T '{rev}\n'
+  2
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor=3 -T '{rev}\n'
+  1
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor='*' -T '{rev}\n'
+  1
+
   $ cd ..