# HG changeset patch # User Bryan O'Sullivan # Date 1452892487 28800 # Node ID bab359a3cf4981756f768b6761c53167b3fac631 # Parent 823069f73ff9ea9731d3a653c993e6bc8f0349f9 with: use context manager for wlock in qpop diff -r 823069f73ff9 -r bab359a3cf49 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 @@ -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)