changeset 27847:71853c0ba592

with: use context manager in qfinish
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:50 -0800
parents 63821023ea79
children 9bda75a0c783
files hgext/mq.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Fri Jan 15 13:14:50 2016 -0800
+++ b/hgext/mq.py	Fri Jan 15 13:14:50 2016 -0800
@@ -3199,12 +3199,9 @@
     # queue.finish may changes phases but leave the responsibility to lock the
     # repo to the caller to avoid deadlock with wlock. This command code is
     # responsibility for this locking.
-    lock = repo.lock()
-    try:
+    with repo.lock():
         q.finish(repo, revs)
         q.savedirty()
-    finally:
-        lock.release()
     return 0
 
 @command("qqueue",