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