--- a/tests/test-extension.t Sun May 04 21:33:14 2014 -0700
+++ b/tests/test-extension.t Sun May 04 22:48:07 2014 -0700
@@ -2,7 +2,10 @@
$ cat > foobar.py <<EOF
> import os
- > from mercurial import commands
+ > from mercurial import cmdutil, commands
+ >
+ > cmdtable = {}
+ > command = cmdutil.command(cmdtable)
>
> def uisetup(ui):
> ui.write("uisetup called\\n")
@@ -11,17 +14,14 @@
> ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
> ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
>
+ > @command('foo', [], 'hg foo')
> def foo(ui, *args, **kwargs):
> ui.write("Foo\\n")
>
+ > @command('bar', [], 'hg bar')
> def bar(ui, *args, **kwargs):
> ui.write("Bar\\n")
>
- > cmdtable = {
- > "foo": (foo, [], "hg foo"),
- > "bar": (bar, [], "hg bar"),
- > }
- >
> commands.norepo += ' bar'
> EOF
$ abspath=`pwd`/foobar.py
@@ -288,21 +288,22 @@
$ cat > debugextension.py <<EOF
> '''only debugcommands
> '''
+ > from mercurial import cmdutil
+ > cmdtable = {}
+ > command = cmdutil.command(cmdtable)
+ >
+ > @command('debugfoobar', [], 'hg debugfoobar')
> def debugfoobar(ui, repo, *args, **opts):
> "yet another debug command"
> pass
>
+ > @command('foo', [], 'hg foo')
> def foo(ui, repo, *args, **opts):
> """yet another foo command
>
> This command has been DEPRECATED since forever.
> """
> pass
- >
- > cmdtable = {
- > "debugfoobar": (debugfoobar, (), "hg debugfoobar"),
- > "foo": (foo, (), "hg foo")
- > }
> EOF
$ debugpath=`pwd`/debugextension.py
$ echo "debugextension = $debugpath" >> $HGRCPATH
@@ -475,15 +476,15 @@
Test help topic with same name as extension
$ cat > multirevs.py <<EOF
- > from mercurial import commands
+ > from mercurial import cmdutil, commands
+ > cmdtable = {}
+ > command = cmdutil.command(cmdtable)
> """multirevs extension
> Big multi-line module docstring."""
+ > @command('multirevs', [], 'ARG')
> def multirevs(ui, repo, arg, *args, **opts):
> """multirevs command"""
> pass
- > cmdtable = {
- > "multirevs": (multirevs, [], 'ARG')
- > }
> commands.norepo += ' multirevs'
> EOF
$ echo "multirevs = multirevs.py" >> $HGRCPATH
@@ -532,13 +533,15 @@
$ cat > debugissue811.py <<EOF
> '''show all loaded extensions
> '''
- > from mercurial import extensions, commands
+ > from mercurial import cmdutil, commands, extensions
+ > cmdtable = {}
+ > command = cmdutil.command(cmdtable)
>
+ > @command('debugextensions', [], 'hg debugextensions')
> def debugextensions(ui):
> "yet another debug command"
> ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
>
- > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")}
> commands.norepo += " debugextensions"
> EOF
$ echo "debugissue811 = $debugpath" >> $HGRCPATH