comparison hgext/rebase.py @ 36927:17a744c5e270

rebase: also include commit of collapsed commits in single transaction When rebase.singletransaction is set, we still used to create a second transaction when committing with --collapse. It's simpler to create a single transaction. Note that in the affected .t file, the test that uses --collapse still appears to create two transactions (it prints "rebase status stored" twice). However, only a single transaction is actually created and the second printout comes from cmdutil.commitforceeditor() that explicitly calls tr.writepending(). Also note the that we now roll back any commits if the user closes the commit message editor with an error code (or leaves the message empty). That might be unfortunate, but it's consistent with how we behave in the --no-collapse case (if the user passed --edit). If we want to change that, I think it should be done consistently in a separate patch. Differential Revision: https://phab.mercurial-scm.org/D2728
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 09 Mar 2018 10:35:48 -0800
parents 6dab3bdb1f00
children 9457c395fcbb
comparison
equal deleted inserted replaced
36926:0dcf50dc90b6 36927:17a744c5e270
571 extrafn=_makeextrafn(self.extrafns), 571 extrafn=_makeextrafn(self.extrafns),
572 editor=editor, 572 editor=editor,
573 keepbranches=self.keepbranchesf, 573 keepbranches=self.keepbranchesf,
574 date=self.date, wctx=self.wctx) 574 date=self.date, wctx=self.wctx)
575 else: 575 else:
576 dsguard = None 576 newnode = concludenode(repo, revtoreuse, p1, self.external,
577 if ui.configbool('rebase', 'singletransaction'): 577 commitmsg=commitmsg,
578 dsguard = dirstateguard.dirstateguard(repo, 'rebase') 578 extrafn=_makeextrafn(self.extrafns),
579 with util.acceptintervention(dsguard): 579 editor=editor,
580 newnode = concludenode(repo, revtoreuse, p1, self.external, 580 keepbranches=self.keepbranchesf,
581 commitmsg=commitmsg, 581 date=self.date)
582 extrafn=_makeextrafn(self.extrafns),
583 editor=editor,
584 keepbranches=self.keepbranchesf,
585 date=self.date)
586 if newnode is not None: 582 if newnode is not None:
587 newrev = repo[newnode].rev() 583 newrev = repo[newnode].rev()
588 for oldrev in self.state: 584 for oldrev in self.state:
589 self.state[oldrev] = newrev 585 self.state[oldrev] = newrev
590 586
862 dsguard = None 858 dsguard = None
863 if singletr and not inmemory: 859 if singletr and not inmemory:
864 dsguard = dirstateguard.dirstateguard(repo, 'rebase') 860 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
865 with util.acceptintervention(dsguard): 861 with util.acceptintervention(dsguard):
866 rbsrt._performrebase(tr) 862 rbsrt._performrebase(tr)
867 863 rbsrt._finishrebase()
868 rbsrt._finishrebase()
869 864
870 def _definedestmap(ui, repo, rbsrt, destf=None, srcf=None, basef=None, 865 def _definedestmap(ui, repo, rbsrt, destf=None, srcf=None, basef=None,
871 revf=None, destspace=None): 866 revf=None, destspace=None):
872 """use revisions argument to define destmap {srcrev: destrev}""" 867 """use revisions argument to define destmap {srcrev: destrev}"""
873 if revf is None: 868 if revf is None: