comparison mercurial/merge.py @ 23541:495bc1b65d25

merge: move cd/dc prompts after largefiles prompts By moving the cd/dc prompts out of calculateupdates(), we let largefiles' overridecalculateupdates() so the unresolved values (i.e. 'cd' or 'dc' rather than 'g', 'r', 'a' and missing). This allows overridecalculateupdates() to ask the user whether to keep the normal file or the largefile before the user gets the cd/dc prompt. Whichever answer the user gives, we make overridecalculateupdates() replace 'cd' or 'dc' action, saving the user one annoying (and less clear) question.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 11 Dec 2014 21:21:21 -0800
parents 416c133145ee
children 7cc0fb0080b6
comparison
equal deleted inserted replaced
23540:f274d27f1994 23541:495bc1b65d25
638 continue 638 continue
639 repo.ui.note(_('end of auction\n\n')) 639 repo.ui.note(_('end of auction\n\n'))
640 640
641 _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) 641 _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
642 642
643 # Prompt and create actions. TODO: Move this towards resolve phase.
644 for f, args, msg in sorted(actions['cd']):
645 if repo.ui.promptchoice(
646 _("local changed %s which remote deleted\n"
647 "use (c)hanged version or (d)elete?"
648 "$$ &Changed $$ &Delete") % f, 0):
649 actions['r'].append((f, None, "prompt delete"))
650 else:
651 actions['a'].append((f, None, "prompt keep"))
652 del actions['cd'][:]
653
654 for f, args, msg in sorted(actions['dc']):
655 flags, = args
656 if repo.ui.promptchoice(
657 _("remote changed %s which local deleted\n"
658 "use (c)hanged version or leave (d)eleted?"
659 "$$ &Changed $$ &Deleted") % f, 0) == 0:
660 actions['g'].append((f, (flags,), "prompt recreating"))
661 del actions['dc'][:]
662
663 if wctx.rev() is None: 643 if wctx.rev() is None:
664 ractions, factions = _forgetremoved(wctx, mctx, branchmerge) 644 ractions, factions = _forgetremoved(wctx, mctx, branchmerge)
665 actions['r'].extend(ractions) 645 actions['r'].extend(ractions)
666 actions['f'].extend(factions) 646 actions['f'].extend(factions)
667 647
1109 ### calculate phase 1089 ### calculate phase
1110 actions, diverge, renamedelete = calculateupdates( 1090 actions, diverge, renamedelete = calculateupdates(
1111 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor, 1091 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor,
1112 followcopies) 1092 followcopies)
1113 1093
1094 # Prompt and create actions. TODO: Move this towards resolve phase.
1095 for f, args, msg in sorted(actions['cd']):
1096 if repo.ui.promptchoice(
1097 _("local changed %s which remote deleted\n"
1098 "use (c)hanged version or (d)elete?"
1099 "$$ &Changed $$ &Delete") % f, 0):
1100 actions['r'].append((f, None, "prompt delete"))
1101 else:
1102 actions['a'].append((f, None, "prompt keep"))
1103 del actions['cd'][:]
1104
1105 for f, args, msg in sorted(actions['dc']):
1106 flags, = args
1107 if repo.ui.promptchoice(
1108 _("remote changed %s which local deleted\n"
1109 "use (c)hanged version or leave (d)eleted?"
1110 "$$ &Changed $$ &Deleted") % f, 0) == 0:
1111 actions['g'].append((f, (flags,), "prompt recreating"))
1112 del actions['dc'][:]
1113
1114 ### apply phase 1114 ### apply phase
1115 if not branchmerge: # just jump to the new rev 1115 if not branchmerge: # just jump to the new rev
1116 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' 1116 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
1117 if not partial: 1117 if not partial:
1118 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) 1118 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)