changectx: add ancestor function
authorMatt Mackall <mpm@selenic.com>
Sun, 17 Sep 2006 22:59:33 -0500
changeset 3133 02b22fefc01f
parent 3132 4d021b91cb26
child 3134 4bf2e895cf86
changectx: add ancestor function
mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -67,6 +67,13 @@ class changectx(object):
         for f in m:
             yield self.filectx(f, fileid=mf[f])
 
+    def ancestor(self, c2):
+        """
+        return the ancestor context of self and c2
+        """
+        n = self._repo.changelog.ancestor(self._node, c2._node)
+        return changectx(self._repo, n)
+
 class filectx(object):
     """A filecontext object makes access to data related to a particular
        filerevision convenient."""