##// END OF EJS Templates
perf-unbundle: add a perf command to time the unbundle operation...
marmoute -
r50309:3c5d0f87 default
parent child Browse files
Show More
@@ -2590,6 +2590,51 b' def perfbdiff(ui, repo, file_, rev=None,'
2590
2590
2591
2591
2592 @command(
2592 @command(
2593 b'perf::unbundle',
2594 formatteropts,
2595 b'BUNDLE_FILE',
2596 )
2597 def perf_unbundle(ui, repo, fname, **opts):
2598 """benchmark application of a bundle in a repository.
2599
2600 This does not include the final transaction processing"""
2601 from mercurial import exchange
2602 from mercurial import bundle2
2603
2604 with repo.lock():
2605 bundle = [None, None]
2606 try:
2607 with open(fname, mode="rb") as f:
2608
2609 def setup():
2610 gen, tr = bundle
2611 if tr is not None:
2612 tr.abort()
2613 bundle[:] = [None, None]
2614 f.seek(0)
2615 bundle[0] = exchange.readbundle(ui, f, fname)
2616 bundle[1] = repo.transaction(b'perf::unbundle')
2617
2618 def apply():
2619 gen, tr = bundle
2620 bundle2.applybundle(
2621 repo,
2622 gen,
2623 tr,
2624 source=b'perf::unbundle',
2625 url=fname,
2626 )
2627
2628 timer, fm = gettimer(ui, opts)
2629 timer(apply, setup=setup)
2630 fm.end()
2631 finally:
2632 gen, tr = bundle
2633 if tr is not None:
2634 tr.abort()
2635
2636
2637 @command(
2593 b'perf::unidiff|perfunidiff',
2638 b'perf::unidiff|perfunidiff',
2594 revlogopts
2639 revlogopts
2595 + formatteropts
2640 + formatteropts
@@ -188,6 +188,8 b' perfstatus'
188 perf::tags (no help text available)
188 perf::tags (no help text available)
189 perf::templating
189 perf::templating
190 test the rendering time of a given template
190 test the rendering time of a given template
191 perf::unbundle
192 benchmark application of a bundle in a repository.
191 perf::unidiff
193 perf::unidiff
192 benchmark a unified diff between revisions
194 benchmark a unified diff between revisions
193 perf::volatilesets
195 perf::volatilesets
@@ -387,6 +389,15 b' Test pre-run feature'
387 searching for changes
389 searching for changes
388 searching for changes
390 searching for changes
389 $ hg perf::bundle 'last(all(), 5)'
391 $ hg perf::bundle 'last(all(), 5)'
392 $ hg bundle --exact --rev 'last(all(), 5)' last-5.hg
393 4 changesets found
394 $ hg perf::unbundle last-5.hg
395 adding changesets
396 adding manifests
397 adding file changes
398 transaction abort!
399 rollback completed
400
390
401
391 test profile-benchmark option
402 test profile-benchmark option
392 ------------------------------
403 ------------------------------
General Comments 0
You need to be logged in to leave comments. Login now