# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:47 # Node ID 7ec3cb2462910c19114bc2a45a4ee32f812b89e7 # Parent 60b850b7e4eff3a808984be4ea40332a12f9d8e4 with: use context manager for wlock in shelve stripcmd diff --git a/hgext/strip.py b/hgext/strip.py --- a/hgext/strip.py +++ b/hgext/strip.py @@ -133,8 +133,7 @@ def stripcmd(ui, repo, *revs, **opts): revs = list(revs) + opts.get('rev') revs = set(scmutil.revrange(repo, revs)) - wlock = repo.wlock() - try: + with repo.wlock(): bookmarks = set(opts.get('bookmark')) if bookmarks: repomarks = repo._bookmarks @@ -232,7 +231,5 @@ def stripcmd(ui, repo, *revs, **opts): strip(ui, repo, revs, backup=backup, update=update, force=opts.get('force'), bookmarks=bookmarks) - finally: - wlock.release() return 0