# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:50 # Node ID 9bda75a0c783f491d5c9d914495c6bcfd7e5f820 # Parent 71853c0ba59264e4653e76eac8d5e423d6bebb03 with: use context manager in qrename diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -2986,16 +2986,13 @@ def rename(ui, repo, patch, name=None, * r = q.qrepo() if r and patch in r.dirstate: wctx = r[None] - wlock = r.wlock() - try: + with r.wlock(): if r.dirstate[patch] == 'a': r.dirstate.drop(patch) r.dirstate.add(name) else: wctx.copy(patch, name) wctx.forget([patch]) - finally: - wlock.release() q.savedirty()