##// END OF EJS Templates
rebase: clarify naming of variables holding node hashes - don't call them rev
Mads Kiilerich -
r23459:2e047b15 default
parent child Browse files
Show More
@@ -392,17 +392,17 b' def rebase(ui, repo, **opts):'
392 merging = repo[p2].rev() != nullrev
392 merging = repo[p2].rev() != nullrev
393 editform = cmdutil.mergeeditform(merging, 'rebase')
393 editform = cmdutil.mergeeditform(merging, 'rebase')
394 editor = cmdutil.getcommiteditor(editform=editform, **opts)
394 editor = cmdutil.getcommiteditor(editform=editform, **opts)
395 newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn,
395 newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
396 editor=editor)
396 editor=editor)
397 else:
397 else:
398 # Skip commit if we are collapsing
398 # Skip commit if we are collapsing
399 repo.dirstate.beginparentchange()
399 repo.dirstate.beginparentchange()
400 repo.setparents(repo[p1].node())
400 repo.setparents(repo[p1].node())
401 repo.dirstate.endparentchange()
401 repo.dirstate.endparentchange()
402 newrev = None
402 newnode = None
403 # Update the state
403 # Update the state
404 if newrev is not None:
404 if newnode is not None:
405 state[rev] = repo[newrev].rev()
405 state[rev] = repo[newnode].rev()
406 else:
406 else:
407 if not collapsef:
407 if not collapsef:
408 ui.note(_('no changes, revision %d skipped\n') % rev)
408 ui.note(_('no changes, revision %d skipped\n') % rev)
@@ -427,11 +427,11 b' def rebase(ui, repo, **opts):'
427 commitmsg += '\n* %s' % repo[rebased].description()
427 commitmsg += '\n* %s' % repo[rebased].description()
428 editopt = True
428 editopt = True
429 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
429 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
430 newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
430 newnode = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
431 extrafn=extrafn, editor=editor)
431 extrafn=extrafn, editor=editor)
432 for oldrev in state.iterkeys():
432 for oldrev in state.iterkeys():
433 if state[oldrev] > nullmerge:
433 if state[oldrev] > nullmerge:
434 state[oldrev] = newrev
434 state[oldrev] = newnode
435
435
436 if 'qtip' in repo.tags():
436 if 'qtip' in repo.tags():
437 updatemq(repo, state, skipped, **opts)
437 updatemq(repo, state, skipped, **opts)
@@ -459,7 +459,7 b' def rebase(ui, repo, **opts):'
459 if not keepf:
459 if not keepf:
460 collapsedas = None
460 collapsedas = None
461 if collapsef:
461 if collapsef:
462 collapsedas = newrev
462 collapsedas = newnode
463 clearrebased(ui, repo, state, skipped, collapsedas)
463 clearrebased(ui, repo, state, skipped, collapsedas)
464
464
465 if currentbookmarks:
465 if currentbookmarks:
@@ -505,7 +505,8 b' def externalparent(repo, state, targetan'
505 ', '.join(str(p) for p in sorted(parents))))
505 ', '.join(str(p) for p in sorted(parents))))
506
506
507 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None):
507 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None):
508 'Commit the changes and store useful information in extra'
508 '''Commit the changes and store useful information in extra.
509 Return node of committed revision.'''
509 try:
510 try:
510 repo.dirstate.beginparentchange()
511 repo.dirstate.beginparentchange()
511 repo.setparents(repo[p1].node(), repo[p2].node())
512 repo.setparents(repo[p1].node(), repo[p2].node())
@@ -522,13 +523,13 b' def concludenode(repo, rev, p1, p2, comm'
522 targetphase = max(ctx.phase(), phases.draft)
523 targetphase = max(ctx.phase(), phases.draft)
523 repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase')
524 repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase')
524 # Commit might fail if unresolved files exist
525 # Commit might fail if unresolved files exist
525 newrev = repo.commit(text=commitmsg, user=ctx.user(),
526 newnode = repo.commit(text=commitmsg, user=ctx.user(),
526 date=ctx.date(), extra=extra, editor=editor)
527 date=ctx.date(), extra=extra, editor=editor)
527 finally:
528 finally:
528 repo.ui.restoreconfig(backup)
529 repo.ui.restoreconfig(backup)
529
530
530 repo.dirstate.setbranch(repo[newrev].branch())
531 repo.dirstate.setbranch(repo[newnode].branch())
531 return newrev
532 return newnode
532 except util.Abort:
533 except util.Abort:
533 # Invalidate the previous setparents
534 # Invalidate the previous setparents
534 repo.dirstate.invalidate()
535 repo.dirstate.invalidate()
General Comments 0
You need to be logged in to leave comments. Login now