# HG changeset patch # User Matt Mackall # Date 2014-04-30 19:19:01 # Node ID 9f12d8665c7bb9f3aa731d02e3db7432e765c7ce # Parent c04e5e937139f13772e6597c1c070b0feafcc639 ancestor: silence multiple ancestor warning outside of merge (issue4234) The current situation is a bit of a layering violation as merge-specific knowledge is pushed down to lower layers and leaks merge assumptions into other code paths. Here, we simply silence the warning with a hack. Both the warning and the hack will probably go away in the near future when bid merge is made the default. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -394,7 +394,7 @@ class changectx(basectx): return filectx(self._repo, path, fileid=fileid, changectx=self, filelog=filelog) - def ancestor(self, c2): + def ancestor(self, c2, warn=False): """ return the "best" ancestor context of self and c2 """ @@ -415,12 +415,13 @@ class changectx(basectx): break else: anc = self._repo.changelog.ancestor(self._node, n2) - self._repo.ui.status( - (_("note: using %s as ancestor of %s and %s\n") % - (short(anc), short(self._node), short(n2))) + - ''.join(_(" alternatively, use --config " - "merge.preferancestor=%s\n") % - short(n) for n in sorted(cahs) if n != anc)) + if warn: + self._repo.ui.status( + (_("note: using %s as ancestor of %s and %s\n") % + (short(anc), short(self._node), short(n2))) + + ''.join(_(" alternatively, use --config " + "merge.preferancestor=%s\n") % + short(n) for n in sorted(cahs) if n != anc)) return changectx(self._repo, anc) def descendant(self, other): diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -992,7 +992,7 @@ def update(repo, node, branchmerge, forc cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node()) pas = [repo[anc] for anc in (sorted(cahs) or [nullid])] else: - pas = [p1.ancestor(p2)] + pas = [p1.ancestor(p2, warn=True)] fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)