Mercurial > public > mercurial-scm > hg-stable
diff mercurial/context.py @ 21203:9f12d8665c7b stable
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.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 30 Apr 2014 14:19:01 -0500 |
parents | 99b5eaf372a7 |
children | 25d6fdc0294a |
line wrap: on
line diff
--- a/mercurial/context.py Fri Apr 25 13:44:51 2014 -0700 +++ b/mercurial/context.py Wed Apr 30 14:19:01 2014 -0500 @@ -394,7 +394,7 @@ 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 @@ 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):