changeset 27831:62f3126ef678

with: use context manager for wlock in qfold
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents 1c5941542f24
children 1e38b9d731c4
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
@@ -2715,14 +2715,11 @@
         message = '\n'.join(message)
 
     diffopts = q.patchopts(q.diffopts(), *patches)
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         q.refresh(repo, msg=message, git=diffopts.git, edit=opts.get('edit'),
                   editform='mq.qfold')
         q.delete(repo, patches, opts)
         q.savedirty()
-    finally:
-        wlock.release()
 
 @command("qgoto",
          [('', 'keep-changes', None,