##// END OF EJS Templates
test-extension: add check for 'hg version -v' listing enabled extensions
Augie Fackler -
r21849:a3306b8c default
parent child Browse files
Show More
@@ -1,846 +1,905 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 >
7 > cmdtable = {}
6 > cmdtable = {}
8 > command = cmdutil.command(cmdtable)
7 > command = cmdutil.command(cmdtable)
9 >
10 > def uisetup(ui):
8 > def uisetup(ui):
11 > ui.write("uisetup called\\n")
9 > ui.write("uisetup called\\n")
12 >
13 > def reposetup(ui, repo):
10 > def reposetup(ui, repo):
14 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
11 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
15 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
12 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
16 >
17 > @command('foo', [], 'hg foo')
13 > @command('foo', [], 'hg foo')
18 > def foo(ui, *args, **kwargs):
14 > def foo(ui, *args, **kwargs):
19 > ui.write("Foo\\n")
15 > ui.write("Foo\\n")
20 >
21 > @command('bar', [], 'hg bar', norepo=True)
16 > @command('bar', [], 'hg bar', norepo=True)
22 > def bar(ui, *args, **kwargs):
17 > def bar(ui, *args, **kwargs):
23 > ui.write("Bar\\n")
18 > ui.write("Bar\\n")
24 >
25 > EOF
19 > EOF
26 $ abspath=`pwd`/foobar.py
20 $ abspath=`pwd`/foobar.py
27
21
28 $ mkdir barfoo
22 $ mkdir barfoo
29 $ cp foobar.py barfoo/__init__.py
23 $ cp foobar.py barfoo/__init__.py
30 $ barfoopath=`pwd`/barfoo
24 $ barfoopath=`pwd`/barfoo
31
25
32 $ hg init a
26 $ hg init a
33 $ cd a
27 $ cd a
34 $ echo foo > file
28 $ echo foo > file
35 $ hg add file
29 $ hg add file
36 $ hg commit -m 'add file'
30 $ hg commit -m 'add file'
37
31
38 $ echo '[extensions]' >> $HGRCPATH
32 $ echo '[extensions]' >> $HGRCPATH
39 $ echo "foobar = $abspath" >> $HGRCPATH
33 $ echo "foobar = $abspath" >> $HGRCPATH
40 $ hg foo
34 $ hg foo
41 uisetup called
35 uisetup called
42 reposetup called for a
36 reposetup called for a
43 ui == repo.ui
37 ui == repo.ui
44 Foo
38 Foo
45
39
46 $ cd ..
40 $ cd ..
47 $ hg clone a b
41 $ hg clone a b
48 uisetup called
42 uisetup called
49 reposetup called for a
43 reposetup called for a
50 ui == repo.ui
44 ui == repo.ui
51 reposetup called for b
45 reposetup called for b
52 ui == repo.ui
46 ui == repo.ui
53 updating to branch default
47 updating to branch default
54 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55
49
56 $ hg bar
50 $ hg bar
57 uisetup called
51 uisetup called
58 Bar
52 Bar
59 $ echo 'foobar = !' >> $HGRCPATH
53 $ echo 'foobar = !' >> $HGRCPATH
60
54
61 module/__init__.py-style
55 module/__init__.py-style
62
56
63 $ echo "barfoo = $barfoopath" >> $HGRCPATH
57 $ echo "barfoo = $barfoopath" >> $HGRCPATH
64 $ cd a
58 $ cd a
65 $ hg foo
59 $ hg foo
66 uisetup called
60 uisetup called
67 reposetup called for a
61 reposetup called for a
68 ui == repo.ui
62 ui == repo.ui
69 Foo
63 Foo
70 $ echo 'barfoo = !' >> $HGRCPATH
64 $ echo 'barfoo = !' >> $HGRCPATH
71
65
72 Check that extensions are loaded in phases:
66 Check that extensions are loaded in phases:
73
67
74 $ cat > foo.py <<EOF
68 $ cat > foo.py <<EOF
75 > import os
69 > import os
76 > name = os.path.basename(__file__).rsplit('.', 1)[0]
70 > name = os.path.basename(__file__).rsplit('.', 1)[0]
77 > print "1) %s imported" % name
71 > print "1) %s imported" % name
78 > def uisetup(ui):
72 > def uisetup(ui):
79 > print "2) %s uisetup" % name
73 > print "2) %s uisetup" % name
80 > def extsetup():
74 > def extsetup():
81 > print "3) %s extsetup" % name
75 > print "3) %s extsetup" % name
82 > def reposetup(ui, repo):
76 > def reposetup(ui, repo):
83 > print "4) %s reposetup" % name
77 > print "4) %s reposetup" % name
84 > EOF
78 > EOF
85
79
86 $ cp foo.py bar.py
80 $ cp foo.py bar.py
87 $ echo 'foo = foo.py' >> $HGRCPATH
81 $ echo 'foo = foo.py' >> $HGRCPATH
88 $ echo 'bar = bar.py' >> $HGRCPATH
82 $ echo 'bar = bar.py' >> $HGRCPATH
89
83
90 Command with no output, we just want to see the extensions loaded:
84 Command with no output, we just want to see the extensions loaded:
91
85
92 $ hg paths
86 $ hg paths
93 1) foo imported
87 1) foo imported
94 1) bar imported
88 1) bar imported
95 2) foo uisetup
89 2) foo uisetup
96 2) bar uisetup
90 2) bar uisetup
97 3) foo extsetup
91 3) foo extsetup
98 3) bar extsetup
92 3) bar extsetup
99 4) foo reposetup
93 4) foo reposetup
100 4) bar reposetup
94 4) bar reposetup
101
95
102 Check hgweb's load order:
96 Check hgweb's load order:
103
97
104 $ cat > hgweb.cgi <<EOF
98 $ cat > hgweb.cgi <<EOF
105 > #!/usr/bin/env python
99 > #!/usr/bin/env python
106 > from mercurial import demandimport; demandimport.enable()
100 > from mercurial import demandimport; demandimport.enable()
107 > from mercurial.hgweb import hgweb
101 > from mercurial.hgweb import hgweb
108 > from mercurial.hgweb import wsgicgi
102 > from mercurial.hgweb import wsgicgi
109 >
110 > application = hgweb('.', 'test repo')
103 > application = hgweb('.', 'test repo')
111 > wsgicgi.launch(application)
104 > wsgicgi.launch(application)
112 > EOF
105 > EOF
113
106
114 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
107 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
115 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
108 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
116 > | grep '^[0-9]) ' # ignores HTML output
109 > | grep '^[0-9]) ' # ignores HTML output
117 1) foo imported
110 1) foo imported
118 1) bar imported
111 1) bar imported
119 2) foo uisetup
112 2) foo uisetup
120 2) bar uisetup
113 2) bar uisetup
121 3) foo extsetup
114 3) foo extsetup
122 3) bar extsetup
115 3) bar extsetup
123 4) foo reposetup
116 4) foo reposetup
124 4) bar reposetup
117 4) bar reposetup
125 4) foo reposetup
118 4) foo reposetup
126 4) bar reposetup
119 4) bar reposetup
127
120
128 $ echo 'foo = !' >> $HGRCPATH
121 $ echo 'foo = !' >> $HGRCPATH
129 $ echo 'bar = !' >> $HGRCPATH
122 $ echo 'bar = !' >> $HGRCPATH
130
123
131 Check "from __future__ import absolute_import" support for external libraries
124 Check "from __future__ import absolute_import" support for external libraries
132
125
133 #if windows
126 #if windows
134 $ PATHSEP=";"
127 $ PATHSEP=";"
135 #else
128 #else
136 $ PATHSEP=":"
129 $ PATHSEP=":"
137 #endif
130 #endif
138 $ export PATHSEP
131 $ export PATHSEP
139
132
140 $ mkdir $TESTTMP/libroot
133 $ mkdir $TESTTMP/libroot
141 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
134 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
142 $ mkdir $TESTTMP/libroot/mod
135 $ mkdir $TESTTMP/libroot/mod
143 $ touch $TESTTMP/libroot/mod/__init__.py
136 $ touch $TESTTMP/libroot/mod/__init__.py
144 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
137 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
145
138
146 #if absimport
139 #if absimport
147 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
140 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
148 > from __future__ import absolute_import
141 > from __future__ import absolute_import
149 > import ambig # should load "libroot/ambig.py"
142 > import ambig # should load "libroot/ambig.py"
150 > s = ambig.s
143 > s = ambig.s
151 > EOF
144 > EOF
152 $ cat > loadabs.py <<EOF
145 $ cat > loadabs.py <<EOF
153 > import mod.ambigabs as ambigabs
146 > import mod.ambigabs as ambigabs
154 > def extsetup():
147 > def extsetup():
155 > print 'ambigabs.s=%s' % ambigabs.s
148 > print 'ambigabs.s=%s' % ambigabs.s
156 > EOF
149 > EOF
157 $ (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)
158 ambigabs.s=libroot/ambig.py
151 ambigabs.s=libroot/ambig.py
159 $TESTTMP/a (glob)
152 $TESTTMP/a (glob)
160 #endif
153 #endif
161
154
162 #if no-py3k
155 #if no-py3k
163 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
156 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
164 > import ambig # should load "libroot/mod/ambig.py"
157 > import ambig # should load "libroot/mod/ambig.py"
165 > s = ambig.s
158 > s = ambig.s
166 > EOF
159 > EOF
167 $ cat > loadrel.py <<EOF
160 $ cat > loadrel.py <<EOF
168 > import mod.ambigrel as ambigrel
161 > import mod.ambigrel as ambigrel
169 > def extsetup():
162 > def extsetup():
170 > print 'ambigrel.s=%s' % ambigrel.s
163 > print 'ambigrel.s=%s' % ambigrel.s
171 > EOF
164 > EOF
172 $ (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)
173 ambigrel.s=libroot/mod/ambig.py
166 ambigrel.s=libroot/mod/ambig.py
174 $TESTTMP/a (glob)
167 $TESTTMP/a (glob)
175 #endif
168 #endif
176
169
177 Check absolute/relative import of extension specific modules
170 Check absolute/relative import of extension specific modules
178
171
179 $ mkdir $TESTTMP/extroot
172 $ mkdir $TESTTMP/extroot
180 $ cat > $TESTTMP/extroot/bar.py <<EOF
173 $ cat > $TESTTMP/extroot/bar.py <<EOF
181 > s = 'this is extroot.bar'
174 > s = 'this is extroot.bar'
182 > EOF
175 > EOF
183 $ mkdir $TESTTMP/extroot/sub1
176 $ mkdir $TESTTMP/extroot/sub1
184 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
177 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
185 > s = 'this is extroot.sub1.__init__'
178 > s = 'this is extroot.sub1.__init__'
186 > EOF
179 > EOF
187 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
180 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
188 > s = 'this is extroot.sub1.baz'
181 > s = 'this is extroot.sub1.baz'
189 > EOF
182 > EOF
190 $ cat > $TESTTMP/extroot/__init__.py <<EOF
183 $ cat > $TESTTMP/extroot/__init__.py <<EOF
191 > s = 'this is extroot.__init__'
184 > s = 'this is extroot.__init__'
192 > import foo
185 > import foo
193 > def extsetup(ui):
186 > def extsetup(ui):
194 > ui.write('(extroot) ', foo.func(), '\n')
187 > ui.write('(extroot) ', foo.func(), '\n')
195 > EOF
188 > EOF
196
189
197 $ cat > $TESTTMP/extroot/foo.py <<EOF
190 $ cat > $TESTTMP/extroot/foo.py <<EOF
198 > # test absolute import
191 > # test absolute import
199 > buf = []
192 > buf = []
200 > def func():
193 > def func():
201 > # "not locals" case
194 > # "not locals" case
202 > import extroot.bar
195 > import extroot.bar
203 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
196 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
204 >
205 > return '\n(extroot) '.join(buf)
197 > return '\n(extroot) '.join(buf)
206 >
207 > # "fromlist == ('*',)" case
198 > # "fromlist == ('*',)" case
208 > from extroot.bar import *
199 > from extroot.bar import *
209 > buf.append('from extroot.bar import *: %s' % s)
200 > buf.append('from extroot.bar import *: %s' % s)
210 >
211 > # "not fromlist" and "if '.' in name" case
201 > # "not fromlist" and "if '.' in name" case
212 > import extroot.sub1.baz
202 > import extroot.sub1.baz
213 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
203 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
214 >
215 > # "not fromlist" and NOT "if '.' in name" case
204 > # "not fromlist" and NOT "if '.' in name" case
216 > import extroot
205 > import extroot
217 > buf.append('import extroot: %s' % extroot.s)
206 > buf.append('import extroot: %s' % extroot.s)
218 >
219 > # NOT "not fromlist" and NOT "level != -1" case
207 > # NOT "not fromlist" and NOT "level != -1" case
220 > from extroot.bar import s
208 > from extroot.bar import s
221 > buf.append('from extroot.bar import s: %s' % s)
209 > buf.append('from extroot.bar import s: %s' % s)
222 > EOF
210 > EOF
223 $ hg --config extensions.extroot=$TESTTMP/extroot root
211 $ hg --config extensions.extroot=$TESTTMP/extroot root
224 (extroot) from extroot.bar import *: this is extroot.bar
212 (extroot) from extroot.bar import *: this is extroot.bar
225 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
213 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
226 (extroot) import extroot: this is extroot.__init__
214 (extroot) import extroot: this is extroot.__init__
227 (extroot) from extroot.bar import s: this is extroot.bar
215 (extroot) from extroot.bar import s: this is extroot.bar
228 (extroot) import extroot.bar in func(): this is extroot.bar
216 (extroot) import extroot.bar in func(): this is extroot.bar
229 $TESTTMP/a (glob)
217 $TESTTMP/a (glob)
230
218
231 #if no-py3k
219 #if no-py3k
232 $ rm "$TESTTMP"/extroot/foo.*
220 $ rm "$TESTTMP"/extroot/foo.*
233 $ cat > $TESTTMP/extroot/foo.py <<EOF
221 $ cat > $TESTTMP/extroot/foo.py <<EOF
234 > # test relative import
222 > # test relative import
235 > buf = []
223 > buf = []
236 > def func():
224 > def func():
237 > # "not locals" case
225 > # "not locals" case
238 > import bar
226 > import bar
239 > buf.append('import bar in func(): %s' % bar.s)
227 > buf.append('import bar in func(): %s' % bar.s)
240 >
241 > return '\n(extroot) '.join(buf)
228 > return '\n(extroot) '.join(buf)
242 >
243 > # "fromlist == ('*',)" case
229 > # "fromlist == ('*',)" case
244 > from bar import *
230 > from bar import *
245 > buf.append('from bar import *: %s' % s)
231 > buf.append('from bar import *: %s' % s)
246 >
247 > # "not fromlist" and "if '.' in name" case
232 > # "not fromlist" and "if '.' in name" case
248 > import sub1.baz
233 > import sub1.baz
249 > buf.append('import sub1.baz: %s' % sub1.baz.s)
234 > buf.append('import sub1.baz: %s' % sub1.baz.s)
250 >
251 > # "not fromlist" and NOT "if '.' in name" case
235 > # "not fromlist" and NOT "if '.' in name" case
252 > import sub1
236 > import sub1
253 > buf.append('import sub1: %s' % sub1.s)
237 > buf.append('import sub1: %s' % sub1.s)
254 >
255 > # NOT "not fromlist" and NOT "level != -1" case
238 > # NOT "not fromlist" and NOT "level != -1" case
256 > from bar import s
239 > from bar import s
257 > buf.append('from bar import s: %s' % s)
240 > buf.append('from bar import s: %s' % s)
258 > EOF
241 > EOF
259 $ hg --config extensions.extroot=$TESTTMP/extroot root
242 $ hg --config extensions.extroot=$TESTTMP/extroot root
260 (extroot) from bar import *: this is extroot.bar
243 (extroot) from bar import *: this is extroot.bar
261 (extroot) import sub1.baz: this is extroot.sub1.baz
244 (extroot) import sub1.baz: this is extroot.sub1.baz
262 (extroot) import sub1: this is extroot.sub1.__init__
245 (extroot) import sub1: this is extroot.sub1.__init__
263 (extroot) from bar import s: this is extroot.bar
246 (extroot) from bar import s: this is extroot.bar
264 (extroot) import bar in func(): this is extroot.bar
247 (extroot) import bar in func(): this is extroot.bar
265 $TESTTMP/a (glob)
248 $TESTTMP/a (glob)
266 #endif
249 #endif
267
250
268 $ cd ..
251 $ cd ..
269
252
270 hide outer repo
253 hide outer repo
271 $ hg init
254 $ hg init
272
255
273 $ cat > empty.py <<EOF
256 $ cat > empty.py <<EOF
274 > '''empty cmdtable
257 > '''empty cmdtable
275 > '''
258 > '''
276 > cmdtable = {}
259 > cmdtable = {}
277 > EOF
260 > EOF
278 $ emptypath=`pwd`/empty.py
261 $ emptypath=`pwd`/empty.py
279 $ echo "empty = $emptypath" >> $HGRCPATH
262 $ echo "empty = $emptypath" >> $HGRCPATH
280 $ hg help empty
263 $ hg help empty
281 empty extension - empty cmdtable
264 empty extension - empty cmdtable
282
265
283 no commands defined
266 no commands defined
284
267
268
285 $ echo 'empty = !' >> $HGRCPATH
269 $ echo 'empty = !' >> $HGRCPATH
286
270
287 $ cat > debugextension.py <<EOF
271 $ cat > debugextension.py <<EOF
288 > '''only debugcommands
272 > '''only debugcommands
289 > '''
273 > '''
290 > from mercurial import cmdutil
274 > from mercurial import cmdutil
291 > cmdtable = {}
275 > cmdtable = {}
292 > command = cmdutil.command(cmdtable)
276 > command = cmdutil.command(cmdtable)
293 >
294 > @command('debugfoobar', [], 'hg debugfoobar')
277 > @command('debugfoobar', [], 'hg debugfoobar')
295 > def debugfoobar(ui, repo, *args, **opts):
278 > def debugfoobar(ui, repo, *args, **opts):
296 > "yet another debug command"
279 > "yet another debug command"
297 > pass
280 > pass
298 >
299 > @command('foo', [], 'hg foo')
281 > @command('foo', [], 'hg foo')
300 > def foo(ui, repo, *args, **opts):
282 > def foo(ui, repo, *args, **opts):
301 > """yet another foo command
283 > """yet another foo command
302 >
303 > This command has been DEPRECATED since forever.
284 > This command has been DEPRECATED since forever.
304 > """
285 > """
305 > pass
286 > pass
306 > EOF
287 > EOF
307 $ debugpath=`pwd`/debugextension.py
288 $ debugpath=`pwd`/debugextension.py
308 $ echo "debugextension = $debugpath" >> $HGRCPATH
289 $ echo "debugextension = $debugpath" >> $HGRCPATH
309
290
310 $ hg help debugextension
291 $ hg help debugextension
311 debugextension extension - only debugcommands
292 debugextension extension - only debugcommands
312
293
313 no commands defined
294 no commands defined
314
295
296
315 $ hg --verbose help debugextension
297 $ hg --verbose help debugextension
316 debugextension extension - only debugcommands
298 debugextension extension - only debugcommands
317
299
318 list of commands:
300 list of commands:
319
301
320 foo yet another foo command
302 foo yet another foo command
321
303
322 global options:
304 global options:
323
305
324 -R --repository REPO repository root directory or name of overlay bundle
306 -R --repository REPO repository root directory or name of overlay bundle
325 file
307 file
326 --cwd DIR change working directory
308 --cwd DIR change working directory
327 -y --noninteractive do not prompt, automatically pick the first choice for
309 -y --noninteractive do not prompt, automatically pick the first choice for
328 all prompts
310 all prompts
329 -q --quiet suppress output
311 -q --quiet suppress output
330 -v --verbose enable additional output
312 -v --verbose enable additional output
331 --config CONFIG [+] set/override config option (use 'section.name=value')
313 --config CONFIG [+] set/override config option (use 'section.name=value')
332 --debug enable debugging output
314 --debug enable debugging output
333 --debugger start debugger
315 --debugger start debugger
334 --encoding ENCODE set the charset encoding (default: ascii)
316 --encoding ENCODE set the charset encoding (default: ascii)
335 --encodingmode MODE set the charset encoding mode (default: strict)
317 --encodingmode MODE set the charset encoding mode (default: strict)
336 --traceback always print a traceback on exception
318 --traceback always print a traceback on exception
337 --time time how long the command takes
319 --time time how long the command takes
338 --profile print command execution profile
320 --profile print command execution profile
339 --version output version information and exit
321 --version output version information and exit
340 -h --help display help and exit
322 -h --help display help and exit
341 --hidden consider hidden changesets
323 --hidden consider hidden changesets
342
324
343 [+] marked option can be specified multiple times
325 [+] marked option can be specified multiple times
344
326
327
328
329
330
331
345 $ hg --debug help debugextension
332 $ hg --debug help debugextension
346 debugextension extension - only debugcommands
333 debugextension extension - only debugcommands
347
334
348 list of commands:
335 list of commands:
349
336
350 debugfoobar yet another debug command
337 debugfoobar yet another debug command
351 foo yet another foo command
338 foo yet another foo command
352
339
353 global options:
340 global options:
354
341
355 -R --repository REPO repository root directory or name of overlay bundle
342 -R --repository REPO repository root directory or name of overlay bundle
356 file
343 file
357 --cwd DIR change working directory
344 --cwd DIR change working directory
358 -y --noninteractive do not prompt, automatically pick the first choice for
345 -y --noninteractive do not prompt, automatically pick the first choice for
359 all prompts
346 all prompts
360 -q --quiet suppress output
347 -q --quiet suppress output
361 -v --verbose enable additional output
348 -v --verbose enable additional output
362 --config CONFIG [+] set/override config option (use 'section.name=value')
349 --config CONFIG [+] set/override config option (use 'section.name=value')
363 --debug enable debugging output
350 --debug enable debugging output
364 --debugger start debugger
351 --debugger start debugger
365 --encoding ENCODE set the charset encoding (default: ascii)
352 --encoding ENCODE set the charset encoding (default: ascii)
366 --encodingmode MODE set the charset encoding mode (default: strict)
353 --encodingmode MODE set the charset encoding mode (default: strict)
367 --traceback always print a traceback on exception
354 --traceback always print a traceback on exception
368 --time time how long the command takes
355 --time time how long the command takes
369 --profile print command execution profile
356 --profile print command execution profile
370 --version output version information and exit
357 --version output version information and exit
371 -h --help display help and exit
358 -h --help display help and exit
372 --hidden consider hidden changesets
359 --hidden consider hidden changesets
373
360
374 [+] marked option can be specified multiple times
361 [+] marked option can be specified multiple times
362
363
364
365
366
375 $ echo 'debugextension = !' >> $HGRCPATH
367 $ echo 'debugextension = !' >> $HGRCPATH
376
368
377 Extension module help vs command help:
369 Extension module help vs command help:
378
370
379 $ echo 'extdiff =' >> $HGRCPATH
371 $ echo 'extdiff =' >> $HGRCPATH
380 $ hg help extdiff
372 $ hg help extdiff
381 hg extdiff [OPT]... [FILE]...
373 hg extdiff [OPT]... [FILE]...
382
374
383 use external program to diff repository (or selected files)
375 use external program to diff repository (or selected files)
384
376
385 Show differences between revisions for the specified files, using an
377 Show differences between revisions for the specified files, using an
386 external program. The default program used is diff, with default options
378 external program. The default program used is diff, with default options
387 "-Npru".
379 "-Npru".
388
380
389 To select a different program, use the -p/--program option. The program
381 To select a different program, use the -p/--program option. The program
390 will be passed the names of two directories to compare. To pass additional
382 will be passed the names of two directories to compare. To pass additional
391 options to the program, use -o/--option. These will be passed before the
383 options to the program, use -o/--option. These will be passed before the
392 names of the directories to compare.
384 names of the directories to compare.
393
385
394 When two revision arguments are given, then changes are shown between
386 When two revision arguments are given, then changes are shown between
395 those revisions. If only one revision is specified then that revision is
387 those revisions. If only one revision is specified then that revision is
396 compared to the working directory, and, when no revisions are specified,
388 compared to the working directory, and, when no revisions are specified,
397 the working directory files are compared to its parent.
389 the working directory files are compared to its parent.
398
390
399 use "hg help -e extdiff" to show help for the extdiff extension
391 use "hg help -e extdiff" to show help for the extdiff extension
400
392
401 options:
393 options:
402
394
403 -p --program CMD comparison program to run
395 -p --program CMD comparison program to run
404 -o --option OPT [+] pass option to comparison program
396 -o --option OPT [+] pass option to comparison program
405 -r --rev REV [+] revision
397 -r --rev REV [+] revision
406 -c --change REV change made by revision
398 -c --change REV change made by revision
407 -I --include PATTERN [+] include names matching the given patterns
399 -I --include PATTERN [+] include names matching the given patterns
408 -X --exclude PATTERN [+] exclude names matching the given patterns
400 -X --exclude PATTERN [+] exclude names matching the given patterns
409
401
410 [+] marked option can be specified multiple times
402 [+] marked option can be specified multiple times
411
403
412 use "hg -v help extdiff" to show the global options
404 use "hg -v help extdiff" to show the global options
413
405
406
407
408
409
410
411
412
413
414
414 $ hg help --extension extdiff
415 $ hg help --extension extdiff
415 extdiff extension - command to allow external programs to compare revisions
416 extdiff extension - command to allow external programs to compare revisions
416
417
417 The extdiff Mercurial extension allows you to use external programs to compare
418 The extdiff Mercurial extension allows you to use external programs to compare
418 revisions, or revision with working directory. The external diff programs are
419 revisions, or revision with working directory. The external diff programs are
419 called with a configurable set of options and two non-option arguments: paths
420 called with a configurable set of options and two non-option arguments: paths
420 to directories containing snapshots of files to compare.
421 to directories containing snapshots of files to compare.
421
422
422 The extdiff extension also allows you to configure new diff commands, so you
423 The extdiff extension also allows you to configure new diff commands, so you
423 do not need to type "hg extdiff -p kdiff3" always.
424 do not need to type "hg extdiff -p kdiff3" always.
424
425
425 [extdiff]
426 [extdiff]
426 # add new command that runs GNU diff(1) in 'context diff' mode
427 # add new command that runs GNU diff(1) in 'context diff' mode
427 cdiff = gdiff -Nprc5
428 cdiff = gdiff -Nprc5
428 ## or the old way:
429 ## or the old way:
429 #cmd.cdiff = gdiff
430 #cmd.cdiff = gdiff
430 #opts.cdiff = -Nprc5
431 #opts.cdiff = -Nprc5
431
432
432 # add new command called vdiff, runs kdiff3
433 # add new command called vdiff, runs kdiff3
433 vdiff = kdiff3
434 vdiff = kdiff3
434
435
435 # add new command called meld, runs meld (no need to name twice)
436 # add new command called meld, runs meld (no need to name twice)
436 meld =
437 meld =
437
438
438 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
439 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
439 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
440 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
440 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
441 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
441 # your .vimrc
442 # your .vimrc
442 vimdiff = gvim -f "+next" \
443 vimdiff = gvim -f "+next" \
443 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
444 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
444
445
445 Tool arguments can include variables that are expanded at runtime:
446 Tool arguments can include variables that are expanded at runtime:
446
447
447 $parent1, $plabel1 - filename, descriptive label of first parent
448 $parent1, $plabel1 - filename, descriptive label of first parent
448 $child, $clabel - filename, descriptive label of child revision
449 $child, $clabel - filename, descriptive label of child revision
449 $parent2, $plabel2 - filename, descriptive label of second parent
450 $parent2, $plabel2 - filename, descriptive label of second parent
450 $root - repository root
451 $root - repository root
451 $parent is an alias for $parent1.
452 $parent is an alias for $parent1.
452
453
453 The extdiff extension will look in your [diff-tools] and [merge-tools]
454 The extdiff extension will look in your [diff-tools] and [merge-tools]
454 sections for diff tool arguments, when none are specified in [extdiff].
455 sections for diff tool arguments, when none are specified in [extdiff].
455
456
456 [extdiff]
457 [extdiff]
457 kdiff3 =
458 kdiff3 =
458
459
459 [diff-tools]
460 [diff-tools]
460 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
461 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
461
462
462 You can use -I/-X and list of file or directory names like normal "hg diff"
463 You can use -I/-X and list of file or directory names like normal "hg diff"
463 command. The extdiff extension makes snapshots of only needed files, so
464 command. The extdiff extension makes snapshots of only needed files, so
464 running the external diff program will actually be pretty fast (at least
465 running the external diff program will actually be pretty fast (at least
465 faster than having to compare the entire tree).
466 faster than having to compare the entire tree).
466
467
467 list of commands:
468 list of commands:
468
469
469 extdiff use external program to diff repository (or selected files)
470 extdiff use external program to diff repository (or selected files)
470
471
471 use "hg -v help extdiff" to show builtin aliases and global options
472 use "hg -v help extdiff" to show builtin aliases and global options
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
473 $ echo 'extdiff = !' >> $HGRCPATH
489 $ echo 'extdiff = !' >> $HGRCPATH
474
490
475 Test help topic with same name as extension
491 Test help topic with same name as extension
476
492
477 $ cat > multirevs.py <<EOF
493 $ cat > multirevs.py <<EOF
478 > from mercurial import cmdutil, commands
494 > from mercurial import cmdutil, commands
479 > cmdtable = {}
495 > cmdtable = {}
480 > command = cmdutil.command(cmdtable)
496 > command = cmdutil.command(cmdtable)
481 > """multirevs extension
497 > """multirevs extension
482 > Big multi-line module docstring."""
498 > Big multi-line module docstring."""
483 > @command('multirevs', [], 'ARG', norepo=True)
499 > @command('multirevs', [], 'ARG', norepo=True)
484 > def multirevs(ui, repo, arg, *args, **opts):
500 > def multirevs(ui, repo, arg, *args, **opts):
485 > """multirevs command"""
501 > """multirevs command"""
486 > pass
502 > pass
487 > EOF
503 > EOF
488 $ echo "multirevs = multirevs.py" >> $HGRCPATH
504 $ echo "multirevs = multirevs.py" >> $HGRCPATH
489
505
490 $ hg help multirevs
506 $ hg help multirevs
491 Specifying Multiple Revisions
507 Specifying Multiple Revisions
492 """""""""""""""""""""""""""""
508 """""""""""""""""""""""""""""
493
509
494 When Mercurial accepts more than one revision, they may be specified
510 When Mercurial accepts more than one revision, they may be specified
495 individually, or provided as a topologically continuous range, separated
511 individually, or provided as a topologically continuous range, separated
496 by the ":" character.
512 by the ":" character.
497
513
498 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
514 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
499 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
515 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
500 specified, it defaults to revision number 0. If END is not specified, it
516 specified, it defaults to revision number 0. If END is not specified, it
501 defaults to the tip. The range ":" thus means "all revisions".
517 defaults to the tip. The range ":" thus means "all revisions".
502
518
503 If BEGIN is greater than END, revisions are treated in reverse order.
519 If BEGIN is greater than END, revisions are treated in reverse order.
504
520
505 A range acts as a closed interval. This means that a range of 3:5 gives 3,
521 A range acts as a closed interval. This means that a range of 3:5 gives 3,
506 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
522 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
507
523
508 use "hg help -c multirevs" to see help for the multirevs command
524 use "hg help -c multirevs" to see help for the multirevs command
509
525
526
527
528
529
530
510 $ hg help -c multirevs
531 $ hg help -c multirevs
511 hg multirevs ARG
532 hg multirevs ARG
512
533
513 multirevs command
534 multirevs command
514
535
515 use "hg -v help multirevs" to show the global options
536 use "hg -v help multirevs" to show the global options
516
537
538
539
517 $ hg multirevs
540 $ hg multirevs
518 hg multirevs: invalid arguments
541 hg multirevs: invalid arguments
519 hg multirevs ARG
542 hg multirevs ARG
520
543
521 multirevs command
544 multirevs command
522
545
523 use "hg help multirevs" to show the full help text
546 use "hg help multirevs" to show the full help text
524 [255]
547 [255]
525
548
549
550
526 $ echo "multirevs = !" >> $HGRCPATH
551 $ echo "multirevs = !" >> $HGRCPATH
527
552
528 Issue811: Problem loading extensions twice (by site and by user)
553 Issue811: Problem loading extensions twice (by site and by user)
529
554
530 $ debugpath=`pwd`/debugissue811.py
555 $ debugpath=`pwd`/debugissue811.py
531 $ cat > debugissue811.py <<EOF
556 $ cat > debugissue811.py <<EOF
532 > '''show all loaded extensions
557 > '''show all loaded extensions
533 > '''
558 > '''
534 > from mercurial import cmdutil, commands, extensions
559 > from mercurial import cmdutil, commands, extensions
535 > cmdtable = {}
560 > cmdtable = {}
536 > command = cmdutil.command(cmdtable)
561 > command = cmdutil.command(cmdtable)
537 >
538 > @command('debugextensions', [], 'hg debugextensions', norepo=True)
562 > @command('debugextensions', [], 'hg debugextensions', norepo=True)
539 > def debugextensions(ui):
563 > def debugextensions(ui):
540 > "yet another debug command"
564 > "yet another debug command"
541 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
565 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
542 >
543 > EOF
566 > EOF
544 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
567 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
545 $ echo "mq=" >> $HGRCPATH
568 $ echo "mq=" >> $HGRCPATH
546 $ echo "strip=" >> $HGRCPATH
569 $ echo "strip=" >> $HGRCPATH
547 $ echo "hgext.mq=" >> $HGRCPATH
570 $ echo "hgext.mq=" >> $HGRCPATH
548 $ echo "hgext/mq=" >> $HGRCPATH
571 $ echo "hgext/mq=" >> $HGRCPATH
549
572
550 Show extensions:
573 Show extensions:
551 (note that mq force load strip, also checking it's not loaded twice)
574 (note that mq force load strip, also checking it's not loaded twice)
552
575
553 $ hg debugextensions
576 $ hg debugextensions
554 debugissue811
577 debugissue811
555 strip
578 strip
556 mq
579 mq
557
580
558 Disabled extension commands:
581 Disabled extension commands:
559
582
560 $ ORGHGRCPATH=$HGRCPATH
583 $ ORGHGRCPATH=$HGRCPATH
561 $ HGRCPATH=
584 $ HGRCPATH=
562 $ export HGRCPATH
585 $ export HGRCPATH
563 $ hg help email
586 $ hg help email
564 'email' is provided by the following extension:
587 'email' is provided by the following extension:
565
588
566 patchbomb command to send changesets as (a series of) patch emails
589 patchbomb command to send changesets as (a series of) patch emails
567
590
568 use "hg help extensions" for information on enabling extensions
591 use "hg help extensions" for information on enabling extensions
592
593
569 $ hg qdel
594 $ hg qdel
570 hg: unknown command 'qdel'
595 hg: unknown command 'qdel'
571 'qdelete' is provided by the following extension:
596 'qdelete' is provided by the following extension:
572
597
573 mq manage a stack of patches
598 mq manage a stack of patches
574
599
575 use "hg help extensions" for information on enabling extensions
600 use "hg help extensions" for information on enabling extensions
576 [255]
601 [255]
602
603
577 $ hg churn
604 $ hg churn
578 hg: unknown command 'churn'
605 hg: unknown command 'churn'
579 'churn' is provided by the following extension:
606 'churn' is provided by the following extension:
580
607
581 churn command to display statistics about repository history
608 churn command to display statistics about repository history
582
609
583 use "hg help extensions" for information on enabling extensions
610 use "hg help extensions" for information on enabling extensions
584 [255]
611 [255]
585
612
613
614
586 Disabled extensions:
615 Disabled extensions:
587
616
588 $ hg help churn
617 $ hg help churn
589 churn extension - command to display statistics about repository history
618 churn extension - command to display statistics about repository history
590
619
591 use "hg help extensions" for information on enabling extensions
620 use "hg help extensions" for information on enabling extensions
621
592 $ hg help patchbomb
622 $ hg help patchbomb
593 patchbomb extension - command to send changesets as (a series of) patch emails
623 patchbomb extension - command to send changesets as (a series of) patch emails
594
624
595 use "hg help extensions" for information on enabling extensions
625 use "hg help extensions" for information on enabling extensions
596
626
627
597 Broken disabled extension and command:
628 Broken disabled extension and command:
598
629
599 $ mkdir hgext
630 $ mkdir hgext
600 $ echo > hgext/__init__.py
631 $ echo > hgext/__init__.py
601 $ cat > hgext/broken.py <<EOF
632 $ cat > hgext/broken.py <<EOF
602 > "broken extension'
633 > "broken extension'
603 > EOF
634 > EOF
604 $ cat > path.py <<EOF
635 $ cat > path.py <<EOF
605 > import os, sys
636 > import os, sys
606 > sys.path.insert(0, os.environ['HGEXTPATH'])
637 > sys.path.insert(0, os.environ['HGEXTPATH'])
607 > EOF
638 > EOF
608 $ HGEXTPATH=`pwd`
639 $ HGEXTPATH=`pwd`
609 $ export HGEXTPATH
640 $ export HGEXTPATH
610
641
611 $ hg --config extensions.path=./path.py help broken
642 $ hg --config extensions.path=./path.py help broken
612 broken extension - (no help text available)
643 broken extension - (no help text available)
613
644
614 use "hg help extensions" for information on enabling extensions
645 use "hg help extensions" for information on enabling extensions
615
646
647
616 $ cat > hgext/forest.py <<EOF
648 $ cat > hgext/forest.py <<EOF
617 > cmdtable = None
649 > cmdtable = None
618 > EOF
650 > EOF
619 $ hg --config extensions.path=./path.py help foo > /dev/null
651 $ hg --config extensions.path=./path.py help foo > /dev/null
620 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
652 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
621 abort: no such help topic: foo
653 abort: no such help topic: foo
622 (try "hg help --keyword foo")
654 (try "hg help --keyword foo")
623 [255]
655 [255]
624
656
625 $ cat > throw.py <<EOF
657 $ cat > throw.py <<EOF
626 > from mercurial import cmdutil, commands
658 > from mercurial import cmdutil, commands
627 > cmdtable = {}
659 > cmdtable = {}
628 > command = cmdutil.command(cmdtable)
660 > command = cmdutil.command(cmdtable)
629 > class Bogon(Exception): pass
661 > class Bogon(Exception): pass
630 >
631 > @command('throw', [], 'hg throw', norepo=True)
662 > @command('throw', [], 'hg throw', norepo=True)
632 > def throw(ui, **opts):
663 > def throw(ui, **opts):
633 > """throws an exception"""
664 > """throws an exception"""
634 > raise Bogon()
665 > raise Bogon()
635 > EOF
666 > EOF
636 No declared supported version, extension complains:
667 No declared supported version, extension complains:
637 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
668 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
638 ** Unknown exception encountered with possibly-broken third-party extension throw
669 ** Unknown exception encountered with possibly-broken third-party extension throw
639 ** which supports versions unknown of Mercurial.
670 ** which supports versions unknown of Mercurial.
640 ** Please disable throw and try your action again.
671 ** Please disable throw and try your action again.
641 ** If that fixes the bug please report it to the extension author.
672 ** If that fixes the bug please report it to the extension author.
642 ** Python * (glob)
673 ** Python * (glob)
643 ** Mercurial Distributed SCM * (glob)
674 ** Mercurial Distributed SCM * (glob)
644 ** Extensions loaded: throw
675 ** Extensions loaded: throw
645 empty declaration of supported version, extension complains:
676 empty declaration of supported version, extension complains:
646 $ echo "testedwith = ''" >> throw.py
677 $ echo "testedwith = ''" >> throw.py
647 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
678 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
648 ** Unknown exception encountered with possibly-broken third-party extension throw
679 ** Unknown exception encountered with possibly-broken third-party extension throw
649 ** which supports versions unknown of Mercurial.
680 ** which supports versions unknown of Mercurial.
650 ** Please disable throw and try your action again.
681 ** Please disable throw and try your action again.
651 ** If that fixes the bug please report it to the extension author.
682 ** If that fixes the bug please report it to the extension author.
652 ** Python * (glob)
683 ** Python * (glob)
653 ** Mercurial Distributed SCM (*) (glob)
684 ** Mercurial Distributed SCM (*) (glob)
654 ** Extensions loaded: throw
685 ** Extensions loaded: throw
655 If the extension specifies a buglink, show that:
686 If the extension specifies a buglink, show that:
656 $ echo 'buglink = "http://example.com/bts"' >> throw.py
687 $ echo 'buglink = "http://example.com/bts"' >> throw.py
657 $ rm -f throw.pyc throw.pyo
688 $ rm -f throw.pyc throw.pyo
658 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
689 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
659 ** Unknown exception encountered with possibly-broken third-party extension throw
690 ** Unknown exception encountered with possibly-broken third-party extension throw
660 ** which supports versions unknown of Mercurial.
691 ** which supports versions unknown of Mercurial.
661 ** Please disable throw and try your action again.
692 ** Please disable throw and try your action again.
662 ** If that fixes the bug please report it to http://example.com/bts
693 ** If that fixes the bug please report it to http://example.com/bts
663 ** Python * (glob)
694 ** Python * (glob)
664 ** Mercurial Distributed SCM (*) (glob)
695 ** Mercurial Distributed SCM (*) (glob)
665 ** Extensions loaded: throw
696 ** Extensions loaded: throw
666 If the extensions declare outdated versions, accuse the older extension first:
697 If the extensions declare outdated versions, accuse the older extension first:
667 $ echo "from mercurial import util" >> older.py
698 $ echo "from mercurial import util" >> older.py
668 $ echo "util.version = lambda:'2.2'" >> older.py
699 $ echo "util.version = lambda:'2.2'" >> older.py
669 $ echo "testedwith = '1.9.3'" >> older.py
700 $ echo "testedwith = '1.9.3'" >> older.py
670 $ echo "testedwith = '2.1.1'" >> throw.py
701 $ echo "testedwith = '2.1.1'" >> throw.py
671 $ rm -f throw.pyc throw.pyo
702 $ rm -f throw.pyc throw.pyo
672 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
703 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
673 > throw 2>&1 | egrep '^\*\*'
704 > throw 2>&1 | egrep '^\*\*'
674 ** Unknown exception encountered with possibly-broken third-party extension older
705 ** Unknown exception encountered with possibly-broken third-party extension older
675 ** which supports versions 1.9.3 of Mercurial.
706 ** which supports versions 1.9.3 of Mercurial.
676 ** Please disable older and try your action again.
707 ** Please disable older and try your action again.
677 ** If that fixes the bug please report it to the extension author.
708 ** If that fixes the bug please report it to the extension author.
678 ** Python * (glob)
709 ** Python * (glob)
679 ** Mercurial Distributed SCM (version 2.2)
710 ** Mercurial Distributed SCM (version 2.2)
680 ** Extensions loaded: throw, older
711 ** Extensions loaded: throw, older
681 One extension only tested with older, one only with newer versions:
712 One extension only tested with older, one only with newer versions:
682 $ echo "util.version = lambda:'2.1.0'" >> older.py
713 $ echo "util.version = lambda:'2.1.0'" >> older.py
683 $ rm -f older.pyc older.pyo
714 $ rm -f older.pyc older.pyo
684 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
715 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
685 > throw 2>&1 | egrep '^\*\*'
716 > throw 2>&1 | egrep '^\*\*'
686 ** Unknown exception encountered with possibly-broken third-party extension older
717 ** Unknown exception encountered with possibly-broken third-party extension older
687 ** which supports versions 1.9.3 of Mercurial.
718 ** which supports versions 1.9.3 of Mercurial.
688 ** Please disable older and try your action again.
719 ** Please disable older and try your action again.
689 ** If that fixes the bug please report it to the extension author.
720 ** If that fixes the bug please report it to the extension author.
690 ** Python * (glob)
721 ** Python * (glob)
691 ** Mercurial Distributed SCM (version 2.1.0)
722 ** Mercurial Distributed SCM (version 2.1.0)
692 ** Extensions loaded: throw, older
723 ** Extensions loaded: throw, older
693 Older extension is tested with current version, the other only with newer:
724 Older extension is tested with current version, the other only with newer:
694 $ echo "util.version = lambda:'1.9.3'" >> older.py
725 $ echo "util.version = lambda:'1.9.3'" >> older.py
695 $ rm -f older.pyc older.pyo
726 $ rm -f older.pyc older.pyo
696 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
727 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
697 > throw 2>&1 | egrep '^\*\*'
728 > throw 2>&1 | egrep '^\*\*'
698 ** Unknown exception encountered with possibly-broken third-party extension throw
729 ** Unknown exception encountered with possibly-broken third-party extension throw
699 ** which supports versions 2.1.1 of Mercurial.
730 ** which supports versions 2.1.1 of Mercurial.
700 ** Please disable throw and try your action again.
731 ** Please disable throw and try your action again.
701 ** If that fixes the bug please report it to http://example.com/bts
732 ** If that fixes the bug please report it to http://example.com/bts
702 ** Python * (glob)
733 ** Python * (glob)
703 ** Mercurial Distributed SCM (version 1.9.3)
734 ** Mercurial Distributed SCM (version 1.9.3)
704 ** Extensions loaded: throw, older
735 ** Extensions loaded: throw, older
705
736
706 Declare the version as supporting this hg version, show regular bts link:
737 Declare the version as supporting this hg version, show regular bts link:
707 $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'`
738 $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'`
708 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
739 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
709 $ rm -f throw.pyc throw.pyo
740 $ rm -f throw.pyc throw.pyo
710 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
741 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
711 ** unknown exception encountered, please report by visiting
742 ** unknown exception encountered, please report by visiting
712 ** http://mercurial.selenic.com/wiki/BugTracker
743 ** http://mercurial.selenic.com/wiki/BugTracker
713 ** Python * (glob)
744 ** Python * (glob)
714 ** Mercurial Distributed SCM (*) (glob)
745 ** Mercurial Distributed SCM (*) (glob)
715 ** Extensions loaded: throw
746 ** Extensions loaded: throw
716
747
748 Test version number support in 'hg version':
749 $ echo '__version__ = (1, 2, 3)' >> throw.py
750 $ rm -f throw.pyc throw.pyo
751 $ hg version -v --config extensions.throw=throw.py
752 Mercurial Distributed SCM (version *) (glob)
753 (see http://mercurial.selenic.com for more information)
754
755 Copyright (C) 2005-* Matt Mackall and others (glob)
756 This is free software; see the source for copying conditions. There is NO
757 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
758
759 Enabled extensions:
760
761 throw 1.2.3
762 $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
763 $ rm -f throw.pyc throw.pyo
764 $ hg version -v --config extensions.throw=throw.py
765 Mercurial Distributed SCM (version *) (glob)
766 (see http://mercurial.selenic.com for more information)
767
768 Copyright (C) 2005-* Matt Mackall and others (glob)
769 This is free software; see the source for copying conditions. There is NO
770 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
771
772 Enabled extensions:
773
774 throw 1.twentythree
775
717 Restore HGRCPATH
776 Restore HGRCPATH
718
777
719 $ HGRCPATH=$ORGHGRCPATH
778 $ HGRCPATH=$ORGHGRCPATH
720 $ export HGRCPATH
779 $ export HGRCPATH
721
780
722 Commands handling multiple repositories at a time should invoke only
781 Commands handling multiple repositories at a time should invoke only
723 "reposetup()" of extensions enabling in the target repository.
782 "reposetup()" of extensions enabling in the target repository.
724
783
725 $ mkdir reposetup-test
784 $ mkdir reposetup-test
726 $ cd reposetup-test
785 $ cd reposetup-test
727
786
728 $ cat > $TESTTMP/reposetuptest.py <<EOF
787 $ cat > $TESTTMP/reposetuptest.py <<EOF
729 > from mercurial import extensions
788 > from mercurial import extensions
730 > def reposetup(ui, repo):
789 > def reposetup(ui, repo):
731 > ui.write('reposetup() for %s\n' % (repo.root))
790 > ui.write('reposetup() for %s\n' % (repo.root))
732 > EOF
791 > EOF
733 $ hg init src
792 $ hg init src
734 $ echo a > src/a
793 $ echo a > src/a
735 $ hg -R src commit -Am '#0 at src/a'
794 $ hg -R src commit -Am '#0 at src/a'
736 adding a
795 adding a
737 $ echo '[extensions]' >> src/.hg/hgrc
796 $ echo '[extensions]' >> src/.hg/hgrc
738 $ echo '# enable extension locally' >> src/.hg/hgrc
797 $ echo '# enable extension locally' >> src/.hg/hgrc
739 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
798 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
740 $ hg -R src status
799 $ hg -R src status
741 reposetup() for $TESTTMP/reposetup-test/src (glob)
800 reposetup() for $TESTTMP/reposetup-test/src (glob)
742
801
743 $ hg clone -U src clone-dst1
802 $ hg clone -U src clone-dst1
744 reposetup() for $TESTTMP/reposetup-test/src (glob)
803 reposetup() for $TESTTMP/reposetup-test/src (glob)
745 $ hg init push-dst1
804 $ hg init push-dst1
746 $ hg -q -R src push push-dst1
805 $ hg -q -R src push push-dst1
747 reposetup() for $TESTTMP/reposetup-test/src (glob)
806 reposetup() for $TESTTMP/reposetup-test/src (glob)
748 $ hg init pull-src1
807 $ hg init pull-src1
749 $ hg -q -R pull-src1 pull src
808 $ hg -q -R pull-src1 pull src
750 reposetup() for $TESTTMP/reposetup-test/src (glob)
809 reposetup() for $TESTTMP/reposetup-test/src (glob)
751
810
752 $ echo '[extensions]' >> $HGRCPATH
811 $ echo '[extensions]' >> $HGRCPATH
753 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
812 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
754 $ echo 'reposetuptest = !' >> $HGRCPATH
813 $ echo 'reposetuptest = !' >> $HGRCPATH
755 $ hg clone -U src clone-dst2
814 $ hg clone -U src clone-dst2
756 reposetup() for $TESTTMP/reposetup-test/src (glob)
815 reposetup() for $TESTTMP/reposetup-test/src (glob)
757 $ hg init push-dst2
816 $ hg init push-dst2
758 $ hg -q -R src push push-dst2
817 $ hg -q -R src push push-dst2
759 reposetup() for $TESTTMP/reposetup-test/src (glob)
818 reposetup() for $TESTTMP/reposetup-test/src (glob)
760 $ hg init pull-src2
819 $ hg init pull-src2
761 $ hg -q -R pull-src2 pull src
820 $ hg -q -R pull-src2 pull src
762 reposetup() for $TESTTMP/reposetup-test/src (glob)
821 reposetup() for $TESTTMP/reposetup-test/src (glob)
763
822
764 $ echo '[extensions]' >> $HGRCPATH
823 $ echo '[extensions]' >> $HGRCPATH
765 $ echo '# enable extension globally' >> $HGRCPATH
824 $ echo '# enable extension globally' >> $HGRCPATH
766 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> $HGRCPATH
825 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> $HGRCPATH
767 $ hg clone -U src clone-dst3
826 $ hg clone -U src clone-dst3
768 reposetup() for $TESTTMP/reposetup-test/src (glob)
827 reposetup() for $TESTTMP/reposetup-test/src (glob)
769 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
828 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
770 $ hg init push-dst3
829 $ hg init push-dst3
771 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
830 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
772 $ hg -q -R src push push-dst3
831 $ hg -q -R src push push-dst3
773 reposetup() for $TESTTMP/reposetup-test/src (glob)
832 reposetup() for $TESTTMP/reposetup-test/src (glob)
774 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
833 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
775 $ hg init pull-src3
834 $ hg init pull-src3
776 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
835 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
777 $ hg -q -R pull-src3 pull src
836 $ hg -q -R pull-src3 pull src
778 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
837 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
779 reposetup() for $TESTTMP/reposetup-test/src (glob)
838 reposetup() for $TESTTMP/reposetup-test/src (glob)
780
839
781 $ echo '[extensions]' >> src/.hg/hgrc
840 $ echo '[extensions]' >> src/.hg/hgrc
782 $ echo '# disable extension locally' >> src/.hg/hgrc
841 $ echo '# disable extension locally' >> src/.hg/hgrc
783 $ echo 'reposetuptest = !' >> src/.hg/hgrc
842 $ echo 'reposetuptest = !' >> src/.hg/hgrc
784 $ hg clone -U src clone-dst4
843 $ hg clone -U src clone-dst4
785 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
844 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
786 $ hg init push-dst4
845 $ hg init push-dst4
787 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
846 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
788 $ hg -q -R src push push-dst4
847 $ hg -q -R src push push-dst4
789 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
848 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
790 $ hg init pull-src4
849 $ hg init pull-src4
791 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
850 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
792 $ hg -q -R pull-src4 pull src
851 $ hg -q -R pull-src4 pull src
793 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
852 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
794
853
795 disabling in command line overlays with all configuration
854 disabling in command line overlays with all configuration
796 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
855 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
797 $ hg --config extensions.reposetuptest=! init push-dst5
856 $ hg --config extensions.reposetuptest=! init push-dst5
798 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
857 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
799 $ hg --config extensions.reposetuptest=! init pull-src5
858 $ hg --config extensions.reposetuptest=! init pull-src5
800 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
859 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
801
860
802 $ echo '[extensions]' >> $HGRCPATH
861 $ echo '[extensions]' >> $HGRCPATH
803 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
862 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
804 $ echo 'reposetuptest = !' >> $HGRCPATH
863 $ echo 'reposetuptest = !' >> $HGRCPATH
805 $ hg init parent
864 $ hg init parent
806 $ hg init parent/sub1
865 $ hg init parent/sub1
807 $ echo 1 > parent/sub1/1
866 $ echo 1 > parent/sub1/1
808 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
867 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
809 adding 1
868 adding 1
810 $ hg init parent/sub2
869 $ hg init parent/sub2
811 $ hg init parent/sub2/sub21
870 $ hg init parent/sub2/sub21
812 $ echo 21 > parent/sub2/sub21/21
871 $ echo 21 > parent/sub2/sub21/21
813 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
872 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
814 adding 21
873 adding 21
815 $ cat > parent/sub2/.hgsub <<EOF
874 $ cat > parent/sub2/.hgsub <<EOF
816 > sub21 = sub21
875 > sub21 = sub21
817 > EOF
876 > EOF
818 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
877 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
819 adding .hgsub
878 adding .hgsub
820 $ hg init parent/sub3
879 $ hg init parent/sub3
821 $ echo 3 > parent/sub3/3
880 $ echo 3 > parent/sub3/3
822 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
881 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
823 adding 3
882 adding 3
824 $ cat > parent/.hgsub <<EOF
883 $ cat > parent/.hgsub <<EOF
825 > sub1 = sub1
884 > sub1 = sub1
826 > sub2 = sub2
885 > sub2 = sub2
827 > sub3 = sub3
886 > sub3 = sub3
828 > EOF
887 > EOF
829 $ hg -R parent commit -Am '#0 at parent'
888 $ hg -R parent commit -Am '#0 at parent'
830 adding .hgsub
889 adding .hgsub
831 $ echo '[extensions]' >> parent/.hg/hgrc
890 $ echo '[extensions]' >> parent/.hg/hgrc
832 $ echo '# enable extension locally' >> parent/.hg/hgrc
891 $ echo '# enable extension locally' >> parent/.hg/hgrc
833 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
892 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
834 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
893 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
835 $ hg -R parent status -S -A
894 $ hg -R parent status -S -A
836 reposetup() for $TESTTMP/reposetup-test/parent (glob)
895 reposetup() for $TESTTMP/reposetup-test/parent (glob)
837 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
896 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
838 C .hgsub
897 C .hgsub
839 C .hgsubstate
898 C .hgsubstate
840 C sub1/1
899 C sub1/1
841 C sub2/.hgsub
900 C sub2/.hgsub
842 C sub2/.hgsubstate
901 C sub2/.hgsubstate
843 C sub2/sub21/21
902 C sub2/sub21/21
844 C sub3/3
903 C sub3/3
845
904
846 $ cd ..
905 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now