From patchwork Mon Feb 24 22:19:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6, of, 7] context: introduce [ui]topancestor for controlling which ancestor to pick From: Mads Kiilerich X-Patchwork-Id: 3749 Message-Id: To: mercurial-devel@selenic.com Date: Mon, 24 Feb 2014 23:19:15 +0100 # HG changeset patch # User Mads Kiilerich # Date 1393278134 -3600 # Mon Feb 24 22:42:14 2014 +0100 # Node ID c5b597a62f2231919df87fe2915a4edf1023166b # Parent d6e2126534dce3cc4dea26c5e869f72a44353a47 context: introduce [ui]topancestor for controlling which ancestor to pick Multiple revisions can be specified in ui.topancestor, separated by whitespace. First match wins. This makes it possible to overrule the default of picking the common ancestor with the lowest hash value. This can for instance help with some merges where the 'wrong' ancestor is used. There will thus be some overlap between this and the problems that can be solved with a future 'consensus merge'. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -410,6 +410,12 @@ _("warning: multiple ancestors of %s and %s: %s\n") % (short(self._node), short(n2), ' '.join(short(n) for n in sorted(ancs)))) + for r in self._repo.ui.config('ui', 'topancestors', '').split(): + ctx = changectx(self._repo, r) + if ctx.node() in ancs: + self._repo.ui.status(_('picked topancestor %s\n') % + short(ctx.node())) + return ctx return changectx(self._repo, min(ancs)) def descendant(self, other):