mirror of
https://github.com/facebook/sapling.git
synced 2024-12-27 15:11:54 +03:00
tests: @command expects str command names
Summary: This change all the tests to use strings as the command names. Reviewed By: simpkins Differential Revision: D19649479 fbshipit-source-id: 4b2cb9b3af73a7508ef359ee3c407d04a39c7893
This commit is contained in:
parent
96f5dc6652
commit
cb64df7197
@ -20,7 +20,7 @@ cmdtable = {}
|
||||
command = registrar.command(cmdtable)
|
||||
|
||||
|
||||
@command(b"debugbruterebase")
|
||||
@command("debugbruterebase")
|
||||
def debugbruterebase(ui, repo, source, dest):
|
||||
"""for every non-empty subset of source, run rebase -r subset -d dest
|
||||
|
||||
|
@ -7,7 +7,7 @@ Setup:
|
||||
> from edenscm.mercurial import commands, context, registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'eval', [], 'hg eval CMD')
|
||||
> @command('eval', [], 'hg eval CMD')
|
||||
> def eval_(ui, repo, *cmds, **opts):
|
||||
> cmd = " ".join(cmds)
|
||||
> res = str(eval(cmd, globals(), locals()))
|
||||
|
@ -64,7 +64,7 @@ names of extensions failed to load can be accessed via extensions.notloaded()
|
||||
> from edenscm.mercurial import commands, extensions, registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'showbadexts', norepo=True)
|
||||
> @command('showbadexts', norepo=True)
|
||||
> def showbadexts(ui, *pats, **opts):
|
||||
> ui.write('BADEXTS: %s\n' % ' '.join(sorted(extensions.notloaded())))
|
||||
> EOF
|
||||
|
@ -75,7 +75,7 @@ Create an extension to test bundle2 API
|
||||
> for val in op.reply.capabilities[cap]:
|
||||
> op.ui.write(b"debugreply: '%s'\n" % val)
|
||||
>
|
||||
> @command(b'bundle2',
|
||||
> @command('bundle2',
|
||||
> [(b'', b'param', [], b'stream level parameter'),
|
||||
> (b'', b'unknown', False, b'include an unknown mandatory part in the bundle'),
|
||||
> (b'', b'unknownparams', False, b'include an unknown part parameters in the bundle'),
|
||||
@ -170,7 +170,7 @@ Create an extension to test bundle2 API
|
||||
> finally:
|
||||
> file.flush()
|
||||
>
|
||||
> @command(b'unbundle2', [], b'')
|
||||
> @command('unbundle2', [], b'')
|
||||
> def cmdunbundle2(ui, repo, replypath=None):
|
||||
> """process a bundle2 stream from stdin on the current repo"""
|
||||
> try:
|
||||
@ -201,7 +201,7 @@ Create an extension to test bundle2 API
|
||||
> for chunk in op.reply.getchunks():
|
||||
> file.write(chunk)
|
||||
>
|
||||
> @command(b'statbundle2', [], b'')
|
||||
> @command('statbundle2', [], b'')
|
||||
> def cmdstatbundle2(ui, repo):
|
||||
> """print statistic on the bundle2 container read from stdin"""
|
||||
> unbundler = bundle2.getunbundler(ui, pycompat.stdin)
|
||||
|
@ -108,7 +108,7 @@ chg waits for pager if runcommand raises
|
||||
> from edenscm.mercurial import registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'crash')
|
||||
> @command('crash')
|
||||
> def pagercrash(ui, repo, *pats, **opts):
|
||||
> ui.write('going to crash\n')
|
||||
> raise Exception('.')
|
||||
|
@ -8,20 +8,20 @@
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
>
|
||||
> @command(b'buggylocking', [], '')
|
||||
> @command('buggylocking', [], '')
|
||||
> def buggylocking(ui, repo):
|
||||
> lo = repo.lock()
|
||||
> wl = repo.wlock()
|
||||
> wl.release()
|
||||
> lo.release()
|
||||
>
|
||||
> @command(b'buggytransaction', [], '')
|
||||
> @command('buggytransaction', [], '')
|
||||
> def buggylocking(ui, repo):
|
||||
> tr = repo.transaction('buggy')
|
||||
> # make sure we rollback the transaction as we don't want to rely on the__del__
|
||||
> tr.release()
|
||||
>
|
||||
> @command(b'properlocking', [], '')
|
||||
> @command('properlocking', [], '')
|
||||
> def properlocking(ui, repo):
|
||||
> """check that reentrance is fine"""
|
||||
> wl = repo.wlock()
|
||||
@ -37,24 +37,24 @@
|
||||
> lo.release()
|
||||
> wl.release()
|
||||
>
|
||||
> @command(b'nowaitlocking', [], '')
|
||||
> @command('nowaitlocking', [], '')
|
||||
> def nowaitlocking(ui, repo):
|
||||
> lo = repo.lock()
|
||||
> wl = repo.wlock(wait=False)
|
||||
> wl.release()
|
||||
> lo.release()
|
||||
>
|
||||
> @command(b'no-wlock-write', [], '')
|
||||
> @command('no-wlock-write', [], '')
|
||||
> def nowlockwrite(ui, repo):
|
||||
> with repo.vfs(b'branch', 'a'):
|
||||
> pass
|
||||
>
|
||||
> @command(b'no-lock-write', [], '')
|
||||
> @command('no-lock-write', [], '')
|
||||
> def nolockwrite(ui, repo):
|
||||
> with repo.svfs(b'fncache', 'a'):
|
||||
> pass
|
||||
>
|
||||
> @command(b'stripintr', [], '')
|
||||
> @command('stripintr', [], '')
|
||||
> def stripintr(ui, repo):
|
||||
> lo = repo.lock()
|
||||
> tr = repo.transaction('foobar')
|
||||
@ -62,16 +62,16 @@
|
||||
> repair.strip(repo.ui, repo, [repo['.'].node()])
|
||||
> finally:
|
||||
> lo.release()
|
||||
> @command(b'oldanddeprecated', [], '')
|
||||
> @command('oldanddeprecated', [], '')
|
||||
> def oldanddeprecated(ui, repo):
|
||||
> """test deprecation warning API"""
|
||||
> def foobar(ui):
|
||||
> ui.deprecwarn('foorbar is deprecated, go shopping', '42.1337')
|
||||
> foobar(ui)
|
||||
> @command(b'nouiwarning', [], '')
|
||||
> @command('nouiwarning', [], '')
|
||||
> def nouiwarning(ui, repo):
|
||||
> util.nouideprecwarn('this is a test', '13.37')
|
||||
> @command(b'programmingerror', [], '')
|
||||
> @command('programmingerror', [], '')
|
||||
> def programmingerror(ui, repo):
|
||||
> raise error.ProgrammingError('something went wrong', hint='try again')
|
||||
> EOF
|
||||
@ -181,7 +181,7 @@ Test warning on config option access and registration
|
||||
> configitem('ui', 'quiet', default=False)
|
||||
> configitem('ui', 'interactive', default=None)
|
||||
>
|
||||
> @command(b'buggyconfig')
|
||||
> @command('buggyconfig')
|
||||
> def cmdbuggyconfig(ui, repo):
|
||||
> repo.ui.config('ui', 'quiet', True)
|
||||
> repo.ui.config('ui', 'interactive', False)
|
||||
|
@ -22,7 +22,7 @@ Test alignment of multibyte characters
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
>
|
||||
> @command(b'showoptlist',
|
||||
> @command('showoptlist',
|
||||
> [('s', 'opt1', '', 'short width' + ' %(s)s' * 8, '%(s)s'),
|
||||
> ('m', 'opt2', '', 'middle width' + ' %(m)s' * 8, '%(m)s'),
|
||||
> ('l', 'opt3', '', 'long width' + ' %(l)s' * 8, '%(l)s')],
|
||||
|
@ -12,7 +12,7 @@ define commands to display help text
|
||||
> command = registrar.command(cmdtable)
|
||||
>
|
||||
> # Japanese full-width characters:
|
||||
> @command(b'show_full_ja', [], '')
|
||||
> @command('show_full_ja', [], '')
|
||||
> def show_full_ja(ui, **opts):
|
||||
> u'''\u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051 \u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051 \u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051
|
||||
>
|
||||
@ -22,7 +22,7 @@ define commands to display help text
|
||||
> '''
|
||||
>
|
||||
> # Japanese half-width characters:
|
||||
> @command(b'show_half_ja', [], '')
|
||||
> @command('show_half_ja', [], '')
|
||||
> def show_half_ja(ui, *opts):
|
||||
> u'''\uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79
|
||||
>
|
||||
@ -32,7 +32,7 @@ define commands to display help text
|
||||
> '''
|
||||
>
|
||||
> # Japanese ambiguous-width characters:
|
||||
> @command(b'show_ambig_ja', [], '')
|
||||
> @command('show_ambig_ja', [], '')
|
||||
> def show_ambig_ja(ui, **opts):
|
||||
> u'''\u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb \u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb \u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb
|
||||
>
|
||||
@ -42,7 +42,7 @@ define commands to display help text
|
||||
> '''
|
||||
>
|
||||
> # Russian ambiguous-width characters:
|
||||
> @command(b'show_ambig_ru', [], '')
|
||||
> @command('show_ambig_ru', [], '')
|
||||
> def show_ambig_ru(ui, **opts):
|
||||
> u'''\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438
|
||||
>
|
||||
|
@ -18,12 +18,12 @@ Test basic extension support
|
||||
> ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
|
||||
> ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
|
||||
> ui.flush()
|
||||
> @command(b'foo', [], 'hg foo')
|
||||
> @command('foo', [], 'hg foo')
|
||||
> def foo(ui, *args, **kwargs):
|
||||
> foo = ui.config('tests', 'foo')
|
||||
> ui.write(foo)
|
||||
> ui.write("\\n")
|
||||
> @command(b'bar', [], 'hg bar', norepo=True)
|
||||
> @command('bar', [], 'hg bar', norepo=True)
|
||||
> def bar(ui, *args, **kwargs):
|
||||
> ui.write("Bar\\n")
|
||||
> EOF
|
||||
@ -405,12 +405,12 @@ Setup main procedure of extension.
|
||||
> # preceding import (= instantiate "demandmod" object instead of
|
||||
> # real "module" object) might hide problem of succeeding import.
|
||||
>
|
||||
> @command(b'showabsolute', [], norepo=True)
|
||||
> @command('showabsolute', [], norepo=True)
|
||||
> def showabsolute(ui, *args, **opts):
|
||||
> from absextroot import absolute
|
||||
> ui.write('ABS: %s\n' % '\nABS: '.join(absolute.getresult()))
|
||||
>
|
||||
> @command(b'showrelative', [], norepo=True)
|
||||
> @command('showrelative', [], norepo=True)
|
||||
> def showrelative(ui, *args, **opts):
|
||||
> from . import relative
|
||||
> ui.write('REL: %s\n' % '\nREL: '.join(relative.getresult()))
|
||||
@ -471,7 +471,7 @@ See also issue5208 for detail about example case on Python 3.x.
|
||||
> # demand import avoids failure of importing notexist here
|
||||
> import extlibroot.lsub1.lsub2.notexist
|
||||
>
|
||||
> @command(b'checkrelativity', [], norepo=True)
|
||||
> @command('checkrelativity', [], norepo=True)
|
||||
> def checkrelativity(ui, *args, **opts):
|
||||
> try:
|
||||
> ui.write(extlibroot.lsub1.lsub2.notexist.text)
|
||||
@ -532,11 +532,11 @@ hide outer repo
|
||||
> from edenscm.mercurial import registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'debugfoobar', [], 'hg debugfoobar')
|
||||
> @command('debugfoobar', [], 'hg debugfoobar')
|
||||
> def debugfoobar(ui, repo, *args, **opts):
|
||||
> "yet another debug command"
|
||||
> pass
|
||||
> @command(b'foo', [], 'hg foo')
|
||||
> @command('foo', [], 'hg foo')
|
||||
> def foo(ui, repo, *args, **opts):
|
||||
> """yet another foo command
|
||||
> This command has been DEPRECATED since forever.
|
||||
@ -708,7 +708,7 @@ Test help topic with same name as extension
|
||||
> command = registrar.command(cmdtable)
|
||||
> """multirevs extension
|
||||
> Big multi-line module docstring."""
|
||||
> @command(b'multirevs', [], 'ARG', norepo=True)
|
||||
> @command('multirevs', [], 'ARG', norepo=True)
|
||||
> def multirevs(ui, repo, arg, *args, **opts):
|
||||
> """multirevs command"""
|
||||
> pass
|
||||
@ -763,11 +763,11 @@ along with extension help itself
|
||||
> from edenscm.mercurial import commands, registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'dodo', [], 'hg dodo')
|
||||
> @command('dodo', [], 'hg dodo')
|
||||
> def dodo(ui, *args, **kwargs):
|
||||
> """Does nothing"""
|
||||
> ui.write("I do nothing. Yay\\n")
|
||||
> @command(b'foofoo', [], 'hg foofoo')
|
||||
> @command('foofoo', [], 'hg foofoo')
|
||||
> def foofoo(ui, *args, **kwargs):
|
||||
> """Writes 'Foo foo'"""
|
||||
> ui.write("Foo foo\\n")
|
||||
@ -844,11 +844,11 @@ along with extension help
|
||||
> from edenscm.mercurial import commands, registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'something', [], 'hg something')
|
||||
> @command('something', [], 'hg something')
|
||||
> def something(ui, *args, **kwargs):
|
||||
> """Does something"""
|
||||
> ui.write("I do something. Yaaay\\n")
|
||||
> @command(b'beep', [], 'hg beep')
|
||||
> @command('beep', [], 'hg beep')
|
||||
> def beep(ui, *args, **kwargs):
|
||||
> """Writes 'Beep beep'"""
|
||||
> ui.write("Beep beep\\n")
|
||||
@ -944,7 +944,7 @@ get scanned)
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> class Bogon(Exception): pass
|
||||
> @command(b'throw', [], 'hg throw', norepo=True)
|
||||
> @command('throw', [], 'hg throw', norepo=True)
|
||||
> def throw(ui, **opts):
|
||||
> """throws an exception"""
|
||||
> raise Bogon()
|
||||
@ -1312,7 +1312,7 @@ Show deprecation warning for the use of cmdutil.command
|
||||
> from edenscm.mercurial import cmdutil
|
||||
> cmdtable = {}
|
||||
> command = cmdutil.command(cmdtable)
|
||||
> @command(b'foo', [], norepo=True)
|
||||
> @command('foo', [], norepo=True)
|
||||
> def foo(ui):
|
||||
> pass
|
||||
> EOF
|
||||
|
@ -778,15 +778,15 @@ this is a section and erroring out weirdly.
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
>
|
||||
> @command(b'nohelp',
|
||||
> @command('nohelp',
|
||||
> [(b'', b'longdesc', 3, b'x'*90),
|
||||
> (b'n', b'', None, b'normal desc'),
|
||||
> (b'', b'newline', b'', b'line1\nline2')],
|
||||
> b'hg nohelp',
|
||||
> norepo=True)
|
||||
> @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
|
||||
> @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
|
||||
> @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
|
||||
> @command('debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
|
||||
> @command('debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
|
||||
> @command('debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
|
||||
> def nohelp(ui, *args, **kwargs):
|
||||
> pass
|
||||
>
|
||||
|
@ -29,7 +29,7 @@ Test that raising an exception in the release function doesn't cause the lock to
|
||||
> l = repo._lock(repo.localvfs, 'testlock', False, unlock, None, 'test lock')
|
||||
> return l
|
||||
>
|
||||
> @command(b'testlockexc')
|
||||
> @command('testlockexc')
|
||||
> def testlockexc(ui, repo):
|
||||
> testlock = acquiretestlock(repo, True)
|
||||
> try:
|
||||
|
@ -29,7 +29,7 @@ duplicating obsmarkers.
|
||||
> from edenscm.mercurial import obsolete, registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'debugdupobsmarkers')
|
||||
> @command('debugdupobsmarkers')
|
||||
> def debugdupobsmarkers(ui, repo, **opts):
|
||||
> newmarkers = []
|
||||
> for marker in repo.obsstore._all:
|
||||
|
@ -241,7 +241,7 @@ Pager should not override the exit code of other commands
|
||||
> from edenscm.mercurial import commands, registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'fortytwo', [], 'fortytwo', norepo=True)
|
||||
> @command('fortytwo', [], 'fortytwo', norepo=True)
|
||||
> def fortytwo(ui, *opts):
|
||||
> ui.write('42\n')
|
||||
> return 42
|
||||
|
@ -5,7 +5,7 @@
|
||||
> from edenscm.mercurial import registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'debugadddrop',
|
||||
> @command('debugadddrop',
|
||||
> [('', 'drop', False, 'drop file from dirstate', 'FILE'),
|
||||
> ('', 'normal-lookup', False, 'add file to dirstate', 'FILE')],
|
||||
> 'hg debugadddrop')
|
||||
|
@ -107,7 +107,7 @@ don't allow marking or unmarking driver-resolved files
|
||||
> from edenscm.mercurial import merge, registrar, scmutil
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'markdriver',
|
||||
> @command('markdriver',
|
||||
> [('u', 'unmark', None, '')],
|
||||
> 'FILE...')
|
||||
> def markdriver(ui, repo, *pats, **opts):
|
||||
|
@ -7,6 +7,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from testutil.dott import feature, sh, shlib, testtmp # noqa: F401
|
||||
|
||||
|
||||
@ -95,7 +96,7 @@ from edenscm.mercurial import (
|
||||
)
|
||||
cmdtable = {}
|
||||
command = registrar.command(cmdtable)
|
||||
@command(b'debugrevlistspec',
|
||||
@command('debugrevlistspec',
|
||||
[('', 'optimize', None, 'print parsed tree after optimizing'),
|
||||
('', 'bin', None, 'unhexlify arguments')])
|
||||
def debugrevlistspec(ui, repo, fmt, *args, **opts):
|
||||
|
@ -64,7 +64,7 @@ these predicates use '\0' as a separator:
|
||||
> )
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'debugrevlistspec',
|
||||
> @command('debugrevlistspec',
|
||||
> [('', 'optimize', None, 'print parsed tree after optimizing'),
|
||||
> ('', 'bin', None, 'unhexlify arguments')])
|
||||
> def debugrevlistspec(ui, repo, fmt, *args, **opts):
|
||||
|
@ -4,30 +4,30 @@
|
||||
> from edenscm.mercurial import registrar
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'test', [], 'hg test SUBCOMMAND', subonly=True)
|
||||
> @command('test', [], 'hg test SUBCOMMAND', subonly=True)
|
||||
> def test(ui, repo):
|
||||
> """test command"""
|
||||
> ui.status("test command called (should not happen)\n")
|
||||
> subcmd = test.subcommand(categories=[("First Category", ["one"])])
|
||||
> @subcmd(b'one', [])
|
||||
> @subcmd('one', [])
|
||||
> def testone(ui, repo):
|
||||
> """first test subcommand"""
|
||||
> ui.status("test subcommand one called\n")
|
||||
> @subcmd(b'two', [])
|
||||
> @subcmd('two', [])
|
||||
> def testone(ui, repo):
|
||||
> """second test subcommand"""
|
||||
> ui.status("test subcommand two called\n")
|
||||
> @command(b'othertest', [], 'hg othertest [SUBCOMMAND]')
|
||||
> @command('othertest', [], 'hg othertest [SUBCOMMAND]')
|
||||
> def othertest(ui, repo, parameter):
|
||||
> """other test command"""
|
||||
> ui.status("other test command called with '%s'\n" % parameter)
|
||||
> othersubcmd = othertest.subcommand()
|
||||
> @othersubcmd(b'alpha|alfa', [])
|
||||
> @othersubcmd('alpha|alfa', [])
|
||||
> def othertestalpha(ui, repo, parameter):
|
||||
> """other test subcommand alpha"""
|
||||
> ui.status("other test command alpha called with '%s'\n" % parameter)
|
||||
> nestedsubcmd = othertestalpha.subcommand()
|
||||
> @nestedsubcmd(b'beta', [])
|
||||
> @nestedsubcmd('beta', [])
|
||||
> def othertestalphabeta(ui, repo):
|
||||
> """other test subcommand alpha subcommand beta"""
|
||||
> ui.status("other test command alpha/beta called\n")
|
||||
|
@ -33,7 +33,7 @@ Test UI worker interaction
|
||||
> }
|
||||
> cmdtable = {}
|
||||
> command = registrar.command(cmdtable)
|
||||
> @command(b'test', [], 'hg test [COST] [FUNC]')
|
||||
> @command('test', [], 'hg test [COST] [FUNC]')
|
||||
> def t(ui, repo, cost=1.0, func='runme'):
|
||||
> cost = float(cost)
|
||||
> func = functable[func]
|
||||
|
Loading…
Reference in New Issue
Block a user