Skip to content
Snippets Groups Projects
Commit 3c5d0f87 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

perf-unbundle: add a perf command to time the unbundle operation

Check documentation for details.
parent b380583a
No related branches found
No related tags found
2 merge requests!267merge default into stable,!178Various improvement to bundle and new related perf command
......@@ -2590,6 +2590,51 @@
@command(
b'perf::unbundle',
formatteropts,
b'BUNDLE_FILE',
)
def perf_unbundle(ui, repo, fname, **opts):
"""benchmark application of a bundle in a repository.
This does not include the final transaction processing"""
from mercurial import exchange
from mercurial import bundle2
with repo.lock():
bundle = [None, None]
try:
with open(fname, mode="rb") as f:
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')
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:
gen, tr = bundle
if tr is not None:
tr.abort()
@command(
b'perf::unidiff|perfunidiff',
revlogopts
+ formatteropts
......
......@@ -188,6 +188,8 @@
perf::tags (no help text available)
perf::templating
test the rendering time of a given template
perf::unbundle
benchmark application of a bundle in a repository.
perf::unidiff
benchmark a unified diff between revisions
perf::volatilesets
......@@ -387,6 +389,15 @@
searching for changes
searching for changes
$ hg perf::bundle 'last(all(), 5)'
$ hg bundle --exact --rev 'last(all(), 5)' last-5.hg
4 changesets found
$ hg perf::unbundle last-5.hg
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
test profile-benchmark option
------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment