##// END OF EJS Templates
perf-bundle: add a new command to benchmark bundle creation time
marmoute -
r50306:b081a5aa default
parent child Browse files
Show More
@@ -974,6 +974,56 b' def perfbookmarks(ui, repo, **opts):'
974 fm.end()
974 fm.end()
975
975
976
976
977 @command(b'perf::bundle', formatteropts, b'REVS')
978 def perfbundle(ui, repo, *revs, **opts):
979 """benchmark the creation of a bundle from a repository
980
981 For now, this create a `none-v1` bundle.
982 """
983 from mercurial import bundlecaches
984 from mercurial import discovery
985 from mercurial import bundle2
986
987 opts = _byteskwargs(opts)
988 timer, fm = gettimer(ui, opts)
989
990 cl = repo.changelog
991 revs = scmutil.revrange(repo, revs)
992 if not revs:
993 raise error.Abort(b"not revision specified")
994 # make it a consistent set (ie: without topological gaps)
995 old_len = len(revs)
996 revs = list(repo.revs(b"%ld::%ld", revs, revs))
997 if old_len != len(revs):
998 new_count = len(revs) - old_len
999 msg = b"add %d new revisions to make it a consistent set\n"
1000 ui.write_err(msg % new_count)
1001
1002 targets = [cl.node(r) for r in repo.revs(b"heads(::%ld)", revs)]
1003 bases = [cl.node(r) for r in repo.revs(b"heads(::%ld - %ld)", revs, revs)]
1004 outgoing = discovery.outgoing(repo, bases, targets)
1005
1006 bundlespec = bundlecaches.parsebundlespec(
1007 repo, b"none", strict=False
1008 )
1009
1010 bversion = b'HG10' + bundlespec.wirecompression
1011
1012 def do_bundle():
1013 bundle2.writenewbundle(
1014 ui,
1015 repo,
1016 b'perf::bundle',
1017 os.devnull,
1018 bversion,
1019 outgoing,
1020 {},
1021 )
1022
1023 timer(do_bundle)
1024 fm.end()
1025
1026
977 @command(b'perf::bundleread|perfbundleread', formatteropts, b'BUNDLE')
1027 @command(b'perf::bundleread|perfbundleread', formatteropts, b'BUNDLE')
978 def perfbundleread(ui, repo, bundlepath, **opts):
1028 def perfbundleread(ui, repo, bundlepath, **opts):
979 """Benchmark reading of bundle files.
1029 """Benchmark reading of bundle files.
@@ -96,6 +96,7 b' perfstatus'
96 perf::branchmapupdate
96 perf::branchmapupdate
97 benchmark branchmap update from for <base> revs to <target>
97 benchmark branchmap update from for <base> revs to <target>
98 revs
98 revs
99 perf::bundle benchmark the creation of a bundle from a repository
99 perf::bundleread
100 perf::bundleread
100 Benchmark reading of bundle files.
101 Benchmark reading of bundle files.
101 perf::cca (no help text available)
102 perf::cca (no help text available)
@@ -385,6 +386,7 b' Test pre-run feature'
385 searching for changes
386 searching for changes
386 searching for changes
387 searching for changes
387 searching for changes
388 searching for changes
389 $ hg perf::bundle 'last(all(), 5)'
388
390
389 test profile-benchmark option
391 test profile-benchmark option
390 ------------------------------
392 ------------------------------
General Comments 0
You need to be logged in to leave comments. Login now