From patchwork Tue Aug 15 21:32:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D405: commit: move dirstateguard creation out of try-block From: phabricator X-Patchwork-Id: 23052 Message-Id: <62536c47b03fe60d3e1aa98442fda327@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Tue, 15 Aug 2017 21:32:50 +0000 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 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"))