changeset 27830:1c5941542f24

with: use context manager for wlock in qrefresh
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents bab359a3cf49
children 62f3126ef678
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:47 2016 -0800
+++ b/hgext/mq.py	Fri Jan 15 13:14:47 2016 -0800
@@ -2627,13 +2627,10 @@
     q = repo.mq
     message = cmdutil.logmessage(ui, opts)
     setupheaderopts(ui, opts)
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         ret = q.refresh(repo, pats, msg=message, **opts)
         q.savedirty()
         return ret
-    finally:
-        wlock.release()
 
 @command("^qdiff",
          commands.diffopts + commands.diffopts2 + commands.walkopts,