filectx: shortcut unrelated files in ancestor() (issue1327)
authorMatt Mackall <mpm@selenic.com>
Sat, 07 Nov 2009 14:07:45 -0600
changeset 9751 f8ca4035a949
parent 9750 f153af9580fe
child 9752 a22cdd5e56b7
filectx: shortcut unrelated files in ancestor() (issue1327)
mercurial/context.py
--- a/mercurial/context.py	Sat Nov 07 14:07:45 2009 -0600
+++ b/mercurial/context.py	Sat Nov 07 14:07:45 2009 -0600
@@ -452,9 +452,14 @@
         """
 
         actx = self.changectx().ancestor(fc2.changectx())
-        if self.path() in actx:
+
+        # the trivial case: changesets are unrelated, files must be too
+        if not actx:
+            return None
+
+        # the easy case: no (relevant) renames
+        if fc2.path() == self.path() and self.path() in actx:
             return actx[self.path()]
-
         acache = {}
 
         # prime the ancestor cache for the working directory