Mercurial > hg-stable
changeset 27832:1e38b9d731c4
with: use context manager for lock in qimport
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:47 -0800 |
parents | 62f3126ef678 |
children | 321759dfc049 |
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 @@ -2316,8 +2316,7 @@ Returns 0 if import succeeded. """ - lock = repo.lock() # cause this may move phase - try: + with repo.lock(): # cause this may move phase q = repo.mq try: imported = q.qimport( @@ -2326,8 +2325,6 @@ rev=opts.get('rev'), git=opts.get('git')) finally: q.savedirty() - finally: - lock.release() if imported and opts.get('push') and not opts.get('rev'): return q.push(repo, imported[-1])