backout: use context manager for locks
Differential Revision: https://phab.mercurial-scm.org/D3744
--- a/mercurial/commands.py Thu Jun 14 15:28:32 2018 -0700
+++ b/mercurial/commands.py Thu Jun 14 15:08:19 2018 -0700
@@ -560,13 +560,8 @@
Returns 0 on success, 1 if nothing to backout or there are unresolved
files.
'''
- wlock = lock = None
- try:
- wlock = repo.wlock()
- lock = repo.lock()
+ with repo.wlock(), repo.lock():
return _dobackout(ui, repo, node, rev, **opts)
- finally:
- release(lock, wlock)
def _dobackout(ui, repo, node=None, rev=None, **opts):
opts = pycompat.byteskwargs(opts)