[PATCH 1 of 3] context: allow passing the common cset ancestor to fctx.ancestor

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Fri Jun 18 02:36:45 CDT 2010


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1276843685 -7200
context: allow passing the common cset ancestor to fctx.ancestor

This is used by the next patch to speed up merge.applyupdates.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -490,12 +490,16 @@
 
         return zip(hist[f][0], hist[f][1].splitlines(True))
 
-    def ancestor(self, fc2):
+    def ancestor(self, fc2, actx=None):
         """
         find the common ancestor file context, if any, of self, and fc2
+
+        If actx is given, it must be the changectx of the common ancestor
+        of self's and fc2's respective changesets.
         """
 
-        actx = self.changectx().ancestor(fc2.changectx())
+        if actx is None:
+            actx = self.changectx().ancestor(fc2.changectx())
 
         # the trivial case: changesets are unrelated, files must be too
         if not actx:


More information about the Mercurial-devel mailing list