changeset 36781: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
files hgext/rebase.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Wed Mar 07 09:46:53 2018 -0800
+++ b/hgext/rebase.py	Thu Mar 01 20:12:25 2018 -0800
@@ -565,7 +565,6 @@
             editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
             revtoreuse = max(self.state)
 
-            dsguard = None
             if self.inmemory:
                 newnode = concludememorynode(repo, revtoreuse, p1,
                     self.external,
@@ -575,6 +574,7 @@
                     keepbranches=self.keepbranchesf,
                     date=self.date, wctx=self.wctx)
             else:
+                dsguard = None
                 if ui.configbool('rebase', 'singletransaction'):
                     dsguard = dirstateguard.dirstateguard(repo, 'rebase')
                 with util.acceptintervention(dsguard):
@@ -849,7 +849,6 @@
                 return retcode
 
         tr = None
-        dsguard = None
 
         singletr = ui.configbool('rebase', 'singletransaction')
         if singletr:
@@ -861,6 +860,7 @@
         with util.acceptintervention(tr):
             # Same logic for the dirstate guard, except we don't create one when
             # rebasing in-memory (it's not needed).
+            dsguard = None
             if singletr and not inmemory:
                 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
             with util.acceptintervention(dsguard):