Mercurial > public > mercurial-scm > hg-stable
diff tests/test-progress.t @ 21254:51e5c793a9f4
tests: declare commands using decorator
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 04 May 2014 22:48:07 -0700 |
parents | 4694ccd5d994 |
children | 26d2fb899637 |
line wrap: on
line diff
--- a/tests/test-progress.t Sun May 04 21:33:14 2014 -0700 +++ b/tests/test-progress.t Sun May 04 22:48:07 2014 -0700 @@ -1,7 +1,11 @@ $ cat > loop.py <<EOF - > from mercurial import commands + > from mercurial import cmdutil, commands > import time + > + > cmdtable = {} + > command = cmdutil.command(cmdtable) + > > class incrementingtime(object): > def __init__(self): > self._time = 0.0 @@ -10,6 +14,11 @@ > return self._time > time.time = incrementingtime() > + > @command('loop', + > [('', 'total', '', 'override for total'), + > ('', 'nested', False, 'show nested results'), + > ('', 'parallel', False, 'show parallel sets of results')], + > 'hg loop LOOPS') > def loop(ui, loops, **opts): > loops = int(loops) > total = None @@ -38,14 +47,6 @@ > ui.progress('loop', None, 'loop.done', 'loopnum', total) > > commands.norepo += " loop" - > - > cmdtable = { - > "loop": (loop, [('', 'total', '', 'override for total'), - > ('', 'nested', False, 'show nested results'), - > ('', 'parallel', False, 'show parallel sets of results'), - > ], - > 'hg loop LOOPS'), - > } > EOF $ cp $HGRCPATH $HGRCPATH.orig