Patchwork [1,of,3] changectx: skip all invalid merge.preferancestor values

login
register
mail settings
Submitter Mads Kiilerich
Date Oct. 1, 2014, 1:42 a.m.
Message ID <1cc49a02d89b1845e695.1412127726@localhost.localdomain>
Download mbox | patch
Permalink /patch/6058/
State Accepted
Commit 5220c12c43fda739990eb65be617b127aaa7719f
Headers show

Comments

Mads Kiilerich - Oct. 1, 2014, 1:42 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1412127651 -7200
#      Wed Oct 01 03:40:51 2014 +0200
# Node ID 1cc49a02d89b1845e695bc6fcbd1a717b462e33d
# Parent  3ccf9a9d3a6650914311d0e2b9b44a449614b5d5
changectx: skip all invalid merge.preferancestor values

A better fix for 17011b36aac7 that will ignore other kinds of "invalid"
revisions.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -558,9 +558,10 @@  class changectx(basectx):
             anc = cahs[0]
         else:
             for r in self._repo.ui.configlist('merge', 'preferancestor'):
-                if r == '*':
+                try:
+                    ctx = changectx(self._repo, r)
+                except error.RepoLookupError:
                     continue
-                ctx = changectx(self._repo, r)
                 anc = ctx.node()
                 if anc in cahs:
                     break
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
@@ -349,7 +349,7 @@  Verify that the old context ancestor wor
   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
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor='1337 * - 2' -T '{rev}\n'
+  2
 
   $ cd ..