Show More
@@ -2282,6 +2282,61 b' def perfbranchmap(ui, repo, *filternames' | |||
|
2282 | 2282 | branchcachewrite.restore() |
|
2283 | 2283 | fm.end() |
|
2284 | 2284 | |
|
2285 | @command(b'perfbranchmapupdate', [ | |
|
2286 | (b'', b'base', [], b'subset of revision to start from'), | |
|
2287 | (b'', b'target', [], b'subset of revision to end with'), | |
|
2288 | ] + formatteropts) | |
|
2289 | def perfbranchmapupdate(ui, repo, base=(), target=(), **opts): | |
|
2290 | """benchmark branchmap update from for <base> revs to <target> revs | |
|
2291 | ||
|
2292 | Examples: | |
|
2293 | ||
|
2294 | # update for the one last revision | |
|
2295 | $ hg perfbranchmapupdate --base 'not tip' --target 'tip' | |
|
2296 | ||
|
2297 | $ update for change coming with a new branch | |
|
2298 | $ hg perfbranchmapupdate --base 'stable' --target 'default' | |
|
2299 | """ | |
|
2300 | from mercurial import branchmap | |
|
2301 | opts = _byteskwargs(opts) | |
|
2302 | timer, fm = gettimer(ui, opts) | |
|
2303 | x = [None] # used to pass data between closure | |
|
2304 | ||
|
2305 | # we use a `list` here to avoid possible side effect from smartset | |
|
2306 | baserevs = list(scmutil.revrange(repo, base)) | |
|
2307 | targetrevs = list(scmutil.revrange(repo, target)) | |
|
2308 | if not baserevs: | |
|
2309 | raise error.Abort(b'no revisions selected for --base') | |
|
2310 | if not targetrevs: | |
|
2311 | raise error.Abort(b'no revisions selected for --target') | |
|
2312 | ||
|
2313 | # make sure the target branchmap also contains the one in the base | |
|
2314 | targetrevs = list(set(baserevs) | set(targetrevs)) | |
|
2315 | targetrevs.sort() | |
|
2316 | ||
|
2317 | cl = repo.changelog | |
|
2318 | allbaserevs = list(cl.ancestors(baserevs, inclusive=True)) | |
|
2319 | allbaserevs.sort() | |
|
2320 | alltargetrevs = frozenset(cl.ancestors(targetrevs, inclusive=True)) | |
|
2321 | ||
|
2322 | newrevs = list(alltargetrevs.difference(allbaserevs)) | |
|
2323 | newrevs.sort() | |
|
2324 | ||
|
2325 | msg = b'benchmark of branchmap with %d revisions with %d new ones\n' | |
|
2326 | ui.status(msg % (len(allbaserevs), len(newrevs))) | |
|
2327 | ||
|
2328 | base = branchmap.branchcache() | |
|
2329 | base.update(repo, allbaserevs) | |
|
2330 | ||
|
2331 | def setup(): | |
|
2332 | x[0] = base.copy() | |
|
2333 | ||
|
2334 | def bench(): | |
|
2335 | x[0].update(repo, newrevs) | |
|
2336 | ||
|
2337 | timer(bench, setup=setup) | |
|
2338 | fm.end() | |
|
2339 | ||
|
2285 | 2340 | @command(b'perfbranchmapload', [ |
|
2286 | 2341 | (b'f', b'filter', b'', b'Specify repoview filter'), |
|
2287 | 2342 | (b'', b'list', False, b'List brachmap filter caches'), |
@@ -57,6 +57,9 b' perfstatus' | |||
|
57 | 57 | benchmark the update of a branchmap |
|
58 | 58 | perfbranchmapload |
|
59 | 59 | benchmark reading the branchmap |
|
60 | perfbranchmapupdate | |
|
61 | benchmark branchmap update from for <base> revs to <target> | |
|
62 | revs | |
|
60 | 63 | perfbundleread |
|
61 | 64 | Benchmark reading of bundle files. |
|
62 | 65 | perfcca (no help text available) |
@@ -145,6 +148,8 b' perfstatus' | |||
|
145 | 148 | $ hg perfbookmarks |
|
146 | 149 | $ hg perfbranchmap |
|
147 | 150 | $ hg perfbranchmapload |
|
151 | $ hg perfbranchmapupdate --base "not tip" --target "tip" | |
|
152 | benchmark of branchmap with 3 revisions with 1 new ones | |
|
148 | 153 | $ hg perfcca |
|
149 | 154 | $ hg perfchangegroupchangelog |
|
150 | 155 | $ hg perfchangegroupchangelog --cgversion 01 |
General Comments 0
You need to be logged in to leave comments.
Login now