# HG changeset patch # User Sean Farley <s...@farley.io> # Date 1527357492 -7200 # Sat May 26 19:58:12 2018 +0200 # Branch gca-revset # Node ID 6dbbddee08084074fd1a7662e18424a7b70318e2 # Parent c019db5ccfa155de8a98cced1e7f5ddaede439e5 context: factor out commonancestorsheads calculation
A future patch will make a new method that returns a list of all changesets that are a common ancestor. In other words, this method will return all the candidates for a consensus merge. diff --git a/mercurial/context.py b/mercurial/context.py index 90142e4..30d57e0 100644 --- a/mercurial/context.py +++ b/mercurial/context.py @@ -543,21 +543,24 @@ class changectx(basectx): if fileid is None: fileid = self.filenode(path) return filectx(self._repo, path, fileid=fileid, changectx=self, filelog=filelog) + def _commonancestors(self, c2): + # deal with workingctxs + n2 = c2._node + if n2 is None: + n2 = c2._parents[0]._node + return n2, self._repo.changelog.commonancestorsheads(self._node, n2) + def ancestor(self, c2, warn=False): """return the "best" ancestor context of self and c2 If there are multiple candidates, it will show a message and check merge.preferancestor configuration before falling back to the revlog ancestor.""" - # deal with workingctxs - n2 = c2._node - if n2 is None: - n2 = c2._parents[0]._node - cahs = self._repo.changelog.commonancestorsheads(self._node, n2) + n2, cahs = self._commonancestors(c2) if not cahs: anc = nullid elif len(cahs) == 1: anc = cahs[0] else: _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel