# HG changeset patch # User Bryan O'Sullivan # Date 1452892486 28800 # Node ID a8e8950ebd4d8e6e78346d261453d2bdf9a87887 # Parent ed44a66fd7ae4e7f00a54496888e2e6666e9d387 with: use context manager for wlock in revert diff -r ed44a66fd7ae -r a8e8950ebd4d mercurial/cmdutil.py --- a/mercurial/cmdutil.py Fri Jan 15 13:14:45 2016 -0800 +++ b/mercurial/cmdutil.py Fri Jan 15 13:14:46 2016 -0800 @@ -2868,8 +2868,7 @@ # -> (, ) names = {} - wlock = repo.wlock() - try: + with repo.wlock(): ## filling of the `names` mapping # walk dirstate to fill `names` @@ -3122,8 +3121,6 @@ except KeyError: raise error.Abort("subrepository '%s' does not exist in %s!" % (sub, short(ctx.node()))) - finally: - wlock.release() def _revertprefetch(repo, ctx, *files): """Let extension changing the storage layer prefetch content"""