Mercurial > hg
changeset 38322:e218ed5ba484
commit: use context manager for locks
Differential Revision: https://phab.mercurial-scm.org/D3745
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 14 Jun 2018 15:05:14 -0700 |
parents | 9b1536b02221 |
children | 48c52385e062 |
files | mercurial/commands.py |
diffstat | 1 files changed, 1 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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'):