Show More
@@ -361,9 +361,10 b' def overridecheckunknownfile(origfn, rep' | |||
|
361 | 361 | # writing the files into the working copy and lfcommands.updatelfiles |
|
362 | 362 | # will update the largefiles. |
|
363 | 363 | def overridemanifestmerge(origfn, repo, p1, p2, pa, branchmerge, force, |
|
364 | partial): | |
|
364 | partial, acceptremote=False): | |
|
365 | 365 | overwrite = force and not branchmerge |
|
366 |
actions = origfn(repo, p1, p2, pa, branchmerge, force, partial |
|
|
366 | actions = origfn(repo, p1, p2, pa, branchmerge, force, partial, | |
|
367 | acceptremote) | |
|
367 | 368 | processed = [] |
|
368 | 369 | |
|
369 | 370 | for action in actions: |
@@ -185,12 +185,14 b' def _forgetremoved(wctx, mctx, branchmer' | |||
|
185 | 185 | |
|
186 | 186 | return actions |
|
187 | 187 | |
|
188 |
def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial |
|
|
188 | def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial, | |
|
189 | acceptremote=False): | |
|
189 | 190 | """ |
|
190 | 191 | Merge p1 and p2 with ancestor pa and generate merge action list |
|
191 | 192 | |
|
192 | 193 | branchmerge and force are as passed in to update |
|
193 | 194 | partial = function to filter file lists |
|
195 | acceptremote = accept the incoming changes without prompting | |
|
194 | 196 | """ |
|
195 | 197 | |
|
196 | 198 | overwrite = force and not branchmerge |
@@ -331,7 +333,9 b' def manifestmerge(repo, wctx, p2, pa, br' | |||
|
331 | 333 | |
|
332 | 334 | for f, m in sorted(prompts): |
|
333 | 335 | if m == "cd": |
|
334 |
if |
|
|
336 | if acceptremote: | |
|
337 | actions.append((f, "r", None, "remote delete")) | |
|
338 | elif repo.ui.promptchoice( | |
|
335 | 339 | _("local changed %s which remote deleted\n" |
|
336 | 340 | "use (c)hanged version or (d)elete?") % f, |
|
337 | 341 | (_("&Changed"), _("&Delete")), 0): |
@@ -339,7 +343,9 b' def manifestmerge(repo, wctx, p2, pa, br' | |||
|
339 | 343 | else: |
|
340 | 344 | actions.append((f, "a", None, "prompt keep")) |
|
341 | 345 | elif m == "dc": |
|
342 |
if |
|
|
346 | if acceptremote: | |
|
347 | actions.append((f, "g", (m2.flags(f),), "remote recreating")) | |
|
348 | elif repo.ui.promptchoice( | |
|
343 | 349 | _("remote changed %s which local deleted\n" |
|
344 | 350 | "use (c)hanged version or leave (d)eleted?") % f, |
|
345 | 351 | (_("&Changed"), _("&Deleted")), 0) == 0: |
@@ -512,7 +518,8 b' def applyupdates(repo, actions, wctx, mc' | |||
|
512 | 518 | |
|
513 | 519 | return updated, merged, removed, unresolved |
|
514 | 520 | |
|
515 |
def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial |
|
|
521 | def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial, | |
|
522 | acceptremote=False): | |
|
516 | 523 | "Calculate the actions needed to merge mctx into tctx" |
|
517 | 524 | actions = [] |
|
518 | 525 | folding = not util.checkcase(repo.path) |
@@ -526,7 +533,7 b' def calculateupdates(repo, tctx, mctx, a' | |||
|
526 | 533 | actions += manifestmerge(repo, tctx, mctx, |
|
527 | 534 | ancestor, |
|
528 | 535 | branchmerge, force, |
|
529 | partial) | |
|
536 | partial, acceptremote) | |
|
530 | 537 | if tctx.rev() is None: |
|
531 | 538 | actions += _forgetremoved(tctx, mctx, branchmerge) |
|
532 | 539 | return actions |
@@ -602,10 +609,11 b' def update(repo, node, branchmerge, forc' | |||
|
602 | 609 | branchmerge = whether to merge between branches |
|
603 | 610 | force = whether to force branch merging or file overwriting |
|
604 | 611 | partial = a function to filter file lists (dirstate not updated) |
|
605 |
mergeancestor = |
|
|
606 | is only allowed between different named branches. This flag | |
|
607 | is used by rebase extension as a temporary fix and should be | |
|
608 | avoided in general. | |
|
612 | mergeancestor = whether it is merging with an ancestor. If true, | |
|
613 | we should accept the incoming changes for any prompts that occur. | |
|
614 | If false, merging with an ancestor (fast-forward) is only allowed | |
|
615 | between different named branches. This flag is used by rebase extension | |
|
616 | as a temporary fix and should be avoided in general. | |
|
609 | 617 | |
|
610 | 618 | The table below shows all the behaviors of the update command |
|
611 | 619 | given the -c and -C or no options, whether the working directory |
@@ -693,7 +701,7 b' def update(repo, node, branchmerge, forc' | |||
|
693 | 701 | |
|
694 | 702 | ### calculate phase |
|
695 | 703 | actions = calculateupdates(repo, wc, p2, pa, |
|
696 | branchmerge, force, partial) | |
|
704 | branchmerge, force, partial, mergeancestor) | |
|
697 | 705 | |
|
698 | 706 | ### apply phase |
|
699 | 707 | if not branchmerge: # just jump to the new rev |
@@ -719,6 +719,30 b' Test stripping a revision with another c' | |||
|
719 | 719 | |
|
720 | 720 | $ cd .. |
|
721 | 721 | |
|
722 | Test collapsing changes that add then remove a file | |
|
722 | 723 | |
|
724 | $ hg init collapseaddremove | |
|
725 | $ cd collapseaddremove | |
|
723 | 726 | |
|
727 | $ touch base | |
|
728 | $ hg commit -Am base | |
|
729 | adding base | |
|
730 | $ touch a | |
|
731 | $ hg commit -Am a | |
|
732 | adding a | |
|
733 | $ hg rm a | |
|
734 | $ touch b | |
|
735 | $ hg commit -Am b | |
|
736 | adding b | |
|
737 | $ hg rebase -d 0 -r "1::2" --collapse -m collapsed | |
|
738 | saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/*-backup.hg (glob) | |
|
739 | $ hg tglog | |
|
740 | @ 1: 'collapsed' | |
|
741 | | | |
|
742 | o 0: 'base' | |
|
743 | ||
|
744 | $ hg manifest | |
|
745 | b | |
|
746 | base | |
|
724 | 747 | |
|
748 | $ cd .. |
@@ -326,8 +326,6 b' Verify that target is not selected as ex' | |||
|
326 | 326 | $ hg ci -m "J" |
|
327 | 327 | |
|
328 | 328 | $ hg rebase -s 8 -d 7 --collapse --config ui.merge=internal:other |
|
329 | remote changed E which local deleted | |
|
330 | use (c)hanged version or leave (d)eleted? c | |
|
331 | 329 | saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob) |
|
332 | 330 | |
|
333 | 331 | $ hg tglog |
General Comments 0
You need to be logged in to leave comments.
Login now