with: use context manager for wlock in unshelve
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:47 -0800
changeset 27837 496ca4deddc5
parent 27836 1c2408c28aff
child 27838 60b850b7e4ef
with: use context manager for wlock in unshelve
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
@@ -602,11 +602,8 @@
        than ``maxbackups`` backups are kept, if same timestamp
        prevents from deciding exact order of them, for safety.
     """
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         return _dounshelve(ui, repo, *shelved, **opts)
-    finally:
-        lockmod.release(wlock)
 
 def _dounshelve(ui, repo, *shelved, **opts):
     abortf = opts['abort']