commit: use context manager for locks
Differential Revision: https://phab.mercurial-scm.org/D3745
--- a/mercurial/commands.py Thu Jun 14 15:08:19 2018 -0700
+++ b/mercurial/commands.py Thu Jun 14 15:05:14 2018 -0700
@@ -1523,13 +1523,8 @@
hg commit --amend --date now
"""
- wlock = lock = None
- try:
- wlock = repo.wlock()
- lock = repo.lock()
+ with repo.wlock(), repo.lock():
return _docommit(ui, repo, *pats, **opts)
- finally:
- release(lock, wlock)
def _docommit(ui, repo, *pats, **opts):
if opts.get(r'interactive'):