diff -r 321759dfc049 -r 476f53058ee8 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):