changeset 27848:9bda75a0c783

with: use context manager in qrename
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:50 -0800
parents 71853c0ba592
children 900d36a3e4dd
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
@@ -2986,16 +2986,13 @@
     r = q.qrepo()
     if r and patch in r.dirstate:
         wctx = r[None]
-        wlock = r.wlock()
-        try:
+        with r.wlock():
             if r.dirstate[patch] == 'a':
                 r.dirstate.drop(patch)
                 r.dirstate.add(name)
             else:
                 wctx.copy(patch, name)
                 wctx.forget([patch])
-        finally:
-            wlock.release()
 
     q.savedirty()