# HG changeset patch # User Bryan O'Sullivan # Date 1452892487 28800 # Node ID 496ca4deddc56e09a44c2a2a27aee8dcb132289d # Parent 1c2408c28aff71044dbdc8f82ced26b55373b8e1 with: use context manager for wlock in unshelve diff -r 1c2408c28aff -r 496ca4deddc5 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']