Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 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 | 495bc1b65d25 |
children | 13f53a2aa342 |
comparison
equal
deleted
inserted
replaced
23543:4dd8a6a1240d | 23544:7cc0fb0080b6 |
---|---|
525 else: assert False, m | 525 else: assert False, m |
526 if aborts: | 526 if aborts: |
527 raise util.Abort(_("untracked files in working directory differ " | 527 raise util.Abort(_("untracked files in working directory differ " |
528 "from files in requested revision")) | 528 "from files in requested revision")) |
529 | 529 |
530 if not util.checkcase(repo.path): | |
531 # check collision between files only in p2 for clean update | |
532 if (not branchmerge and | |
533 (force or not wctx.dirty(missing=True, branch=False))): | |
534 _checkcollision(repo, m2, None) | |
535 else: | |
536 _checkcollision(repo, m1, actions) | |
537 | |
538 return actions, diverge, renamedelete | 530 return actions, diverge, renamedelete |
539 | 531 |
540 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): | 532 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): |
541 """Resolves false conflicts where the nodeid changed but the content | 533 """Resolves false conflicts where the nodeid changed but the content |
542 remained the same.""" | 534 remained the same.""" |
1089 ### calculate phase | 1081 ### calculate phase |
1090 actions, diverge, renamedelete = calculateupdates( | 1082 actions, diverge, renamedelete = calculateupdates( |
1091 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor, | 1083 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor, |
1092 followcopies) | 1084 followcopies) |
1093 | 1085 |
1086 if not util.checkcase(repo.path): | |
1087 # check collision between files only in p2 for clean update | |
1088 if (not branchmerge and | |
1089 (force or not wc.dirty(missing=True, branch=False))): | |
1090 _checkcollision(repo, p2.manifest(), None) | |
1091 else: | |
1092 _checkcollision(repo, wc.manifest(), actions) | |
1093 | |
1094 # Prompt and create actions. TODO: Move this towards resolve phase. | 1094 # Prompt and create actions. TODO: Move this towards resolve phase. |
1095 for f, args, msg in sorted(actions['cd']): | 1095 for f, args, msg in sorted(actions['cd']): |
1096 if repo.ui.promptchoice( | 1096 if repo.ui.promptchoice( |
1097 _("local changed %s which remote deleted\n" | 1097 _("local changed %s which remote deleted\n" |
1098 "use (c)hanged version or (d)elete?" | 1098 "use (c)hanged version or (d)elete?" |