# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:45 # Node ID ed44a66fd7ae4e7f00a54496888e2e6666e9d387 # Parent 7be6371c732e7bace9fd0b3e0251fa326e5a10c7 with: use context manager for wlock in remove diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2421,16 +2421,13 @@ def remove(ui, repo, m, prefix, after, f if ui.verbose or not m.exact(f): ui.status(_('removing %s\n') % m.rel(f)) - wlock = repo.wlock() - try: + with repo.wlock(): if not after: for f in list: if f in added: continue # we never unlink added files on remove util.unlinkpath(repo.wjoin(f), ignoremissing=True) repo[None].forget(list) - finally: - wlock.release() return ret