changeset 27839:7ec3cb246291

with: use context manager for wlock in shelve stripcmd
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents 60b850b7e4ef
children dc237afacbd4
files hgext/strip.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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