changeset 27827:a5b168953013

with: use context manager for wlock in qnew
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents f087b7095381
children 823069f73ff9
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
@@ -1168,8 +1168,7 @@
             raise error.Abort(_('cannot manage merge changesets'))
         self.checktoppatch(repo)
         insert = self.fullseriesend()
-        wlock = repo.wlock()
-        try:
+        with repo.wlock():
             try:
                 # if patch file write fails, abort early
                 p = self.opener(patchfn, "w")
@@ -1239,8 +1238,6 @@
                     self.ui.warn(_('error unlinking %s\n') % patchpath)
                 raise
             self.removeundo(repo)
-        finally:
-            release(wlock)
 
     def isapplied(self, patch):
         """returns (index, rev, patch)"""