# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:46 # Node ID bdaf433192f0395a2e81cd9fe94c494ee11ab152 # Parent aa41199a74e2568afcd44f5932f63d60ffcb5c62 with: use context manager for wlock in copy diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1833,11 +1833,8 @@ def copy(ui, repo, *pats, **opts): Returns 0 on success, 1 if errors are encountered. """ - wlock = repo.wlock(False) - try: + with repo.wlock(False): return cmdutil.copy(ui, repo, pats, opts) - finally: - wlock.release() @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) def debugancestor(ui, repo, *args):