Mercurial > hg
comparison hgext/rebase.py @ 36773:1004fd71810f
rebase: reduce scope of "dsguard" variables a bit
Differential Revision: https://phab.mercurial-scm.org/D2710
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 01 Mar 2018 20:12:25 -0800 |
parents | 0f3116c08e65 |
children | a835bf3fe40a |
comparison
equal
deleted
inserted
replaced
36772:0f3116c08e65 | 36773:1004fd71810f |
---|---|
563 commitmsg += '\n* %s' % repo[rebased].description() | 563 commitmsg += '\n* %s' % repo[rebased].description() |
564 editopt = True | 564 editopt = True |
565 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) | 565 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) |
566 revtoreuse = max(self.state) | 566 revtoreuse = max(self.state) |
567 | 567 |
568 dsguard = None | |
569 if self.inmemory: | 568 if self.inmemory: |
570 newnode = concludememorynode(repo, revtoreuse, p1, | 569 newnode = concludememorynode(repo, revtoreuse, p1, |
571 self.external, | 570 self.external, |
572 commitmsg=commitmsg, | 571 commitmsg=commitmsg, |
573 extrafn=_makeextrafn(self.extrafns), | 572 extrafn=_makeextrafn(self.extrafns), |
574 editor=editor, | 573 editor=editor, |
575 keepbranches=self.keepbranchesf, | 574 keepbranches=self.keepbranchesf, |
576 date=self.date, wctx=self.wctx) | 575 date=self.date, wctx=self.wctx) |
577 else: | 576 else: |
577 dsguard = None | |
578 if ui.configbool('rebase', 'singletransaction'): | 578 if ui.configbool('rebase', 'singletransaction'): |
579 dsguard = dirstateguard.dirstateguard(repo, 'rebase') | 579 dsguard = dirstateguard.dirstateguard(repo, 'rebase') |
580 with util.acceptintervention(dsguard): | 580 with util.acceptintervention(dsguard): |
581 newnode = concludenode(repo, revtoreuse, p1, self.external, | 581 newnode = concludenode(repo, revtoreuse, p1, self.external, |
582 commitmsg=commitmsg, | 582 commitmsg=commitmsg, |
847 retcode = rbsrt._preparenewrebase(destmap) | 847 retcode = rbsrt._preparenewrebase(destmap) |
848 if retcode is not None: | 848 if retcode is not None: |
849 return retcode | 849 return retcode |
850 | 850 |
851 tr = None | 851 tr = None |
852 dsguard = None | |
853 | 852 |
854 singletr = ui.configbool('rebase', 'singletransaction') | 853 singletr = ui.configbool('rebase', 'singletransaction') |
855 if singletr: | 854 if singletr: |
856 tr = repo.transaction('rebase') | 855 tr = repo.transaction('rebase') |
857 | 856 |
859 # one transaction here. Otherwise, transactions are obtained when | 858 # one transaction here. Otherwise, transactions are obtained when |
860 # committing each node, which is slower but allows partial success. | 859 # committing each node, which is slower but allows partial success. |
861 with util.acceptintervention(tr): | 860 with util.acceptintervention(tr): |
862 # Same logic for the dirstate guard, except we don't create one when | 861 # Same logic for the dirstate guard, except we don't create one when |
863 # rebasing in-memory (it's not needed). | 862 # rebasing in-memory (it's not needed). |
863 dsguard = None | |
864 if singletr and not inmemory: | 864 if singletr and not inmemory: |
865 dsguard = dirstateguard.dirstateguard(repo, 'rebase') | 865 dsguard = dirstateguard.dirstateguard(repo, 'rebase') |
866 with util.acceptintervention(dsguard): | 866 with util.acceptintervention(dsguard): |
867 rbsrt._performrebase(tr) | 867 rbsrt._performrebase(tr) |
868 | 868 |