Mercurial > hg
changeset 27492:ac549d7fbc2b
perf: use standard arguments for perfrevlog
We have a convention of using -c|-m|FILE elsewhere for reading from
revlogs. Use it for `hg perfrevlog`.
While I was here, I also added a docstring to document what this
command does, as "perfrevlog" is ambiguous.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Dec 2015 19:45:55 -0800 |
parents | 28c1aa12f5de |
children | 14b0930105da |
files | contrib/perf.py tests/test-contrib-perf.t |
diffstat | 2 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Fri Dec 18 09:47:21 2015 +0000 +++ b/contrib/perf.py Sun Dec 20 19:45:55 2015 -0800 @@ -474,16 +474,20 @@ timer(d, title) fm.end() -@command('perfrevlog', - [('d', 'dist', 100, 'distance between the revisions')] + formatteropts, - "[INDEXFILE]") -def perfrevlog(ui, repo, file_, **opts): +@command('perfrevlog', revlogopts + formatteropts + + [('d', 'dist', 100, 'distance between the revisions')], + '-c|-m|FILE') +def perfrevlog(ui, repo, file_=None, **opts): + """Benchmark reading a series of revisions from a revlog. + + By default, we read every ``-d/--dist`` revision from 0 to tip of + the specified revlog. + """ timer, fm = gettimer(ui, opts) - from mercurial import revlog dist = opts['dist'] _len = getlen(ui) def d(): - r = revlog.revlog(lambda fn: open(fn, 'rb'), file_) + r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts) for x in xrange(0, _len(r), dist): r.revision(r.node(x))
--- a/tests/test-contrib-perf.t Fri Dec 18 09:47:21 2015 +0000 +++ b/tests/test-contrib-perf.t Sun Dec 20 19:45:55 2015 -0800 @@ -90,7 +90,7 @@ perfpathcopies (no help text available) perfrawfiles (no help text available) - perfrevlog (no help text available) + perfrevlog Benchmark reading a series of revisions from a revlog. perfrevlogrevision Benchmark obtaining a revlog revision. perfrevrange (no help text available)