hgext3rd/evolve/cmdrewrite.py
branchstable
changeset 3744 4a70392f1723
parent 3709 aaa6adbbb47a
child 3751 a1a0cfbffd30
--- a/hgext3rd/evolve/cmdrewrite.py	Thu May 10 21:37:28 2018 -0700
+++ b/hgext3rd/evolve/cmdrewrite.py	Mon May 14 15:25:38 2018 -0700
@@ -140,15 +140,11 @@
         opts['amend'] = True
         _resolveoptions(ui, opts)
         _alias, commitcmd = cmdutil.findcmd('commit', commands.table)
-        try:
-            wlock = repo.wlock()
-            lock = repo.lock()
+        with repo.wlock(), repo.lock():
             if not (edit or opts['message'] or log):
                 opts['message'] = repo['.'].description()
             rewriteutil.precheck(repo, [repo['.'].rev()], action='amend')
             return commitcmd[0](ui, repo, *pats, **opts)
-        finally:
-            lockmod.release(lock, wlock)
 
 def amendpatch(ui, repo, *pats, **opts):
     """logic for --patch flag of `hg amend` command."""