changeset 27814:a72735028336

with: use context manager for wlock in sign
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents ff20fe74e5c6
children 16cfbbc69800
files hgext/gpg.py
diffstat 1 files changed, 1 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/gpg.py	Fri Jan 15 13:14:46 2016 -0800
+++ b/hgext/gpg.py	Fri Jan 15 13:14:46 2016 -0800
@@ -9,7 +9,6 @@
 from mercurial import util, commands, match, cmdutil, error
 from mercurial import node as hgnode
 from mercurial.i18n import _
-from mercurial import lock as lockmod
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
@@ -223,12 +222,8 @@
 
     See :hg:`help dates` for a list of formats valid for -d/--date.
     """
-    wlock = None
-    try:
-        wlock = repo.wlock()
+    with repo.wlock():
         return _dosign(ui, repo, *revs, **opts)
-    finally:
-        lockmod.release(wlock)
 
 def _dosign(ui, repo, *revs, **opts):
     mygpg = newgpg(ui, **opts)