Mercurial > public > mercurial-scm > hg
diff mercurial/cmdutil.py @ 33736:86aca74a063b
merge with stable
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 10 Aug 2017 14:23:41 -0400 |
parents | 2cb442bc1a76 5ac845ca059a |
children | 02a745c20121 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Aug 02 19:49:57 2017 +0200 +++ b/mercurial/cmdutil.py Thu Aug 10 14:23:41 2017 -0400 @@ -26,6 +26,7 @@ changelog, copies, crecord as crecordmod, + dirstateguard, encoding, error, formatter, @@ -2889,14 +2890,23 @@ message = logmessage(ui, opts) matcher = scmutil.match(repo[None], pats, opts) + dsguard = None # extract addremove carefully -- this function can be called from a command # that doesn't support addremove - if opts.get('addremove'): - if scmutil.addremove(repo, matcher, "", opts) != 0: - raise error.Abort( - _("failed to mark all new/missing files as added/removed")) - - return commitfunc(ui, repo, message, matcher, opts) + try: + if opts.get('addremove'): + dsguard = dirstateguard.dirstateguard(repo, 'commit') + if scmutil.addremove(repo, matcher, "", opts) != 0: + raise error.Abort( + _("failed to mark all new/missing files as added/removed")) + + r = commitfunc(ui, repo, message, matcher, opts) + if dsguard: + dsguard.close() + return r + finally: + if dsguard: + dsguard.release() def samefile(f, ctx1, ctx2): if f in ctx1.manifest():