Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 18035:5881d5b7552f
merge: refactor action calculation into function
This pulls the code used to calculate the changes that need to happen
during merge.update() into a separate function. This is not useful on
its own, but is instead preparatory to performing grafts in memory
when there are no potential conflicts.
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Tue, 04 Dec 2012 12:54:18 -0800 |
parents | ce7bc04d863b |
children | 8b846dbc57b6 |
comparison
equal
deleted
inserted
replaced
18034:1a570f04de07 | 18035:5881d5b7552f |
---|---|
446 ms.commit() | 446 ms.commit() |
447 repo.ui.progress(_('updating'), None, total=numupdates, unit=_('files')) | 447 repo.ui.progress(_('updating'), None, total=numupdates, unit=_('files')) |
448 | 448 |
449 return updated, merged, removed, unresolved | 449 return updated, merged, removed, unresolved |
450 | 450 |
451 def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial): | |
452 "Calculate the actions needed to merge mctx into tctx" | |
453 action = [] | |
454 folding = not util.checkcase(repo.path) | |
455 if folding: | |
456 # collision check is not needed for clean update | |
457 if (not branchmerge and | |
458 (force or not tctx.dirty(missing=True, branch=False))): | |
459 _checkcollision(mctx, None) | |
460 else: | |
461 _checkcollision(mctx, tctx) | |
462 if not force: | |
463 _checkunknown(repo, tctx, mctx) | |
464 action += _forgetremoved(tctx, mctx, branchmerge) | |
465 action += manifestmerge(repo, tctx, mctx, | |
466 ancestor, | |
467 force and not branchmerge, | |
468 partial) | |
469 return action | |
470 | |
451 def recordupdates(repo, action, branchmerge): | 471 def recordupdates(repo, action, branchmerge): |
452 "record merge actions to the dirstate" | 472 "record merge actions to the dirstate" |
453 | 473 |
454 for a in action: | 474 for a in action: |
455 f, m = a[:2] | 475 f, m = a[:2] |
607 else: | 627 else: |
608 # Allow jumping branches if clean and specific rev given | 628 # Allow jumping branches if clean and specific rev given |
609 pa = p1 | 629 pa = p1 |
610 | 630 |
611 ### calculate phase | 631 ### calculate phase |
612 action = [] | 632 action = calculateupdates(repo, wc, p2, pa, branchmerge, force, partial) |
613 folding = not util.checkcase(repo.path) | |
614 if folding: | |
615 # collision check is not needed for clean update | |
616 if (not branchmerge and | |
617 (force or not wc.dirty(missing=True, branch=False))): | |
618 _checkcollision(p2, None) | |
619 else: | |
620 _checkcollision(p2, (wc, pa)) | |
621 if not force: | |
622 _checkunknown(repo, wc, p2) | |
623 action += _forgetremoved(wc, p2, branchmerge) | |
624 action += manifestmerge(repo, wc, p2, pa, overwrite, partial) | |
625 | 633 |
626 ### apply phase | 634 ### apply phase |
627 if not branchmerge: # just jump to the new rev | 635 if not branchmerge: # just jump to the new rev |
628 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' | 636 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' |
629 if not partial: | 637 if not partial: |