Mercurial > hg
changeset 49561:220738a53d05 stable
perf-unbundle: pre-indent the main block in per::unbundle
This makes the next changeset clearer.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 19 Oct 2022 01:54:04 +0200 |
parents | 5f778b3a94ca |
children | 27bff60887fe |
files | contrib/perf.py |
diffstat | 1 files changed, 40 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Wed Oct 19 16:23:42 2022 -0400 +++ b/contrib/perf.py Wed Oct 19 01:54:04 2022 +0200 @@ -2681,44 +2681,46 @@ opts = _byteskwargs(opts) - with repo.lock(): - bundle = [None, None] - orig_quiet = repo.ui.quiet - try: - repo.ui.quiet = True - with open(fname, mode="rb") as f: - - def noop_report(*args, **kwargs): - pass - - def setup(): - gen, tr = bundle - if tr is not None: - tr.abort() - bundle[:] = [None, None] - f.seek(0) - bundle[0] = exchange.readbundle(ui, f, fname) - bundle[1] = repo.transaction(b'perf::unbundle') - bundle[1]._report = noop_report # silence the transaction - - def apply(): - gen, tr = bundle - bundle2.applybundle( - repo, - gen, - tr, - source=b'perf::unbundle', - url=fname, - ) - - timer, fm = gettimer(ui, opts) - timer(apply, setup=setup) - fm.end() - finally: - repo.ui.quiet == orig_quiet - gen, tr = bundle - if tr is not None: - tr.abort() + if True: + with repo.lock(): + bundle = [None, None] + orig_quiet = repo.ui.quiet + try: + repo.ui.quiet = True + with open(fname, mode="rb") as f: + + def noop_report(*args, **kwargs): + pass + + def setup(): + gen, tr = bundle + if tr is not None: + tr.abort() + bundle[:] = [None, None] + f.seek(0) + bundle[0] = exchange.readbundle(ui, f, fname) + bundle[1] = repo.transaction(b'perf::unbundle') + # silence the transaction + bundle[1]._report = noop_report + + def apply(): + gen, tr = bundle + bundle2.applybundle( + repo, + gen, + tr, + source=b'perf::unbundle', + url=fname, + ) + + timer, fm = gettimer(ui, opts) + timer(apply, setup=setup) + fm.end() + finally: + repo.ui.quiet == orig_quiet + gen, tr = bundle + if tr is not None: + tr.abort() @command(