[PATCH 2 of 3 gca-revset] context: add a method to return a list of common ancestor changesets
Sean Farley
sean at farley.io
Fri Jun 15 03:10:24 EDT 2018
# HG changeset patch
# User Sean Farley <sean at farley.io>
# Date 1527357601 -7200
# Sat May 26 20:00:01 2018 +0200
# Branch gca-revset
# Node ID ab29cfd39f48432d8e7c38cdceb62980d5c22f09
# Parent 6dbbddee08084074fd1a7662e18424a7b70318e2
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
More information about the Mercurial-devel
mailing list