mercurial/merge.py
changeset 15674 7b7f03502b5a
parent 15655 5402fd9dd13e
parent 15673 d550168f11ce
child 15774 0bd17a4bed88
--- a/mercurial/merge.py	Thu Dec 15 16:50:21 2011 -0600
+++ b/mercurial/merge.py	Fri Dec 16 19:05:59 2011 -0600
@@ -96,7 +96,7 @@
             raise util.Abort(_("untracked file in working directory differs"
                                " from file in requested revision: '%s'") % fn)
 
-def _checkcollision(mctx):
+def _checkcollision(mctx, wctx):
     "check for case folding collisions in the destination context"
     folded = {}
     for fn in mctx:
@@ -106,6 +106,14 @@
                              % (fn, folded[fold]))
         folded[fold] = fn
 
+    if wctx:
+        for fn in wctx:
+            fold = util.normcase(fn)
+            mfn = folded.get(fold, None)
+            if mfn and (mfn != fn):
+                raise util.Abort(_("case-folding collision between %s and %s")
+                                 % (mfn, fn))
+
 def _forgetremoved(wctx, mctx, branchmerge):
     """
     Forget removed files
@@ -551,7 +559,7 @@
         if not force:
             _checkunknown(wc, p2, folding)
         if folding:
-            _checkcollision(p2)
+            _checkcollision(p2, branchmerge and p1)
         action += _forgetremoved(wc, p2, branchmerge)
         action += manifestmerge(repo, wc, p2, pa, overwrite, partial)