##// END OF EJS Templates
rebase: avoid redundant repo[rev].rev() - just keep working in rev space
Mads Kiilerich -
r23461:ffef6d50 default
parent child Browse files
Show More
@@ -389,7 +389,7 b' def rebase(ui, repo, **opts):'
389 389 finally:
390 390 ui.setconfig('ui', 'forcemerge', '', 'rebase')
391 391 if not collapsef:
392 merging = repo[p2].rev() != nullrev
392 merging = p2 != nullrev
393 393 editform = cmdutil.mergeeditform(merging, 'rebase')
394 394 editor = cmdutil.getcommiteditor(editform=editform, **opts)
395 395 newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
@@ -543,20 +543,20 b' def rebasenode(repo, rev, p1, state, col'
543 543 'Rebase a single revision'
544 544 # Merge phase
545 545 # Update to target and merge it with local
546 if repo['.'].rev() != repo[p1].rev():
547 repo.ui.debug(" update to %d:%s\n" % (repo[p1].rev(), repo[p1]))
546 if repo['.'].rev() != p1:
547 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
548 548 merge.update(repo, p1, False, True, False)
549 549 else:
550 550 repo.ui.debug(" already in target\n")
551 551 repo.dirstate.write()
552 repo.ui.debug(" merge against %d:%s\n" % (repo[rev].rev(), repo[rev]))
553 if repo[rev].rev() == repo[min(state)].rev():
552 repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev]))
553 if rev == min(state):
554 554 # Case (1) initial changeset of a non-detaching rebase.
555 555 # Let the merge mechanism find the base itself.
556 556 base = None
557 557 elif not repo[rev].p2():
558 558 # Case (2) detaching the node with a single parent, use this parent
559 base = repo[rev].p1().node()
559 base = repo[rev].p1().rev()
560 560 else:
561 561 # In case of merge, we need to pick the right parent as merge base.
562 562 #
@@ -583,8 +583,8 b' def rebasenode(repo, rev, p1, state, col'
583 583 # Which does not represent anything sensible and creates a lot of
584 584 # conflicts.
585 585 for p in repo[rev].parents():
586 if state.get(p.rev()) == repo[p1].rev():
587 base = p.node()
586 if state.get(p.rev()) == p1:
587 base = p.rev()
588 588 break
589 589 else: # fallback when base not found
590 590 base = None
@@ -593,7 +593,7 b' def rebasenode(repo, rev, p1, state, col'
593 593 raise AssertionError('no base found to rebase on '
594 594 '(rebasenode called wrong)')
595 595 if base is not None:
596 repo.ui.debug(" detach base %d:%s\n" % (repo[base].rev(), repo[base]))
596 repo.ui.debug(" detach base %d:%s\n" % (base, repo[base]))
597 597 # When collapsing in-place, the parent is the common ancestor, we
598 598 # have to allow merging with it.
599 599 stats = merge.update(repo, rev, True, True, False, base, collapse,
@@ -835,7 +835,7 b' def abort(repo, originalwd, target, stat'
835 835 if cleanup:
836 836 # Update away from the rebase if necessary
837 837 if inrebase(repo, originalwd, state):
838 merge.update(repo, repo[originalwd].rev(), False, True, False)
838 merge.update(repo, originalwd, False, True, False)
839 839
840 840 # Strip from the first rebased revision
841 841 rebased = filter(lambda x: x > -1 and x != target, state.values())
General Comments 0
You need to be logged in to leave comments. Login now