Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG1004fd71810f: rebase: reduce scope of "dsguard" variables a bit
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/rebase.py (4 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
commitmsg = 'Collapsed revision' | commitmsg = 'Collapsed revision' | ||||
for rebased in sorted(self.state): | for rebased in sorted(self.state): | ||||
if rebased not in self.skipped: | if rebased not in self.skipped: | ||||
commitmsg += '\n* %s' % repo[rebased].description() | commitmsg += '\n* %s' % repo[rebased].description() | ||||
editopt = True | editopt = True | ||||
editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) | editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) | ||||
revtoreuse = max(self.state) | revtoreuse = max(self.state) | ||||
dsguard = None | |||||
if self.inmemory: | if self.inmemory: | ||||
newnode = concludememorynode(repo, revtoreuse, p1, | newnode = concludememorynode(repo, revtoreuse, p1, | ||||
self.external, | self.external, | ||||
commitmsg=commitmsg, | commitmsg=commitmsg, | ||||
extrafn=_makeextrafn(self.extrafns), | extrafn=_makeextrafn(self.extrafns), | ||||
editor=editor, | editor=editor, | ||||
keepbranches=self.keepbranchesf, | keepbranches=self.keepbranchesf, | ||||
date=self.date, wctx=self.wctx) | date=self.date, wctx=self.wctx) | ||||
else: | else: | ||||
dsguard = None | |||||
if ui.configbool('rebase', 'singletransaction'): | if ui.configbool('rebase', 'singletransaction'): | ||||
dsguard = dirstateguard.dirstateguard(repo, 'rebase') | dsguard = dirstateguard.dirstateguard(repo, 'rebase') | ||||
with util.acceptintervention(dsguard): | with util.acceptintervention(dsguard): | ||||
newnode = concludenode(repo, revtoreuse, p1, self.external, | newnode = concludenode(repo, revtoreuse, p1, self.external, | ||||
commitmsg=commitmsg, | commitmsg=commitmsg, | ||||
extrafn=_makeextrafn(self.extrafns), | extrafn=_makeextrafn(self.extrafns), | ||||
editor=editor, | editor=editor, | ||||
keepbranches=self.keepbranchesf, | keepbranches=self.keepbranchesf, | ||||
else: | else: | ||||
destmap = _definedestmap(ui, repo, rbsrt, destf, srcf, basef, revf, | destmap = _definedestmap(ui, repo, rbsrt, destf, srcf, basef, revf, | ||||
destspace=destspace) | destspace=destspace) | ||||
retcode = rbsrt._preparenewrebase(destmap) | retcode = rbsrt._preparenewrebase(destmap) | ||||
if retcode is not None: | if retcode is not None: | ||||
return retcode | return retcode | ||||
tr = None | tr = None | ||||
dsguard = None | |||||
singletr = ui.configbool('rebase', 'singletransaction') | singletr = ui.configbool('rebase', 'singletransaction') | ||||
if singletr: | if singletr: | ||||
tr = repo.transaction('rebase') | tr = repo.transaction('rebase') | ||||
# If `rebase.singletransaction` is enabled, wrap the entire operation in | # If `rebase.singletransaction` is enabled, wrap the entire operation in | ||||
# one transaction here. Otherwise, transactions are obtained when | # one transaction here. Otherwise, transactions are obtained when | ||||
# committing each node, which is slower but allows partial success. | # committing each node, which is slower but allows partial success. | ||||
with util.acceptintervention(tr): | with util.acceptintervention(tr): | ||||
# Same logic for the dirstate guard, except we don't create one when | # Same logic for the dirstate guard, except we don't create one when | ||||
# rebasing in-memory (it's not needed). | # rebasing in-memory (it's not needed). | ||||
dsguard = None | |||||
if singletr and not inmemory: | if singletr and not inmemory: | ||||
dsguard = dirstateguard.dirstateguard(repo, 'rebase') | dsguard = dirstateguard.dirstateguard(repo, 'rebase') | ||||
with util.acceptintervention(dsguard): | with util.acceptintervention(dsguard): | ||||
rbsrt._performrebase(tr) | rbsrt._performrebase(tr) | ||||
rbsrt._finishrebase() | rbsrt._finishrebase() | ||||
def _definedestmap(ui, repo, rbsrt, destf=None, srcf=None, basef=None, | def _definedestmap(ui, repo, rbsrt, destf=None, srcf=None, basef=None, |