From patchwork Sun May 27 11:48:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2, of, 3, RFC] context: add a method to return a list of common ancestor changesets From: Sean Farley X-Patchwork-Id: 31889 Message-Id: <000e9442997b1c61ae02.1527421697@1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa> To: mercurial-devel@mercurial-scm.org Cc: sean@farley.io Date: Sun, 27 May 2018 13:48:17 +0200 # HG changeset patch # User Sean Farley # Date 1527357601 -7200 # Sat May 26 20:00:01 2018 +0200 # Node ID 000e9442997b1c61ae02a27e657ffb34d170502b # Parent 6a31ef919a2440e79a1477d428b46408bf3667ab # EXP-Topic gca-revset context: add a method to return a list of common ancestor changesets This is a convenience method to return a list of common ancestor changesets between two contexts. diff --git a/mercurial/context.py b/mercurial/context.py index 30d57e0..a4d2da1 100644 --- a/mercurial/context.py +++ b/mercurial/context.py @@ -550,10 +550,20 @@ class changectx(basectx): n2 = c2._node if n2 is None: n2 = c2._parents[0]._node return n2, self._repo.changelog.commonancestorsheads(self._node, n2) + def commonancestors(self, c2): + """return all ancestor contexts of self and c202c8af058d + + Commonly called the "bid merge" this method returns the common + ancestors. + + """ + n2, cahs = self._commonancestors(c2) + return [changectx(self._repo, anc) for anc in cahs] + 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