Mercurial > hg
annotate tests/test-extension @ 4775:739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 02 Jul 2007 07:54:51 -0700 |
parents | c41a404ac387 |
children | 93b7e2fa7ee3 |
rev | line source |
---|---|
4064
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
1 #!/bin/sh |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
2 # Test basic extension support |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
3 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
4 cat > foobar.py <<EOF |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
5 import os |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
6 from mercurial import commands |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
7 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
8 def uisetup(ui): |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
9 ui.write("uisetup called\\n") |
4074
0f9381cf9723
Try to pass repo.ui to reposetup hooks
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4064
diff
changeset
|
10 ui.write("ui.parentui is%s None\\n" % (ui.parentui is not None |
0f9381cf9723
Try to pass repo.ui to reposetup hooks
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4064
diff
changeset
|
11 and "not" or "")) |
4064
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
12 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
13 def reposetup(ui, repo): |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
14 ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
4074
0f9381cf9723
Try to pass repo.ui to reposetup hooks
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4064
diff
changeset
|
15 ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) |
4064
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
16 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
17 def foo(ui, *args, **kwargs): |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
18 ui.write("Foo\\n") |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
19 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
20 def bar(ui, *args, **kwargs): |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
21 ui.write("Bar\\n") |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
22 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
23 cmdtable = { |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
24 "foo": (foo, [], "hg foo"), |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
25 "bar": (bar, [], "hg bar"), |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
26 } |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
27 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
28 commands.norepo += ' bar' |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
29 EOF |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
30 abspath=`pwd`/foobar.py |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
31 |
4569
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
32 mkdir barfoo |
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
33 cp foobar.py barfoo/__init__.py |
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
34 barfoopath=`pwd`/barfoo |
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
35 |
4064
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
36 hg init a |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
37 cd a |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
38 echo foo > file |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
39 hg add file |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
40 hg commit -m 'add file' |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
41 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
42 echo '[extensions]' >> $HGRCPATH |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
43 echo "foobar = $abspath" >> $HGRCPATH |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
44 hg foo |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
45 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
46 cd .. |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
47 hg clone a b |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
48 |
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
49 hg bar |
4569
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
50 |
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
51 echo '% module/__init__.py-style' |
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
52 echo '[extensions]' > $HGRCPATH |
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
53 echo "barfoo = $barfoopath" >> $HGRCPATH |
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
54 cd a |
622d8ed78b47
extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents:
4074
diff
changeset
|
55 hg foo |
4738
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
56 |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
57 cd .. |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
58 cat > empty.py <<EOF |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
59 '''empty cmdtable |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
60 ''' |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
61 cmdtable = {} |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
62 EOF |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
63 emptypath=`pwd`/empty.py |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
64 echo '[extensions]' > $HGRCPATH |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
65 echo "empty = $emptypath" >> $HGRCPATH |
c41a404ac387
Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents:
4569
diff
changeset
|
66 hg help empty |