diff mercurial/context.py @ 16601:0c98820be15c

filectx: handle some other simple cases for finding merge ancestor
author Matt Mackall <mpm@selenic.com>
date Sun, 06 May 2012 14:20:53 -0500
parents 4b73f4ba27ca
children 80aef0bc5ba7
line wrap: on
line diff
--- a/mercurial/context.py	Sun May 06 14:15:17 2012 -0500
+++ b/mercurial/context.py	Sun May 06 14:20:53 2012 -0500
@@ -645,9 +645,16 @@
         # the easy case: no (relevant) renames
         if fc2.path() == self.path() and self.path() in actx:
             return actx[self.path()]
-        acache = {}
+
+        # the next easiest cases: unambiguous predecessor (name trumps
+        # history)
+        if self.path() in actx and fc2.path() not in actx:
+            return actx[self.path()]
+        if fc2.path() in actx and self.path() not in actx:
+            return actx[fc2.path()]
 
         # prime the ancestor cache for the working directory
+        acache = {}
         for c in (self, fc2):
             if c._filerev is None:
                 pl = [(n.path(), n.filenode()) for n in c.parents()]