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