Patchwork D405: commit: move dirstateguard creation out of try-block

login
register
mail settings
Submitter phabricator
Date Aug. 15, 2017, 9:32 p.m.
Message ID <62536c47b03fe60d3e1aa98442fda327@localhost.localdomain>
Download mbox | patch
Permalink /patch/23052/
State Not Applicable
Headers show

Comments

phabricator - Aug. 15, 2017, 9:32 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5d286eb7009f: commit: move dirstateguard creation out of try-block (authored by martinvonz).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D405?vs=921&id=951

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2998,9 +2998,10 @@ 
     dsguard = None
     # extract addremove carefully -- this function can be called from a command
     # that doesn't support addremove
+    if opts.get('addremove'):
+        dsguard = dirstateguard.dirstateguard(repo, 'commit')
     try:
-        if opts.get('addremove'):
-            dsguard = dirstateguard.dirstateguard(repo, 'commit')
+        if dsguard:
             if scmutil.addremove(repo, matcher, "", opts) != 0:
                 raise error.Abort(
                     _("failed to mark all new/missing files as added/removed"))