changeset 27837:496ca4deddc5

with: use context manager for wlock in unshelve
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents 1c2408c28aff
children 60b850b7e4ef
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
@@ -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']