changeset 23544:7cc0fb0080b6

merge: perform case-collision checking on final set of actions When there are multiple common ancestors, we should check for case collisions only on the resulting actions after bid merge has run. To do this, move the code until after bid merge. Move it past _resolvetrivial() too, since that might update actions. If the remote changed a file and then reverted the change, while the local side deleted the file and created a new file with a name that case-folds like the old file, we should fail before this patch but not after. Although the changes to the actions caused by _forgetremoved() should have no effect on case collisions, move it after that, too, so the next person reading the code won't have to think about it. Moving it past these blocks of code takes it to the end of calculateupdates(), so let's even move it outside of the method, so we also check collisions in actions produced by extensions overriding the method.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 14 Nov 2014 05:53:04 -0800
parents 4dd8a6a1240d
children 68c434799559
files mercurial/merge.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Thu Apr 17 22:47:38 2014 +0200
+++ b/mercurial/merge.py	Fri Nov 14 05:53:04 2014 -0800
@@ -527,14 +527,6 @@
         raise util.Abort(_("untracked files in working directory differ "
                            "from files in requested revision"))
 
-    if not util.checkcase(repo.path):
-        # check collision between files only in p2 for clean update
-        if (not branchmerge and
-            (force or not wctx.dirty(missing=True, branch=False))):
-            _checkcollision(repo, m2, None)
-        else:
-            _checkcollision(repo, m1, actions)
-
     return actions, diverge, renamedelete
 
 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
@@ -1091,6 +1083,14 @@
             repo, wc, p2, pas, branchmerge, force, partial, mergeancestor,
             followcopies)
 
+        if not util.checkcase(repo.path):
+            # check collision between files only in p2 for clean update
+            if (not branchmerge and
+                (force or not wc.dirty(missing=True, branch=False))):
+                _checkcollision(repo, p2.manifest(), None)
+            else:
+                _checkcollision(repo, wc.manifest(), actions)
+
         # Prompt and create actions. TODO: Move this towards resolve phase.
         for f, args, msg in sorted(actions['cd']):
             if repo.ui.promptchoice(