changeset 27828:823069f73ff9

with: use context manager for wlock in qpush
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents a5b168953013
children bab359a3cf49
files hgext/mq.py
diffstat 1 files changed, 1 insertions(+), 5 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
@@ -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)