3 $ cat > foobar.py <<EOF |
3 $ cat > foobar.py <<EOF |
4 > import os |
4 > import os |
5 > from mercurial import commands, registrar |
5 > from mercurial import commands, registrar |
6 > cmdtable = {} |
6 > cmdtable = {} |
7 > command = registrar.command(cmdtable) |
7 > command = registrar.command(cmdtable) |
|
8 > configtable = {} |
|
9 > configitem = registrar.configitem(configtable) |
|
10 > configitem('tests', 'foo', default="Foo") |
8 > def uisetup(ui): |
11 > def uisetup(ui): |
9 > ui.write("uisetup called\\n") |
12 > ui.write("uisetup called\\n") |
10 > ui.flush() |
13 > ui.flush() |
11 > def reposetup(ui, repo): |
14 > def reposetup(ui, repo): |
12 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
15 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
13 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) |
16 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) |
14 > ui.flush() |
17 > ui.flush() |
15 > @command(b'foo', [], 'hg foo') |
18 > @command(b'foo', [], 'hg foo') |
16 > def foo(ui, *args, **kwargs): |
19 > def foo(ui, *args, **kwargs): |
17 > ui.write("Foo\\n") |
20 > foo = ui.config('tests', 'foo') |
|
21 > ui.write(foo) |
|
22 > ui.write("\\n") |
18 > @command(b'bar', [], 'hg bar', norepo=True) |
23 > @command(b'bar', [], 'hg bar', norepo=True) |
19 > def bar(ui, *args, **kwargs): |
24 > def bar(ui, *args, **kwargs): |
20 > ui.write("Bar\\n") |
25 > ui.write("Bar\\n") |
21 > EOF |
26 > EOF |
22 $ abspath=`pwd`/foobar.py |
27 $ abspath=`pwd`/foobar.py |