changeset 27834:476f53058ee8

with: use context manager for wlock in shelve createcmd
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents 321759dfc049
children c448d7e00bf9
files hgext/shelve.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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):