##// END OF EJS Templates
tests: define norepo in command decorator
Gregory Szorc -
r21773:26d2fb89 default
parent child Browse files
Show More
@@ -341,10 +341,9 b" if __name__ == '__main__':"
341 check(mqoutsidechanges)
341 check(mqoutsidechanges)
342 dbg = open('dbgui.py', 'w')
342 dbg = open('dbgui.py', 'w')
343 dbg.write('from mercurial import cmdutil, commands\n'
343 dbg.write('from mercurial import cmdutil, commands\n'
344 'commands.norepo += " debuggetpass"\n'
345 'cmdtable = {}\n'
344 'cmdtable = {}\n'
346 'command = cmdutil.command(cmdtable)\n'
345 'command = cmdutil.command(cmdtable)\n'
347 '@command("debuggetpass")\n'
346 '@command("debuggetpass", norepo=True)\n'
348 'def debuggetpass(ui):\n'
347 'def debuggetpass(ui):\n'
349 ' ui.write("%s\\n" % ui.getpass())\n')
348 ' ui.write("%s\\n" % ui.getpass())\n')
350 dbg.close()
349 dbg.close()
@@ -18,11 +18,10 b' Test basic extension support'
18 > def foo(ui, *args, **kwargs):
18 > def foo(ui, *args, **kwargs):
19 > ui.write("Foo\\n")
19 > ui.write("Foo\\n")
20 >
20 >
21 > @command('bar', [], 'hg bar')
21 > @command('bar', [], 'hg bar', norepo=True)
22 > def bar(ui, *args, **kwargs):
22 > def bar(ui, *args, **kwargs):
23 > ui.write("Bar\\n")
23 > ui.write("Bar\\n")
24 >
24 >
25 > commands.norepo += ' bar'
26 > EOF
25 > EOF
27 $ abspath=`pwd`/foobar.py
26 $ abspath=`pwd`/foobar.py
28
27
@@ -481,11 +480,10 b' Test help topic with same name as extens'
481 > command = cmdutil.command(cmdtable)
480 > command = cmdutil.command(cmdtable)
482 > """multirevs extension
481 > """multirevs extension
483 > Big multi-line module docstring."""
482 > Big multi-line module docstring."""
484 > @command('multirevs', [], 'ARG')
483 > @command('multirevs', [], 'ARG', norepo=True)
485 > def multirevs(ui, repo, arg, *args, **opts):
484 > def multirevs(ui, repo, arg, *args, **opts):
486 > """multirevs command"""
485 > """multirevs command"""
487 > pass
486 > pass
488 > commands.norepo += ' multirevs'
489 > EOF
487 > EOF
490 $ echo "multirevs = multirevs.py" >> $HGRCPATH
488 $ echo "multirevs = multirevs.py" >> $HGRCPATH
491
489
@@ -537,12 +535,11 b' Issue811: Problem loading extensions twi'
537 > cmdtable = {}
535 > cmdtable = {}
538 > command = cmdutil.command(cmdtable)
536 > command = cmdutil.command(cmdtable)
539 >
537 >
540 > @command('debugextensions', [], 'hg debugextensions')
538 > @command('debugextensions', [], 'hg debugextensions', norepo=True)
541 > def debugextensions(ui):
539 > def debugextensions(ui):
542 > "yet another debug command"
540 > "yet another debug command"
543 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
541 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
544 >
542 >
545 > commands.norepo += " debugextensions"
546 > EOF
543 > EOF
547 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
544 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
548 $ echo "mq=" >> $HGRCPATH
545 $ echo "mq=" >> $HGRCPATH
@@ -631,11 +628,10 b' Broken disabled extension and command:'
631 > command = cmdutil.command(cmdtable)
628 > command = cmdutil.command(cmdtable)
632 > class Bogon(Exception): pass
629 > class Bogon(Exception): pass
633 >
630 >
634 > @command('throw', [], 'hg throw')
631 > @command('throw', [], 'hg throw', norepo=True)
635 > def throw(ui, **opts):
632 > def throw(ui, **opts):
636 > """throws an exception"""
633 > """throws an exception"""
637 > raise Bogon()
634 > raise Bogon()
638 > commands.norepo += " throw"
639 > EOF
635 > EOF
640 No declared supported version, extension complains:
636 No declared supported version, extension complains:
641 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
637 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
@@ -639,12 +639,12 b' Test command without options'
639 > [('', 'longdesc', 3, 'x'*90),
639 > [('', 'longdesc', 3, 'x'*90),
640 > ('n', '', None, 'normal desc'),
640 > ('n', '', None, 'normal desc'),
641 > ('', 'newline', '', 'line1\nline2')],
641 > ('', 'newline', '', 'line1\nline2')],
642 > 'hg nohelp')
642 > 'hg nohelp',
643 > norepo=True)
643 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
644 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
644 > def nohelp(ui, *args, **kwargs):
645 > def nohelp(ui, *args, **kwargs):
645 > pass
646 > pass
646 >
647 >
647 > commands.norepo += ' nohelp'
648 > EOF
648 > EOF
649 $ echo '[extensions]' >> $HGRCPATH
649 $ echo '[extensions]' >> $HGRCPATH
650 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
650 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
@@ -18,7 +18,8 b''
18 > [('', 'total', '', 'override for total'),
18 > [('', 'total', '', 'override for total'),
19 > ('', 'nested', False, 'show nested results'),
19 > ('', 'nested', False, 'show nested results'),
20 > ('', 'parallel', False, 'show parallel sets of results')],
20 > ('', 'parallel', False, 'show parallel sets of results')],
21 > 'hg loop LOOPS')
21 > 'hg loop LOOPS',
22 > norepo=True)
22 > def loop(ui, loops, **opts):
23 > def loop(ui, loops, **opts):
23 > loops = int(loops)
24 > loops = int(loops)
24 > total = None
25 > total = None
@@ -46,7 +47,6 b''
46 > 'nested', None, 'nested.done', 'nestnum', nested_steps)
47 > 'nested', None, 'nested.done', 'nestnum', nested_steps)
47 > ui.progress('loop', None, 'loop.done', 'loopnum', total)
48 > ui.progress('loop', None, 'loop.done', 'loopnum', total)
48 >
49 >
49 > commands.norepo += " loop"
50 > EOF
50 > EOF
51
51
52 $ cp $HGRCPATH $HGRCPATH.orig
52 $ cp $HGRCPATH $HGRCPATH.orig
General Comments 0
You need to be logged in to leave comments. Login now