Mercurial > hg
changeset 38323:48c52385e062
tag: use context manager for locks
Differential Revision: https://phab.mercurial-scm.org/D3746
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 14 Jun 2018 15:08:32 -0700 |
parents | e218ed5ba484 |
children | c924e7dbcd0f |
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:05:14 2018 -0700 +++ b/mercurial/commands.py Thu Jun 14 15:08:32 2018 -0700 @@ -5356,10 +5356,7 @@ Returns 0 on success. """ opts = pycompat.byteskwargs(opts) - wlock = lock = None - try: - wlock = repo.wlock() - lock = repo.lock() + with repo.wlock(), repo.lock(): rev_ = "." names = [t.strip() for t in (name1,) + names] if len(names) != len(set(names)): @@ -5430,8 +5427,6 @@ tagsmod.tag(repo, names, node, message, opts.get('local'), opts.get('user'), date, editor=editor) - finally: - release(lock, wlock) @command('tags', formatteropts, '', intents={INTENT_READONLY}) def tags(ui, repo, **opts):