with: use context manager for wlock in shelve stripcmd
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:47 -0800
changeset 27839 7ec3cb246291
parent 27838 60b850b7e4ef
child 27840 dc237afacbd4
with: use context manager for wlock in shelve stripcmd
hgext/strip.py
--- a/hgext/strip.py	Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/strip.py	Fri Jan 15 13:14:47 2016 -0800
@@ -133,8 +133,7 @@
     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 @@
 
         strip(ui, repo, revs, backup=backup, update=update,
               force=opts.get('force'), bookmarks=bookmarks)
-    finally:
-        wlock.release()
 
     return 0