277 for rev in revs: |
278 for rev in revs: |
278 rev in s |
279 rev in s |
279 timer(d) |
280 timer(d) |
280 fm.end() |
281 fm.end() |
281 |
282 |
|
283 @command('perfchangegroupchangelog', formatteropts + |
|
284 [('', 'version', '02', 'changegroup version'), |
|
285 ('r', 'rev', '', 'revisions to add to changegroup')]) |
|
286 def perfchangegroupchangelog(ui, repo, version='02', rev=None, **opts): |
|
287 """Benchmark producing a changelog group for a changegroup. |
|
288 |
|
289 This measures the time spent processing the changelog during a |
|
290 bundle operation. This occurs during `hg bundle` and on a server |
|
291 processing a `getbundle` wire protocol request (handles clones |
|
292 and pull requests). |
|
293 |
|
294 By default, all revisions are added to the changegroup. |
|
295 """ |
|
296 cl = repo.changelog |
|
297 revs = [cl.lookup(r) for r in repo.revs(rev or 'all()')] |
|
298 bundler = changegroup.getbundler(version, repo) |
|
299 |
|
300 def lookup(node): |
|
301 # The real bundler reads the revision in order to access the |
|
302 # manifest node and files list. Do that here. |
|
303 cl.read(node) |
|
304 return node |
|
305 |
|
306 def d(): |
|
307 for chunk in bundler.group(revs, cl, lookup): |
|
308 pass |
|
309 |
|
310 timer, fm = gettimer(ui, opts) |
|
311 timer(d) |
|
312 fm.end() |
|
313 |
282 @command('perfdirs', formatteropts) |
314 @command('perfdirs', formatteropts) |
283 def perfdirs(ui, repo, **opts): |
315 def perfdirs(ui, repo, **opts): |
284 timer, fm = gettimer(ui, opts) |
316 timer, fm = gettimer(ui, opts) |
285 dirstate = repo.dirstate |
317 dirstate = repo.dirstate |
286 'a' in dirstate |
318 'a' in dirstate |