annotate tests/test-extension.t @ 49742:30eb36d93072

path: use `get_clone_path_obj` in _getlocal We don't need to feed the `path` object to a `peer` object, but using an higher level function is simpler here (e.g. no subscript access, explicit attribute access).
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 02 Dec 2022 16:36:43 +0100
parents 7d9a45c7517f
children 950c39918bd2 9c7fb04843b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1 Test basic extension support
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
2 $ cat > foobar.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
3 > import os
41047
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
4 > from mercurial import commands, exthelper, registrar
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
5 >
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
6 > eh = exthelper.exthelper()
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
7 > eh.configitem(b'tests', b'foo', default=b"Foo")
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
8 >
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
9 > uisetup = eh.finaluisetup
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
10 > uipopulate = eh.finaluipopulate
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
11 > reposetup = eh.finalreposetup
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
12 > cmdtable = eh.cmdtable
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
13 > configtable = eh.configtable
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
14 >
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
15 > @eh.uisetup
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
16 > def _uisetup(ui):
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
17 > ui.debug(b"uisetup called [debug]\\n")
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
18 > ui.write(b"uisetup called\\n")
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
19 > ui.status(b"uisetup called [status]\\n")
28612
6fb1d3c936d2 tests: explicitly flush output streams
Jun Wu <quark@fb.com>
parents: 27990
diff changeset
20 > ui.flush()
41047
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
21 > @eh.uipopulate
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
22 > def _uipopulate(ui):
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
23 > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
24 > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt)
41047
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
25 > @eh.reposetup
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
26 > def _reposetup(ui, repo):
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
27 > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root))
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
28 > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!"))
28612
6fb1d3c936d2 tests: explicitly flush output streams
Jun Wu <quark@fb.com>
parents: 27990
diff changeset
29 > ui.flush()
41047
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
30 > @eh.command(b'foo', [], b'hg foo')
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
31 > def foo(ui, *args, **kwargs):
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
32 > foo = ui.config(b'tests', b'foo')
33132
c467d13334ee configitems: add an official API for extensions to register config item
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 33099
diff changeset
33 > ui.write(foo)
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
34 > ui.write(b"\\n")
41047
555215e2b051 tests: convert a test extension to use exthelper
Matt Harbison <matt_harbison@yahoo.com>
parents: 41010
diff changeset
35 > @eh.command(b'bar', [], b'hg bar', norepo=True)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
36 > def bar(ui, *args, **kwargs):
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
37 > ui.write(b"Bar\\n")
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
38 > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
39 $ abspath=`pwd`/foobar.py
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
40
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
41 $ mkdir barfoo
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
42 $ cp foobar.py barfoo/__init__.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
43 $ barfoopath=`pwd`/barfoo
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
44
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
45 $ hg init a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
46 $ cd a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
47 $ echo foo > file
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
48 $ hg add file
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
49 $ hg commit -m 'add file'
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
50
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
51 $ echo '[extensions]' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
52 $ echo "foobar = $abspath" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
53 $ hg foo
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
54 uisetup called
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
55 uisetup called [status]
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
56 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
57 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
58 uipopulate called (1 times)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
59 reposetup called for a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
60 ui == repo.ui
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
61 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
62 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
63 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
64 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
65 uipopulate called (1 times) (chg !)
34841
6bfe43dd20eb test-extension: make the test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34048
diff changeset
66 reposetup called for a (chg !)
6bfe43dd20eb test-extension: make the test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34048
diff changeset
67 ui == repo.ui (chg !)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
68 Foo
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
69 $ hg foo --quiet
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
70 uisetup called (no-chg !)
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
71 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
72 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
73 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
74 uipopulate called (1 times) (chg !)
42505
c1850798f995 run-tests: stop matching line for missing feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41738
diff changeset
75 uipopulate called (1 times)
c1850798f995 run-tests: stop matching line for missing feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41738
diff changeset
76 reposetup called for a
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
77 ui == repo.ui
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
78 Foo
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
79 $ hg foo --debug
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
80 uisetup called [debug] (no-chg !)
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
81 uisetup called (no-chg !)
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
82 uisetup called [status] (no-chg !)
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
83 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
84 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
85 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
86 uipopulate called (1 times) (chg !)
42505
c1850798f995 run-tests: stop matching line for missing feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41738
diff changeset
87 uipopulate called (1 times)
c1850798f995 run-tests: stop matching line for missing feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41738
diff changeset
88 reposetup called for a
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
89 ui == repo.ui
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
90 Foo
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
91
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
92 $ cd ..
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
93 $ hg clone a b
34841
6bfe43dd20eb test-extension: make the test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34048
diff changeset
94 uisetup called (no-chg !)
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
95 uisetup called [status] (no-chg !)
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
96 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
97 uipopulate called (1 times) (chg !)
42505
c1850798f995 run-tests: stop matching line for missing feature
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41738
diff changeset
98 uipopulate called (1 times)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
99 reposetup called for a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
100 ui == repo.ui
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
101 uipopulate called (1 times)
47442
d1c1fd7ac46d clone: use "official" API to create local clone destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46819
diff changeset
102 uipopulate called (1 times)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
103 reposetup called for b
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
104 ui == repo.ui
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
105 updating to branch default
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4569
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
107
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
108 $ hg bar
34841
6bfe43dd20eb test-extension: make the test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34048
diff changeset
109 uisetup called (no-chg !)
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
110 uisetup called [status] (no-chg !)
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
111 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
112 uipopulate called (1 times) (chg !)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
113 Bar
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
114 $ echo 'foobar = !' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
115
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
116 module/__init__.py-style
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
117
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
118 $ echo "barfoo = $barfoopath" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
119 $ cd a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
120 $ hg foo
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
121 uisetup called
38534
b86664c81833 debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents: 38162
diff changeset
122 uisetup called [status]
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
123 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
124 uipopulate called (1 times)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
125 uipopulate called (1 times)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
126 reposetup called for a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
127 ui == repo.ui
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
128 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
129 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
130 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
131 uipopulate called (1 times) (chg !)
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
132 uipopulate called (1 times) (chg !)
34841
6bfe43dd20eb test-extension: make the test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34048
diff changeset
133 reposetup called for a (chg !)
6bfe43dd20eb test-extension: make the test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34048
diff changeset
134 ui == repo.ui (chg !)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
135 Foo
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
136 $ echo 'barfoo = !' >> $HGRCPATH
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
137
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
138 Check that extensions are loaded in phases:
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
139
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
140 $ cat > foo.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
141 > import os
41066
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
142 > from mercurial import exthelper
44987
a28d1eca6507 tests: use proctutil.stdout.write() instead of print() in test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44953
diff changeset
143 > from mercurial.utils import procutil
a28d1eca6507 tests: use proctutil.stdout.write() instead of print() in test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44953
diff changeset
144 >
46065
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
145 > def write(msg):
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
146 > procutil.stdout.write(msg)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
147 > procutil.stdout.flush()
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
148 >
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
149 > name = os.path.basename(__file__).rsplit('.', 1)[0]
44987
a28d1eca6507 tests: use proctutil.stdout.write() instead of print() in test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44953
diff changeset
150 > bytesname = name.encode('utf-8')
a28d1eca6507 tests: use proctutil.stdout.write() instead of print() in test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44953
diff changeset
151 > write(b"1) %s imported\n" % bytesname)
41066
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
152 > eh = exthelper.exthelper()
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
153 > @eh.uisetup
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
154 > def _uisetup(ui):
44987
a28d1eca6507 tests: use proctutil.stdout.write() instead of print() in test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44953
diff changeset
155 > write(b"2) %s uisetup\n" % bytesname)
41066
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
156 > @eh.extsetup
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
157 > def _extsetup(ui):
44987
a28d1eca6507 tests: use proctutil.stdout.write() instead of print() in test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44953
diff changeset
158 > write(b"3) %s extsetup\n" % bytesname)
41066
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
159 > @eh.uipopulate
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
160 > def _uipopulate(ui):
44987
a28d1eca6507 tests: use proctutil.stdout.write() instead of print() in test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44953
diff changeset
161 > write(b"4) %s uipopulate\n" % bytesname)
41066
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
162 > @eh.reposetup
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
163 > def _reposetup(ui, repo):
44987
a28d1eca6507 tests: use proctutil.stdout.write() instead of print() in test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44953
diff changeset
164 > write(b"5) %s reposetup\n" % bytesname)
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
165 >
41066
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
166 > extsetup = eh.finalextsetup
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
167 > reposetup = eh.finalreposetup
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
168 > uipopulate = eh.finaluipopulate
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
169 > uisetup = eh.finaluisetup
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
170 > revsetpredicate = eh.revsetpredicate
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
171 >
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
172 > # custom predicate to check registration of functions at loading
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
173 > from mercurial import (
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
174 > smartset,
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
175 > )
41066
0358cca1dccf exthelper: reintroduce the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 41047
diff changeset
176 > @eh.revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
177 > def custompredicate(repo, subset, x):
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
178 > return smartset.baseset([r for r in subset if r in {0}])
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
179 > EOF
4569
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
180
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
181 $ cp foo.py bar.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
182 $ echo 'foo = foo.py' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
183 $ echo 'bar = bar.py' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
184
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
185 Check normal command's load order of extensions and registration of functions
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
186
46065
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
187 On chg server, extension should be first set up by the server. Then
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
188 object-level setup should follow in the worker process.
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
189
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
190 $ hg log -r "foo() and bar()" -q
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
191 1) foo imported
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
192 1) bar imported
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
193 2) foo uisetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
194 2) bar uisetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
195 3) foo extsetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
196 3) bar extsetup
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
197 4) foo uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
198 4) bar uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
199 4) foo uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
200 4) bar uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
201 4) foo uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
202 4) bar uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
203 5) foo reposetup
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
204 5) bar reposetup
46065
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
205 4) foo uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
206 4) bar uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
207 4) foo uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
208 4) bar uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
209 4) foo uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
210 4) bar uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
211 4) foo uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
212 4) bar uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
213 4) foo uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
214 4) bar uipopulate (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
215 5) foo reposetup (chg !)
56a5ea353182 test-extension: flush diagnostic message to stabilize chg output
Yuya Nishihara <yuya@tcha.org>
parents: 45954
diff changeset
216 5) bar reposetup (chg !)
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
217 0:c24b9ac61126
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
218
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
219 Check hgweb's load order of extensions and registration of functions
4738
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
220
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
221 $ cat > hgweb.cgi <<EOF
32938
b6776b34e44e tests: use $PYTHON in #! so we always use the right Python
Augie Fackler <augie@google.com>
parents: 32757
diff changeset
222 > #!$PYTHON
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
223 > from mercurial import demandimport; demandimport.enable()
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
224 > from mercurial.hgweb import hgweb
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
225 > from mercurial.hgweb import wsgicgi
39621
23b749b84b8a py3: call hgweb.hgweb() with bytes values
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39221
diff changeset
226 > application = hgweb(b'.', b'test repo')
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
227 > wsgicgi.launch(application)
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
228 > EOF
33099
4a8db3538c39 tests: use cgienv to minimize environment setup at hgweb tests
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33098
diff changeset
229 $ . "$TESTDIR/cgienv"
9410
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
230
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 39621
diff changeset
231 $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
232 > | grep '^[0-9]) ' # ignores HTML output
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
233 1) foo imported
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
234 1) bar imported
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
235 2) foo uisetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
236 2) bar uisetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
237 3) foo extsetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
238 3) bar extsetup
40729
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
239 4) foo uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
240 4) bar uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
241 4) foo uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
242 4) bar uipopulate
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
243 5) foo reposetup
c93d046d4300 extensions: add "uipopulate" hook, called per instance, not per process
Yuya Nishihara <yuya@tcha.org>
parents: 40463
diff changeset
244 5) bar reposetup
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
245
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
246 (check that revset predicate foo() and bar() are available)
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
247
33098
c4a20c9484e7 tests: avoid test failure for mangling path-like string by MSYS
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
248 #if msys
c4a20c9484e7 tests: avoid test failure for mangling path-like string by MSYS
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
249 $ PATH_INFO='//shortlog'
c4a20c9484e7 tests: avoid test failure for mangling path-like string by MSYS
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
250 #else
c4a20c9484e7 tests: avoid test failure for mangling path-like string by MSYS
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
251 $ PATH_INFO='/shortlog'
c4a20c9484e7 tests: avoid test failure for mangling path-like string by MSYS
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
252 #endif
c4a20c9484e7 tests: avoid test failure for mangling path-like string by MSYS
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
253 $ export PATH_INFO
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 39621
diff changeset
254 $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \
33052
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
255 > | grep '<a href="/rev/[0-9a-z]*">'
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
256 <a href="/rev/c24b9ac61126">add file</a>
45b0e9d05ee9 extensions: register functions always at loading extension (issue5601)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32938
diff changeset
257
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
258 $ echo 'foo = !' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
259 $ echo 'bar = !' >> $HGRCPATH
9410
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
260
19932
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
261 Check "from __future__ import absolute_import" support for external libraries
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
262
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
263 (import-checker.py reports issues for some of heredoc python code
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
264 fragments below, because import-checker.py does not know test specific
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
265 package hierarchy. NO_CHECK_* should be used as a limit mark of
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
266 heredoc, in order to make import-checker.py ignore them. For
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
267 simplicity, all python code fragments below are generated with such
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
268 limit mark, regardless of importing module or not.)
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
269
20001
a1f99a7f2d72 tests: choose the path separator in PYTHONPATH suitable for platform
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19933
diff changeset
270 #if windows
a1f99a7f2d72 tests: choose the path separator in PYTHONPATH suitable for platform
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19933
diff changeset
271 $ PATHSEP=";"
a1f99a7f2d72 tests: choose the path separator in PYTHONPATH suitable for platform
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19933
diff changeset
272 #else
a1f99a7f2d72 tests: choose the path separator in PYTHONPATH suitable for platform
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19933
diff changeset
273 $ PATHSEP=":"
a1f99a7f2d72 tests: choose the path separator in PYTHONPATH suitable for platform
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19933
diff changeset
274 #endif
a1f99a7f2d72 tests: choose the path separator in PYTHONPATH suitable for platform
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19933
diff changeset
275 $ export PATHSEP
a1f99a7f2d72 tests: choose the path separator in PYTHONPATH suitable for platform
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19933
diff changeset
276
19932
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
277 $ mkdir $TESTTMP/libroot
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
278 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
279 $ mkdir $TESTTMP/libroot/mod
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
280 $ touch $TESTTMP/libroot/mod/__init__.py
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
281 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
282
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
283 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF
19932
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
284 > import ambig # should load "libroot/ambig.py"
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
285 > s = ambig.s
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
286 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
287 $ cat > loadabs.py <<NO_CHECK_EOF
19932
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
288 > import mod.ambigabs as ambigabs
41068
28a4fb793ba1 extensions: deprecate extsetup without a `ui` argument (API)
Matt Harbison <matt_harbison@yahoo.com>
parents: 41066
diff changeset
289 > def extsetup(ui):
40181
958b4c506d3a tests: ensure print() statements in test-extension.t all flush
Augie Fackler <augie@google.com>
parents: 39931
diff changeset
290 > print('ambigabs.s=%s' % ambigabs.s, flush=True)
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
291 > NO_CHECK_EOF
20001
a1f99a7f2d72 tests: choose the path separator in PYTHONPATH suitable for platform
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19933
diff changeset
292 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
19932
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
293 ambigabs.s=libroot/ambig.py
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
294 $TESTTMP/a
19932
e3a5922e18c3 demandimport: support "absolute_import" for external libraries (issue4029)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19822
diff changeset
295
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
296 Check absolute/relative import of extension specific modules
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
297
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
298 $ mkdir $TESTTMP/extroot
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
299 $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
300 > s = b'this is extroot.bar'
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
301 > NO_CHECK_EOF
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
302 $ mkdir $TESTTMP/extroot/sub1
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
303 $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
304 > s = b'this is extroot.sub1.__init__'
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
305 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
306 $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
307 > s = b'this is extroot.sub1.baz'
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
308 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
309 $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
310 > s = b'this is extroot.__init__'
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
311 > from . import foo
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
312 > def extsetup(ui):
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
313 > ui.write(b'(extroot) ', foo.func(), b'\n')
28612
6fb1d3c936d2 tests: explicitly flush output streams
Jun Wu <quark@fb.com>
parents: 27990
diff changeset
314 > ui.flush()
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
315 > NO_CHECK_EOF
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
316
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
317 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
318 > # test absolute import
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
319 > buf = []
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
320 > def func():
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
321 > # "not locals" case
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
322 > import extroot.bar
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
323 > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s)
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
324 > return b'\n(extroot) '.join(buf)
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
325 > # b"fromlist == ('*',)" case
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
326 > from extroot.bar import *
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
327 > buf.append(b'from extroot.bar import *: %s' % s)
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
328 > # "not fromlist" and "if '.' in name" case
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
329 > import extroot.sub1.baz
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
330 > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
331 > # "not fromlist" and NOT "if '.' in name" case
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
332 > import extroot
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
333 > buf.append(b'import extroot: %s' % extroot.s)
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
334 > # NOT "not fromlist" and NOT "level != -1" case
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
335 > from extroot.bar import s
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
336 > buf.append(b'from extroot.bar import s: %s' % s)
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
337 > NO_CHECK_EOF
27491
28c1aa12f5de test-extension: do not depend on demandimport (issue5012)
Jun Wu <quark@fb.com>
parents: 27152
diff changeset
338 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
339 (extroot) from extroot.bar import *: this is extroot.bar
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
340 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
341 (extroot) import extroot: this is extroot.__init__
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
342 (extroot) from extroot.bar import s: this is extroot.bar
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
343 (extroot) import extroot.bar in func(): this is extroot.bar
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
344 $TESTTMP/a
19933
621a26eb3a99 demandimport: allow extensions to import own modules by absolute name
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19932
diff changeset
345
33528
c384ac3ea147 tests: drop "absimport" conditionals which should be always true
Yuya Nishihara <yuya@tcha.org>
parents: 33287
diff changeset
346 #if demandimport
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
347
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 30306
diff changeset
348 Examine whether module loading is delayed until actual referring, even
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
349 though module is imported with "absolute_import" feature.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
350
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 30306
diff changeset
351 Files below in each packages are used for described purpose:
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
352
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
353 - "called": examine whether "from MODULE import ATTR" works correctly
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
354 - "unused": examine whether loading is delayed correctly
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
355 - "used": examine whether "from PACKAGE import MODULE" works correctly
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
356
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
357 Package hierarchy is needed to examine whether demand importing works
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
358 as expected for "from SUB.PACK.AGE import MODULE".
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
359
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
360 Setup "external library" to be imported with "absolute_import"
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
361 feature.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
362
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
363 $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
364 $ touch $TESTTMP/extlibroot/__init__.py
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
365 $ touch $TESTTMP/extlibroot/lsub1/__init__.py
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
366 $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
367
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
368 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
369 > def func():
39725
be396c86f98e py3: add some b'' prefixes in tests/test-extension.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39707
diff changeset
370 > return b"this is extlibroot.lsub1.lsub2.called.func()"
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
371 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
372 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
373 > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally")
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
374 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
375 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF
39725
be396c86f98e py3: add some b'' prefixes in tests/test-extension.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39707
diff changeset
376 > detail = b"this is extlibroot.lsub1.lsub2.used"
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
377 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
378
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
379 Setup sub-package of "external library", which causes instantiation of
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
380 demandmod in "recurse down the module chain" code path. Relative
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
381 importing with "absolute_import" feature isn't tested, because "level
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
382 >=1 " doesn't cause instantiation of demandmod.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
383
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
384 $ mkdir -p $TESTTMP/extlibroot/recursedown/abs
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
385 $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF
39725
be396c86f98e py3: add some b'' prefixes in tests/test-extension.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39707
diff changeset
386 > detail = b"this is extlibroot.recursedown.abs.used"
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
387 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
388 $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
389 > from extlibroot.recursedown.abs.used import detail
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
390 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
391
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
392 $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
393 $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF
39725
be396c86f98e py3: add some b'' prefixes in tests/test-extension.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39707
diff changeset
394 > detail = b"this is extlibroot.recursedown.legacy.used"
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
395 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
396 $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
397 > # legacy style (level == -1) import
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
398 > from extlibroot.recursedown.legacy.used import detail
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
399 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
400
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
401 $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
402 > from extlibroot.recursedown.abs import detail as absdetail
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
403 > from .legacy import detail as legacydetail
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
404 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
405
33531
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
406 Setup package that re-exports an attribute of its submodule as the same
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
407 name. This leaves 'shadowing.used' pointing to 'used.detail', but still
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
408 the submodule 'used' should be somehow accessible. (issue5617)
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
409
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
410 $ mkdir -p $TESTTMP/extlibroot/shadowing
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
411 $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF
39725
be396c86f98e py3: add some b'' prefixes in tests/test-extension.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39707
diff changeset
412 > detail = b"this is extlibroot.shadowing.used"
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
413 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
414 $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF
33531
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
415 > from extlibroot.shadowing.used import detail
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
416 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
417 $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF
33531
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
418 > from .used import detail as used
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
419 > NO_CHECK_EOF
33531
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
420
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
421 Setup extension local modules to be imported with "absolute_import"
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
422 feature.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
423
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
424 $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
425 $ touch $TESTTMP/absextroot/xsub1/__init__.py
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
426 $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
427
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
428 $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
429 > def func():
39725
be396c86f98e py3: add some b'' prefixes in tests/test-extension.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39707
diff changeset
430 > return b"this is absextroot.xsub1.xsub2.called.func()"
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
431 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
432 $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
433 > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally")
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
434 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
435 $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF
39725
be396c86f98e py3: add some b'' prefixes in tests/test-extension.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39707
diff changeset
436 > detail = b"this is absextroot.xsub1.xsub2.used"
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
437 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
438
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
439 Setup extension local modules to examine whether demand importing
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
440 works as expected in "level > 1" case.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
441
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
442 $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF
39725
be396c86f98e py3: add some b'' prefixes in tests/test-extension.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39707
diff changeset
443 > detail = b"this is absextroot.relimportee"
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
444 > NO_CHECK_EOF
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
445 $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF
40183
0173ed47a873 tests: fix a repr on python3 in test-extension.t
Augie Fackler <augie@google.com>
parents: 40182
diff changeset
446 > from mercurial import pycompat
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
447 > from ... import relimportee
40183
0173ed47a873 tests: fix a repr on python3 in test-extension.t
Augie Fackler <augie@google.com>
parents: 40182
diff changeset
448 > detail = b"this relimporter imports %r" % (
0173ed47a873 tests: fix a repr on python3 in test-extension.t
Augie Fackler <augie@google.com>
parents: 40182
diff changeset
449 > pycompat.bytestr(relimportee.detail))
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
450 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
451
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
452 Setup modules, which actually import extension local modules at
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
453 runtime.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
454
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
455 $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
456 >
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
457 > # import extension local modules absolutely (level = 0)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
458 > from absextroot.xsub1.xsub2 import used, unused
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
459 > from absextroot.xsub1.xsub2.called import func
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
460 >
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
461 > def getresult():
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
462 > result = []
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
463 > result.append(used.detail)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
464 > result.append(func())
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
465 > return result
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
466 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
467
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
468 $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
469 >
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
470 > # import extension local modules relatively (level == 1)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
471 > from .xsub1.xsub2 import used, unused
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
472 > from .xsub1.xsub2.called import func
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
473 >
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
474 > # import a module, which implies "importing with level > 1"
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
475 > from .xsub1.xsub2 import relimporter
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
476 >
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
477 > def getresult():
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
478 > result = []
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
479 > result.append(used.detail)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
480 > result.append(func())
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
481 > result.append(relimporter.detail)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
482 > return result
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
483 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
484
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
485 Setup main procedure of extension.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
486
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
487 $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
488 > from mercurial import registrar
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
489 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
490 > command = registrar.command(cmdtable)
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
491 >
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
492 > # "absolute" and "relative" shouldn't be imported before actual
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
493 > # command execution, because (1) they import same modules, and (2)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
494 > # preceding import (= instantiate "demandmod" object instead of
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
495 > # real "module" object) might hide problem of succeeding import.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
496 >
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 33052
diff changeset
497 > @command(b'showabsolute', [], norepo=True)
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
498 > def showabsolute(ui, *args, **opts):
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
499 > from absextroot import absolute
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
500 > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult()))
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
501 >
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 33052
diff changeset
502 > @command(b'showrelative', [], norepo=True)
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
503 > def showrelative(ui, *args, **opts):
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
504 > from . import relative
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
505 > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult()))
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
506 >
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
507 > # import modules from external library
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
508 > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
509 > from extlibroot.lsub1.lsub2.called import func as lfunc
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
510 > from extlibroot.recursedown import absdetail, legacydetail
33531
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
511 > from extlibroot.shadowing import proxied
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
512 >
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
513 > def uisetup(ui):
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
514 > result = []
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
515 > result.append(lused.detail)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
516 > result.append(lfunc())
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
517 > result.append(absdetail)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
518 > result.append(legacydetail)
33531
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
519 > result.append(proxied.detail)
40182
b348fe5f5c36 tests: so many b prefixes in test-extension.t
Augie Fackler <augie@google.com>
parents: 40181
diff changeset
520 > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result))
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
521 > NO_CHECK_EOF
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
522
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
523 Examine module importing.
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
524
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
525 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
526 LIB: this is extlibroot.lsub1.lsub2.used
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
527 LIB: this is extlibroot.lsub1.lsub2.called.func()
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
528 LIB: this is extlibroot.recursedown.abs.used
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
529 LIB: this is extlibroot.recursedown.legacy.used
33531
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
530 LIB: this is extlibroot.shadowing.used
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
531 ABS: this is absextroot.xsub1.xsub2.used
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
532 ABS: this is absextroot.xsub1.xsub2.called.func()
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
533
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
534 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative)
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
535 LIB: this is extlibroot.lsub1.lsub2.used
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
536 LIB: this is extlibroot.lsub1.lsub2.called.func()
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
537 LIB: this is extlibroot.recursedown.abs.used
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
538 LIB: this is extlibroot.recursedown.legacy.used
33531
9cbbf9118c6c demandimport: prefer loaded module over package attribute (issue5617)
Yuya Nishihara <yuya@tcha.org>
parents: 33529
diff changeset
539 LIB: this is extlibroot.shadowing.used
29375
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
540 REL: this is absextroot.xsub1.xsub2.used
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
541 REL: this is absextroot.xsub1.xsub2.called.func()
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
542 REL: this relimporter imports 'this is absextroot.relimportee'
fcaf20175b1b demandimport: delay loading for "from a import b" with absolute_import
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29198
diff changeset
543
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
544 Examine whether sub-module is imported relatively as expected.
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
545
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
546 See also issue5208 for detail about example case on Python 3.x.
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
547
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
548 $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
549 $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
550
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
551 $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
552 > text = 'notexist.py at root is loaded unintentionally\n'
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
553 > NO_CHECK_EOF
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
554
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
555 $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
556 > from mercurial import registrar
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
557 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
558 > command = registrar.command(cmdtable)
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
559 >
41508
b0865b5919c6 py3: account for demand import difference between Python versions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41487
diff changeset
560 > # demand import avoids failure of importing notexist here, but only on
b0865b5919c6 py3: account for demand import difference between Python versions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41487
diff changeset
561 > # Python 2.
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
562 > import extlibroot.lsub1.lsub2.notexist
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
563 >
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 33052
diff changeset
564 > @command(b'checkrelativity', [], norepo=True)
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
565 > def checkrelativity(ui, *args, **opts):
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
566 > try:
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
567 > ui.write(extlibroot.lsub1.lsub2.notexist.text)
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
568 > return 1 # unintentional success
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
569 > except ImportError:
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
570 > pass # intentional failure
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
571 > NO_CHECK_EOF
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
572
41508
b0865b5919c6 py3: account for demand import difference between Python versions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41487
diff changeset
573 Python 3's lazy importer verifies modules exist before returning the lazy
b0865b5919c6 py3: account for demand import difference between Python versions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41487
diff changeset
574 module stub. Our custom lazy importer for Python 2 always returns a stub.
b0865b5919c6 py3: account for demand import difference between Python versions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41487
diff changeset
575
b0865b5919c6 py3: account for demand import difference between Python versions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41487
diff changeset
576 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) || true
48410
0b2469bf1227 python2-compat: fix extensions' tests on python2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48362
diff changeset
577 *** failed to import extension "checkrelativity" from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist' (py3 !)
41508
b0865b5919c6 py3: account for demand import difference between Python versions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41487
diff changeset
578 hg: unknown command 'checkrelativity' (py3 !)
b0865b5919c6 py3: account for demand import difference between Python versions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41487
diff changeset
579 (use 'hg help' for a list of commands) (py3 !)
29736
14f077f7519a demandimport: import sub-module relatively as expected (issue5208)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29375
diff changeset
580
34844
f0a62afd1e40 tests: move baduisetup() test out of "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 34843
diff changeset
581 #endif
f0a62afd1e40 tests: move baduisetup() test out of "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 34843
diff changeset
582
40206
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
583 (Here, module importing tests are finished. Therefore, use other than
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
584 NO_CHECK_* limit mark for heredoc python files, in order to apply
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
585 import-checker.py or so on their contents)
37295cee1a15 tests: use NO_CHECK_EOF for fragments used to test importing via extension
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40205
diff changeset
586
33939
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
587 Make sure a broken uisetup doesn't globally break hg:
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
588 $ cat > $TESTTMP/baduisetup.py <<EOF
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
589 > def uisetup(ui):
41738
c70bdd222dcd tests: bulk changes to avoid whitespace errors of check-code.py
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 41736
diff changeset
590 > 1 / 0
33939
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
591 > EOF
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
592
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
593 Even though the extension fails during uisetup, hg is still basically usable:
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
594 $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
595 Traceback (most recent call last):
47832
7835f2696de8 test-extension: adapt output to pyoxidizer
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47442
diff changeset
596 File "*/mercurial/extensions.py", line *, in _runuisetup (glob) (no-pyoxidizer !)
7835f2696de8 test-extension: adapt output to pyoxidizer
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47442
diff changeset
597 File "mercurial.extensions", line *, in _runuisetup (glob) (pyoxidizer !)
33939
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
598 uisetup(ui)
34843
df871c41bd00 tests: make test-extension.t's baduisetup.py test fail even if bdiff exists
Martin von Zweigbergk <martinvonz@google.com>
parents: 34841
diff changeset
599 File "$TESTTMP/baduisetup.py", line 2, in uisetup
41738
c70bdd222dcd tests: bulk changes to avoid whitespace errors of check-code.py
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 41736
diff changeset
600 1 / 0
40184
c3b7d9c54edd tests: glob away some annoying py3 differences
Augie Fackler <augie@google.com>
parents: 40183
diff changeset
601 ZeroDivisionError: * by zero (glob)
c3b7d9c54edd tests: glob away some annoying py3 differences
Augie Fackler <augie@google.com>
parents: 40183
diff changeset
602 *** failed to set up extension baduisetup: * by zero (glob)
33939
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
603 Mercurial Distributed SCM (version *) (glob)
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
604 (see https://mercurial-scm.org for more information)
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
605
46819
d4ba4d51f85f contributor: change mentions of mpm to olivia
Raphaël Gomès <rgomes@octobus.net>
parents: 46262
diff changeset
606 Copyright (C) 2005-* Olivia Mackall and others (glob)
33939
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
607 This is free software; see the source for copying conditions. There is NO
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
608 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9d5d040160e6 tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents: 33736
diff changeset
609
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
610 $ cd ..
9661
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
611
17014
50fbe9063ff2 tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16853
diff changeset
612 hide outer repo
50fbe9063ff2 tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16853
diff changeset
613 $ hg init
50fbe9063ff2 tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16853
diff changeset
614
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
615 $ cat > empty.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
616 > '''empty cmdtable
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
617 > '''
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
618 > cmdtable = {}
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
619 > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
620 $ emptypath=`pwd`/empty.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
621 $ echo "empty = $emptypath" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
622 $ hg help empty
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
623 empty extension - empty cmdtable
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
624
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
625 no commands defined
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
626
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
627
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
628 $ echo 'empty = !' >> $HGRCPATH
9661
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
629
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
630 $ cat > debugextension.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
631 > '''only debugcommands
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
632 > '''
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
633 > from mercurial import registrar
21254
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 20003
diff changeset
634 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
635 > command = registrar.command(cmdtable)
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
636 > @command(b'debugfoobar', [], b'hg debugfoobar')
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
637 > def debugfoobar(ui, repo, *args, **opts):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
638 > "yet another debug command"
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
639 > @command(b'foo', [], b'hg foo')
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
640 > def foo(ui, repo, *args, **opts):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
641 > """yet another foo command
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
642 > This command has been DEPRECATED since forever.
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
643 > """
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
644 > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
645 $ debugpath=`pwd`/debugextension.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
646 $ echo "debugextension = $debugpath" >> $HGRCPATH
9410
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
647
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
648 $ hg help debugextension
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
649 hg debugextensions
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
650
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
651 show information about active extensions
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
652
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
653 options:
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
654
39931
0d703063d0c8 formatter: remove experimental marker from -T option
Yuya Nishihara <yuya@tcha.org>
parents: 39730
diff changeset
655 -T --template TEMPLATE display with template
0d703063d0c8 formatter: remove experimental marker from -T option
Yuya Nishihara <yuya@tcha.org>
parents: 39730
diff changeset
656
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
657 (some details hidden, use --verbose to show complete help)
4950
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
658
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
659
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
660 $ hg --verbose help debugextension
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
661 hg debugextensions
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
662
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
663 show information about active extensions
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
664
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
665 options:
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
666
39931
0d703063d0c8 formatter: remove experimental marker from -T option
Yuya Nishihara <yuya@tcha.org>
parents: 39730
diff changeset
667 -T --template TEMPLATE display with template
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
668
22117
c1d93edcf004 help: fold repeatable option message into option table header
Matt Mackall <mpm@selenic.com>
parents: 22113
diff changeset
669 global options ([+] can be repeated):
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
670
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
671 -R --repository REPO repository root directory or name of overlay bundle
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
672 file
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
673 --cwd DIR change working directory
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
674 -y --noninteractive do not prompt, automatically pick the first choice for
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
675 all prompts
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
676 -q --quiet suppress output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
677 -v --verbose enable additional output
31104
8346b2f09e79 color: add the definition of '--color' in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30993
diff changeset
678 --color TYPE when to colorize (boolean, always, auto, never, or
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31110
diff changeset
679 debug)
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
680 --config CONFIG [+] set/override config option (use 'section.name=value')
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
681 --debug enable debugging output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
682 --debugger start debugger
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
683 --encoding ENCODE set the charset encoding (default: ascii)
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
684 --encodingmode MODE set the charset encoding mode (default: strict)
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
685 --traceback always print a traceback on exception
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
686 --time time how long the command takes
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
687 --profile print command execution profile
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
688 --version output version information and exit
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
689 -h --help display help and exit
41010
e8e2a7656e83 help: hide default value for default-off flags
Martin von Zweigbergk <martinvonz@google.com>
parents: 41009
diff changeset
690 --hidden consider hidden changesets
30993
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
691 --pager TYPE when to paginate (boolean, always, auto, or never)
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
692 (default: auto)
9128
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
693
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
694
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
695
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
696
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
697
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
698
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
699 $ hg --debug help debugextension
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
700 hg debugextensions
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
701
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
702 show information about active extensions
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
703
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
704 options:
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
705
39931
0d703063d0c8 formatter: remove experimental marker from -T option
Yuya Nishihara <yuya@tcha.org>
parents: 39730
diff changeset
706 -T --template TEMPLATE display with template
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
707
22117
c1d93edcf004 help: fold repeatable option message into option table header
Matt Mackall <mpm@selenic.com>
parents: 22113
diff changeset
708 global options ([+] can be repeated):
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
709
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
710 -R --repository REPO repository root directory or name of overlay bundle
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
711 file
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
712 --cwd DIR change working directory
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
713 -y --noninteractive do not prompt, automatically pick the first choice for
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
714 all prompts
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
715 -q --quiet suppress output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
716 -v --verbose enable additional output
31104
8346b2f09e79 color: add the definition of '--color' in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30993
diff changeset
717 --color TYPE when to colorize (boolean, always, auto, never, or
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31110
diff changeset
718 debug)
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
719 --config CONFIG [+] set/override config option (use 'section.name=value')
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
720 --debug enable debugging output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
721 --debugger start debugger
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
722 --encoding ENCODE set the charset encoding (default: ascii)
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
723 --encodingmode MODE set the charset encoding mode (default: strict)
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
724 --traceback always print a traceback on exception
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
725 --time time how long the command takes
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
726 --profile print command execution profile
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
727 --version output version information and exit
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
728 -h --help display help and exit
41010
e8e2a7656e83 help: hide default value for default-off flags
Martin von Zweigbergk <martinvonz@google.com>
parents: 41009
diff changeset
729 --hidden consider hidden changesets
30993
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
730 --pager TYPE when to paginate (boolean, always, auto, or never)
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
731 (default: auto)
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
732
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
733
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
734
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
735
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
736
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
737 $ echo 'debugextension = !' >> $HGRCPATH
7011
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
738
27152
ac27b1b3be85 help: make help deprecated mention the extension
timeless <timeless@mozdev.org>
parents: 27142
diff changeset
739 Asking for help about a deprecated extension should do something useful:
ac27b1b3be85 help: make help deprecated mention the extension
timeless <timeless@mozdev.org>
parents: 27142
diff changeset
740
ac27b1b3be85 help: make help deprecated mention the extension
timeless <timeless@mozdev.org>
parents: 27142
diff changeset
741 $ hg help glog
ac27b1b3be85 help: make help deprecated mention the extension
timeless <timeless@mozdev.org>
parents: 27142
diff changeset
742 'glog' is provided by the following extension:
ac27b1b3be85 help: make help deprecated mention the extension
timeless <timeless@mozdev.org>
parents: 27142
diff changeset
743
ac27b1b3be85 help: make help deprecated mention the extension
timeless <timeless@mozdev.org>
parents: 27142
diff changeset
744 graphlog command to view revision graphs from a shell (DEPRECATED)
ac27b1b3be85 help: make help deprecated mention the extension
timeless <timeless@mozdev.org>
parents: 27142
diff changeset
745
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
746 (use 'hg help extensions' for information on enabling extensions)
27152
ac27b1b3be85 help: make help deprecated mention the extension
timeless <timeless@mozdev.org>
parents: 27142
diff changeset
747
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
748 Extension module help vs command help:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
749
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
750 $ echo 'extdiff =' >> $HGRCPATH
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
751 $ hg help extdiff
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
752 hg extdiff [OPT]... [FILE]...
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
753
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
754 use external program to diff repository (or selected files)
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
755
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
756 Show differences between revisions for the specified files, using an
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
757 external program. The default program used is diff, with default options
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
758 "-Npru".
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
759
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
760 To select a different program, use the -p/--program option. The program
41487
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
761 will be passed the names of two directories to compare, unless the --per-
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
762 file option is specified (see below). To pass additional options to the
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
763 program, use -o/--option. These will be passed before the names of the
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
764 directories or files to compare.
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
765
46133
0a4d47f4337b extdiff: add --from/--to and deprecate -r, as was done for `hg diff`
Martin von Zweigbergk <martinvonz@google.com>
parents: 46065
diff changeset
766 The --from, --to, and --change options work the same way they do for 'hg
0a4d47f4337b extdiff: add --from/--to and deprecate -r, as was done for `hg diff`
Martin von Zweigbergk <martinvonz@google.com>
parents: 46065
diff changeset
767 diff'.
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
768
41487
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
769 The --per-file option runs the external program repeatedly on each file to
41584
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
770 diff, instead of once on two directories. By default, this happens one by
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
771 one, where the next file diff is open in the external program only once
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
772 the previous external program (for the previous file diff) has exited. If
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
773 the external program has a graphical interface, it can open all the file
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
774 diffs at once instead of one by one. See 'hg help -e extdiff' for
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
775 information about how to tell Mercurial that a given program has a
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
776 graphical interface.
41487
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
777
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
778 The --confirm option will prompt the user before each invocation of the
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
779 external program. It is ignored if --per-file isn't specified.
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
780
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
781 (use 'hg help -e extdiff' to show help for the extdiff extension)
14285
aa64a87b493d help: give hint about 'hg help -e' when appropriate
Martin Geisler <mg@aragost.com>
parents: 14284
diff changeset
782
22117
c1d93edcf004 help: fold repeatable option message into option table header
Matt Mackall <mpm@selenic.com>
parents: 22113
diff changeset
783 options ([+] can be repeated):
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
784
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
785 -p --program CMD comparison program to run
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
786 -o --option OPT [+] pass option to comparison program
46133
0a4d47f4337b extdiff: add --from/--to and deprecate -r, as was done for `hg diff`
Martin von Zweigbergk <martinvonz@google.com>
parents: 46065
diff changeset
787 --from REV1 revision to diff from
0a4d47f4337b extdiff: add --from/--to and deprecate -r, as was done for `hg diff`
Martin von Zweigbergk <martinvonz@google.com>
parents: 46065
diff changeset
788 --to REV2 revision to diff to
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
789 -c --change REV change made by revision
41487
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
790 --per-file compare each file instead of revision snapshots
fa471151d269 extdiff: add --per-file and --confirm options
Ludovic Chabant <ludovic@chabant.com>
parents: 41068
diff changeset
791 --confirm prompt user before each external program invocation
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
792 --patch compare patches for two revisions
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
793 -I --include PATTERN [+] include names matching the given patterns
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14849
diff changeset
794 -X --exclude PATTERN [+] exclude names matching the given patterns
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
795 -S --subrepos recurse into subrepositories
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
796
22110
26f7c8033bed help: tweak --verbose command help hint
Matt Mackall <mpm@selenic.com>
parents: 21937
diff changeset
797 (some details hidden, use --verbose to show complete help)
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
798
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
799
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
800
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
801
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
802
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
803
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
804
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
805
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
806
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
807
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
808 $ hg help --extension extdiff
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
809 extdiff extension - command to allow external programs to compare revisions
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
810
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
811 The extdiff Mercurial extension allows you to use external programs to compare
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
812 revisions, or revision with working directory. The external diff programs are
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
813 called with a configurable set of options and two non-option arguments: paths
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
814 to directories containing snapshots of files to compare.
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
815
37209
2208149c4b8e extdiff: document that it copies modified files back to working directory
Kyle Lippincott <spectral@google.com>
parents: 36458
diff changeset
816 If there is more than one file being compared and the "child" revision is the
2208149c4b8e extdiff: document that it copies modified files back to working directory
Kyle Lippincott <spectral@google.com>
parents: 36458
diff changeset
817 working directory, any modifications made in the external diff program will be
2208149c4b8e extdiff: document that it copies modified files back to working directory
Kyle Lippincott <spectral@google.com>
parents: 36458
diff changeset
818 copied back to the working directory from the temporary directory.
2208149c4b8e extdiff: document that it copies modified files back to working directory
Kyle Lippincott <spectral@google.com>
parents: 36458
diff changeset
819
14327
d943412e2fba extdiff: grammar "allows to" -> "allows one to"
Javi Merino <cibervicho@gmail.com>
parents: 14286
diff changeset
820 The extdiff extension also allows you to configure new diff commands, so you
27729
58f8b29c37ff minirst: change hgrole to use single quotes
timeless <timeless@mozdev.org>
parents: 27491
diff changeset
821 do not need to type 'hg extdiff -p kdiff3' always.
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
822
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
823 [extdiff]
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
824 # add new command that runs GNU diff(1) in 'context diff' mode
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
825 cdiff = gdiff -Nprc5
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
826 ## or the old way:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
827 #cmd.cdiff = gdiff
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
828 #opts.cdiff = -Nprc5
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
829
23150
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22947
diff changeset
830 # add new command called meld, runs meld (no need to name twice). If
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22947
diff changeset
831 # the meld executable is not available, the meld tool in [merge-tools]
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22947
diff changeset
832 # will be used, if available
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
833 meld =
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
834
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
835 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
836 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
837 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
838 # your .vimrc
16242
55174ab81973 extdiff: escape filenames with vim/DirDiff and make quoting work with Windows
Thomas Arendsen Hein <thomas@intevation.de>
parents: 15862
diff changeset
839 vimdiff = gvim -f "+next" \
55174ab81973 extdiff: escape filenames with vim/DirDiff and make quoting work with Windows
Thomas Arendsen Hein <thomas@intevation.de>
parents: 15862
diff changeset
840 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
841
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
842 Tool arguments can include variables that are expanded at runtime:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
843
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
844 $parent1, $plabel1 - filename, descriptive label of first parent
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
845 $child, $clabel - filename, descriptive label of child revision
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
846 $parent2, $plabel2 - filename, descriptive label of second parent
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
847 $root - repository root
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
848 $parent is an alias for $parent1.
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
849
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
850 The extdiff extension will look in your [diff-tools] and [merge-tools]
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
851 sections for diff tool arguments, when none are specified in [extdiff].
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
852
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
853 [extdiff]
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
854 kdiff3 =
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
855
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
856 [diff-tools]
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
857 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
858
41584
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
859 If a program has a graphical interface, it might be interesting to tell
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
860 Mercurial about it. It will prevent the program from being mistakenly used in
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
861 a terminal-only environment (such as an SSH terminal session), and will make
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
862 'hg extdiff --per-file' open multiple file diffs at once instead of one by one
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
863 (if you still want to open file diffs one by one, you can use the --confirm
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
864 option).
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
865
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
866 Declaring that a tool has a graphical interface can be done with the "gui"
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
867 flag next to where "diffargs" are specified:
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
868
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
869 [diff-tools]
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
870 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
871 kdiff3.gui = true
a4cd77a425a3 extdiff: support tools that can be run simultaneously
Ludovic Chabant <ludovic@chabant.com>
parents: 41508
diff changeset
872
27729
58f8b29c37ff minirst: change hgrole to use single quotes
timeless <timeless@mozdev.org>
parents: 27491
diff changeset
873 You can use -I/-X and list of file or directory names like normal 'hg diff'
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
874 command. The extdiff extension makes snapshots of only needed files, so
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
875 running the external diff program will actually be pretty fast (at least
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
876 faster than having to compare the entire tree).
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
877
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
878 list of commands:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
879
16853
7863ff383894 help: format command and option list help using RST
Olav Reinert <seroton10@gmail.com>
parents: 16744
diff changeset
880 extdiff use external program to diff repository (or selected files)
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
881
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
882 (use 'hg help -v -e extdiff' to show built-in aliases and global options)
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
883
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
884
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
885
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
886
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
887
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
888
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
889
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
890
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
891
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
892
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
893
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
894
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
895
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
896
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
897
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
898
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
899 $ echo 'extdiff = !' >> $HGRCPATH
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
900
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
901 Test help topic with same name as extension
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
902
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
903 $ cat > multirevs.py <<EOF
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
904 > from mercurial import commands, registrar
21254
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 20003
diff changeset
905 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
906 > command = registrar.command(cmdtable)
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
907 > """multirevs extension
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
908 > Big multi-line module docstring."""
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
909 > @command(b'multirevs', [], b'ARG', norepo=True)
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
910 > def multirevs(ui, repo, arg, *args, **opts):
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
911 > """multirevs command"""
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
912 > EOF
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
913 $ echo "multirevs = multirevs.py" >> $HGRCPATH
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
914
30610
66cffa87d2f2 help: make multirevs just an alias for revsets
Martin von Zweigbergk <martinvonz@google.com>
parents: 30485
diff changeset
915 $ hg help multirevs | tail
34948
ff178743e59b help: minor copy editing for grammar
Matt Harbison <matt_harbison@yahoo.com>
parents: 34845
diff changeset
916 used):
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
917
30771
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30610
diff changeset
918 hg update :@
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
919
30771
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30610
diff changeset
920 - Show diff between tags 1.3 and 1.5 (this works because the first and the
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30610
diff changeset
921 last revisions of the revset are used):
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
922
30771
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30610
diff changeset
923 hg diff -r 1.3::1.5
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
924
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
925 use 'hg help -c multirevs' to see help for the multirevs command
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
926
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
927
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
928
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
929
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
930
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
931
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
932 $ hg help -c multirevs
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
933 hg multirevs ARG
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
934
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
935 multirevs command
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
936
22110
26f7c8033bed help: tweak --verbose command help hint
Matt Mackall <mpm@selenic.com>
parents: 21937
diff changeset
937 (some details hidden, use --verbose to show complete help)
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
938
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
939
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
940
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
941 $ hg multirevs
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
942 hg multirevs: invalid arguments
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
943 hg multirevs ARG
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
944
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
945 multirevs command
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
946
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
947 (use 'hg multirevs -h' to show more help)
46262
9c9e0b4b2ca7 error: use detailed exit code 10 for command errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 46133
diff changeset
948 [10]
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
949
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
950
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
951
14286
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
952 $ echo "multirevs = !" >> $HGRCPATH
005a540e9aee help: add -c/--command flag to only show command help (issue2799)
Martin Geisler <mg@aragost.com>
parents: 14285
diff changeset
953
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12327
diff changeset
954 Issue811: Problem loading extensions twice (by site and by user)
7011
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
955
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
956 $ cat <<EOF >> $HGRCPATH
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
957 > mq =
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
958 > strip =
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
959 > hgext.mq =
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
960 > hgext/mq =
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
961 > EOF
7011
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
962
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
963 Show extensions:
19822
a194a33f8cb2 mq: prepare a strip extension for extraction
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19777
diff changeset
964 (note that mq force load strip, also checking it's not loaded twice)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
965
37342
4e6a6d0dccee tests: conditionalize tests based on presence of custom extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37209
diff changeset
966 #if no-extraextensions
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
967 $ hg debugextensions
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents: 26263
diff changeset
968 mq
19822
a194a33f8cb2 mq: prepare a strip extension for extraction
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19777
diff changeset
969 strip
37342
4e6a6d0dccee tests: conditionalize tests based on presence of custom extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37209
diff changeset
970 #endif
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
971
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
972 For extensions, which name matches one of its commands, help
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
973 message should ask '-v -e' to get list of built-in aliases
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
974 along with extension help itself
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
975
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
976 $ mkdir $TESTTMP/d
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
977 $ cat > $TESTTMP/d/dodo.py <<EOF
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
978 > """
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
979 > This is an awesome 'dodo' extension. It does nothing and
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
980 > writes 'Foo foo'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
981 > """
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
982 > from mercurial import commands, registrar
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
983 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
984 > command = registrar.command(cmdtable)
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
985 > @command(b'dodo', [], b'hg dodo')
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
986 > def dodo(ui, *args, **kwargs):
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
987 > """Does nothing"""
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
988 > ui.write(b"I do nothing. Yay\\n")
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
989 > @command(b'foofoo', [], b'hg foofoo')
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
990 > def foofoo(ui, *args, **kwargs):
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
991 > """Writes 'Foo foo'"""
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
992 > ui.write(b"Foo foo\\n")
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
993 > EOF
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
994 $ dodopath=$TESTTMP/d/dodo.py
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
995
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
996 $ echo "dodo = $dodopath" >> $HGRCPATH
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
997
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
998 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
999 $ hg help -e dodo
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1000 dodo extension -
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1001
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1002 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1003
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1004 list of commands:
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1005
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1006 dodo Does nothing
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1007 foofoo Writes 'Foo foo'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1008
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1009 (use 'hg help -v -e dodo' to show built-in aliases and global options)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1010
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1011 Make sure that '-v -e' prints list of built-in aliases along with
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1012 extension help itself
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1013 $ hg help -v -e dodo
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1014 dodo extension -
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1015
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1016 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1017
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1018 list of commands:
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1019
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1020 dodo Does nothing
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1021 foofoo Writes 'Foo foo'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1022
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1023 global options ([+] can be repeated):
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1024
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1025 -R --repository REPO repository root directory or name of overlay bundle
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1026 file
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1027 --cwd DIR change working directory
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1028 -y --noninteractive do not prompt, automatically pick the first choice for
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1029 all prompts
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1030 -q --quiet suppress output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1031 -v --verbose enable additional output
31104
8346b2f09e79 color: add the definition of '--color' in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30993
diff changeset
1032 --color TYPE when to colorize (boolean, always, auto, never, or
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31110
diff changeset
1033 debug)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1034 --config CONFIG [+] set/override config option (use 'section.name=value')
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1035 --debug enable debugging output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1036 --debugger start debugger
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1037 --encoding ENCODE set the charset encoding (default: ascii)
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1038 --encodingmode MODE set the charset encoding mode (default: strict)
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1039 --traceback always print a traceback on exception
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1040 --time time how long the command takes
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1041 --profile print command execution profile
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1042 --version output version information and exit
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1043 -h --help display help and exit
41010
e8e2a7656e83 help: hide default value for default-off flags
Martin von Zweigbergk <martinvonz@google.com>
parents: 41009
diff changeset
1044 --hidden consider hidden changesets
30993
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
1045 --pager TYPE when to paginate (boolean, always, auto, or never)
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
1046 (default: auto)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1047
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1048 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1049 $ hg help -v dodo
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1050 hg dodo
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1051
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1052 Does nothing
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1053
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1054 (use 'hg help -e dodo' to show help for the dodo extension)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1055
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1056 options:
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1057
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1058 --mq operate on patch repository
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1059
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1060 global options ([+] can be repeated):
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1061
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1062 -R --repository REPO repository root directory or name of overlay bundle
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1063 file
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1064 --cwd DIR change working directory
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1065 -y --noninteractive do not prompt, automatically pick the first choice for
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1066 all prompts
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1067 -q --quiet suppress output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1068 -v --verbose enable additional output
31104
8346b2f09e79 color: add the definition of '--color' in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30993
diff changeset
1069 --color TYPE when to colorize (boolean, always, auto, never, or
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31110
diff changeset
1070 debug)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1071 --config CONFIG [+] set/override config option (use 'section.name=value')
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1072 --debug enable debugging output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1073 --debugger start debugger
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1074 --encoding ENCODE set the charset encoding (default: ascii)
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1075 --encodingmode MODE set the charset encoding mode (default: strict)
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1076 --traceback always print a traceback on exception
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1077 --time time how long the command takes
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1078 --profile print command execution profile
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1079 --version output version information and exit
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1080 -h --help display help and exit
41010
e8e2a7656e83 help: hide default value for default-off flags
Martin von Zweigbergk <martinvonz@google.com>
parents: 41009
diff changeset
1081 --hidden consider hidden changesets
30993
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
1082 --pager TYPE when to paginate (boolean, always, auto, or never)
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
1083 (default: auto)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1084
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1085 In case when extension name doesn't match any of its commands,
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1086 help message should ask for '-v' to get list of built-in aliases
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1087 along with extension help
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1088 $ cat > $TESTTMP/d/dudu.py <<EOF
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1089 > """
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1090 > This is an awesome 'dudu' extension. It does something and
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1091 > also writes 'Beep beep'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1092 > """
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
1093 > from mercurial import commands, registrar
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1094 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
1095 > command = registrar.command(cmdtable)
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1096 > @command(b'something', [], b'hg something')
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1097 > def something(ui, *args, **kwargs):
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1098 > """Does something"""
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1099 > ui.write(b"I do something. Yaaay\\n")
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1100 > @command(b'beep', [], b'hg beep')
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1101 > def beep(ui, *args, **kwargs):
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1102 > """Writes 'Beep beep'"""
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1103 > ui.write(b"Beep beep\\n")
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1104 > EOF
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1105 $ dudupath=$TESTTMP/d/dudu.py
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1106
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1107 $ echo "dudu = $dudupath" >> $HGRCPATH
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1108
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1109 $ hg help -e dudu
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1110 dudu extension -
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1111
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1112 This is an awesome 'dudu' extension. It does something and also writes 'Beep
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1113 beep'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1114
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1115 list of commands:
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1116
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1117 beep Writes 'Beep beep'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1118 something Does something
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1119
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1120 (use 'hg help -v dudu' to show built-in aliases and global options)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1121
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1122 In case when extension name doesn't match any of its commands,
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1123 help options '-v' and '-v -e' should be equivalent
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1124 $ hg help -v dudu
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1125 dudu extension -
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1126
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1127 This is an awesome 'dudu' extension. It does something and also writes 'Beep
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1128 beep'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1129
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1130 list of commands:
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1131
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1132 beep Writes 'Beep beep'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1133 something Does something
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1134
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1135 global options ([+] can be repeated):
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1136
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1137 -R --repository REPO repository root directory or name of overlay bundle
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1138 file
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1139 --cwd DIR change working directory
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1140 -y --noninteractive do not prompt, automatically pick the first choice for
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1141 all prompts
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1142 -q --quiet suppress output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1143 -v --verbose enable additional output
31104
8346b2f09e79 color: add the definition of '--color' in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30993
diff changeset
1144 --color TYPE when to colorize (boolean, always, auto, never, or
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31110
diff changeset
1145 debug)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1146 --config CONFIG [+] set/override config option (use 'section.name=value')
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1147 --debug enable debugging output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1148 --debugger start debugger
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1149 --encoding ENCODE set the charset encoding (default: ascii)
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1150 --encodingmode MODE set the charset encoding mode (default: strict)
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1151 --traceback always print a traceback on exception
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1152 --time time how long the command takes
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1153 --profile print command execution profile
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1154 --version output version information and exit
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1155 -h --help display help and exit
41010
e8e2a7656e83 help: hide default value for default-off flags
Martin von Zweigbergk <martinvonz@google.com>
parents: 41009
diff changeset
1156 --hidden consider hidden changesets
30993
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
1157 --pager TYPE when to paginate (boolean, always, auto, or never)
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
1158 (default: auto)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1159
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1160 $ hg help -v -e dudu
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1161 dudu extension -
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1162
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1163 This is an awesome 'dudu' extension. It does something and also writes 'Beep
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1164 beep'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1165
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1166 list of commands:
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1167
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1168 beep Writes 'Beep beep'
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1169 something Does something
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1170
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1171 global options ([+] can be repeated):
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1172
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1173 -R --repository REPO repository root directory or name of overlay bundle
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1174 file
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1175 --cwd DIR change working directory
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1176 -y --noninteractive do not prompt, automatically pick the first choice for
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1177 all prompts
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1178 -q --quiet suppress output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1179 -v --verbose enable additional output
31104
8346b2f09e79 color: add the definition of '--color' in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30993
diff changeset
1180 --color TYPE when to colorize (boolean, always, auto, never, or
31123
df0a0734304a color: update main documentation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31110
diff changeset
1181 debug)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1182 --config CONFIG [+] set/override config option (use 'section.name=value')
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1183 --debug enable debugging output
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1184 --debugger start debugger
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1185 --encoding ENCODE set the charset encoding (default: ascii)
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1186 --encodingmode MODE set the charset encoding mode (default: strict)
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1187 --traceback always print a traceback on exception
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1188 --time time how long the command takes
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
1189 --profile print command execution profile
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1190 --version output version information and exit
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1191 -h --help display help and exit
41010
e8e2a7656e83 help: hide default value for default-off flags
Martin von Zweigbergk <martinvonz@google.com>
parents: 41009
diff changeset
1192 --hidden consider hidden changesets
30993
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
1193 --pager TYPE when to paginate (boolean, always, auto, or never)
9c2977ceaa46 pager: move more behavior into core
Augie Fackler <augie@google.com>
parents: 30771
diff changeset
1194 (default: auto)
23624
861ddedfb402 help: suggest '-v -e' to get built-in aliases for extensions (issue4461)
Chingis Dugarzhapov <chingis.dug@gmail.com>
parents: 23172
diff changeset
1195
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1196 Disabled extension commands:
10364
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
1197
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1198 $ ORGHGRCPATH=$HGRCPATH
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1199 $ HGRCPATH=
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1200 $ export HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1201 $ hg help email
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1202 'email' is provided by the following extension:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1203
15861
ee8f5e4ce7b8 minirst: simplify and standardize field list formatting
Olav Reinert <seroton10@gmail.com>
parents: 15447
diff changeset
1204 patchbomb command to send changesets as (a series of) patch emails
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1205
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1206 (use 'hg help extensions' for information on enabling extensions)
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1207
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1208
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1209 $ hg qdel
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1210 hg: unknown command 'qdel'
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1211 'qdelete' is provided by the following extension:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1212
15861
ee8f5e4ce7b8 minirst: simplify and standardize field list formatting
Olav Reinert <seroton10@gmail.com>
parents: 15447
diff changeset
1213 mq manage a stack of patches
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1214
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1215 (use 'hg help extensions' for information on enabling extensions)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12191
diff changeset
1216 [255]
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1217
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1218
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1219 $ hg churn
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1220 hg: unknown command 'churn'
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1221 'churn' is provided by the following extension:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1222
15861
ee8f5e4ce7b8 minirst: simplify and standardize field list formatting
Olav Reinert <seroton10@gmail.com>
parents: 15447
diff changeset
1223 churn command to display statistics about repository history
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1224
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1225 (use 'hg help extensions' for information on enabling extensions)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12191
diff changeset
1226 [255]
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1227
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1228
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1229
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1230 Disabled extensions:
10364
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
1231
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1232 $ hg help churn
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1233 churn extension - command to display statistics about repository history
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1234
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1235 (use 'hg help extensions' for information on enabling extensions)
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1236
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1237 $ hg help patchbomb
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1238 patchbomb extension - command to send changesets as (a series of) patch emails
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1239
30306
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1240 The series is started off with a "[PATCH 0 of N]" introduction, which
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1241 describes the series as a whole.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1242
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1243 Each patch email has a Subject line of "[PATCH M of N] ...", using the first
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1244 line of the changeset description as the subject text. The message contains
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1245 two or three body parts:
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1246
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1247 - The changeset description.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1248 - [Optional] The result of running diffstat on the patch.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1249 - The patch itself, as generated by 'hg export'.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1250
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1251 Each message refers to the first in the series using the In-Reply-To and
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1252 References headers, so they will show up as a sequence in threaded mail and
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1253 news readers, and in mail archives.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1254
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1255 To configure other defaults, add a section like this to your configuration
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1256 file:
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1257
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1258 [email]
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1259 from = My Name <my@email>
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1260 to = recipient1, recipient2, ...
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1261 cc = cc1, cc2, ...
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1262 bcc = bcc1, bcc2, ...
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1263 reply-to = address1, address2, ...
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1264
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1265 Use "[patchbomb]" as configuration section name if you need to override global
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1266 "[email]" address settings.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1267
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1268 Then you can use the 'hg email' command to mail a series of changesets as a
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1269 patchbomb.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1270
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1271 You can also either configure the method option in the email section to be a
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1272 sendmail compatible mailer or fill out the [smtp] section so that the
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1273 patchbomb extension can automatically send patchbombs directly from the
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1274 commandline. See the [email] and [smtp] sections in hgrc(5) for details.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1275
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1276 By default, 'hg email' will prompt for a "To" or "CC" header if you do not
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1277 supply one via configuration or the command line. You can override this to
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1278 never prompt by configuring an empty value:
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1279
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1280 [email]
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1281 cc =
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1282
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1283 You can control the default inclusion of an introduction message with the
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1284 "patchbomb.intro" configuration option. The configuration is always
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1285 overwritten by command line flags like --intro and --desc:
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1286
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1287 [patchbomb]
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1288 intro=auto # include introduction message if more than 1 patch (default)
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1289 intro=never # never include an introduction message
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1290 intro=always # always include an introduction message
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1291
31187
6b8e1a08ef1d patchbomb: add config knob to generate flags by template (issue5354)
Yuya Nishihara <yuya@tcha.org>
parents: 31123
diff changeset
1292 You can specify a template for flags to be added in subject prefixes. Flags
6b8e1a08ef1d patchbomb: add config knob to generate flags by template (issue5354)
Yuya Nishihara <yuya@tcha.org>
parents: 31123
diff changeset
1293 specified by --flag option are exported as "{flags}" keyword:
6b8e1a08ef1d patchbomb: add config knob to generate flags by template (issue5354)
Yuya Nishihara <yuya@tcha.org>
parents: 31123
diff changeset
1294
6b8e1a08ef1d patchbomb: add config knob to generate flags by template (issue5354)
Yuya Nishihara <yuya@tcha.org>
parents: 31123
diff changeset
1295 [patchbomb]
6b8e1a08ef1d patchbomb: add config knob to generate flags by template (issue5354)
Yuya Nishihara <yuya@tcha.org>
parents: 31123
diff changeset
1296 flagtemplate = "{separate(' ',
6b8e1a08ef1d patchbomb: add config knob to generate flags by template (issue5354)
Yuya Nishihara <yuya@tcha.org>
parents: 31123
diff changeset
1297 ifeq(branch, 'default', '', branch|upper),
6b8e1a08ef1d patchbomb: add config knob to generate flags by template (issue5354)
Yuya Nishihara <yuya@tcha.org>
parents: 31123
diff changeset
1298 flags)}"
6b8e1a08ef1d patchbomb: add config knob to generate flags by template (issue5354)
Yuya Nishihara <yuya@tcha.org>
parents: 31123
diff changeset
1299
30306
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1300 You can set patchbomb to always ask for confirmation by setting
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1301 "patchbomb.confirm" to true.
5581b294f3c6 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30152
diff changeset
1302
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1303 (use 'hg help extensions' for information on enabling extensions)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1304
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1305
47851
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1306 Help can find unimported extensions
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1307 -----------------------------------
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1308
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1309 XXX-PYOXIDIZER since the frozen binary does not have source directory tree,
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1310 this make the checking for actual file under `hgext` a bit complicated. In
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1311 addition these tests do some strange dance to ensure some other module are the
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1312 first in `sys.path` (since the current install path is always in front
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1313 otherwise) that are fragile and that does not match reality in the field. So
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1314 for now we disable this test untill a deeper rework of that logic is done.
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1315
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1316 #if no-pyoxidizer
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1317
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1318 Broken disabled extension and command:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1319
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1320 $ mkdir hgext
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1321 $ echo > hgext/__init__.py
40205
89ba51c3e4f1 tests: use NO_CHECK_EOF for fragments having intentional error
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40184
diff changeset
1322 $ cat > hgext/broken.py <<NO_CHECK_EOF
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1323 > "broken extension'
40205
89ba51c3e4f1 tests: use NO_CHECK_EOF for fragments having intentional error
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40184
diff changeset
1324 > NO_CHECK_EOF
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1325 $ cat > path.py <<EOF
40369
ef6cab7930b3 py3: fix module imports in tests, as flagged by test-check-module-imports.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 40263
diff changeset
1326 > import os
ef6cab7930b3 py3: fix module imports in tests, as flagged by test-check-module-imports.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 40263
diff changeset
1327 > import sys
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1328 > sys.path.insert(0, os.environ['HGEXTPATH'])
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1329 > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1330 $ HGEXTPATH=`pwd`
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1331 $ export HGEXTPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1332
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1333 $ hg --config extensions.path=./path.py help broken
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1334 broken extension - (no help text available)
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1335
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29885
diff changeset
1336 (use 'hg help extensions' for information on enabling extensions)
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
1337
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1338
13191
1aea66b71f4f extensions: warn about invalid extensions when listing disabled commands
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
1339 $ cat > hgext/forest.py <<EOF
1aea66b71f4f extensions: warn about invalid extensions when listing disabled commands
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
1340 > cmdtable = None
38162
bdf344aea0ee extensions: peek command table of disabled extensions without importing
Yuya Nishihara <yuya@tcha.org>
parents: 38018
diff changeset
1341 > @command()
bdf344aea0ee extensions: peek command table of disabled extensions without importing
Yuya Nishihara <yuya@tcha.org>
parents: 38018
diff changeset
1342 > def f():
bdf344aea0ee extensions: peek command table of disabled extensions without importing
Yuya Nishihara <yuya@tcha.org>
parents: 38018
diff changeset
1343 > pass
bdf344aea0ee extensions: peek command table of disabled extensions without importing
Yuya Nishihara <yuya@tcha.org>
parents: 38018
diff changeset
1344 > @command(123)
bdf344aea0ee extensions: peek command table of disabled extensions without importing
Yuya Nishihara <yuya@tcha.org>
parents: 38018
diff changeset
1345 > def g():
bdf344aea0ee extensions: peek command table of disabled extensions without importing
Yuya Nishihara <yuya@tcha.org>
parents: 38018
diff changeset
1346 > pass
13191
1aea66b71f4f extensions: warn about invalid extensions when listing disabled commands
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
1347 > EOF
39221
d7ac6dafc609 tests: drop an unnecessary redirect to /dev/null
Matt Harbison <matt_harbison@yahoo.com>
parents: 39190
diff changeset
1348 $ hg --config extensions.path=./path.py help foo
d7ac6dafc609 tests: drop an unnecessary redirect to /dev/null
Matt Harbison <matt_harbison@yahoo.com>
parents: 39190
diff changeset
1349 abort: no such help topic: foo
d7ac6dafc609 tests: drop an unnecessary redirect to /dev/null
Matt Harbison <matt_harbison@yahoo.com>
parents: 39190
diff changeset
1350 (try 'hg help --keyword foo')
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12191
diff changeset
1351 [255]
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1352
47851
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1353 #endif
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1354
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1355 ---
d88f4231712c pyoxidizer: disable the test for disabled & broken extensions help
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47832
diff changeset
1356
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1357 $ cat > throw.py <<EOF
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
1358 > from mercurial import commands, registrar, util
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1359 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31187
diff changeset
1360 > command = registrar.command(cmdtable)
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1361 > class Bogon(Exception): pass
45947
3db545fccac1 extensions: avoid a crash when the version isn't properly byteified on py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 45008
diff changeset
1362 > # NB: version should be bytes; simulating extension not ported to py3
3db545fccac1 extensions: avoid a crash when the version isn't properly byteified on py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 45008
diff changeset
1363 > __version__ = '1.0.0'
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1364 > @command(b'throw', [], b'hg throw', norepo=True)
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1365 > def throw(ui, **opts):
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1366 > """throws an exception"""
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1367 > raise Bogon()
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1368 > EOF
23869
d9967b82394a test-extension: improve test readability
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23624
diff changeset
1369
45947
3db545fccac1 extensions: avoid a crash when the version isn't properly byteified on py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 45008
diff changeset
1370 Test extension without proper byteification of key attributes doesn't crash when
3db545fccac1 extensions: avoid a crash when the version isn't properly byteified on py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 45008
diff changeset
1371 accessed.
3db545fccac1 extensions: avoid a crash when the version isn't properly byteified on py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 45008
diff changeset
1372
3db545fccac1 extensions: avoid a crash when the version isn't properly byteified on py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 45008
diff changeset
1373 $ hg version -v --config extensions.throw=throw.py | grep '^ '
3db545fccac1 extensions: avoid a crash when the version isn't properly byteified on py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 45008
diff changeset
1374 throw external 1.0.0
3db545fccac1 extensions: avoid a crash when the version isn't properly byteified on py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 45008
diff changeset
1375
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1376 No declared supported version, extension complains:
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1377 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1378 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1379 ** which supports versions unknown of Mercurial.
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1380 ** Please disable "throw" and try your action again.
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1381 ** If that fixes the bug please report it to the extension author.
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1382 ** Python * (glob)
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1383 ** Mercurial Distributed SCM * (glob)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1384 ** Extensions loaded: throw 1.0.0
23869
d9967b82394a test-extension: improve test readability
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23624
diff changeset
1385
45948
250e18437e30 tests: add a comment that we're purposely testing py2 extension attributes
Matt Harbison <matt_harbison@yahoo.com>
parents: 45947
diff changeset
1386 empty declaration of supported version, extension complains (but doesn't choke if
250e18437e30 tests: add a comment that we're purposely testing py2 extension attributes
Matt Harbison <matt_harbison@yahoo.com>
parents: 45947
diff changeset
1387 the value is improperly a str instead of bytes):
18224
0f9013112eba dispatch: handle empty `testedwith` value in extension
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 17837
diff changeset
1388 $ echo "testedwith = ''" >> throw.py
0f9013112eba dispatch: handle empty `testedwith` value in extension
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 17837
diff changeset
1389 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1390 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
18224
0f9013112eba dispatch: handle empty `testedwith` value in extension
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 17837
diff changeset
1391 ** which supports versions unknown of Mercurial.
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1392 ** Please disable "throw" and try your action again.
18224
0f9013112eba dispatch: handle empty `testedwith` value in extension
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 17837
diff changeset
1393 ** If that fixes the bug please report it to the extension author.
0f9013112eba dispatch: handle empty `testedwith` value in extension
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 17837
diff changeset
1394 ** Python * (glob)
0f9013112eba dispatch: handle empty `testedwith` value in extension
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 17837
diff changeset
1395 ** Mercurial Distributed SCM (*) (glob)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1396 ** Extensions loaded: throw 1.0.0
23869
d9967b82394a test-extension: improve test readability
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23624
diff changeset
1397
45948
250e18437e30 tests: add a comment that we're purposely testing py2 extension attributes
Matt Harbison <matt_harbison@yahoo.com>
parents: 45947
diff changeset
1398 If the extension specifies a buglink, show that (but don't choke if the value is
250e18437e30 tests: add a comment that we're purposely testing py2 extension attributes
Matt Harbison <matt_harbison@yahoo.com>
parents: 45947
diff changeset
1399 improperly a str instead of bytes):
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1400 $ echo 'buglink = "http://example.com/bts"' >> throw.py
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1401 $ rm -f throw.pyc throw.pyo
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33623
diff changeset
1402 $ rm -Rf __pycache__
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1403 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1404 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1405 ** which supports versions unknown of Mercurial.
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1406 ** Please disable "throw" and try your action again.
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1407 ** If that fixes the bug please report it to http://example.com/bts
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1408 ** Python * (glob)
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1409 ** Mercurial Distributed SCM (*) (glob)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1410 ** Extensions loaded: throw 1.0.0
23869
d9967b82394a test-extension: improve test readability
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23624
diff changeset
1411
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1412 If the extensions declare outdated versions, accuse the older extension first:
17227
7af38fe1f829 test-extension.t: use fixed version string instead of current tag
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17014
diff changeset
1413 $ echo "from mercurial import util" >> older.py
38018
a9ffb4a577d0 py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37977
diff changeset
1414 $ echo "util.version = lambda:b'2.2'" >> older.py
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1415 $ echo "testedwith = b'1.9.3'" >> older.py
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1416 $ echo "testedwith = b'2.1.1'" >> throw.py
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1417 $ rm -f throw.pyc throw.pyo
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33623
diff changeset
1418 $ rm -Rf __pycache__
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1419 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1420 > throw 2>&1 | egrep '^\*\*'
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1421 ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A)
23871
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1422 ** which supports versions 1.9 of Mercurial.
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1423 ** Please disable "older" and try your action again.
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1424 ** If that fixes the bug please report it to the extension author.
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1425 ** Python * (glob)
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1426 ** Mercurial Distributed SCM (version 2.2)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1427 ** Extensions loaded: older, throw 1.0.0
23869
d9967b82394a test-extension: improve test readability
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23624
diff changeset
1428
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1429 One extension only tested with older, one only with newer versions:
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1430 $ echo "util.version = lambda:b'2.1'" >> older.py
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1431 $ rm -f older.pyc older.pyo
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33623
diff changeset
1432 $ rm -Rf __pycache__
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1433 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1434 > throw 2>&1 | egrep '^\*\*'
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1435 ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A)
23871
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1436 ** which supports versions 1.9 of Mercurial.
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1437 ** Please disable "older" and try your action again.
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1438 ** If that fixes the bug please report it to the extension author.
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1439 ** Python * (glob)
23870
9070e20057ae test-extension: use a realistic Mercurial version
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23869
diff changeset
1440 ** Mercurial Distributed SCM (version 2.1)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1441 ** Extensions loaded: older, throw 1.0.0
23869
d9967b82394a test-extension: improve test readability
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23624
diff changeset
1442
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1443 Older extension is tested with current version, the other only with newer:
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1444 $ echo "util.version = lambda:b'1.9.3'" >> older.py
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1445 $ rm -f older.pyc older.pyo
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33623
diff changeset
1446 $ rm -Rf __pycache__
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1447 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1448 > throw 2>&1 | egrep '^\*\*'
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1449 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
23871
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1450 ** which supports versions 2.1 of Mercurial.
45952
a2104b9b1787 dispatch: quote the extension when printing the bug report
Matt Harbison <matt_harbison@yahoo.com>
parents: 45951
diff changeset
1451 ** Please disable "throw" and try your action again.
17228
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1452 ** If that fixes the bug please report it to http://example.com/bts
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1453 ** Python * (glob)
d1b49b02bc16 dispatch: fix traceback when extension was tested with newer versions only
Thomas Arendsen Hein <thomas@intevation.de>
parents: 17227
diff changeset
1454 ** Mercurial Distributed SCM (version 1.9.3)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1455 ** Extensions loaded: older, throw 1.0.0
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1456
26263
bf2bfc6f45fb traceback: allow providing a local support contact point
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26228
diff changeset
1457 Ability to point to a different point
bf2bfc6f45fb traceback: allow providing a local support contact point
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26228
diff changeset
1458 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
bf2bfc6f45fb traceback: allow providing a local support contact point
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26228
diff changeset
1459 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
bf2bfc6f45fb traceback: allow providing a local support contact point
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26228
diff changeset
1460 ** unknown exception encountered, please report by visiting
bf2bfc6f45fb traceback: allow providing a local support contact point
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26228
diff changeset
1461 ** Your Local Goat Lenders
bf2bfc6f45fb traceback: allow providing a local support contact point
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26228
diff changeset
1462 ** Python * (glob)
bf2bfc6f45fb traceback: allow providing a local support contact point
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26228
diff changeset
1463 ** Mercurial Distributed SCM (*) (glob)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1464 ** Extensions loaded: older, throw 1.0.0
26263
bf2bfc6f45fb traceback: allow providing a local support contact point
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26228
diff changeset
1465
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1466 Declare the version as supporting this hg version, show regular bts link:
29198
a3e5e1fb257c tests: use debuginstall to retrieve hg version
timeless <timeless@mozdev.org>
parents: 28623
diff changeset
1467 $ hgver=`hg debuginstall -T '{hgver}'`
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1468 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
24257
31e9f66863f3 test: make version based test-extensions failure more explanatory
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24124
diff changeset
1469 $ if [ -z "$hgver" ]; then
31e9f66863f3 test: make version based test-extensions failure more explanatory
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24124
diff changeset
1470 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
31e9f66863f3 test: make version based test-extensions failure more explanatory
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24124
diff changeset
1471 > fi
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1472 $ rm -f throw.pyc throw.pyo
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33623
diff changeset
1473 $ rm -Rf __pycache__
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1474 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1475 ** unknown exception encountered, please report by visiting
26421
4b0fc75f9403 urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents: 26351
diff changeset
1476 ** https://mercurial-scm.org/wiki/BugTracker
16744
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1477 ** Python * (glob)
1c9f58a6c8f1 dispatch: try and identify third-party extensions as sources of tracebacks
Augie Fackler <raf@durin42.com>
parents: 16242
diff changeset
1478 ** Mercurial Distributed SCM (*) (glob)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1479 ** Extensions loaded: throw 1.0.0
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1480
23871
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1481 Patch version is ignored during compatibility check
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1482 $ echo "testedwith = b'3.2'" >> throw.py
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1483 $ echo "util.version = lambda:b'3.2.2'" >> throw.py
23871
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1484 $ rm -f throw.pyc throw.pyo
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33623
diff changeset
1485 $ rm -Rf __pycache__
23871
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1486 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1487 ** unknown exception encountered, please report by visiting
26421
4b0fc75f9403 urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents: 26351
diff changeset
1488 ** https://mercurial-scm.org/wiki/BugTracker
23871
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1489 ** Python * (glob)
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1490 ** Mercurial Distributed SCM (*) (glob)
45954
a120d1c9c704 dispatch: print the version of each extension in the bug report, if available
Matt Harbison <matt_harbison@yahoo.com>
parents: 45953
diff changeset
1491 ** Extensions loaded: throw 1.0.0
23871
b2d8f3685b06 dispatch: only check compatibility against major and minor versions (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23870
diff changeset
1492
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1493 Test version number support in 'hg version':
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1494 $ echo '__version__ = (1, 2, 3)' >> throw.py
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1495 $ rm -f throw.pyc throw.pyo
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33623
diff changeset
1496 $ rm -Rf __pycache__
21937
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1497 $ hg version -v
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1498 Mercurial Distributed SCM (version *) (glob)
26421
4b0fc75f9403 urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents: 26351
diff changeset
1499 (see https://mercurial-scm.org for more information)
21937
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1500
46819
d4ba4d51f85f contributor: change mentions of mpm to olivia
Raphaël Gomès <rgomes@octobus.net>
parents: 46262
diff changeset
1501 Copyright (C) 2005-* Olivia Mackall and others (glob)
21937
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1502 This is free software; see the source for copying conditions. There is NO
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1503 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1504
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1505 Enabled extensions:
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1506
54ff2789d75e version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents: 21849
diff changeset
1507
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1508 $ hg version -v --config extensions.throw=throw.py
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1509 Mercurial Distributed SCM (version *) (glob)
26421
4b0fc75f9403 urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents: 26351
diff changeset
1510 (see https://mercurial-scm.org for more information)
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1511
46819
d4ba4d51f85f contributor: change mentions of mpm to olivia
Raphaël Gomès <rgomes@octobus.net>
parents: 46262
diff changeset
1512 Copyright (C) 2005-* Olivia Mackall and others (glob)
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1513 This is free software; see the source for copying conditions. There is NO
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1514 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1515
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1516 Enabled extensions:
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1517
27990
96bfd2875213 version: verbose list internal and external extension source (issue4731)
liscju <piotr.listkiewicz@gmail.com>
parents: 27729
diff changeset
1518 throw external 1.2.3
38018
a9ffb4a577d0 py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37977
diff changeset
1519 $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1520 $ rm -f throw.pyc throw.pyo
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33623
diff changeset
1521 $ rm -Rf __pycache__
29839
110ed1868f86 version: factor out mapping of internal/external labels
Yuya Nishihara <yuya@tcha.org>
parents: 29838
diff changeset
1522 $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1523 Mercurial Distributed SCM (version *) (glob)
26421
4b0fc75f9403 urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents: 26351
diff changeset
1524 (see https://mercurial-scm.org for more information)
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1525
46819
d4ba4d51f85f contributor: change mentions of mpm to olivia
Raphaël Gomès <rgomes@octobus.net>
parents: 46262
diff changeset
1526 Copyright (C) 2005-* Olivia Mackall and others (glob)
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1527 This is free software; see the source for copying conditions. There is NO
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1528 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1529
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1530 Enabled extensions:
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1531
45008
e1ea913da2ed version: sort extensions by name in verbose mode
Matt Harbison <matt_harbison@yahoo.com>
parents: 44987
diff changeset
1532 strip internal
27990
96bfd2875213 version: verbose list internal and external extension source (issue4731)
liscju <piotr.listkiewicz@gmail.com>
parents: 27729
diff changeset
1533 throw external 1.twentythree
21849
a3306b8cdc0f test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler <raf@durin42.com>
parents: 21773
diff changeset
1534
29838
8540133f91a1 version: always build list of extension versions
Yuya Nishihara <yuya@tcha.org>
parents: 29736
diff changeset
1535 $ hg version -q --config extensions.throw=throw.py
8540133f91a1 version: always build list of extension versions
Yuya Nishihara <yuya@tcha.org>
parents: 29736
diff changeset
1536 Mercurial Distributed SCM (version *) (glob)
8540133f91a1 version: always build list of extension versions
Yuya Nishihara <yuya@tcha.org>
parents: 29736
diff changeset
1537
37500
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37342
diff changeset
1538 Test template output:
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37342
diff changeset
1539
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37342
diff changeset
1540 $ hg version --config extensions.strip= -T'{extensions}'
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37342
diff changeset
1541 strip
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37342
diff changeset
1542
29840
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1543 Test JSON output of version:
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1544
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1545 $ hg version -Tjson
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1546 [
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1547 {
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1548 "extensions": [],
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1549 "ver": "*" (glob)
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1550 }
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1551 ]
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1552
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1553 $ hg version --config extensions.throw=throw.py -Tjson
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1554 [
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1555 {
29885
42751543fa06 version: change "place" field of extension to "bundled" flag
Yuya Nishihara <yuya@tcha.org>
parents: 29869
diff changeset
1556 "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}],
29840
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1557 "ver": "3.2.2"
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1558 }
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1559 ]
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1560
29885
42751543fa06 version: change "place" field of extension to "bundled" flag
Yuya Nishihara <yuya@tcha.org>
parents: 29869
diff changeset
1561 $ hg version --config extensions.strip= -Tjson
29840
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1562 [
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1563 {
29885
42751543fa06 version: change "place" field of extension to "bundled" flag
Yuya Nishihara <yuya@tcha.org>
parents: 29869
diff changeset
1564 "extensions": [{"bundled": true, "name": "strip", "ver": null}],
29840
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1565 "ver": "*" (glob)
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1566 }
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1567 ]
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1568
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1569 Test template output of version:
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1570
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1571 $ hg version --config extensions.throw=throw.py --config extensions.strip= \
29885
42751543fa06 version: change "place" field of extension to "bundled" flag
Yuya Nishihara <yuya@tcha.org>
parents: 29869
diff changeset
1572 > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}'
45008
e1ea913da2ed version: sort extensions by name in verbose mode
Matt Harbison <matt_harbison@yahoo.com>
parents: 44987
diff changeset
1573 strip (internal)
29840
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1574 throw 1.twentythree (external)
4435d4c951ec version: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29839
diff changeset
1575
27142
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1576 Refuse to load extensions with minimum version requirements
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1577
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1578 $ cat > minversion1.py << EOF
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1579 > from mercurial import util
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1580 > util.version = lambda: b'3.5.2'
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1581 > minimumhgversion = b'3.6'
27142
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1582 > EOF
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1583 $ hg --config extensions.minversion=minversion1.py version
40463
cfa564037789 extensions: include current version in "invalid version" message
Boris Feld <boris.feld@octobus.net>
parents: 40369
diff changeset
1584 (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling)
27142
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1585 Mercurial Distributed SCM (version 3.5.2)
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1586 (see https://mercurial-scm.org for more information)
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1587
46819
d4ba4d51f85f contributor: change mentions of mpm to olivia
Raphaël Gomès <rgomes@octobus.net>
parents: 46262
diff changeset
1588 Copyright (C) 2005-* Olivia Mackall and others (glob)
27142
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1589 This is free software; see the source for copying conditions. There is NO
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1590 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1591
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1592 $ cat > minversion2.py << EOF
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1593 > from mercurial import util
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1594 > util.version = lambda: b'3.6'
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1595 > minimumhgversion = b'3.7'
27142
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1596 > EOF
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1597 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
40463
cfa564037789 extensions: include current version in "invalid version" message
Boris Feld <boris.feld@octobus.net>
parents: 40369
diff changeset
1598 (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling)
27142
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1599
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1600 Can load version that is only off by point release
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1601
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1602 $ cat > minversion2.py << EOF
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1603 > from mercurial import util
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1604 > util.version = lambda: b'3.6.1'
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1605 > minimumhgversion = b'3.6'
27142
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1606 > EOF
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1607 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1608 [1]
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1609
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1610 Can load minimum version identical to current
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1611
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1612 $ cat > minversion3.py << EOF
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1613 > from mercurial import util
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1614 > util.version = lambda: b'3.5'
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1615 > minimumhgversion = b'3.5'
27142
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1616 > EOF
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1617 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1618 [1]
060f83d219b9 extensions: refuse to load extensions if minimum hg version not met
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26421
diff changeset
1619
48016
5caec48d9a01 extensions: prevent a crash on py3 with a `minimumhgversion` str value
Matt Harbison <matt_harbison@yahoo.com>
parents: 48015
diff changeset
1620 Don't explode on py3 with a bad version number (both str vs bytes, and not enough
5caec48d9a01 extensions: prevent a crash on py3 with a `minimumhgversion` str value
Matt Harbison <matt_harbison@yahoo.com>
parents: 48015
diff changeset
1621 parts)
48015
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1622
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1623 $ cat > minversion4.py << EOF
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1624 > from mercurial import util
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1625 > util.version = lambda: b'3.5'
48016
5caec48d9a01 extensions: prevent a crash on py3 with a `minimumhgversion` str value
Matt Harbison <matt_harbison@yahoo.com>
parents: 48015
diff changeset
1626 > minimumhgversion = '3'
48015
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1627 > EOF
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1628 $ hg --config extensions.minversion=minversion4.py version -v
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1629 Mercurial Distributed SCM (version 3.5)
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1630 (see https://mercurial-scm.org for more information)
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1631
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1632 Copyright (C) 2005-* Olivia Mackall and others (glob)
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1633 This is free software; see the source for copying conditions. There is NO
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1634 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1635
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1636 Enabled extensions:
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1637
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1638 minversion external
a9bedc56f025 extensions: prevent a crash on py3 when testing a bad extension minimum
Matt Harbison <matt_harbison@yahoo.com>
parents: 47851
diff changeset
1639
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1640 Restore HGRCPATH
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1641
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1642 $ HGRCPATH=$ORGHGRCPATH
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1643 $ export HGRCPATH
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1644
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1645 Commands handling multiple repositories at a time should invoke only
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1646 "reposetup()" of extensions enabling in the target repository.
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1647
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1648 $ mkdir reposetup-test
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1649 $ cd reposetup-test
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1650
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1651 $ cat > $TESTTMP/reposetuptest.py <<EOF
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1652 > from mercurial import extensions
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1653 > def reposetup(ui, repo):
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1654 > ui.write(b'reposetup() for %s\n' % (repo.root))
28612
6fb1d3c936d2 tests: explicitly flush output streams
Jun Wu <quark@fb.com>
parents: 27990
diff changeset
1655 > ui.flush()
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1656 > EOF
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1657 $ hg init src
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1658 $ echo a > src/a
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1659 $ hg -R src commit -Am '#0 at src/a'
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1660 adding a
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1661 $ echo '[extensions]' >> src/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1662 $ echo '# enable extension locally' >> src/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1663 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1664 $ hg -R src status
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1665 reposetup() for $TESTTMP/reposetup-test/src
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1666 reposetup() for $TESTTMP/reposetup-test/src (chg !)
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1667
39112
f2e645dc6a67 tests: conditionalize extension tests for extra extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 38787
diff changeset
1668 #if no-extraextensions
37977
8ba0344f9fb1 debugextensions: process extensions loaded from the local repository too
Matt Harbison <matt_harbison@yahoo.com>
parents: 37957
diff changeset
1669 $ hg --cwd src debugextensions
8ba0344f9fb1 debugextensions: process extensions loaded from the local repository too
Matt Harbison <matt_harbison@yahoo.com>
parents: 37957
diff changeset
1670 reposetup() for $TESTTMP/reposetup-test/src
8ba0344f9fb1 debugextensions: process extensions loaded from the local repository too
Matt Harbison <matt_harbison@yahoo.com>
parents: 37957
diff changeset
1671 dodo (untested!)
8ba0344f9fb1 debugextensions: process extensions loaded from the local repository too
Matt Harbison <matt_harbison@yahoo.com>
parents: 37957
diff changeset
1672 dudu (untested!)
8ba0344f9fb1 debugextensions: process extensions loaded from the local repository too
Matt Harbison <matt_harbison@yahoo.com>
parents: 37957
diff changeset
1673 mq
8ba0344f9fb1 debugextensions: process extensions loaded from the local repository too
Matt Harbison <matt_harbison@yahoo.com>
parents: 37957
diff changeset
1674 reposetuptest (untested!)
8ba0344f9fb1 debugextensions: process extensions loaded from the local repository too
Matt Harbison <matt_harbison@yahoo.com>
parents: 37957
diff changeset
1675 strip
39112
f2e645dc6a67 tests: conditionalize extension tests for extra extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 38787
diff changeset
1676 #endif
37977
8ba0344f9fb1 debugextensions: process extensions loaded from the local repository too
Matt Harbison <matt_harbison@yahoo.com>
parents: 37957
diff changeset
1677
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1678 $ hg clone -U src clone-dst1
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1679 reposetup() for $TESTTMP/reposetup-test/src
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1680 $ hg init push-dst1
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1681 $ hg -q -R src push push-dst1
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1682 reposetup() for $TESTTMP/reposetup-test/src
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1683 $ hg init pull-src1
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1684 $ hg -q -R pull-src1 pull src
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1685 reposetup() for $TESTTMP/reposetup-test/src
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1686
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1687 $ cat <<EOF >> $HGRCPATH
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1688 > [extensions]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1689 > # disable extension globally and explicitly
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1690 > reposetuptest = !
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1691 > EOF
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1692 $ hg clone -U src clone-dst2
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1693 reposetup() for $TESTTMP/reposetup-test/src
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1694 $ hg init push-dst2
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1695 $ hg -q -R src push push-dst2
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1696 reposetup() for $TESTTMP/reposetup-test/src
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1697 $ hg init pull-src2
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1698 $ hg -q -R pull-src2 pull src
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1699 reposetup() for $TESTTMP/reposetup-test/src
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1700
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1701 $ cat <<EOF >> $HGRCPATH
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1702 > [extensions]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1703 > # enable extension globally
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1704 > reposetuptest = $TESTTMP/reposetuptest.py
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1705 > EOF
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1706 $ hg clone -U src clone-dst3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1707 reposetup() for $TESTTMP/reposetup-test/src
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1708 reposetup() for $TESTTMP/reposetup-test/clone-dst3
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1709 $ hg init push-dst3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1710 reposetup() for $TESTTMP/reposetup-test/push-dst3
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1711 $ hg -q -R src push push-dst3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1712 reposetup() for $TESTTMP/reposetup-test/src
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1713 reposetup() for $TESTTMP/reposetup-test/push-dst3
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1714 $ hg init pull-src3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1715 reposetup() for $TESTTMP/reposetup-test/pull-src3
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1716 $ hg -q -R pull-src3 pull src
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1717 reposetup() for $TESTTMP/reposetup-test/pull-src3
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1718 reposetup() for $TESTTMP/reposetup-test/src
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1719
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1720 $ echo '[extensions]' >> src/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1721 $ echo '# disable extension locally' >> src/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1722 $ echo 'reposetuptest = !' >> src/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1723 $ hg clone -U src clone-dst4
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1724 reposetup() for $TESTTMP/reposetup-test/clone-dst4
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1725 $ hg init push-dst4
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1726 reposetup() for $TESTTMP/reposetup-test/push-dst4
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1727 $ hg -q -R src push push-dst4
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1728 reposetup() for $TESTTMP/reposetup-test/push-dst4
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1729 $ hg init pull-src4
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1730 reposetup() for $TESTTMP/reposetup-test/pull-src4
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1731 $ hg -q -R pull-src4 pull src
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1732 reposetup() for $TESTTMP/reposetup-test/pull-src4
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1733
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1734 disabling in command line overlays with all configuration
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1735 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1736 $ hg --config extensions.reposetuptest=! init push-dst5
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1737 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1738 $ hg --config extensions.reposetuptest=! init pull-src5
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1739 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1740
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1741 $ cat <<EOF >> $HGRCPATH
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1742 > [extensions]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1743 > # disable extension globally and explicitly
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1744 > reposetuptest = !
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23151
diff changeset
1745 > EOF
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1746 $ hg init parent
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1747 $ hg init parent/sub1
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1748 $ echo 1 > parent/sub1/1
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1749 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1750 adding 1
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1751 $ hg init parent/sub2
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1752 $ hg init parent/sub2/sub21
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1753 $ echo 21 > parent/sub2/sub21/21
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1754 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1755 adding 21
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1756 $ cat > parent/sub2/.hgsub <<EOF
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1757 > sub21 = sub21
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1758 > EOF
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1759 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1760 adding .hgsub
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1761 $ hg init parent/sub3
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1762 $ echo 3 > parent/sub3/3
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1763 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1764 adding 3
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1765 $ cat > parent/.hgsub <<EOF
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1766 > sub1 = sub1
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1767 > sub2 = sub2
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1768 > sub3 = sub3
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1769 > EOF
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1770 $ hg -R parent commit -Am '#0 at parent'
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1771 adding .hgsub
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1772 $ echo '[extensions]' >> parent/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1773 $ echo '# enable extension locally' >> parent/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1774 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1775 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1776 $ hg -R parent status -S -A
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1777 reposetup() for $TESTTMP/reposetup-test/parent
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34948
diff changeset
1778 reposetup() for $TESTTMP/reposetup-test/parent/sub2
19777
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1779 C .hgsub
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1780 C .hgsubstate
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1781 C sub1/1
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1782 C sub2/.hgsub
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1783 C sub2/.hgsubstate
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1784 C sub2/sub21/21
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1785 C sub3/3
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1786
6f72e7d28b35 extensions: list up only enabled extensions, if "ui" is specified
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18748
diff changeset
1787 $ cd ..
24124
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1788
32342
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1789 Prohibit registration of commands that don't use @command (issue5137)
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1790
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1791 $ hg init deprecated
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1792 $ cd deprecated
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1793
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1794 $ cat <<EOF > deprecatedcmd.py
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1795 > def deprecatedcmd(repo, ui):
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1796 > pass
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1797 > cmdtable = {
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1798 > b'deprecatedcmd': (deprecatedcmd, [], b''),
32342
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1799 > }
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1800 > EOF
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1801 $ cat <<EOF > .hg/hgrc
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1802 > [extensions]
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1803 > deprecatedcmd = `pwd`/deprecatedcmd.py
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1804 > mq = !
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1805 > hgext.mq = !
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1806 > hgext/mq = !
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1807 > EOF
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1808
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1809 $ hg deprecatedcmd > /dev/null
48360
e4acdf5d94a2 extensions: highlight the name of the faulty extensions in the error message
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48016
diff changeset
1810 *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
32342
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1811 *** (use @command decorator to register 'deprecatedcmd')
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1812 hg: unknown command 'deprecatedcmd'
38787
5199c5b6fd29 dispatch: don't show list of commands on bogus command
Martin von Zweigbergk <martinvonz@google.com>
parents: 38534
diff changeset
1813 (use 'hg help' for a list of commands)
46262
9c9e0b4b2ca7 error: use detailed exit code 10 for command errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 46133
diff changeset
1814 [10]
32342
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1815
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1816 the extension shouldn't be loaded at all so the mq works:
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1817
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1818 $ hg qseries --config extensions.mq= > /dev/null
48360
e4acdf5d94a2 extensions: highlight the name of the faulty extensions in the error message
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48016
diff changeset
1819 *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
32342
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1820 *** (use @command decorator to register 'deprecatedcmd')
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1821
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1822 $ cd ..
e5fbf9687600 extensions: prohibit registration of command without using @command (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
1823
24124
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1824 Test synopsis and docstring extending
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1825
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1826 $ hg init exthelp
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1827 $ cat > exthelp.py <<EOF
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1828 > from mercurial import commands, extensions
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1829 > def exbookmarks(orig, *args, **opts):
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1830 > return orig(*args, **opts)
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1831 > def uisetup(ui):
38018
a9ffb4a577d0 py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37977
diff changeset
1832 > synopsis = b' GREPME [--foo] [-x]'
24124
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1833 > docstring = '''
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1834 > GREPME make sure that this is in the help!
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1835 > '''
36458
2218f5bfafca py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36269
diff changeset
1836 > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks,
24124
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1837 > synopsis, docstring)
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1838 > EOF
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1839 $ abspath=`pwd`/exthelp.py
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1840 $ echo '[extensions]' >> $HGRCPATH
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1841 $ echo "exthelp = $abspath" >> $HGRCPATH
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1842 $ cd exthelp
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1843 $ hg help bookmarks | grep GREPME
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1844 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1845 GREPME make sure that this is in the help!
32343
d47d7d3bd07b extensions: show deprecation warning for the use of cmdutil.command
Yuya Nishihara <yuya@tcha.org>
parents: 32342
diff changeset
1846 $ cd ..
24124
042d95beeee8 extensions: allow extending command synopsis and docstring
Ryan McElroy <rm@fb.com>
parents: 23871
diff changeset
1847
34048
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1848 Prohibit the use of unicode strings as the default value of options
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1849
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1850 $ hg init $TESTTMP/opt-unicode-default
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1851
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1852 $ cat > $TESTTMP/test_unicode_default_value.py << EOF
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1853 > from mercurial import registrar
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1854 > cmdtable = {}
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1855 > command = registrar.command(cmdtable)
38018
a9ffb4a577d0 py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37977
diff changeset
1856 > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]')
34048
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1857 > def ext(*args, **opts):
40181
958b4c506d3a tests: ensure print() statements in test-extension.t all flush
Augie Fackler <augie@google.com>
parents: 39931
diff changeset
1858 > print(opts[b'opt'], flush=True)
34048
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1859 > EOF
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1860 $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1861 > [extensions]
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1862 > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1863 > EOF
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1864 $ hg -R $TESTTMP/opt-unicode-default dummy
48410
0b2469bf1227 python2-compat: fix extensions' tests on python2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48362
diff changeset
1865 *** failed to import extension "test_unicode_default_value" from $TESTTMP/test_unicode_default_value.py: unicode 'value' found in cmdtable.dummy (py3 !)
36269
4088e568a411 extensions: reject any unicode strings in tables before loading
Yuya Nishihara <yuya@tcha.org>
parents: 35773
diff changeset
1866 *** (use b'' to make it byte string)
34048
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1867 hg: unknown command 'dummy'
0e0ac8f09048 extensions: prohibit unicode defaults
Christophe de Vienne <christophe@cdevienne.info>
parents: 33939
diff changeset
1868 (did you mean summary?)
46262
9c9e0b4b2ca7 error: use detailed exit code 10 for command errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 46133
diff changeset
1869 [10]
48361
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1870
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1871 Check the mandatory extension feature
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1872 -------------------------------------
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1873
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1874 $ hg init mandatory-extensions
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1875 $ cat > $TESTTMP/mandatory-extensions/.hg/good.py << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1876 > pass
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1877 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1878 $ cat > $TESTTMP/mandatory-extensions/.hg/bad.py << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1879 > raise RuntimeError("babar")
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1880 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1881 $ cat > $TESTTMP/mandatory-extensions/.hg/syntax.py << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1882 > def (
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1883 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1884
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1885 Check that the good one load :
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1886
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1887 $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1888 > [extensions]
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1889 > good = $TESTTMP/mandatory-extensions/.hg/good.py
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1890 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1891
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1892 $ hg -R mandatory-extensions id
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1893 000000000000 tip
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1894
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1895 Make it mandatory to load
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1896
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1897 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1898 > good:required = yes
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1899 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1900
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1901 $ hg -R mandatory-extensions id
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1902 000000000000 tip
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1903
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1904 Check that the bad one does not load
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1905
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1906 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1907 > bad = $TESTTMP/mandatory-extensions/.hg/bad.py
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1908 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1909
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1910 $ hg -R mandatory-extensions id
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1911 *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1912 000000000000 tip
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1913
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1914 Make it mandatory to load
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1915
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1916 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1917 > bad:required = yes
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1918 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1919
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1920 $ hg -R mandatory-extensions id
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1921 abort: failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1922 (loading of this extension was required, see `hg help config.extensions` for details)
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1923 [255]
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1924
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1925 Make it not mandatory to load
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1926
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1927 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1928 > bad:required = no
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1929 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1930
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1931 $ hg -R mandatory-extensions id
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1932 *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1933 000000000000 tip
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1934
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1935 Same check with the syntax error one
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1936
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1937 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1938 > bad = !
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1939 > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1940 > syntax:required = yes
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1941 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1942
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1943 $ hg -R mandatory-extensions id
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1944 abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob)
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1945 (loading of this extension was required, see `hg help config.extensions` for details)
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1946 [255]
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1947
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1948 Same check with a missing one
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1949
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1950 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1951 > syntax = !
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1952 > syntax:required =
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1953 > missing = foo/bar/baz/I/do/not/exist/
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1954 > missing:required = yes
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1955 > EOF
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1956
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1957 $ hg -R mandatory-extensions id
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1958 abort: failed to import extension "missing" from foo/bar/baz/I/do/not/exist/: [Errno 2] $ENOENT$: 'foo/bar/baz/I/do/not/exist'
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1959 (loading of this extension was required, see `hg help config.extensions` for details)
0d0ce2529540 extension: add a `required` suboption to enforce the use of an extensions
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48360
diff changeset
1960 [255]
48362
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1961
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1962 Have a "default" setting for the suboption:
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1963
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1964 $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1965 > [extensions]
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1966 > bad = $TESTTMP/mandatory-extensions/.hg/bad.py
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1967 > bad:required = no
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1968 > good = $TESTTMP/mandatory-extensions/.hg/good.py
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1969 > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1970 > *:required = yes
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1971 > EOF
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1972
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1973 $ hg -R mandatory-extensions id
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1974 *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1975 abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob)
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1976 (loading of this extension was required, see `hg help config.extensions` for details)
7e6488aa1261 extensions: add a default "*" suboptions prefix
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48361
diff changeset
1977 [255]