comparison hgext/rebase.py @ 26868:a2aa39a725a1

rebase: add date parameter to concludenode function This parameter will allow us to set the date of rebased commits
author Stanislau Hlebik <stash@fb.com>
date Mon, 26 Oct 2015 02:22:26 -0700
parents d1561a422748
children 412e8c5e38b4
comparison
equal deleted inserted replaced
26867:ad443e8d9334 26868:a2aa39a725a1
584 'than one external parent: %s') % 584 'than one external parent: %s') %
585 (max(targetancestors), 585 (max(targetancestors),
586 ', '.join(str(p) for p in sorted(parents)))) 586 ', '.join(str(p) for p in sorted(parents))))
587 587
588 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None, 588 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None,
589 keepbranches=False): 589 keepbranches=False, date=None):
590 '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev 590 '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev
591 but also store useful information in extra. 591 but also store useful information in extra.
592 Return node of committed revision.''' 592 Return node of committed revision.'''
593 dsguard = cmdutil.dirstateguard(repo, 'rebase') 593 dsguard = cmdutil.dirstateguard(repo, 'rebase')
594 try: 594 try:
606 targetphase = max(ctx.phase(), phases.draft) 606 targetphase = max(ctx.phase(), phases.draft)
607 repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase') 607 repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase')
608 if keepbranch: 608 if keepbranch:
609 repo.ui.setconfig('ui', 'allowemptycommit', True) 609 repo.ui.setconfig('ui', 'allowemptycommit', True)
610 # Commit might fail if unresolved files exist 610 # Commit might fail if unresolved files exist
611 if date is None:
612 date = ctx.date()
611 newnode = repo.commit(text=commitmsg, user=ctx.user(), 613 newnode = repo.commit(text=commitmsg, user=ctx.user(),
612 date=ctx.date(), extra=extra, editor=editor) 614 date=date, extra=extra, editor=editor)
613 finally: 615 finally:
614 repo.ui.restoreconfig(backup) 616 repo.ui.restoreconfig(backup)
615 617
616 repo.dirstate.setbranch(repo[newnode].branch()) 618 repo.dirstate.setbranch(repo[newnode].branch())
617 dsguard.close() 619 dsguard.close()