with: use context manager for wlock in qpush
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:47 -0800
changeset 27828 823069f73ff9
parent 27827 a5b168953013
child 27829 bab359a3cf49
with: use context manager for wlock in qpush
hgext/mq.py
--- a/hgext/mq.py	Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/mq.py	Fri Jan 15 13:14:47 2016 -0800
@@ -1318,8 +1318,7 @@
              keepchanges=False):
         self.checkkeepchanges(keepchanges, force)
         diffopts = self.diffopts()
-        wlock = repo.wlock()
-        try:
+        with repo.wlock():
             heads = []
             for hs in repo.branchmap().itervalues():
                 heads.extend(hs)
@@ -1461,9 +1460,6 @@
                 self.ui.write(_("now at: %s\n") % top)
             return ret[0]
 
-        finally:
-            wlock.release()
-
     def pop(self, repo, patch=None, force=False, update=True, all=False,
             nobackup=False, keepchanges=False):
         self.checkkeepchanges(keepchanges, force)