Patchwork D2710: rebase: reduce scope of "dsguard" variables a bit

login
register
mail settings
Submitter phabricator
Date March 7, 2018, 9:15 p.m.
Message ID <6498205268cd075b7f728d1c8bbbdf9f@localhost.localdomain>
Download mbox | patch
Permalink /patch/29104/
State Not Applicable
Headers show

Comments

phabricator - March 7, 2018, 9:15 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1004fd71810f: rebase: reduce scope of &quot;dsguard&quot; variables a bit (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2710?vs=6698&id=6705

REVISION DETAIL
  https://phab.mercurial-scm.org/D2710

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -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):