mercurial/merge.py
changeset 26661 2b955fec91e0
parent 26651 d58f2f0e2b19
child 26682 08b068240a1a
--- a/mercurial/merge.py	Tue Oct 13 00:16:25 2015 +0200
+++ b/mercurial/merge.py	Tue Oct 13 00:16:25 2015 +0200
@@ -478,6 +478,17 @@
                              % (f, foldmap[fold]))
         foldmap[fold] = f
 
+    # check case-folding of directories
+    foldprefix = unfoldprefix = lastfull = ''
+    for fold, f in sorted(foldmap.items()):
+        if fold.startswith(foldprefix) and not f.startswith(unfoldprefix):
+            # the folded prefix matches but actual casing is different
+            raise error.Abort(_("case-folding collision between "
+                                "%s and directory of %s") % (lastfull, f))
+        foldprefix = fold + '/'
+        unfoldprefix = f + '/'
+        lastfull = f
+
 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial,
                   acceptremote, followcopies):
     """