Show More
@@ -1,1270 +1,1270 b'' | |||||
1 | Test basic extension support |
|
1 | Test basic extension support | |
2 |
|
2 | |||
3 | $ cat > foobar.py <<EOF |
|
3 | $ cat > foobar.py <<EOF | |
4 | > import os |
|
4 | > import os | |
5 | > from mercurial import cmdutil, commands |
|
5 | > from mercurial import cmdutil, commands | |
6 | > cmdtable = {} |
|
6 | > cmdtable = {} | |
7 | > command = cmdutil.command(cmdtable) |
|
7 | > command = cmdutil.command(cmdtable) | |
8 | > def uisetup(ui): |
|
8 | > def uisetup(ui): | |
9 | > ui.write("uisetup called\\n") |
|
9 | > ui.write("uisetup called\\n") | |
10 | > ui.flush() |
|
10 | > ui.flush() | |
11 | > def reposetup(ui, repo): |
|
11 | > def reposetup(ui, repo): | |
12 | > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
12 | > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) | |
13 | > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) |
|
13 | > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) | |
14 | > ui.flush() |
|
14 | > ui.flush() | |
15 | > @command('foo', [], 'hg foo') |
|
15 | > @command('foo', [], 'hg foo') | |
16 | > def foo(ui, *args, **kwargs): |
|
16 | > def foo(ui, *args, **kwargs): | |
17 | > ui.write("Foo\\n") |
|
17 | > ui.write("Foo\\n") | |
18 | > @command('bar', [], 'hg bar', norepo=True) |
|
18 | > @command('bar', [], 'hg bar', norepo=True) | |
19 | > def bar(ui, *args, **kwargs): |
|
19 | > def bar(ui, *args, **kwargs): | |
20 | > ui.write("Bar\\n") |
|
20 | > ui.write("Bar\\n") | |
21 | > EOF |
|
21 | > EOF | |
22 | $ abspath=`pwd`/foobar.py |
|
22 | $ abspath=`pwd`/foobar.py | |
23 |
|
23 | |||
24 | $ mkdir barfoo |
|
24 | $ mkdir barfoo | |
25 | $ cp foobar.py barfoo/__init__.py |
|
25 | $ cp foobar.py barfoo/__init__.py | |
26 | $ barfoopath=`pwd`/barfoo |
|
26 | $ barfoopath=`pwd`/barfoo | |
27 |
|
27 | |||
28 | $ hg init a |
|
28 | $ hg init a | |
29 | $ cd a |
|
29 | $ cd a | |
30 | $ echo foo > file |
|
30 | $ echo foo > file | |
31 | $ hg add file |
|
31 | $ hg add file | |
32 | $ hg commit -m 'add file' |
|
32 | $ hg commit -m 'add file' | |
33 |
|
33 | |||
34 | $ echo '[extensions]' >> $HGRCPATH |
|
34 | $ echo '[extensions]' >> $HGRCPATH | |
35 | $ echo "foobar = $abspath" >> $HGRCPATH |
|
35 | $ echo "foobar = $abspath" >> $HGRCPATH | |
36 | $ hg foo |
|
36 | $ hg foo | |
37 | uisetup called |
|
37 | uisetup called | |
38 | reposetup called for a |
|
38 | reposetup called for a | |
39 | ui == repo.ui |
|
39 | ui == repo.ui | |
40 | Foo |
|
40 | Foo | |
41 |
|
41 | |||
42 | $ cd .. |
|
42 | $ cd .. | |
43 | $ hg clone a b |
|
43 | $ hg clone a b | |
44 | uisetup called |
|
44 | uisetup called | |
45 | reposetup called for a |
|
45 | reposetup called for a | |
46 | ui == repo.ui |
|
46 | ui == repo.ui | |
47 | reposetup called for b |
|
47 | reposetup called for b | |
48 | ui == repo.ui |
|
48 | ui == repo.ui | |
49 | updating to branch default |
|
49 | updating to branch default | |
50 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
50 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
51 |
|
51 | |||
52 | $ hg bar |
|
52 | $ hg bar | |
53 | uisetup called |
|
53 | uisetup called | |
54 | Bar |
|
54 | Bar | |
55 | $ echo 'foobar = !' >> $HGRCPATH |
|
55 | $ echo 'foobar = !' >> $HGRCPATH | |
56 |
|
56 | |||
57 | module/__init__.py-style |
|
57 | module/__init__.py-style | |
58 |
|
58 | |||
59 | $ echo "barfoo = $barfoopath" >> $HGRCPATH |
|
59 | $ echo "barfoo = $barfoopath" >> $HGRCPATH | |
60 | $ cd a |
|
60 | $ cd a | |
61 | $ hg foo |
|
61 | $ hg foo | |
62 | uisetup called |
|
62 | uisetup called | |
63 | reposetup called for a |
|
63 | reposetup called for a | |
64 | ui == repo.ui |
|
64 | ui == repo.ui | |
65 | Foo |
|
65 | Foo | |
66 | $ echo 'barfoo = !' >> $HGRCPATH |
|
66 | $ echo 'barfoo = !' >> $HGRCPATH | |
67 |
|
67 | |||
68 | Check that extensions are loaded in phases: |
|
68 | Check that extensions are loaded in phases: | |
69 |
|
69 | |||
70 | $ cat > foo.py <<EOF |
|
70 | $ cat > foo.py <<EOF | |
71 | > import os |
|
71 | > import os | |
72 | > name = os.path.basename(__file__).rsplit('.', 1)[0] |
|
72 | > name = os.path.basename(__file__).rsplit('.', 1)[0] | |
73 | > print "1) %s imported" % name |
|
73 | > print "1) %s imported" % name | |
74 | > def uisetup(ui): |
|
74 | > def uisetup(ui): | |
75 | > print "2) %s uisetup" % name |
|
75 | > print "2) %s uisetup" % name | |
76 | > def extsetup(): |
|
76 | > def extsetup(): | |
77 | > print "3) %s extsetup" % name |
|
77 | > print "3) %s extsetup" % name | |
78 | > def reposetup(ui, repo): |
|
78 | > def reposetup(ui, repo): | |
79 | > print "4) %s reposetup" % name |
|
79 | > print "4) %s reposetup" % name | |
80 | > EOF |
|
80 | > EOF | |
81 |
|
81 | |||
82 | $ cp foo.py bar.py |
|
82 | $ cp foo.py bar.py | |
83 | $ echo 'foo = foo.py' >> $HGRCPATH |
|
83 | $ echo 'foo = foo.py' >> $HGRCPATH | |
84 | $ echo 'bar = bar.py' >> $HGRCPATH |
|
84 | $ echo 'bar = bar.py' >> $HGRCPATH | |
85 |
|
85 | |||
86 | Command with no output, we just want to see the extensions loaded: |
|
86 | Command with no output, we just want to see the extensions loaded: | |
87 |
|
87 | |||
88 | $ hg paths |
|
88 | $ hg paths | |
89 | 1) foo imported |
|
89 | 1) foo imported | |
90 | 1) bar imported |
|
90 | 1) bar imported | |
91 | 2) foo uisetup |
|
91 | 2) foo uisetup | |
92 | 2) bar uisetup |
|
92 | 2) bar uisetup | |
93 | 3) foo extsetup |
|
93 | 3) foo extsetup | |
94 | 3) bar extsetup |
|
94 | 3) bar extsetup | |
95 | 4) foo reposetup |
|
95 | 4) foo reposetup | |
96 | 4) bar reposetup |
|
96 | 4) bar reposetup | |
97 |
|
97 | |||
98 | Check hgweb's load order: |
|
98 | Check hgweb's load order: | |
99 |
|
99 | |||
100 | $ cat > hgweb.cgi <<EOF |
|
100 | $ cat > hgweb.cgi <<EOF | |
101 | > #!/usr/bin/env python |
|
101 | > #!/usr/bin/env python | |
102 | > from mercurial import demandimport; demandimport.enable() |
|
102 | > from mercurial import demandimport; demandimport.enable() | |
103 | > from mercurial.hgweb import hgweb |
|
103 | > from mercurial.hgweb import hgweb | |
104 | > from mercurial.hgweb import wsgicgi |
|
104 | > from mercurial.hgweb import wsgicgi | |
105 | > application = hgweb('.', 'test repo') |
|
105 | > application = hgweb('.', 'test repo') | |
106 | > wsgicgi.launch(application) |
|
106 | > wsgicgi.launch(application) | |
107 | > EOF |
|
107 | > EOF | |
108 |
|
108 | |||
109 | $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \ |
|
109 | $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \ | |
110 | > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \ |
|
110 | > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \ | |
111 | > | grep '^[0-9]) ' # ignores HTML output |
|
111 | > | grep '^[0-9]) ' # ignores HTML output | |
112 | 1) foo imported |
|
112 | 1) foo imported | |
113 | 1) bar imported |
|
113 | 1) bar imported | |
114 | 2) foo uisetup |
|
114 | 2) foo uisetup | |
115 | 2) bar uisetup |
|
115 | 2) bar uisetup | |
116 | 3) foo extsetup |
|
116 | 3) foo extsetup | |
117 | 3) bar extsetup |
|
117 | 3) bar extsetup | |
118 | 4) foo reposetup |
|
118 | 4) foo reposetup | |
119 | 4) bar reposetup |
|
119 | 4) bar reposetup | |
120 |
|
120 | |||
121 | $ echo 'foo = !' >> $HGRCPATH |
|
121 | $ echo 'foo = !' >> $HGRCPATH | |
122 | $ echo 'bar = !' >> $HGRCPATH |
|
122 | $ echo 'bar = !' >> $HGRCPATH | |
123 |
|
123 | |||
124 | Check "from __future__ import absolute_import" support for external libraries |
|
124 | Check "from __future__ import absolute_import" support for external libraries | |
125 |
|
125 | |||
126 | #if windows |
|
126 | #if windows | |
127 | $ PATHSEP=";" |
|
127 | $ PATHSEP=";" | |
128 | #else |
|
128 | #else | |
129 | $ PATHSEP=":" |
|
129 | $ PATHSEP=":" | |
130 | #endif |
|
130 | #endif | |
131 | $ export PATHSEP |
|
131 | $ export PATHSEP | |
132 |
|
132 | |||
133 | $ mkdir $TESTTMP/libroot |
|
133 | $ mkdir $TESTTMP/libroot | |
134 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py |
|
134 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py | |
135 | $ mkdir $TESTTMP/libroot/mod |
|
135 | $ mkdir $TESTTMP/libroot/mod | |
136 | $ touch $TESTTMP/libroot/mod/__init__.py |
|
136 | $ touch $TESTTMP/libroot/mod/__init__.py | |
137 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py |
|
137 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py | |
138 |
|
138 | |||
139 | #if absimport |
|
139 | #if absimport | |
140 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF |
|
140 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF | |
141 | > from __future__ import absolute_import |
|
141 | > from __future__ import absolute_import | |
142 | > import ambig # should load "libroot/ambig.py" |
|
142 | > import ambig # should load "libroot/ambig.py" | |
143 | > s = ambig.s |
|
143 | > s = ambig.s | |
144 | > EOF |
|
144 | > EOF | |
145 | $ cat > loadabs.py <<EOF |
|
145 | $ cat > loadabs.py <<EOF | |
146 | > import mod.ambigabs as ambigabs |
|
146 | > import mod.ambigabs as ambigabs | |
147 | > def extsetup(): |
|
147 | > def extsetup(): | |
148 | > print 'ambigabs.s=%s' % ambigabs.s |
|
148 | > print 'ambigabs.s=%s' % ambigabs.s | |
149 | > EOF |
|
149 | > EOF | |
150 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) |
|
150 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) | |
151 | ambigabs.s=libroot/ambig.py |
|
151 | ambigabs.s=libroot/ambig.py | |
152 | $TESTTMP/a (glob) |
|
152 | $TESTTMP/a (glob) | |
153 | #endif |
|
153 | #endif | |
154 |
|
154 | |||
155 | #if no-py3k |
|
155 | #if no-py3k | |
156 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF |
|
156 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF | |
157 | > import ambig # should load "libroot/mod/ambig.py" |
|
157 | > import ambig # should load "libroot/mod/ambig.py" | |
158 | > s = ambig.s |
|
158 | > s = ambig.s | |
159 | > EOF |
|
159 | > EOF | |
160 | $ cat > loadrel.py <<EOF |
|
160 | $ cat > loadrel.py <<EOF | |
161 | > import mod.ambigrel as ambigrel |
|
161 | > import mod.ambigrel as ambigrel | |
162 | > def extsetup(): |
|
162 | > def extsetup(): | |
163 | > print 'ambigrel.s=%s' % ambigrel.s |
|
163 | > print 'ambigrel.s=%s' % ambigrel.s | |
164 | > EOF |
|
164 | > EOF | |
165 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) |
|
165 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) | |
166 | ambigrel.s=libroot/mod/ambig.py |
|
166 | ambigrel.s=libroot/mod/ambig.py | |
167 | $TESTTMP/a (glob) |
|
167 | $TESTTMP/a (glob) | |
168 | #endif |
|
168 | #endif | |
169 |
|
169 | |||
170 | Check absolute/relative import of extension specific modules |
|
170 | Check absolute/relative import of extension specific modules | |
171 |
|
171 | |||
172 | $ mkdir $TESTTMP/extroot |
|
172 | $ mkdir $TESTTMP/extroot | |
173 | $ cat > $TESTTMP/extroot/bar.py <<EOF |
|
173 | $ cat > $TESTTMP/extroot/bar.py <<EOF | |
174 | > s = 'this is extroot.bar' |
|
174 | > s = 'this is extroot.bar' | |
175 | > EOF |
|
175 | > EOF | |
176 | $ mkdir $TESTTMP/extroot/sub1 |
|
176 | $ mkdir $TESTTMP/extroot/sub1 | |
177 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF |
|
177 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF | |
178 | > s = 'this is extroot.sub1.__init__' |
|
178 | > s = 'this is extroot.sub1.__init__' | |
179 | > EOF |
|
179 | > EOF | |
180 | $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF |
|
180 | $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF | |
181 | > s = 'this is extroot.sub1.baz' |
|
181 | > s = 'this is extroot.sub1.baz' | |
182 | > EOF |
|
182 | > EOF | |
183 | $ cat > $TESTTMP/extroot/__init__.py <<EOF |
|
183 | $ cat > $TESTTMP/extroot/__init__.py <<EOF | |
184 | > s = 'this is extroot.__init__' |
|
184 | > s = 'this is extroot.__init__' | |
185 | > import foo |
|
185 | > import foo | |
186 | > def extsetup(ui): |
|
186 | > def extsetup(ui): | |
187 | > ui.write('(extroot) ', foo.func(), '\n') |
|
187 | > ui.write('(extroot) ', foo.func(), '\n') | |
188 | > ui.flush() |
|
188 | > ui.flush() | |
189 | > EOF |
|
189 | > EOF | |
190 |
|
190 | |||
191 | $ cat > $TESTTMP/extroot/foo.py <<EOF |
|
191 | $ cat > $TESTTMP/extroot/foo.py <<EOF | |
192 | > # test absolute import |
|
192 | > # test absolute import | |
193 | > buf = [] |
|
193 | > buf = [] | |
194 | > def func(): |
|
194 | > def func(): | |
195 | > # "not locals" case |
|
195 | > # "not locals" case | |
196 | > import extroot.bar |
|
196 | > import extroot.bar | |
197 | > buf.append('import extroot.bar in func(): %s' % extroot.bar.s) |
|
197 | > buf.append('import extroot.bar in func(): %s' % extroot.bar.s) | |
198 | > return '\n(extroot) '.join(buf) |
|
198 | > return '\n(extroot) '.join(buf) | |
199 | > # "fromlist == ('*',)" case |
|
199 | > # "fromlist == ('*',)" case | |
200 | > from extroot.bar import * |
|
200 | > from extroot.bar import * | |
201 | > buf.append('from extroot.bar import *: %s' % s) |
|
201 | > buf.append('from extroot.bar import *: %s' % s) | |
202 | > # "not fromlist" and "if '.' in name" case |
|
202 | > # "not fromlist" and "if '.' in name" case | |
203 | > import extroot.sub1.baz |
|
203 | > import extroot.sub1.baz | |
204 | > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s) |
|
204 | > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s) | |
205 | > # "not fromlist" and NOT "if '.' in name" case |
|
205 | > # "not fromlist" and NOT "if '.' in name" case | |
206 | > import extroot |
|
206 | > import extroot | |
207 | > buf.append('import extroot: %s' % extroot.s) |
|
207 | > buf.append('import extroot: %s' % extroot.s) | |
208 | > # NOT "not fromlist" and NOT "level != -1" case |
|
208 | > # NOT "not fromlist" and NOT "level != -1" case | |
209 | > from extroot.bar import s |
|
209 | > from extroot.bar import s | |
210 | > buf.append('from extroot.bar import s: %s' % s) |
|
210 | > buf.append('from extroot.bar import s: %s' % s) | |
211 | > EOF |
|
211 | > EOF | |
212 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root) |
|
212 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root) | |
213 | (extroot) from extroot.bar import *: this is extroot.bar |
|
213 | (extroot) from extroot.bar import *: this is extroot.bar | |
214 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz |
|
214 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz | |
215 | (extroot) import extroot: this is extroot.__init__ |
|
215 | (extroot) import extroot: this is extroot.__init__ | |
216 | (extroot) from extroot.bar import s: this is extroot.bar |
|
216 | (extroot) from extroot.bar import s: this is extroot.bar | |
217 | (extroot) import extroot.bar in func(): this is extroot.bar |
|
217 | (extroot) import extroot.bar in func(): this is extroot.bar | |
218 | $TESTTMP/a (glob) |
|
218 | $TESTTMP/a (glob) | |
219 |
|
219 | |||
220 | #if no-py3k |
|
220 | #if no-py3k | |
221 | $ rm "$TESTTMP"/extroot/foo.* |
|
221 | $ rm "$TESTTMP"/extroot/foo.* | |
222 | $ cat > $TESTTMP/extroot/foo.py <<EOF |
|
222 | $ cat > $TESTTMP/extroot/foo.py <<EOF | |
223 | > # test relative import |
|
223 | > # test relative import | |
224 | > buf = [] |
|
224 | > buf = [] | |
225 | > def func(): |
|
225 | > def func(): | |
226 | > # "not locals" case |
|
226 | > # "not locals" case | |
227 | > import bar |
|
227 | > import bar | |
228 | > buf.append('import bar in func(): %s' % bar.s) |
|
228 | > buf.append('import bar in func(): %s' % bar.s) | |
229 | > return '\n(extroot) '.join(buf) |
|
229 | > return '\n(extroot) '.join(buf) | |
230 | > # "fromlist == ('*',)" case |
|
230 | > # "fromlist == ('*',)" case | |
231 | > from bar import * |
|
231 | > from bar import * | |
232 | > buf.append('from bar import *: %s' % s) |
|
232 | > buf.append('from bar import *: %s' % s) | |
233 | > # "not fromlist" and "if '.' in name" case |
|
233 | > # "not fromlist" and "if '.' in name" case | |
234 | > import sub1.baz |
|
234 | > import sub1.baz | |
235 | > buf.append('import sub1.baz: %s' % sub1.baz.s) |
|
235 | > buf.append('import sub1.baz: %s' % sub1.baz.s) | |
236 | > # "not fromlist" and NOT "if '.' in name" case |
|
236 | > # "not fromlist" and NOT "if '.' in name" case | |
237 | > import sub1 |
|
237 | > import sub1 | |
238 | > buf.append('import sub1: %s' % sub1.s) |
|
238 | > buf.append('import sub1: %s' % sub1.s) | |
239 | > # NOT "not fromlist" and NOT "level != -1" case |
|
239 | > # NOT "not fromlist" and NOT "level != -1" case | |
240 | > from bar import s |
|
240 | > from bar import s | |
241 | > buf.append('from bar import s: %s' % s) |
|
241 | > buf.append('from bar import s: %s' % s) | |
242 | > EOF |
|
242 | > EOF | |
243 | $ hg --config extensions.extroot=$TESTTMP/extroot root |
|
243 | $ hg --config extensions.extroot=$TESTTMP/extroot root | |
244 | (extroot) from bar import *: this is extroot.bar |
|
244 | (extroot) from bar import *: this is extroot.bar | |
245 | (extroot) import sub1.baz: this is extroot.sub1.baz |
|
245 | (extroot) import sub1.baz: this is extroot.sub1.baz | |
246 | (extroot) import sub1: this is extroot.sub1.__init__ |
|
246 | (extroot) import sub1: this is extroot.sub1.__init__ | |
247 | (extroot) from bar import s: this is extroot.bar |
|
247 | (extroot) from bar import s: this is extroot.bar | |
248 | (extroot) import bar in func(): this is extroot.bar |
|
248 | (extroot) import bar in func(): this is extroot.bar | |
249 | $TESTTMP/a (glob) |
|
249 | $TESTTMP/a (glob) | |
250 | #endif |
|
250 | #endif | |
251 |
|
251 | |||
252 | $ cd .. |
|
252 | $ cd .. | |
253 |
|
253 | |||
254 | hide outer repo |
|
254 | hide outer repo | |
255 | $ hg init |
|
255 | $ hg init | |
256 |
|
256 | |||
257 | $ cat > empty.py <<EOF |
|
257 | $ cat > empty.py <<EOF | |
258 | > '''empty cmdtable |
|
258 | > '''empty cmdtable | |
259 | > ''' |
|
259 | > ''' | |
260 | > cmdtable = {} |
|
260 | > cmdtable = {} | |
261 | > EOF |
|
261 | > EOF | |
262 | $ emptypath=`pwd`/empty.py |
|
262 | $ emptypath=`pwd`/empty.py | |
263 | $ echo "empty = $emptypath" >> $HGRCPATH |
|
263 | $ echo "empty = $emptypath" >> $HGRCPATH | |
264 | $ hg help empty |
|
264 | $ hg help empty | |
265 | empty extension - empty cmdtable |
|
265 | empty extension - empty cmdtable | |
266 |
|
266 | |||
267 | no commands defined |
|
267 | no commands defined | |
268 |
|
268 | |||
269 |
|
269 | |||
270 | $ echo 'empty = !' >> $HGRCPATH |
|
270 | $ echo 'empty = !' >> $HGRCPATH | |
271 |
|
271 | |||
272 | $ cat > debugextension.py <<EOF |
|
272 | $ cat > debugextension.py <<EOF | |
273 | > '''only debugcommands |
|
273 | > '''only debugcommands | |
274 | > ''' |
|
274 | > ''' | |
275 | > from mercurial import cmdutil |
|
275 | > from mercurial import cmdutil | |
276 | > cmdtable = {} |
|
276 | > cmdtable = {} | |
277 | > command = cmdutil.command(cmdtable) |
|
277 | > command = cmdutil.command(cmdtable) | |
278 | > @command('debugfoobar', [], 'hg debugfoobar') |
|
278 | > @command('debugfoobar', [], 'hg debugfoobar') | |
279 | > def debugfoobar(ui, repo, *args, **opts): |
|
279 | > def debugfoobar(ui, repo, *args, **opts): | |
280 | > "yet another debug command" |
|
280 | > "yet another debug command" | |
281 | > pass |
|
281 | > pass | |
282 | > @command('foo', [], 'hg foo') |
|
282 | > @command('foo', [], 'hg foo') | |
283 | > def foo(ui, repo, *args, **opts): |
|
283 | > def foo(ui, repo, *args, **opts): | |
284 | > """yet another foo command |
|
284 | > """yet another foo command | |
285 | > This command has been DEPRECATED since forever. |
|
285 | > This command has been DEPRECATED since forever. | |
286 | > """ |
|
286 | > """ | |
287 | > pass |
|
287 | > pass | |
288 | > EOF |
|
288 | > EOF | |
289 | $ debugpath=`pwd`/debugextension.py |
|
289 | $ debugpath=`pwd`/debugextension.py | |
290 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
|
290 | $ echo "debugextension = $debugpath" >> $HGRCPATH | |
291 |
|
291 | |||
292 | $ hg help debugextension |
|
292 | $ hg help debugextension | |
293 | hg debugextensions |
|
293 | hg debugextensions | |
294 |
|
294 | |||
295 | show information about active extensions |
|
295 | show information about active extensions | |
296 |
|
296 | |||
297 | options: |
|
297 | options: | |
298 |
|
298 | |||
299 | (some details hidden, use --verbose to show complete help) |
|
299 | (some details hidden, use --verbose to show complete help) | |
300 |
|
300 | |||
301 |
|
301 | |||
302 | $ hg --verbose help debugextension |
|
302 | $ hg --verbose help debugextension | |
303 | hg debugextensions |
|
303 | hg debugextensions | |
304 |
|
304 | |||
305 | show information about active extensions |
|
305 | show information about active extensions | |
306 |
|
306 | |||
307 | options: |
|
307 | options: | |
308 |
|
308 | |||
309 | -T --template TEMPLATE display with template (EXPERIMENTAL) |
|
309 | -T --template TEMPLATE display with template (EXPERIMENTAL) | |
310 |
|
310 | |||
311 | global options ([+] can be repeated): |
|
311 | global options ([+] can be repeated): | |
312 |
|
312 | |||
313 | -R --repository REPO repository root directory or name of overlay bundle |
|
313 | -R --repository REPO repository root directory or name of overlay bundle | |
314 | file |
|
314 | file | |
315 | --cwd DIR change working directory |
|
315 | --cwd DIR change working directory | |
316 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
316 | -y --noninteractive do not prompt, automatically pick the first choice for | |
317 | all prompts |
|
317 | all prompts | |
318 | -q --quiet suppress output |
|
318 | -q --quiet suppress output | |
319 | -v --verbose enable additional output |
|
319 | -v --verbose enable additional output | |
320 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
320 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
321 | --debug enable debugging output |
|
321 | --debug enable debugging output | |
322 | --debugger start debugger |
|
322 | --debugger start debugger | |
323 | --encoding ENCODE set the charset encoding (default: ascii) |
|
323 | --encoding ENCODE set the charset encoding (default: ascii) | |
324 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
324 | --encodingmode MODE set the charset encoding mode (default: strict) | |
325 | --traceback always print a traceback on exception |
|
325 | --traceback always print a traceback on exception | |
326 | --time time how long the command takes |
|
326 | --time time how long the command takes | |
327 | --profile print command execution profile |
|
327 | --profile print command execution profile | |
328 | --version output version information and exit |
|
328 | --version output version information and exit | |
329 | -h --help display help and exit |
|
329 | -h --help display help and exit | |
330 | --hidden consider hidden changesets |
|
330 | --hidden consider hidden changesets | |
331 |
|
331 | |||
332 |
|
332 | |||
333 |
|
333 | |||
334 |
|
334 | |||
335 |
|
335 | |||
336 |
|
336 | |||
337 | $ hg --debug help debugextension |
|
337 | $ hg --debug help debugextension | |
338 | hg debugextensions |
|
338 | hg debugextensions | |
339 |
|
339 | |||
340 | show information about active extensions |
|
340 | show information about active extensions | |
341 |
|
341 | |||
342 | options: |
|
342 | options: | |
343 |
|
343 | |||
344 | -T --template TEMPLATE display with template (EXPERIMENTAL) |
|
344 | -T --template TEMPLATE display with template (EXPERIMENTAL) | |
345 |
|
345 | |||
346 | global options ([+] can be repeated): |
|
346 | global options ([+] can be repeated): | |
347 |
|
347 | |||
348 | -R --repository REPO repository root directory or name of overlay bundle |
|
348 | -R --repository REPO repository root directory or name of overlay bundle | |
349 | file |
|
349 | file | |
350 | --cwd DIR change working directory |
|
350 | --cwd DIR change working directory | |
351 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
351 | -y --noninteractive do not prompt, automatically pick the first choice for | |
352 | all prompts |
|
352 | all prompts | |
353 | -q --quiet suppress output |
|
353 | -q --quiet suppress output | |
354 | -v --verbose enable additional output |
|
354 | -v --verbose enable additional output | |
355 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
355 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
356 | --debug enable debugging output |
|
356 | --debug enable debugging output | |
357 | --debugger start debugger |
|
357 | --debugger start debugger | |
358 | --encoding ENCODE set the charset encoding (default: ascii) |
|
358 | --encoding ENCODE set the charset encoding (default: ascii) | |
359 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
359 | --encodingmode MODE set the charset encoding mode (default: strict) | |
360 | --traceback always print a traceback on exception |
|
360 | --traceback always print a traceback on exception | |
361 | --time time how long the command takes |
|
361 | --time time how long the command takes | |
362 | --profile print command execution profile |
|
362 | --profile print command execution profile | |
363 | --version output version information and exit |
|
363 | --version output version information and exit | |
364 | -h --help display help and exit |
|
364 | -h --help display help and exit | |
365 | --hidden consider hidden changesets |
|
365 | --hidden consider hidden changesets | |
366 |
|
366 | |||
367 |
|
367 | |||
368 |
|
368 | |||
369 |
|
369 | |||
370 |
|
370 | |||
371 | $ echo 'debugextension = !' >> $HGRCPATH |
|
371 | $ echo 'debugextension = !' >> $HGRCPATH | |
372 |
|
372 | |||
373 | Asking for help about a deprecated extension should do something useful: |
|
373 | Asking for help about a deprecated extension should do something useful: | |
374 |
|
374 | |||
375 | $ hg help glog |
|
375 | $ hg help glog | |
376 | 'glog' is provided by the following extension: |
|
376 | 'glog' is provided by the following extension: | |
377 |
|
377 | |||
378 | graphlog command to view revision graphs from a shell (DEPRECATED) |
|
378 | graphlog command to view revision graphs from a shell (DEPRECATED) | |
379 |
|
379 | |||
380 | (use "hg help extensions" for information on enabling extensions) |
|
380 | (use "hg help extensions" for information on enabling extensions) | |
381 |
|
381 | |||
382 | Extension module help vs command help: |
|
382 | Extension module help vs command help: | |
383 |
|
383 | |||
384 | $ echo 'extdiff =' >> $HGRCPATH |
|
384 | $ echo 'extdiff =' >> $HGRCPATH | |
385 | $ hg help extdiff |
|
385 | $ hg help extdiff | |
386 | hg extdiff [OPT]... [FILE]... |
|
386 | hg extdiff [OPT]... [FILE]... | |
387 |
|
387 | |||
388 | use external program to diff repository (or selected files) |
|
388 | use external program to diff repository (or selected files) | |
389 |
|
389 | |||
390 | Show differences between revisions for the specified files, using an |
|
390 | Show differences between revisions for the specified files, using an | |
391 | external program. The default program used is diff, with default options |
|
391 | external program. The default program used is diff, with default options | |
392 | "-Npru". |
|
392 | "-Npru". | |
393 |
|
393 | |||
394 | To select a different program, use the -p/--program option. The program |
|
394 | To select a different program, use the -p/--program option. The program | |
395 | will be passed the names of two directories to compare. To pass additional |
|
395 | will be passed the names of two directories to compare. To pass additional | |
396 | options to the program, use -o/--option. These will be passed before the |
|
396 | options to the program, use -o/--option. These will be passed before the | |
397 | names of the directories to compare. |
|
397 | names of the directories to compare. | |
398 |
|
398 | |||
399 | When two revision arguments are given, then changes are shown between |
|
399 | When two revision arguments are given, then changes are shown between | |
400 | those revisions. If only one revision is specified then that revision is |
|
400 | those revisions. If only one revision is specified then that revision is | |
401 | compared to the working directory, and, when no revisions are specified, |
|
401 | compared to the working directory, and, when no revisions are specified, | |
402 | the working directory files are compared to its parent. |
|
402 | the working directory files are compared to its parent. | |
403 |
|
403 | |||
404 | (use "hg help -e extdiff" to show help for the extdiff extension) |
|
404 | (use "hg help -e extdiff" to show help for the extdiff extension) | |
405 |
|
405 | |||
406 | options ([+] can be repeated): |
|
406 | options ([+] can be repeated): | |
407 |
|
407 | |||
408 | -p --program CMD comparison program to run |
|
408 | -p --program CMD comparison program to run | |
409 | -o --option OPT [+] pass option to comparison program |
|
409 | -o --option OPT [+] pass option to comparison program | |
410 | -r --rev REV [+] revision |
|
410 | -r --rev REV [+] revision | |
411 | -c --change REV change made by revision |
|
411 | -c --change REV change made by revision | |
412 | --patch compare patches for two revisions |
|
412 | --patch compare patches for two revisions | |
413 | -I --include PATTERN [+] include names matching the given patterns |
|
413 | -I --include PATTERN [+] include names matching the given patterns | |
414 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
414 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
415 | -S --subrepos recurse into subrepositories |
|
415 | -S --subrepos recurse into subrepositories | |
416 |
|
416 | |||
417 | (some details hidden, use --verbose to show complete help) |
|
417 | (some details hidden, use --verbose to show complete help) | |
418 |
|
418 | |||
419 |
|
419 | |||
420 |
|
420 | |||
421 |
|
421 | |||
422 |
|
422 | |||
423 |
|
423 | |||
424 |
|
424 | |||
425 |
|
425 | |||
426 |
|
426 | |||
427 |
|
427 | |||
428 | $ hg help --extension extdiff |
|
428 | $ hg help --extension extdiff | |
429 | extdiff extension - command to allow external programs to compare revisions |
|
429 | extdiff extension - command to allow external programs to compare revisions | |
430 |
|
430 | |||
431 | The extdiff Mercurial extension allows you to use external programs to compare |
|
431 | The extdiff Mercurial extension allows you to use external programs to compare | |
432 | revisions, or revision with working directory. The external diff programs are |
|
432 | revisions, or revision with working directory. The external diff programs are | |
433 | called with a configurable set of options and two non-option arguments: paths |
|
433 | called with a configurable set of options and two non-option arguments: paths | |
434 | to directories containing snapshots of files to compare. |
|
434 | to directories containing snapshots of files to compare. | |
435 |
|
435 | |||
436 | The extdiff extension also allows you to configure new diff commands, so you |
|
436 | The extdiff extension also allows you to configure new diff commands, so you | |
437 | do not need to type 'hg extdiff -p kdiff3' always. |
|
437 | do not need to type 'hg extdiff -p kdiff3' always. | |
438 |
|
438 | |||
439 | [extdiff] |
|
439 | [extdiff] | |
440 | # add new command that runs GNU diff(1) in 'context diff' mode |
|
440 | # add new command that runs GNU diff(1) in 'context diff' mode | |
441 | cdiff = gdiff -Nprc5 |
|
441 | cdiff = gdiff -Nprc5 | |
442 | ## or the old way: |
|
442 | ## or the old way: | |
443 | #cmd.cdiff = gdiff |
|
443 | #cmd.cdiff = gdiff | |
444 | #opts.cdiff = -Nprc5 |
|
444 | #opts.cdiff = -Nprc5 | |
445 |
|
445 | |||
446 | # add new command called meld, runs meld (no need to name twice). If |
|
446 | # add new command called meld, runs meld (no need to name twice). If | |
447 | # the meld executable is not available, the meld tool in [merge-tools] |
|
447 | # the meld executable is not available, the meld tool in [merge-tools] | |
448 | # will be used, if available |
|
448 | # will be used, if available | |
449 | meld = |
|
449 | meld = | |
450 |
|
450 | |||
451 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin |
|
451 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin | |
452 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non |
|
452 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non | |
453 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in |
|
453 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in | |
454 | # your .vimrc |
|
454 | # your .vimrc | |
455 | vimdiff = gvim -f "+next" \ |
|
455 | vimdiff = gvim -f "+next" \ | |
456 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
|
456 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" | |
457 |
|
457 | |||
458 | Tool arguments can include variables that are expanded at runtime: |
|
458 | Tool arguments can include variables that are expanded at runtime: | |
459 |
|
459 | |||
460 | $parent1, $plabel1 - filename, descriptive label of first parent |
|
460 | $parent1, $plabel1 - filename, descriptive label of first parent | |
461 | $child, $clabel - filename, descriptive label of child revision |
|
461 | $child, $clabel - filename, descriptive label of child revision | |
462 | $parent2, $plabel2 - filename, descriptive label of second parent |
|
462 | $parent2, $plabel2 - filename, descriptive label of second parent | |
463 | $root - repository root |
|
463 | $root - repository root | |
464 | $parent is an alias for $parent1. |
|
464 | $parent is an alias for $parent1. | |
465 |
|
465 | |||
466 | The extdiff extension will look in your [diff-tools] and [merge-tools] |
|
466 | The extdiff extension will look in your [diff-tools] and [merge-tools] | |
467 | sections for diff tool arguments, when none are specified in [extdiff]. |
|
467 | sections for diff tool arguments, when none are specified in [extdiff]. | |
468 |
|
468 | |||
469 | [extdiff] |
|
469 | [extdiff] | |
470 | kdiff3 = |
|
470 | kdiff3 = | |
471 |
|
471 | |||
472 | [diff-tools] |
|
472 | [diff-tools] | |
473 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
473 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child | |
474 |
|
474 | |||
475 | You can use -I/-X and list of file or directory names like normal 'hg diff' |
|
475 | You can use -I/-X and list of file or directory names like normal 'hg diff' | |
476 | command. The extdiff extension makes snapshots of only needed files, so |
|
476 | command. The extdiff extension makes snapshots of only needed files, so | |
477 | running the external diff program will actually be pretty fast (at least |
|
477 | running the external diff program will actually be pretty fast (at least | |
478 | faster than having to compare the entire tree). |
|
478 | faster than having to compare the entire tree). | |
479 |
|
479 | |||
480 | list of commands: |
|
480 | list of commands: | |
481 |
|
481 | |||
482 | extdiff use external program to diff repository (or selected files) |
|
482 | extdiff use external program to diff repository (or selected files) | |
483 |
|
483 | |||
484 | (use "hg help -v -e extdiff" to show built-in aliases and global options) |
|
484 | (use "hg help -v -e extdiff" to show built-in aliases and global options) | |
485 |
|
485 | |||
486 |
|
486 | |||
487 |
|
487 | |||
488 |
|
488 | |||
489 |
|
489 | |||
490 |
|
490 | |||
491 |
|
491 | |||
492 |
|
492 | |||
493 |
|
493 | |||
494 |
|
494 | |||
495 |
|
495 | |||
496 |
|
496 | |||
497 |
|
497 | |||
498 |
|
498 | |||
499 |
|
499 | |||
500 |
|
500 | |||
501 | $ echo 'extdiff = !' >> $HGRCPATH |
|
501 | $ echo 'extdiff = !' >> $HGRCPATH | |
502 |
|
502 | |||
503 | Test help topic with same name as extension |
|
503 | Test help topic with same name as extension | |
504 |
|
504 | |||
505 | $ cat > multirevs.py <<EOF |
|
505 | $ cat > multirevs.py <<EOF | |
506 | > from mercurial import cmdutil, commands |
|
506 | > from mercurial import cmdutil, commands | |
507 | > cmdtable = {} |
|
507 | > cmdtable = {} | |
508 | > command = cmdutil.command(cmdtable) |
|
508 | > command = cmdutil.command(cmdtable) | |
509 | > """multirevs extension |
|
509 | > """multirevs extension | |
510 | > Big multi-line module docstring.""" |
|
510 | > Big multi-line module docstring.""" | |
511 | > @command('multirevs', [], 'ARG', norepo=True) |
|
511 | > @command('multirevs', [], 'ARG', norepo=True) | |
512 | > def multirevs(ui, repo, arg, *args, **opts): |
|
512 | > def multirevs(ui, repo, arg, *args, **opts): | |
513 | > """multirevs command""" |
|
513 | > """multirevs command""" | |
514 | > pass |
|
514 | > pass | |
515 | > EOF |
|
515 | > EOF | |
516 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
|
516 | $ echo "multirevs = multirevs.py" >> $HGRCPATH | |
517 |
|
517 | |||
518 | $ hg help multirevs |
|
518 | $ hg help multirevs | |
519 | Specifying Multiple Revisions |
|
519 | Specifying Multiple Revisions | |
520 | """"""""""""""""""""""""""""" |
|
520 | """"""""""""""""""""""""""""" | |
521 |
|
521 | |||
522 | When Mercurial accepts more than one revision, they may be specified |
|
522 | When Mercurial accepts more than one revision, they may be specified | |
523 | individually, or provided as a topologically continuous range, separated |
|
523 | individually, or provided as a topologically continuous range, separated | |
524 | by the ":" character. |
|
524 | by the ":" character. | |
525 |
|
525 | |||
526 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END are |
|
526 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END are | |
527 | revision identifiers. Both BEGIN and END are optional. If BEGIN is not |
|
527 | revision identifiers. Both BEGIN and END are optional. If BEGIN is not | |
528 | specified, it defaults to revision number 0. If END is not specified, it |
|
528 | specified, it defaults to revision number 0. If END is not specified, it | |
529 | defaults to the tip. The range ":" thus means "all revisions". |
|
529 | defaults to the tip. The range ":" thus means "all revisions". | |
530 |
|
530 | |||
531 | If BEGIN is greater than END, revisions are treated in reverse order. |
|
531 | If BEGIN is greater than END, revisions are treated in reverse order. | |
532 |
|
532 | |||
533 | A range acts as a closed interval. This means that a range of 3:5 gives 3, |
|
533 | A range acts as a closed interval. This means that a range of 3:5 gives 3, | |
534 | 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. |
|
534 | 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. | |
535 |
|
535 | |||
536 | use "hg help -c multirevs" to see help for the multirevs command |
|
536 | use "hg help -c multirevs" to see help for the multirevs command | |
537 |
|
537 | |||
538 |
|
538 | |||
539 |
|
539 | |||
540 |
|
540 | |||
541 |
|
541 | |||
542 |
|
542 | |||
543 | $ hg help -c multirevs |
|
543 | $ hg help -c multirevs | |
544 | hg multirevs ARG |
|
544 | hg multirevs ARG | |
545 |
|
545 | |||
546 | multirevs command |
|
546 | multirevs command | |
547 |
|
547 | |||
548 | (some details hidden, use --verbose to show complete help) |
|
548 | (some details hidden, use --verbose to show complete help) | |
549 |
|
549 | |||
550 |
|
550 | |||
551 |
|
551 | |||
552 | $ hg multirevs |
|
552 | $ hg multirevs | |
553 | hg multirevs: invalid arguments |
|
553 | hg multirevs: invalid arguments | |
554 | hg multirevs ARG |
|
554 | hg multirevs ARG | |
555 |
|
555 | |||
556 | multirevs command |
|
556 | multirevs command | |
557 |
|
557 | |||
558 | (use "hg multirevs -h" to show more help) |
|
558 | (use "hg multirevs -h" to show more help) | |
559 | [255] |
|
559 | [255] | |
560 |
|
560 | |||
561 |
|
561 | |||
562 |
|
562 | |||
563 | $ echo "multirevs = !" >> $HGRCPATH |
|
563 | $ echo "multirevs = !" >> $HGRCPATH | |
564 |
|
564 | |||
565 | Issue811: Problem loading extensions twice (by site and by user) |
|
565 | Issue811: Problem loading extensions twice (by site and by user) | |
566 |
|
566 | |||
567 | $ cat <<EOF >> $HGRCPATH |
|
567 | $ cat <<EOF >> $HGRCPATH | |
568 | > mq = |
|
568 | > mq = | |
569 | > strip = |
|
569 | > strip = | |
570 | > hgext.mq = |
|
570 | > hgext.mq = | |
571 | > hgext/mq = |
|
571 | > hgext/mq = | |
572 | > EOF |
|
572 | > EOF | |
573 |
|
573 | |||
574 | Show extensions: |
|
574 | Show extensions: | |
575 | (note that mq force load strip, also checking it's not loaded twice) |
|
575 | (note that mq force load strip, also checking it's not loaded twice) | |
576 |
|
576 | |||
577 | $ hg debugextensions |
|
577 | $ hg debugextensions | |
578 | mq |
|
578 | mq | |
579 | strip |
|
579 | strip | |
580 |
|
580 | |||
581 | For extensions, which name matches one of its commands, help |
|
581 | For extensions, which name matches one of its commands, help | |
582 | message should ask '-v -e' to get list of built-in aliases |
|
582 | message should ask '-v -e' to get list of built-in aliases | |
583 | along with extension help itself |
|
583 | along with extension help itself | |
584 |
|
584 | |||
585 | $ mkdir $TESTTMP/d |
|
585 | $ mkdir $TESTTMP/d | |
586 | $ cat > $TESTTMP/d/dodo.py <<EOF |
|
586 | $ cat > $TESTTMP/d/dodo.py <<EOF | |
587 | > """ |
|
587 | > """ | |
588 | > This is an awesome 'dodo' extension. It does nothing and |
|
588 | > This is an awesome 'dodo' extension. It does nothing and | |
589 | > writes 'Foo foo' |
|
589 | > writes 'Foo foo' | |
590 | > """ |
|
590 | > """ | |
591 | > from mercurial import cmdutil, commands |
|
591 | > from mercurial import cmdutil, commands | |
592 | > cmdtable = {} |
|
592 | > cmdtable = {} | |
593 | > command = cmdutil.command(cmdtable) |
|
593 | > command = cmdutil.command(cmdtable) | |
594 | > @command('dodo', [], 'hg dodo') |
|
594 | > @command('dodo', [], 'hg dodo') | |
595 | > def dodo(ui, *args, **kwargs): |
|
595 | > def dodo(ui, *args, **kwargs): | |
596 | > """Does nothing""" |
|
596 | > """Does nothing""" | |
597 | > ui.write("I do nothing. Yay\\n") |
|
597 | > ui.write("I do nothing. Yay\\n") | |
598 | > @command('foofoo', [], 'hg foofoo') |
|
598 | > @command('foofoo', [], 'hg foofoo') | |
599 | > def foofoo(ui, *args, **kwargs): |
|
599 | > def foofoo(ui, *args, **kwargs): | |
600 | > """Writes 'Foo foo'""" |
|
600 | > """Writes 'Foo foo'""" | |
601 | > ui.write("Foo foo\\n") |
|
601 | > ui.write("Foo foo\\n") | |
602 | > EOF |
|
602 | > EOF | |
603 | $ dodopath=$TESTTMP/d/dodo.py |
|
603 | $ dodopath=$TESTTMP/d/dodo.py | |
604 |
|
604 | |||
605 | $ echo "dodo = $dodopath" >> $HGRCPATH |
|
605 | $ echo "dodo = $dodopath" >> $HGRCPATH | |
606 |
|
606 | |||
607 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases |
|
607 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases | |
608 | $ hg help -e dodo |
|
608 | $ hg help -e dodo | |
609 | dodo extension - |
|
609 | dodo extension - | |
610 |
|
610 | |||
611 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
611 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' | |
612 |
|
612 | |||
613 | list of commands: |
|
613 | list of commands: | |
614 |
|
614 | |||
615 | dodo Does nothing |
|
615 | dodo Does nothing | |
616 | foofoo Writes 'Foo foo' |
|
616 | foofoo Writes 'Foo foo' | |
617 |
|
617 | |||
618 | (use "hg help -v -e dodo" to show built-in aliases and global options) |
|
618 | (use "hg help -v -e dodo" to show built-in aliases and global options) | |
619 |
|
619 | |||
620 | Make sure that '-v -e' prints list of built-in aliases along with |
|
620 | Make sure that '-v -e' prints list of built-in aliases along with | |
621 | extension help itself |
|
621 | extension help itself | |
622 | $ hg help -v -e dodo |
|
622 | $ hg help -v -e dodo | |
623 | dodo extension - |
|
623 | dodo extension - | |
624 |
|
624 | |||
625 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
625 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' | |
626 |
|
626 | |||
627 | list of commands: |
|
627 | list of commands: | |
628 |
|
628 | |||
629 | dodo Does nothing |
|
629 | dodo Does nothing | |
630 | foofoo Writes 'Foo foo' |
|
630 | foofoo Writes 'Foo foo' | |
631 |
|
631 | |||
632 | global options ([+] can be repeated): |
|
632 | global options ([+] can be repeated): | |
633 |
|
633 | |||
634 | -R --repository REPO repository root directory or name of overlay bundle |
|
634 | -R --repository REPO repository root directory or name of overlay bundle | |
635 | file |
|
635 | file | |
636 | --cwd DIR change working directory |
|
636 | --cwd DIR change working directory | |
637 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
637 | -y --noninteractive do not prompt, automatically pick the first choice for | |
638 | all prompts |
|
638 | all prompts | |
639 | -q --quiet suppress output |
|
639 | -q --quiet suppress output | |
640 | -v --verbose enable additional output |
|
640 | -v --verbose enable additional output | |
641 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
641 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
642 | --debug enable debugging output |
|
642 | --debug enable debugging output | |
643 | --debugger start debugger |
|
643 | --debugger start debugger | |
644 | --encoding ENCODE set the charset encoding (default: ascii) |
|
644 | --encoding ENCODE set the charset encoding (default: ascii) | |
645 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
645 | --encodingmode MODE set the charset encoding mode (default: strict) | |
646 | --traceback always print a traceback on exception |
|
646 | --traceback always print a traceback on exception | |
647 | --time time how long the command takes |
|
647 | --time time how long the command takes | |
648 | --profile print command execution profile |
|
648 | --profile print command execution profile | |
649 | --version output version information and exit |
|
649 | --version output version information and exit | |
650 | -h --help display help and exit |
|
650 | -h --help display help and exit | |
651 | --hidden consider hidden changesets |
|
651 | --hidden consider hidden changesets | |
652 |
|
652 | |||
653 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command |
|
653 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command | |
654 | $ hg help -v dodo |
|
654 | $ hg help -v dodo | |
655 | hg dodo |
|
655 | hg dodo | |
656 |
|
656 | |||
657 | Does nothing |
|
657 | Does nothing | |
658 |
|
658 | |||
659 | (use "hg help -e dodo" to show help for the dodo extension) |
|
659 | (use "hg help -e dodo" to show help for the dodo extension) | |
660 |
|
660 | |||
661 | options: |
|
661 | options: | |
662 |
|
662 | |||
663 | --mq operate on patch repository |
|
663 | --mq operate on patch repository | |
664 |
|
664 | |||
665 | global options ([+] can be repeated): |
|
665 | global options ([+] can be repeated): | |
666 |
|
666 | |||
667 | -R --repository REPO repository root directory or name of overlay bundle |
|
667 | -R --repository REPO repository root directory or name of overlay bundle | |
668 | file |
|
668 | file | |
669 | --cwd DIR change working directory |
|
669 | --cwd DIR change working directory | |
670 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
670 | -y --noninteractive do not prompt, automatically pick the first choice for | |
671 | all prompts |
|
671 | all prompts | |
672 | -q --quiet suppress output |
|
672 | -q --quiet suppress output | |
673 | -v --verbose enable additional output |
|
673 | -v --verbose enable additional output | |
674 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
674 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
675 | --debug enable debugging output |
|
675 | --debug enable debugging output | |
676 | --debugger start debugger |
|
676 | --debugger start debugger | |
677 | --encoding ENCODE set the charset encoding (default: ascii) |
|
677 | --encoding ENCODE set the charset encoding (default: ascii) | |
678 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
678 | --encodingmode MODE set the charset encoding mode (default: strict) | |
679 | --traceback always print a traceback on exception |
|
679 | --traceback always print a traceback on exception | |
680 | --time time how long the command takes |
|
680 | --time time how long the command takes | |
681 | --profile print command execution profile |
|
681 | --profile print command execution profile | |
682 | --version output version information and exit |
|
682 | --version output version information and exit | |
683 | -h --help display help and exit |
|
683 | -h --help display help and exit | |
684 | --hidden consider hidden changesets |
|
684 | --hidden consider hidden changesets | |
685 |
|
685 | |||
686 | In case when extension name doesn't match any of its commands, |
|
686 | In case when extension name doesn't match any of its commands, | |
687 | help message should ask for '-v' to get list of built-in aliases |
|
687 | help message should ask for '-v' to get list of built-in aliases | |
688 | along with extension help |
|
688 | along with extension help | |
689 | $ cat > $TESTTMP/d/dudu.py <<EOF |
|
689 | $ cat > $TESTTMP/d/dudu.py <<EOF | |
690 | > """ |
|
690 | > """ | |
691 | > This is an awesome 'dudu' extension. It does something and |
|
691 | > This is an awesome 'dudu' extension. It does something and | |
692 | > also writes 'Beep beep' |
|
692 | > also writes 'Beep beep' | |
693 | > """ |
|
693 | > """ | |
694 | > from mercurial import cmdutil, commands |
|
694 | > from mercurial import cmdutil, commands | |
695 | > cmdtable = {} |
|
695 | > cmdtable = {} | |
696 | > command = cmdutil.command(cmdtable) |
|
696 | > command = cmdutil.command(cmdtable) | |
697 | > @command('something', [], 'hg something') |
|
697 | > @command('something', [], 'hg something') | |
698 | > def something(ui, *args, **kwargs): |
|
698 | > def something(ui, *args, **kwargs): | |
699 | > """Does something""" |
|
699 | > """Does something""" | |
700 | > ui.write("I do something. Yaaay\\n") |
|
700 | > ui.write("I do something. Yaaay\\n") | |
701 | > @command('beep', [], 'hg beep') |
|
701 | > @command('beep', [], 'hg beep') | |
702 | > def beep(ui, *args, **kwargs): |
|
702 | > def beep(ui, *args, **kwargs): | |
703 | > """Writes 'Beep beep'""" |
|
703 | > """Writes 'Beep beep'""" | |
704 | > ui.write("Beep beep\\n") |
|
704 | > ui.write("Beep beep\\n") | |
705 | > EOF |
|
705 | > EOF | |
706 | $ dudupath=$TESTTMP/d/dudu.py |
|
706 | $ dudupath=$TESTTMP/d/dudu.py | |
707 |
|
707 | |||
708 | $ echo "dudu = $dudupath" >> $HGRCPATH |
|
708 | $ echo "dudu = $dudupath" >> $HGRCPATH | |
709 |
|
709 | |||
710 | $ hg help -e dudu |
|
710 | $ hg help -e dudu | |
711 | dudu extension - |
|
711 | dudu extension - | |
712 |
|
712 | |||
713 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
713 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
714 | beep' |
|
714 | beep' | |
715 |
|
715 | |||
716 | list of commands: |
|
716 | list of commands: | |
717 |
|
717 | |||
718 | beep Writes 'Beep beep' |
|
718 | beep Writes 'Beep beep' | |
719 | something Does something |
|
719 | something Does something | |
720 |
|
720 | |||
721 | (use "hg help -v dudu" to show built-in aliases and global options) |
|
721 | (use "hg help -v dudu" to show built-in aliases and global options) | |
722 |
|
722 | |||
723 | In case when extension name doesn't match any of its commands, |
|
723 | In case when extension name doesn't match any of its commands, | |
724 | help options '-v' and '-v -e' should be equivalent |
|
724 | help options '-v' and '-v -e' should be equivalent | |
725 | $ hg help -v dudu |
|
725 | $ hg help -v dudu | |
726 | dudu extension - |
|
726 | dudu extension - | |
727 |
|
727 | |||
728 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
728 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
729 | beep' |
|
729 | beep' | |
730 |
|
730 | |||
731 | list of commands: |
|
731 | list of commands: | |
732 |
|
732 | |||
733 | beep Writes 'Beep beep' |
|
733 | beep Writes 'Beep beep' | |
734 | something Does something |
|
734 | something Does something | |
735 |
|
735 | |||
736 | global options ([+] can be repeated): |
|
736 | global options ([+] can be repeated): | |
737 |
|
737 | |||
738 | -R --repository REPO repository root directory or name of overlay bundle |
|
738 | -R --repository REPO repository root directory or name of overlay bundle | |
739 | file |
|
739 | file | |
740 | --cwd DIR change working directory |
|
740 | --cwd DIR change working directory | |
741 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
741 | -y --noninteractive do not prompt, automatically pick the first choice for | |
742 | all prompts |
|
742 | all prompts | |
743 | -q --quiet suppress output |
|
743 | -q --quiet suppress output | |
744 | -v --verbose enable additional output |
|
744 | -v --verbose enable additional output | |
745 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
745 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
746 | --debug enable debugging output |
|
746 | --debug enable debugging output | |
747 | --debugger start debugger |
|
747 | --debugger start debugger | |
748 | --encoding ENCODE set the charset encoding (default: ascii) |
|
748 | --encoding ENCODE set the charset encoding (default: ascii) | |
749 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
749 | --encodingmode MODE set the charset encoding mode (default: strict) | |
750 | --traceback always print a traceback on exception |
|
750 | --traceback always print a traceback on exception | |
751 | --time time how long the command takes |
|
751 | --time time how long the command takes | |
752 | --profile print command execution profile |
|
752 | --profile print command execution profile | |
753 | --version output version information and exit |
|
753 | --version output version information and exit | |
754 | -h --help display help and exit |
|
754 | -h --help display help and exit | |
755 | --hidden consider hidden changesets |
|
755 | --hidden consider hidden changesets | |
756 |
|
756 | |||
757 | $ hg help -v -e dudu |
|
757 | $ hg help -v -e dudu | |
758 | dudu extension - |
|
758 | dudu extension - | |
759 |
|
759 | |||
760 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
760 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
761 | beep' |
|
761 | beep' | |
762 |
|
762 | |||
763 | list of commands: |
|
763 | list of commands: | |
764 |
|
764 | |||
765 | beep Writes 'Beep beep' |
|
765 | beep Writes 'Beep beep' | |
766 | something Does something |
|
766 | something Does something | |
767 |
|
767 | |||
768 | global options ([+] can be repeated): |
|
768 | global options ([+] can be repeated): | |
769 |
|
769 | |||
770 | -R --repository REPO repository root directory or name of overlay bundle |
|
770 | -R --repository REPO repository root directory or name of overlay bundle | |
771 | file |
|
771 | file | |
772 | --cwd DIR change working directory |
|
772 | --cwd DIR change working directory | |
773 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
773 | -y --noninteractive do not prompt, automatically pick the first choice for | |
774 | all prompts |
|
774 | all prompts | |
775 | -q --quiet suppress output |
|
775 | -q --quiet suppress output | |
776 | -v --verbose enable additional output |
|
776 | -v --verbose enable additional output | |
777 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
777 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
778 | --debug enable debugging output |
|
778 | --debug enable debugging output | |
779 | --debugger start debugger |
|
779 | --debugger start debugger | |
780 | --encoding ENCODE set the charset encoding (default: ascii) |
|
780 | --encoding ENCODE set the charset encoding (default: ascii) | |
781 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
781 | --encodingmode MODE set the charset encoding mode (default: strict) | |
782 | --traceback always print a traceback on exception |
|
782 | --traceback always print a traceback on exception | |
783 | --time time how long the command takes |
|
783 | --time time how long the command takes | |
784 | --profile print command execution profile |
|
784 | --profile print command execution profile | |
785 | --version output version information and exit |
|
785 | --version output version information and exit | |
786 | -h --help display help and exit |
|
786 | -h --help display help and exit | |
787 | --hidden consider hidden changesets |
|
787 | --hidden consider hidden changesets | |
788 |
|
788 | |||
789 | Disabled extension commands: |
|
789 | Disabled extension commands: | |
790 |
|
790 | |||
791 | $ ORGHGRCPATH=$HGRCPATH |
|
791 | $ ORGHGRCPATH=$HGRCPATH | |
792 | $ HGRCPATH= |
|
792 | $ HGRCPATH= | |
793 | $ export HGRCPATH |
|
793 | $ export HGRCPATH | |
794 | $ hg help email |
|
794 | $ hg help email | |
795 | 'email' is provided by the following extension: |
|
795 | 'email' is provided by the following extension: | |
796 |
|
796 | |||
797 | patchbomb command to send changesets as (a series of) patch emails |
|
797 | patchbomb command to send changesets as (a series of) patch emails | |
798 |
|
798 | |||
799 | (use "hg help extensions" for information on enabling extensions) |
|
799 | (use "hg help extensions" for information on enabling extensions) | |
800 |
|
800 | |||
801 |
|
801 | |||
802 | $ hg qdel |
|
802 | $ hg qdel | |
803 | hg: unknown command 'qdel' |
|
803 | hg: unknown command 'qdel' | |
804 | 'qdelete' is provided by the following extension: |
|
804 | 'qdelete' is provided by the following extension: | |
805 |
|
805 | |||
806 | mq manage a stack of patches |
|
806 | mq manage a stack of patches | |
807 |
|
807 | |||
808 | (use "hg help extensions" for information on enabling extensions) |
|
808 | (use "hg help extensions" for information on enabling extensions) | |
809 | [255] |
|
809 | [255] | |
810 |
|
810 | |||
811 |
|
811 | |||
812 | $ hg churn |
|
812 | $ hg churn | |
813 | hg: unknown command 'churn' |
|
813 | hg: unknown command 'churn' | |
814 | 'churn' is provided by the following extension: |
|
814 | 'churn' is provided by the following extension: | |
815 |
|
815 | |||
816 | churn command to display statistics about repository history |
|
816 | churn command to display statistics about repository history | |
817 |
|
817 | |||
818 | (use "hg help extensions" for information on enabling extensions) |
|
818 | (use "hg help extensions" for information on enabling extensions) | |
819 | [255] |
|
819 | [255] | |
820 |
|
820 | |||
821 |
|
821 | |||
822 |
|
822 | |||
823 | Disabled extensions: |
|
823 | Disabled extensions: | |
824 |
|
824 | |||
825 | $ hg help churn |
|
825 | $ hg help churn | |
826 | churn extension - command to display statistics about repository history |
|
826 | churn extension - command to display statistics about repository history | |
827 |
|
827 | |||
828 | (use "hg help extensions" for information on enabling extensions) |
|
828 | (use "hg help extensions" for information on enabling extensions) | |
829 |
|
829 | |||
830 | $ hg help patchbomb |
|
830 | $ hg help patchbomb | |
831 | patchbomb extension - command to send changesets as (a series of) patch emails |
|
831 | patchbomb extension - command to send changesets as (a series of) patch emails | |
832 |
|
832 | |||
833 | (use "hg help extensions" for information on enabling extensions) |
|
833 | (use "hg help extensions" for information on enabling extensions) | |
834 |
|
834 | |||
835 |
|
835 | |||
836 | Broken disabled extension and command: |
|
836 | Broken disabled extension and command: | |
837 |
|
837 | |||
838 | $ mkdir hgext |
|
838 | $ mkdir hgext | |
839 | $ echo > hgext/__init__.py |
|
839 | $ echo > hgext/__init__.py | |
840 | $ cat > hgext/broken.py <<EOF |
|
840 | $ cat > hgext/broken.py <<EOF | |
841 | > "broken extension' |
|
841 | > "broken extension' | |
842 | > EOF |
|
842 | > EOF | |
843 | $ cat > path.py <<EOF |
|
843 | $ cat > path.py <<EOF | |
844 | > import os, sys |
|
844 | > import os, sys | |
845 | > sys.path.insert(0, os.environ['HGEXTPATH']) |
|
845 | > sys.path.insert(0, os.environ['HGEXTPATH']) | |
846 | > EOF |
|
846 | > EOF | |
847 | $ HGEXTPATH=`pwd` |
|
847 | $ HGEXTPATH=`pwd` | |
848 | $ export HGEXTPATH |
|
848 | $ export HGEXTPATH | |
849 |
|
849 | |||
850 | $ hg --config extensions.path=./path.py help broken |
|
850 | $ hg --config extensions.path=./path.py help broken | |
851 | broken extension - (no help text available) |
|
851 | broken extension - (no help text available) | |
852 |
|
852 | |||
853 | (use "hg help extensions" for information on enabling extensions) |
|
853 | (use "hg help extensions" for information on enabling extensions) | |
854 |
|
854 | |||
855 |
|
855 | |||
856 | $ cat > hgext/forest.py <<EOF |
|
856 | $ cat > hgext/forest.py <<EOF | |
857 | > cmdtable = None |
|
857 | > cmdtable = None | |
858 | > EOF |
|
858 | > EOF | |
859 | $ hg --config extensions.path=./path.py help foo > /dev/null |
|
859 | $ hg --config extensions.path=./path.py help foo > /dev/null | |
860 | warning: error finding commands in $TESTTMP/hgext/forest.py (glob) |
|
860 | warning: error finding commands in $TESTTMP/hgext/forest.py (glob) | |
861 | abort: no such help topic: foo |
|
861 | abort: no such help topic: foo | |
862 | (try "hg help --keyword foo") |
|
862 | (try "hg help --keyword foo") | |
863 | [255] |
|
863 | [255] | |
864 |
|
864 | |||
865 | $ cat > throw.py <<EOF |
|
865 | $ cat > throw.py <<EOF | |
866 | > from mercurial import cmdutil, commands, util |
|
866 | > from mercurial import cmdutil, commands, util | |
867 | > cmdtable = {} |
|
867 | > cmdtable = {} | |
868 | > command = cmdutil.command(cmdtable) |
|
868 | > command = cmdutil.command(cmdtable) | |
869 | > class Bogon(Exception): pass |
|
869 | > class Bogon(Exception): pass | |
870 | > @command('throw', [], 'hg throw', norepo=True) |
|
870 | > @command('throw', [], 'hg throw', norepo=True) | |
871 | > def throw(ui, **opts): |
|
871 | > def throw(ui, **opts): | |
872 | > """throws an exception""" |
|
872 | > """throws an exception""" | |
873 | > raise Bogon() |
|
873 | > raise Bogon() | |
874 | > EOF |
|
874 | > EOF | |
875 |
|
875 | |||
876 | No declared supported version, extension complains: |
|
876 | No declared supported version, extension complains: | |
877 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
877 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
878 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
878 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
879 | ** which supports versions unknown of Mercurial. |
|
879 | ** which supports versions unknown of Mercurial. | |
880 | ** Please disable throw and try your action again. |
|
880 | ** Please disable throw and try your action again. | |
881 | ** If that fixes the bug please report it to the extension author. |
|
881 | ** If that fixes the bug please report it to the extension author. | |
882 | ** Python * (glob) |
|
882 | ** Python * (glob) | |
883 | ** Mercurial Distributed SCM * (glob) |
|
883 | ** Mercurial Distributed SCM * (glob) | |
884 | ** Extensions loaded: throw |
|
884 | ** Extensions loaded: throw | |
885 |
|
885 | |||
886 | empty declaration of supported version, extension complains: |
|
886 | empty declaration of supported version, extension complains: | |
887 | $ echo "testedwith = ''" >> throw.py |
|
887 | $ echo "testedwith = ''" >> throw.py | |
888 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
888 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
889 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
889 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
890 | ** which supports versions unknown of Mercurial. |
|
890 | ** which supports versions unknown of Mercurial. | |
891 | ** Please disable throw and try your action again. |
|
891 | ** Please disable throw and try your action again. | |
892 | ** If that fixes the bug please report it to the extension author. |
|
892 | ** If that fixes the bug please report it to the extension author. | |
893 | ** Python * (glob) |
|
893 | ** Python * (glob) | |
894 | ** Mercurial Distributed SCM (*) (glob) |
|
894 | ** Mercurial Distributed SCM (*) (glob) | |
895 | ** Extensions loaded: throw |
|
895 | ** Extensions loaded: throw | |
896 |
|
896 | |||
897 | If the extension specifies a buglink, show that: |
|
897 | If the extension specifies a buglink, show that: | |
898 | $ echo 'buglink = "http://example.com/bts"' >> throw.py |
|
898 | $ echo 'buglink = "http://example.com/bts"' >> throw.py | |
899 | $ rm -f throw.pyc throw.pyo |
|
899 | $ rm -f throw.pyc throw.pyo | |
900 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
900 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
901 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
901 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
902 | ** which supports versions unknown of Mercurial. |
|
902 | ** which supports versions unknown of Mercurial. | |
903 | ** Please disable throw and try your action again. |
|
903 | ** Please disable throw and try your action again. | |
904 | ** If that fixes the bug please report it to http://example.com/bts |
|
904 | ** If that fixes the bug please report it to http://example.com/bts | |
905 | ** Python * (glob) |
|
905 | ** Python * (glob) | |
906 | ** Mercurial Distributed SCM (*) (glob) |
|
906 | ** Mercurial Distributed SCM (*) (glob) | |
907 | ** Extensions loaded: throw |
|
907 | ** Extensions loaded: throw | |
908 |
|
908 | |||
909 | If the extensions declare outdated versions, accuse the older extension first: |
|
909 | If the extensions declare outdated versions, accuse the older extension first: | |
910 | $ echo "from mercurial import util" >> older.py |
|
910 | $ echo "from mercurial import util" >> older.py | |
911 | $ echo "util.version = lambda:'2.2'" >> older.py |
|
911 | $ echo "util.version = lambda:'2.2'" >> older.py | |
912 | $ echo "testedwith = '1.9.3'" >> older.py |
|
912 | $ echo "testedwith = '1.9.3'" >> older.py | |
913 | $ echo "testedwith = '2.1.1'" >> throw.py |
|
913 | $ echo "testedwith = '2.1.1'" >> throw.py | |
914 | $ rm -f throw.pyc throw.pyo |
|
914 | $ rm -f throw.pyc throw.pyo | |
915 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
915 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
916 | > throw 2>&1 | egrep '^\*\*' |
|
916 | > throw 2>&1 | egrep '^\*\*' | |
917 | ** Unknown exception encountered with possibly-broken third-party extension older |
|
917 | ** Unknown exception encountered with possibly-broken third-party extension older | |
918 | ** which supports versions 1.9 of Mercurial. |
|
918 | ** which supports versions 1.9 of Mercurial. | |
919 | ** Please disable older and try your action again. |
|
919 | ** Please disable older and try your action again. | |
920 | ** If that fixes the bug please report it to the extension author. |
|
920 | ** If that fixes the bug please report it to the extension author. | |
921 | ** Python * (glob) |
|
921 | ** Python * (glob) | |
922 | ** Mercurial Distributed SCM (version 2.2) |
|
922 | ** Mercurial Distributed SCM (version 2.2) | |
923 | ** Extensions loaded: throw, older |
|
923 | ** Extensions loaded: throw, older | |
924 |
|
924 | |||
925 | One extension only tested with older, one only with newer versions: |
|
925 | One extension only tested with older, one only with newer versions: | |
926 | $ echo "util.version = lambda:'2.1'" >> older.py |
|
926 | $ echo "util.version = lambda:'2.1'" >> older.py | |
927 | $ rm -f older.pyc older.pyo |
|
927 | $ rm -f older.pyc older.pyo | |
928 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
928 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
929 | > throw 2>&1 | egrep '^\*\*' |
|
929 | > throw 2>&1 | egrep '^\*\*' | |
930 | ** Unknown exception encountered with possibly-broken third-party extension older |
|
930 | ** Unknown exception encountered with possibly-broken third-party extension older | |
931 | ** which supports versions 1.9 of Mercurial. |
|
931 | ** which supports versions 1.9 of Mercurial. | |
932 | ** Please disable older and try your action again. |
|
932 | ** Please disable older and try your action again. | |
933 | ** If that fixes the bug please report it to the extension author. |
|
933 | ** If that fixes the bug please report it to the extension author. | |
934 | ** Python * (glob) |
|
934 | ** Python * (glob) | |
935 | ** Mercurial Distributed SCM (version 2.1) |
|
935 | ** Mercurial Distributed SCM (version 2.1) | |
936 | ** Extensions loaded: throw, older |
|
936 | ** Extensions loaded: throw, older | |
937 |
|
937 | |||
938 | Older extension is tested with current version, the other only with newer: |
|
938 | Older extension is tested with current version, the other only with newer: | |
939 | $ echo "util.version = lambda:'1.9.3'" >> older.py |
|
939 | $ echo "util.version = lambda:'1.9.3'" >> older.py | |
940 | $ rm -f older.pyc older.pyo |
|
940 | $ rm -f older.pyc older.pyo | |
941 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
941 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
942 | > throw 2>&1 | egrep '^\*\*' |
|
942 | > throw 2>&1 | egrep '^\*\*' | |
943 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
943 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
944 | ** which supports versions 2.1 of Mercurial. |
|
944 | ** which supports versions 2.1 of Mercurial. | |
945 | ** Please disable throw and try your action again. |
|
945 | ** Please disable throw and try your action again. | |
946 | ** If that fixes the bug please report it to http://example.com/bts |
|
946 | ** If that fixes the bug please report it to http://example.com/bts | |
947 | ** Python * (glob) |
|
947 | ** Python * (glob) | |
948 | ** Mercurial Distributed SCM (version 1.9.3) |
|
948 | ** Mercurial Distributed SCM (version 1.9.3) | |
949 | ** Extensions loaded: throw, older |
|
949 | ** Extensions loaded: throw, older | |
950 |
|
950 | |||
951 | Ability to point to a different point |
|
951 | Ability to point to a different point | |
952 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
952 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
953 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' |
|
953 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' | |
954 | ** unknown exception encountered, please report by visiting |
|
954 | ** unknown exception encountered, please report by visiting | |
955 | ** Your Local Goat Lenders |
|
955 | ** Your Local Goat Lenders | |
956 | ** Python * (glob) |
|
956 | ** Python * (glob) | |
957 | ** Mercurial Distributed SCM (*) (glob) |
|
957 | ** Mercurial Distributed SCM (*) (glob) | |
958 | ** Extensions loaded: throw, older |
|
958 | ** Extensions loaded: throw, older | |
959 |
|
959 | |||
960 | Declare the version as supporting this hg version, show regular bts link: |
|
960 | Declare the version as supporting this hg version, show regular bts link: | |
961 | $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'` |
|
961 | $ hgver=`hg debuginstall -T '{hgver}'` | |
962 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py |
|
962 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py | |
963 | $ if [ -z "$hgver" ]; then |
|
963 | $ if [ -z "$hgver" ]; then | |
964 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; |
|
964 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; | |
965 | > fi |
|
965 | > fi | |
966 | $ rm -f throw.pyc throw.pyo |
|
966 | $ rm -f throw.pyc throw.pyo | |
967 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
967 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
968 | ** unknown exception encountered, please report by visiting |
|
968 | ** unknown exception encountered, please report by visiting | |
969 | ** https://mercurial-scm.org/wiki/BugTracker |
|
969 | ** https://mercurial-scm.org/wiki/BugTracker | |
970 | ** Python * (glob) |
|
970 | ** Python * (glob) | |
971 | ** Mercurial Distributed SCM (*) (glob) |
|
971 | ** Mercurial Distributed SCM (*) (glob) | |
972 | ** Extensions loaded: throw |
|
972 | ** Extensions loaded: throw | |
973 |
|
973 | |||
974 | Patch version is ignored during compatibility check |
|
974 | Patch version is ignored during compatibility check | |
975 | $ echo "testedwith = '3.2'" >> throw.py |
|
975 | $ echo "testedwith = '3.2'" >> throw.py | |
976 | $ echo "util.version = lambda:'3.2.2'" >> throw.py |
|
976 | $ echo "util.version = lambda:'3.2.2'" >> throw.py | |
977 | $ rm -f throw.pyc throw.pyo |
|
977 | $ rm -f throw.pyc throw.pyo | |
978 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
978 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
979 | ** unknown exception encountered, please report by visiting |
|
979 | ** unknown exception encountered, please report by visiting | |
980 | ** https://mercurial-scm.org/wiki/BugTracker |
|
980 | ** https://mercurial-scm.org/wiki/BugTracker | |
981 | ** Python * (glob) |
|
981 | ** Python * (glob) | |
982 | ** Mercurial Distributed SCM (*) (glob) |
|
982 | ** Mercurial Distributed SCM (*) (glob) | |
983 | ** Extensions loaded: throw |
|
983 | ** Extensions loaded: throw | |
984 |
|
984 | |||
985 | Test version number support in 'hg version': |
|
985 | Test version number support in 'hg version': | |
986 | $ echo '__version__ = (1, 2, 3)' >> throw.py |
|
986 | $ echo '__version__ = (1, 2, 3)' >> throw.py | |
987 | $ rm -f throw.pyc throw.pyo |
|
987 | $ rm -f throw.pyc throw.pyo | |
988 | $ hg version -v |
|
988 | $ hg version -v | |
989 | Mercurial Distributed SCM (version *) (glob) |
|
989 | Mercurial Distributed SCM (version *) (glob) | |
990 | (see https://mercurial-scm.org for more information) |
|
990 | (see https://mercurial-scm.org for more information) | |
991 |
|
991 | |||
992 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
992 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
993 | This is free software; see the source for copying conditions. There is NO |
|
993 | This is free software; see the source for copying conditions. There is NO | |
994 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
994 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
995 |
|
995 | |||
996 | Enabled extensions: |
|
996 | Enabled extensions: | |
997 |
|
997 | |||
998 |
|
998 | |||
999 | $ hg version -v --config extensions.throw=throw.py |
|
999 | $ hg version -v --config extensions.throw=throw.py | |
1000 | Mercurial Distributed SCM (version *) (glob) |
|
1000 | Mercurial Distributed SCM (version *) (glob) | |
1001 | (see https://mercurial-scm.org for more information) |
|
1001 | (see https://mercurial-scm.org for more information) | |
1002 |
|
1002 | |||
1003 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1003 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
1004 | This is free software; see the source for copying conditions. There is NO |
|
1004 | This is free software; see the source for copying conditions. There is NO | |
1005 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1005 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1006 |
|
1006 | |||
1007 | Enabled extensions: |
|
1007 | Enabled extensions: | |
1008 |
|
1008 | |||
1009 | throw external 1.2.3 |
|
1009 | throw external 1.2.3 | |
1010 | $ echo 'getversion = lambda: "1.twentythree"' >> throw.py |
|
1010 | $ echo 'getversion = lambda: "1.twentythree"' >> throw.py | |
1011 | $ rm -f throw.pyc throw.pyo |
|
1011 | $ rm -f throw.pyc throw.pyo | |
1012 | $ hg version -v --config extensions.throw=throw.py |
|
1012 | $ hg version -v --config extensions.throw=throw.py | |
1013 | Mercurial Distributed SCM (version *) (glob) |
|
1013 | Mercurial Distributed SCM (version *) (glob) | |
1014 | (see https://mercurial-scm.org for more information) |
|
1014 | (see https://mercurial-scm.org for more information) | |
1015 |
|
1015 | |||
1016 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1016 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
1017 | This is free software; see the source for copying conditions. There is NO |
|
1017 | This is free software; see the source for copying conditions. There is NO | |
1018 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1018 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1019 |
|
1019 | |||
1020 | Enabled extensions: |
|
1020 | Enabled extensions: | |
1021 |
|
1021 | |||
1022 | throw external 1.twentythree |
|
1022 | throw external 1.twentythree | |
1023 |
|
1023 | |||
1024 | Refuse to load extensions with minimum version requirements |
|
1024 | Refuse to load extensions with minimum version requirements | |
1025 |
|
1025 | |||
1026 | $ cat > minversion1.py << EOF |
|
1026 | $ cat > minversion1.py << EOF | |
1027 | > from mercurial import util |
|
1027 | > from mercurial import util | |
1028 | > util.version = lambda: '3.5.2' |
|
1028 | > util.version = lambda: '3.5.2' | |
1029 | > minimumhgversion = '3.6' |
|
1029 | > minimumhgversion = '3.6' | |
1030 | > EOF |
|
1030 | > EOF | |
1031 | $ hg --config extensions.minversion=minversion1.py version |
|
1031 | $ hg --config extensions.minversion=minversion1.py version | |
1032 | (third party extension minversion requires version 3.6 or newer of Mercurial; disabling) |
|
1032 | (third party extension minversion requires version 3.6 or newer of Mercurial; disabling) | |
1033 | Mercurial Distributed SCM (version 3.5.2) |
|
1033 | Mercurial Distributed SCM (version 3.5.2) | |
1034 | (see https://mercurial-scm.org for more information) |
|
1034 | (see https://mercurial-scm.org for more information) | |
1035 |
|
1035 | |||
1036 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1036 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
1037 | This is free software; see the source for copying conditions. There is NO |
|
1037 | This is free software; see the source for copying conditions. There is NO | |
1038 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1038 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1039 |
|
1039 | |||
1040 | $ cat > minversion2.py << EOF |
|
1040 | $ cat > minversion2.py << EOF | |
1041 | > from mercurial import util |
|
1041 | > from mercurial import util | |
1042 | > util.version = lambda: '3.6' |
|
1042 | > util.version = lambda: '3.6' | |
1043 | > minimumhgversion = '3.7' |
|
1043 | > minimumhgversion = '3.7' | |
1044 | > EOF |
|
1044 | > EOF | |
1045 | $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third' |
|
1045 | $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third' | |
1046 | (third party extension minversion requires version 3.7 or newer of Mercurial; disabling) |
|
1046 | (third party extension minversion requires version 3.7 or newer of Mercurial; disabling) | |
1047 |
|
1047 | |||
1048 | Can load version that is only off by point release |
|
1048 | Can load version that is only off by point release | |
1049 |
|
1049 | |||
1050 | $ cat > minversion2.py << EOF |
|
1050 | $ cat > minversion2.py << EOF | |
1051 | > from mercurial import util |
|
1051 | > from mercurial import util | |
1052 | > util.version = lambda: '3.6.1' |
|
1052 | > util.version = lambda: '3.6.1' | |
1053 | > minimumhgversion = '3.6' |
|
1053 | > minimumhgversion = '3.6' | |
1054 | > EOF |
|
1054 | > EOF | |
1055 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1055 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' | |
1056 | [1] |
|
1056 | [1] | |
1057 |
|
1057 | |||
1058 | Can load minimum version identical to current |
|
1058 | Can load minimum version identical to current | |
1059 |
|
1059 | |||
1060 | $ cat > minversion3.py << EOF |
|
1060 | $ cat > minversion3.py << EOF | |
1061 | > from mercurial import util |
|
1061 | > from mercurial import util | |
1062 | > util.version = lambda: '3.5' |
|
1062 | > util.version = lambda: '3.5' | |
1063 | > minimumhgversion = '3.5' |
|
1063 | > minimumhgversion = '3.5' | |
1064 | > EOF |
|
1064 | > EOF | |
1065 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1065 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' | |
1066 | [1] |
|
1066 | [1] | |
1067 |
|
1067 | |||
1068 | Restore HGRCPATH |
|
1068 | Restore HGRCPATH | |
1069 |
|
1069 | |||
1070 | $ HGRCPATH=$ORGHGRCPATH |
|
1070 | $ HGRCPATH=$ORGHGRCPATH | |
1071 | $ export HGRCPATH |
|
1071 | $ export HGRCPATH | |
1072 |
|
1072 | |||
1073 | Commands handling multiple repositories at a time should invoke only |
|
1073 | Commands handling multiple repositories at a time should invoke only | |
1074 | "reposetup()" of extensions enabling in the target repository. |
|
1074 | "reposetup()" of extensions enabling in the target repository. | |
1075 |
|
1075 | |||
1076 | $ mkdir reposetup-test |
|
1076 | $ mkdir reposetup-test | |
1077 | $ cd reposetup-test |
|
1077 | $ cd reposetup-test | |
1078 |
|
1078 | |||
1079 | $ cat > $TESTTMP/reposetuptest.py <<EOF |
|
1079 | $ cat > $TESTTMP/reposetuptest.py <<EOF | |
1080 | > from mercurial import extensions |
|
1080 | > from mercurial import extensions | |
1081 | > def reposetup(ui, repo): |
|
1081 | > def reposetup(ui, repo): | |
1082 | > ui.write('reposetup() for %s\n' % (repo.root)) |
|
1082 | > ui.write('reposetup() for %s\n' % (repo.root)) | |
1083 | > ui.flush() |
|
1083 | > ui.flush() | |
1084 | > EOF |
|
1084 | > EOF | |
1085 | $ hg init src |
|
1085 | $ hg init src | |
1086 | $ echo a > src/a |
|
1086 | $ echo a > src/a | |
1087 | $ hg -R src commit -Am '#0 at src/a' |
|
1087 | $ hg -R src commit -Am '#0 at src/a' | |
1088 | adding a |
|
1088 | adding a | |
1089 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1089 | $ echo '[extensions]' >> src/.hg/hgrc | |
1090 | $ echo '# enable extension locally' >> src/.hg/hgrc |
|
1090 | $ echo '# enable extension locally' >> src/.hg/hgrc | |
1091 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc |
|
1091 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc | |
1092 | $ hg -R src status |
|
1092 | $ hg -R src status | |
1093 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1093 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1094 |
|
1094 | |||
1095 | $ hg clone -U src clone-dst1 |
|
1095 | $ hg clone -U src clone-dst1 | |
1096 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1096 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1097 | $ hg init push-dst1 |
|
1097 | $ hg init push-dst1 | |
1098 | $ hg -q -R src push push-dst1 |
|
1098 | $ hg -q -R src push push-dst1 | |
1099 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1099 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1100 | $ hg init pull-src1 |
|
1100 | $ hg init pull-src1 | |
1101 | $ hg -q -R pull-src1 pull src |
|
1101 | $ hg -q -R pull-src1 pull src | |
1102 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1102 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1103 |
|
1103 | |||
1104 | $ cat <<EOF >> $HGRCPATH |
|
1104 | $ cat <<EOF >> $HGRCPATH | |
1105 | > [extensions] |
|
1105 | > [extensions] | |
1106 | > # disable extension globally and explicitly |
|
1106 | > # disable extension globally and explicitly | |
1107 | > reposetuptest = ! |
|
1107 | > reposetuptest = ! | |
1108 | > EOF |
|
1108 | > EOF | |
1109 | $ hg clone -U src clone-dst2 |
|
1109 | $ hg clone -U src clone-dst2 | |
1110 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1110 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1111 | $ hg init push-dst2 |
|
1111 | $ hg init push-dst2 | |
1112 | $ hg -q -R src push push-dst2 |
|
1112 | $ hg -q -R src push push-dst2 | |
1113 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1113 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1114 | $ hg init pull-src2 |
|
1114 | $ hg init pull-src2 | |
1115 | $ hg -q -R pull-src2 pull src |
|
1115 | $ hg -q -R pull-src2 pull src | |
1116 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1116 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1117 |
|
1117 | |||
1118 | $ cat <<EOF >> $HGRCPATH |
|
1118 | $ cat <<EOF >> $HGRCPATH | |
1119 | > [extensions] |
|
1119 | > [extensions] | |
1120 | > # enable extension globally |
|
1120 | > # enable extension globally | |
1121 | > reposetuptest = $TESTTMP/reposetuptest.py |
|
1121 | > reposetuptest = $TESTTMP/reposetuptest.py | |
1122 | > EOF |
|
1122 | > EOF | |
1123 | $ hg clone -U src clone-dst3 |
|
1123 | $ hg clone -U src clone-dst3 | |
1124 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1124 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1125 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob) |
|
1125 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob) | |
1126 | $ hg init push-dst3 |
|
1126 | $ hg init push-dst3 | |
1127 | reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob) |
|
1127 | reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob) | |
1128 | $ hg -q -R src push push-dst3 |
|
1128 | $ hg -q -R src push push-dst3 | |
1129 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1129 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1130 | reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob) |
|
1130 | reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob) | |
1131 | $ hg init pull-src3 |
|
1131 | $ hg init pull-src3 | |
1132 | reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob) |
|
1132 | reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob) | |
1133 | $ hg -q -R pull-src3 pull src |
|
1133 | $ hg -q -R pull-src3 pull src | |
1134 | reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob) |
|
1134 | reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob) | |
1135 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1135 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1136 |
|
1136 | |||
1137 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1137 | $ echo '[extensions]' >> src/.hg/hgrc | |
1138 | $ echo '# disable extension locally' >> src/.hg/hgrc |
|
1138 | $ echo '# disable extension locally' >> src/.hg/hgrc | |
1139 | $ echo 'reposetuptest = !' >> src/.hg/hgrc |
|
1139 | $ echo 'reposetuptest = !' >> src/.hg/hgrc | |
1140 | $ hg clone -U src clone-dst4 |
|
1140 | $ hg clone -U src clone-dst4 | |
1141 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob) |
|
1141 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob) | |
1142 | $ hg init push-dst4 |
|
1142 | $ hg init push-dst4 | |
1143 | reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob) |
|
1143 | reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob) | |
1144 | $ hg -q -R src push push-dst4 |
|
1144 | $ hg -q -R src push push-dst4 | |
1145 | reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob) |
|
1145 | reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob) | |
1146 | $ hg init pull-src4 |
|
1146 | $ hg init pull-src4 | |
1147 | reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob) |
|
1147 | reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob) | |
1148 | $ hg -q -R pull-src4 pull src |
|
1148 | $ hg -q -R pull-src4 pull src | |
1149 | reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob) |
|
1149 | reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob) | |
1150 |
|
1150 | |||
1151 | disabling in command line overlays with all configuration |
|
1151 | disabling in command line overlays with all configuration | |
1152 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 |
|
1152 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 | |
1153 | $ hg --config extensions.reposetuptest=! init push-dst5 |
|
1153 | $ hg --config extensions.reposetuptest=! init push-dst5 | |
1154 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 |
|
1154 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 | |
1155 | $ hg --config extensions.reposetuptest=! init pull-src5 |
|
1155 | $ hg --config extensions.reposetuptest=! init pull-src5 | |
1156 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src |
|
1156 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src | |
1157 |
|
1157 | |||
1158 | $ cat <<EOF >> $HGRCPATH |
|
1158 | $ cat <<EOF >> $HGRCPATH | |
1159 | > [extensions] |
|
1159 | > [extensions] | |
1160 | > # disable extension globally and explicitly |
|
1160 | > # disable extension globally and explicitly | |
1161 | > reposetuptest = ! |
|
1161 | > reposetuptest = ! | |
1162 | > EOF |
|
1162 | > EOF | |
1163 | $ hg init parent |
|
1163 | $ hg init parent | |
1164 | $ hg init parent/sub1 |
|
1164 | $ hg init parent/sub1 | |
1165 | $ echo 1 > parent/sub1/1 |
|
1165 | $ echo 1 > parent/sub1/1 | |
1166 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' |
|
1166 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' | |
1167 | adding 1 |
|
1167 | adding 1 | |
1168 | $ hg init parent/sub2 |
|
1168 | $ hg init parent/sub2 | |
1169 | $ hg init parent/sub2/sub21 |
|
1169 | $ hg init parent/sub2/sub21 | |
1170 | $ echo 21 > parent/sub2/sub21/21 |
|
1170 | $ echo 21 > parent/sub2/sub21/21 | |
1171 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' |
|
1171 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' | |
1172 | adding 21 |
|
1172 | adding 21 | |
1173 | $ cat > parent/sub2/.hgsub <<EOF |
|
1173 | $ cat > parent/sub2/.hgsub <<EOF | |
1174 | > sub21 = sub21 |
|
1174 | > sub21 = sub21 | |
1175 | > EOF |
|
1175 | > EOF | |
1176 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' |
|
1176 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' | |
1177 | adding .hgsub |
|
1177 | adding .hgsub | |
1178 | $ hg init parent/sub3 |
|
1178 | $ hg init parent/sub3 | |
1179 | $ echo 3 > parent/sub3/3 |
|
1179 | $ echo 3 > parent/sub3/3 | |
1180 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' |
|
1180 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' | |
1181 | adding 3 |
|
1181 | adding 3 | |
1182 | $ cat > parent/.hgsub <<EOF |
|
1182 | $ cat > parent/.hgsub <<EOF | |
1183 | > sub1 = sub1 |
|
1183 | > sub1 = sub1 | |
1184 | > sub2 = sub2 |
|
1184 | > sub2 = sub2 | |
1185 | > sub3 = sub3 |
|
1185 | > sub3 = sub3 | |
1186 | > EOF |
|
1186 | > EOF | |
1187 | $ hg -R parent commit -Am '#0 at parent' |
|
1187 | $ hg -R parent commit -Am '#0 at parent' | |
1188 | adding .hgsub |
|
1188 | adding .hgsub | |
1189 | $ echo '[extensions]' >> parent/.hg/hgrc |
|
1189 | $ echo '[extensions]' >> parent/.hg/hgrc | |
1190 | $ echo '# enable extension locally' >> parent/.hg/hgrc |
|
1190 | $ echo '# enable extension locally' >> parent/.hg/hgrc | |
1191 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc |
|
1191 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc | |
1192 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc |
|
1192 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc | |
1193 | $ hg -R parent status -S -A |
|
1193 | $ hg -R parent status -S -A | |
1194 | reposetup() for $TESTTMP/reposetup-test/parent (glob) |
|
1194 | reposetup() for $TESTTMP/reposetup-test/parent (glob) | |
1195 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob) |
|
1195 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob) | |
1196 | C .hgsub |
|
1196 | C .hgsub | |
1197 | C .hgsubstate |
|
1197 | C .hgsubstate | |
1198 | C sub1/1 |
|
1198 | C sub1/1 | |
1199 | C sub2/.hgsub |
|
1199 | C sub2/.hgsub | |
1200 | C sub2/.hgsubstate |
|
1200 | C sub2/.hgsubstate | |
1201 | C sub2/sub21/21 |
|
1201 | C sub2/sub21/21 | |
1202 | C sub3/3 |
|
1202 | C sub3/3 | |
1203 |
|
1203 | |||
1204 | $ cd .. |
|
1204 | $ cd .. | |
1205 |
|
1205 | |||
1206 | Test compatibility with extension commands that don't use @command (issue5137) |
|
1206 | Test compatibility with extension commands that don't use @command (issue5137) | |
1207 |
|
1207 | |||
1208 | $ hg init deprecated |
|
1208 | $ hg init deprecated | |
1209 | $ cd deprecated |
|
1209 | $ cd deprecated | |
1210 |
|
1210 | |||
1211 | $ cat <<EOF > deprecatedcmd.py |
|
1211 | $ cat <<EOF > deprecatedcmd.py | |
1212 | > def deprecatedcmd(repo, ui): |
|
1212 | > def deprecatedcmd(repo, ui): | |
1213 | > pass |
|
1213 | > pass | |
1214 | > cmdtable = { |
|
1214 | > cmdtable = { | |
1215 | > 'deprecatedcmd': (deprecatedcmd, [], ''), |
|
1215 | > 'deprecatedcmd': (deprecatedcmd, [], ''), | |
1216 | > } |
|
1216 | > } | |
1217 | > EOF |
|
1217 | > EOF | |
1218 | $ cat <<EOF > .hg/hgrc |
|
1218 | $ cat <<EOF > .hg/hgrc | |
1219 | > [extensions] |
|
1219 | > [extensions] | |
1220 | > deprecatedcmd = `pwd`/deprecatedcmd.py |
|
1220 | > deprecatedcmd = `pwd`/deprecatedcmd.py | |
1221 | > mq = ! |
|
1221 | > mq = ! | |
1222 | > hgext.mq = ! |
|
1222 | > hgext.mq = ! | |
1223 | > hgext/mq = ! |
|
1223 | > hgext/mq = ! | |
1224 | > [alias] |
|
1224 | > [alias] | |
1225 | > deprecatedalias = deprecatedcmd |
|
1225 | > deprecatedalias = deprecatedcmd | |
1226 | > EOF |
|
1226 | > EOF | |
1227 |
|
1227 | |||
1228 | $ hg deprecatedcmd |
|
1228 | $ hg deprecatedcmd | |
1229 | devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedcmd' |
|
1229 | devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedcmd' | |
1230 | (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) |
|
1230 | (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) | |
1231 |
|
1231 | |||
1232 | $ hg deprecatedalias |
|
1232 | $ hg deprecatedalias | |
1233 | devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedalias' |
|
1233 | devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedalias' | |
1234 | (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) |
|
1234 | (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) | |
1235 |
|
1235 | |||
1236 | no warning unless command is executed: |
|
1236 | no warning unless command is executed: | |
1237 |
|
1237 | |||
1238 | $ hg paths |
|
1238 | $ hg paths | |
1239 |
|
1239 | |||
1240 | but mq iterates over command table: |
|
1240 | but mq iterates over command table: | |
1241 |
|
1241 | |||
1242 | $ hg --config extensions.mq= paths |
|
1242 | $ hg --config extensions.mq= paths | |
1243 | devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedcmd' |
|
1243 | devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedcmd' | |
1244 | (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) |
|
1244 | (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) | |
1245 |
|
1245 | |||
1246 | $ cd .. |
|
1246 | $ cd .. | |
1247 |
|
1247 | |||
1248 | Test synopsis and docstring extending |
|
1248 | Test synopsis and docstring extending | |
1249 |
|
1249 | |||
1250 | $ hg init exthelp |
|
1250 | $ hg init exthelp | |
1251 | $ cat > exthelp.py <<EOF |
|
1251 | $ cat > exthelp.py <<EOF | |
1252 | > from mercurial import commands, extensions |
|
1252 | > from mercurial import commands, extensions | |
1253 | > def exbookmarks(orig, *args, **opts): |
|
1253 | > def exbookmarks(orig, *args, **opts): | |
1254 | > return orig(*args, **opts) |
|
1254 | > return orig(*args, **opts) | |
1255 | > def uisetup(ui): |
|
1255 | > def uisetup(ui): | |
1256 | > synopsis = ' GREPME [--foo] [-x]' |
|
1256 | > synopsis = ' GREPME [--foo] [-x]' | |
1257 | > docstring = ''' |
|
1257 | > docstring = ''' | |
1258 | > GREPME make sure that this is in the help! |
|
1258 | > GREPME make sure that this is in the help! | |
1259 | > ''' |
|
1259 | > ''' | |
1260 | > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks, |
|
1260 | > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks, | |
1261 | > synopsis, docstring) |
|
1261 | > synopsis, docstring) | |
1262 | > EOF |
|
1262 | > EOF | |
1263 | $ abspath=`pwd`/exthelp.py |
|
1263 | $ abspath=`pwd`/exthelp.py | |
1264 | $ echo '[extensions]' >> $HGRCPATH |
|
1264 | $ echo '[extensions]' >> $HGRCPATH | |
1265 | $ echo "exthelp = $abspath" >> $HGRCPATH |
|
1265 | $ echo "exthelp = $abspath" >> $HGRCPATH | |
1266 | $ cd exthelp |
|
1266 | $ cd exthelp | |
1267 | $ hg help bookmarks | grep GREPME |
|
1267 | $ hg help bookmarks | grep GREPME | |
1268 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] |
|
1268 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] | |
1269 | GREPME make sure that this is in the help! |
|
1269 | GREPME make sure that this is in the help! | |
1270 |
|
1270 |
General Comments 0
You need to be logged in to leave comments.
Login now