with: use context manager for wlock in qnew

This commit is contained in:
Bryan O'Sullivan 2016-01-15 13:14:47 -08:00
parent e41ff99cd6
commit 68786b4a3e

View File

@ -1168,8 +1168,7 @@ class queue(object):
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 @@ class queue(object):
self.ui.warn(_('error unlinking %s\n') % patchpath)
raise
self.removeundo(repo)
finally:
release(wlock)
def isapplied(self, patch):
"""returns (index, rev, patch)"""