merge: fix unknown file merge detection for case-folding systems
authorMatt Mackall <mpm@selenic.com>
Mon, 26 Mar 2012 16:41:54 -0500
changeset 16284 2b0a406d3043
parent 16279 531e69ff348f
child 16285 e53c0b2d7b60
merge: fix unknown file merge detection for case-folding systems This was triggering some test failures on Mac.
mercurial/merge.py
tests/test-casefolding.t
--- a/mercurial/merge.py	Thu Mar 22 17:08:05 2012 -0500
+++ b/mercurial/merge.py	Mon Mar 26 16:41:54 2012 -0500
@@ -84,6 +84,7 @@
 def _checkunknownfile(repo, wctx, mctx, f):
     return (not repo.dirstate._ignore(f)
         and os.path.exists(repo.wjoin(f))
+        and repo.dirstate.normalize(f) not in repo.dirstate
         and mctx[f].cmp(wctx[f]))
 
 def _checkunknown(repo, wctx, mctx):
@@ -545,8 +546,6 @@
             if not force and (wc.files() or wc.deleted()):
                 raise util.Abort(_("outstanding uncommitted changes"),
                                  hint=_("use 'hg status' to list changes"))
-            if not force:
-                _checkunknown(repo, wc, p2)
             for s in wc.substate:
                 if wc.sub(s).dirty():
                     raise util.Abort(_("outstanding uncommitted changes in "
@@ -570,6 +569,8 @@
         folding = not util.checkcase(repo.path)
         if folding:
             _checkcollision(p2, branchmerge and p1)
+        if not force:
+            _checkunknown(repo, wc, p2)
         action += _forgetremoved(wc, p2, branchmerge)
         action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
 
--- a/tests/test-casefolding.t	Thu Mar 22 17:08:05 2012 -0500
+++ b/tests/test-casefolding.t	Mon Mar 26 16:41:54 2012 -0500
@@ -66,7 +66,7 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo gold > a
   $ hg up
-  a: untracked file differs
+  A: untracked file differs
   abort: untracked files in working directory differ from files in requested revision
   [255]
   $ cat a