with: use context manager for wlock in shelve createcmd
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:47 -0800
changeset 27834 476f53058ee8
parent 27833 321759dfc049
child 27835 c448d7e00bf9
with: use context manager for wlock in shelve createcmd
hgext/shelve.py
--- a/hgext/shelve.py	Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/shelve.py	Fri Jan 15 13:14:47 2016 -0800
@@ -224,12 +224,9 @@
 
 def createcmd(ui, repo, pats, opts):
     """subcommand that creates a new shelve"""
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         cmdutil.checkunfinished(repo)
         return _docreatecmd(ui, repo, pats, opts)
-    finally:
-        lockmod.release(wlock)
 
 def _docreatecmd(ui, repo, pats, opts):
     def mutableancestors(ctx):