Mercurial > hg-stable
changeset 38382:0d7ec620faef
debugbuilddag: use context manager for progress, locks, transaction
I minor side-effect is that .hg/localtags is now written before the
transaction commits.
Differential Revision: https://phab.mercurial-scm.org/D3777
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 17 Jun 2018 21:47:34 -0700 |
parents | fce1c17493db |
children | a73eab7d6575 |
files | mercurial/debugcommands.py |
diffstat | 1 files changed, 1 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Sun Jun 17 21:44:57 2018 -0700 +++ b/mercurial/debugcommands.py Sun Jun 17 21:47:34 2018 -0700 @@ -181,15 +181,9 @@ initialmergedlines.append("") tags = [] - - wlock = lock = tr = None progress = ui.makeprogress(_('building'), unit=_('revisions'), total=total) - try: - wlock = repo.wlock() - lock = repo.lock() - tr = repo.transaction("builddag") - + with progress, repo.wlock(), repo.lock(), repo.transaction("builddag"): at = -1 atbranch = 'default' nodeids = [] @@ -268,13 +262,9 @@ ui.note(('branch %s\n' % data)) atbranch = data progress.update(id) - tr.close() if tags: repo.vfs.write("localtags", "".join(tags)) - finally: - progress.complete() - release(tr, lock, wlock) def _debugchangegroup(ui, gen, all=None, indent=0, **opts): indent_string = ' ' * indent