Mercurial > hg
changeset 38321:9b1536b02221
backout: use context manager for locks
Differential Revision: https://phab.mercurial-scm.org/D3744
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 14 Jun 2018 15:08:19 -0700 |
parents | eef4668be8a3 |
children | e218ed5ba484 |
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: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)