changeset 3125:02b22fefc01f

changectx: add ancestor function
author Matt Mackall <mpm@selenic.com>
date Sun, 17 Sep 2006 22:59:33 -0500
parents 4d021b91cb26
children 4bf2e895cf86
files mercurial/context.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sun Sep 17 22:58:11 2006 -0500
+++ b/mercurial/context.py	Sun Sep 17 22:59:33 2006 -0500
@@ -67,6 +67,13 @@
         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."""