changeset 9751:f8ca4035a949

filectx: shortcut unrelated files in ancestor() (issue1327)
author Matt Mackall <mpm@selenic.com>
date Sat, 07 Nov 2009 14:07:45 -0600
parents f153af9580fe
children a22cdd5e56b7
files mercurial/context.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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