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