diff mercurial/merge.py @ 16478:cbf2ea2f5ca1 stable

icasefs: make case-folding collision detection as rename aware (issue3370) if the file in target context causes case-folding collision against one in working context, current implementation aborts merging with it, even thouhg collding one (in target) is the file renamed from collided one (in working). this patch uses file copy information to know whether colliding file is renamed from collided one or not: if so, collision between them is ignored. this patch also avoids collision detection between current context and target context, if working context is clean (with --check/-c) or will be clean (with --clean/-C).
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 16 Apr 2012 01:11:29 +0900
parents 2b0a406d3043
children 774e2dcd0a65
line wrap: on
line diff
--- a/mercurial/merge.py	Fri Apr 20 11:08:14 2012 -0500
+++ b/mercurial/merge.py	Mon Apr 16 01:11:29 2012 +0900
@@ -110,10 +110,18 @@
         folded[fold] = fn
 
     if wctx:
+        # class to delay looking up copy mapping
+        class pathcopies(object):
+            @util.propertycache
+            def map(self):
+                # {dst@mctx: src@wctx} copy mapping
+                return copies.pathcopies(wctx, mctx)
+        pc = pathcopies()
+
         for fn in wctx:
             fold = util.normcase(fn)
             mfn = folded.get(fold, None)
-            if mfn and (mfn != fn):
+            if mfn and mfn != fn and pc.map.get(mfn) != fn:
                 raise util.Abort(_("case-folding collision between %s and %s")
                                  % (mfn, fn))
 
@@ -568,7 +576,11 @@
         action = []
         folding = not util.checkcase(repo.path)
         if folding:
-            _checkcollision(p2, branchmerge and p1)
+            # collision check is not needed for clean update
+            if not branchmerge and force:
+                _checkcollision(p2, None)
+            else:
+                _checkcollision(p2, wc)
         if not force:
             _checkunknown(repo, wc, p2)
         action += _forgetremoved(wc, p2, branchmerge)