# HG changeset patch # User Bryan O'Sullivan # Date 1452892486 28800 # Node ID bdaf433192f0395a2e81cd9fe94c494ee11ab152 # Parent aa41199a74e2568afcd44f5932f63d60ffcb5c62 with: use context manager for wlock in copy diff -r aa41199a74e2 -r bdaf433192f0 mercurial/commands.py --- a/mercurial/commands.py Fri Jan 15 13:14:46 2016 -0800 +++ b/mercurial/commands.py Fri Jan 15 13:14:46 2016 -0800 @@ -1833,11 +1833,8 @@ 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):