changeset 27829:bab359a3cf49

with: use context manager for wlock in qpop
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents 823069f73ff9
children 1c5941542f24
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
@@ -1463,8 +1463,7 @@
     def pop(self, repo, patch=None, force=False, update=True, all=False,
             nobackup=False, keepchanges=False):
         self.checkkeepchanges(keepchanges, force)
-        wlock = repo.wlock()
-        try:
+        with repo.wlock():
             if patch:
                 # index, rev, patch
                 info = self.isapplied(patch)
@@ -1568,8 +1567,6 @@
                 self.ui.write(_("now at: %s\n") % self.applied[-1].name)
             else:
                 self.ui.write(_("patch queue now empty\n"))
-        finally:
-            wlock.release()
 
     def diff(self, repo, pats, opts):
         top, patch = self.checktoppatch(repo)