Show More
@@ -1,573 +1,574 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 | $ SCRIPT_NAME='/' SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \ |
|
115 | $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \ | |
|
116 | > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \ | |||
116 | > | grep '^[0-9]) ' # ignores HTML output |
|
117 | > | grep '^[0-9]) ' # ignores HTML output | |
117 | 1) foo imported |
|
118 | 1) foo imported | |
118 | 1) bar imported |
|
119 | 1) bar imported | |
119 | 2) foo uisetup |
|
120 | 2) foo uisetup | |
120 | 2) bar uisetup |
|
121 | 2) bar uisetup | |
121 | 3) foo extsetup |
|
122 | 3) foo extsetup | |
122 | 3) bar extsetup |
|
123 | 3) bar extsetup | |
123 | 4) foo reposetup |
|
124 | 4) foo reposetup | |
124 | 4) bar reposetup |
|
125 | 4) bar reposetup | |
125 | 4) foo reposetup |
|
126 | 4) foo reposetup | |
126 | 4) bar reposetup |
|
127 | 4) bar reposetup | |
127 |
|
128 | |||
128 | $ echo 'foo = !' >> $HGRCPATH |
|
129 | $ echo 'foo = !' >> $HGRCPATH | |
129 | $ echo 'bar = !' >> $HGRCPATH |
|
130 | $ echo 'bar = !' >> $HGRCPATH | |
130 |
|
131 | |||
131 | $ cd .. |
|
132 | $ cd .. | |
132 |
|
133 | |||
133 | hide outer repo |
|
134 | hide outer repo | |
134 | $ hg init |
|
135 | $ hg init | |
135 |
|
136 | |||
136 | $ cat > empty.py <<EOF |
|
137 | $ cat > empty.py <<EOF | |
137 | > '''empty cmdtable |
|
138 | > '''empty cmdtable | |
138 | > ''' |
|
139 | > ''' | |
139 | > cmdtable = {} |
|
140 | > cmdtable = {} | |
140 | > EOF |
|
141 | > EOF | |
141 | $ emptypath=`pwd`/empty.py |
|
142 | $ emptypath=`pwd`/empty.py | |
142 | $ echo "empty = $emptypath" >> $HGRCPATH |
|
143 | $ echo "empty = $emptypath" >> $HGRCPATH | |
143 | $ hg help empty |
|
144 | $ hg help empty | |
144 | empty extension - empty cmdtable |
|
145 | empty extension - empty cmdtable | |
145 |
|
146 | |||
146 | no commands defined |
|
147 | no commands defined | |
147 |
|
148 | |||
148 | $ echo 'empty = !' >> $HGRCPATH |
|
149 | $ echo 'empty = !' >> $HGRCPATH | |
149 |
|
150 | |||
150 | $ cat > debugextension.py <<EOF |
|
151 | $ cat > debugextension.py <<EOF | |
151 | > '''only debugcommands |
|
152 | > '''only debugcommands | |
152 | > ''' |
|
153 | > ''' | |
153 | > def debugfoobar(ui, repo, *args, **opts): |
|
154 | > def debugfoobar(ui, repo, *args, **opts): | |
154 | > "yet another debug command" |
|
155 | > "yet another debug command" | |
155 | > pass |
|
156 | > pass | |
156 | > |
|
157 | > | |
157 | > def foo(ui, repo, *args, **opts): |
|
158 | > def foo(ui, repo, *args, **opts): | |
158 | > """yet another foo command |
|
159 | > """yet another foo command | |
159 | > |
|
160 | > | |
160 | > This command has been DEPRECATED since forever. |
|
161 | > This command has been DEPRECATED since forever. | |
161 | > """ |
|
162 | > """ | |
162 | > pass |
|
163 | > pass | |
163 | > |
|
164 | > | |
164 | > cmdtable = { |
|
165 | > cmdtable = { | |
165 | > "debugfoobar": (debugfoobar, (), "hg debugfoobar"), |
|
166 | > "debugfoobar": (debugfoobar, (), "hg debugfoobar"), | |
166 | > "foo": (foo, (), "hg foo") |
|
167 | > "foo": (foo, (), "hg foo") | |
167 | > } |
|
168 | > } | |
168 | > EOF |
|
169 | > EOF | |
169 | $ debugpath=`pwd`/debugextension.py |
|
170 | $ debugpath=`pwd`/debugextension.py | |
170 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
|
171 | $ echo "debugextension = $debugpath" >> $HGRCPATH | |
171 |
|
172 | |||
172 | $ hg help debugextension |
|
173 | $ hg help debugextension | |
173 | debugextension extension - only debugcommands |
|
174 | debugextension extension - only debugcommands | |
174 |
|
175 | |||
175 | no commands defined |
|
176 | no commands defined | |
176 |
|
177 | |||
177 | $ hg --verbose help debugextension |
|
178 | $ hg --verbose help debugextension | |
178 | debugextension extension - only debugcommands |
|
179 | debugextension extension - only debugcommands | |
179 |
|
180 | |||
180 | list of commands: |
|
181 | list of commands: | |
181 |
|
182 | |||
182 | foo yet another foo command |
|
183 | foo yet another foo command | |
183 |
|
184 | |||
184 | global options: |
|
185 | global options: | |
185 |
|
186 | |||
186 | -R --repository REPO repository root directory or name of overlay bundle |
|
187 | -R --repository REPO repository root directory or name of overlay bundle | |
187 | file |
|
188 | file | |
188 | --cwd DIR change working directory |
|
189 | --cwd DIR change working directory | |
189 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
190 | -y --noninteractive do not prompt, automatically pick the first choice for | |
190 | all prompts |
|
191 | all prompts | |
191 | -q --quiet suppress output |
|
192 | -q --quiet suppress output | |
192 | -v --verbose enable additional output |
|
193 | -v --verbose enable additional output | |
193 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
194 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
194 | --debug enable debugging output |
|
195 | --debug enable debugging output | |
195 | --debugger start debugger |
|
196 | --debugger start debugger | |
196 | --encoding ENCODE set the charset encoding (default: ascii) |
|
197 | --encoding ENCODE set the charset encoding (default: ascii) | |
197 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
198 | --encodingmode MODE set the charset encoding mode (default: strict) | |
198 | --traceback always print a traceback on exception |
|
199 | --traceback always print a traceback on exception | |
199 | --time time how long the command takes |
|
200 | --time time how long the command takes | |
200 | --profile print command execution profile |
|
201 | --profile print command execution profile | |
201 | --version output version information and exit |
|
202 | --version output version information and exit | |
202 | -h --help display help and exit |
|
203 | -h --help display help and exit | |
203 | --hidden consider hidden changesets |
|
204 | --hidden consider hidden changesets | |
204 |
|
205 | |||
205 | [+] marked option can be specified multiple times |
|
206 | [+] marked option can be specified multiple times | |
206 |
|
207 | |||
207 | $ hg --debug help debugextension |
|
208 | $ hg --debug help debugextension | |
208 | debugextension extension - only debugcommands |
|
209 | debugextension extension - only debugcommands | |
209 |
|
210 | |||
210 | list of commands: |
|
211 | list of commands: | |
211 |
|
212 | |||
212 | debugfoobar yet another debug command |
|
213 | debugfoobar yet another debug command | |
213 | foo yet another foo command |
|
214 | foo yet another foo command | |
214 |
|
215 | |||
215 | global options: |
|
216 | global options: | |
216 |
|
217 | |||
217 | -R --repository REPO repository root directory or name of overlay bundle |
|
218 | -R --repository REPO repository root directory or name of overlay bundle | |
218 | file |
|
219 | file | |
219 | --cwd DIR change working directory |
|
220 | --cwd DIR change working directory | |
220 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
221 | -y --noninteractive do not prompt, automatically pick the first choice for | |
221 | all prompts |
|
222 | all prompts | |
222 | -q --quiet suppress output |
|
223 | -q --quiet suppress output | |
223 | -v --verbose enable additional output |
|
224 | -v --verbose enable additional output | |
224 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
225 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
225 | --debug enable debugging output |
|
226 | --debug enable debugging output | |
226 | --debugger start debugger |
|
227 | --debugger start debugger | |
227 | --encoding ENCODE set the charset encoding (default: ascii) |
|
228 | --encoding ENCODE set the charset encoding (default: ascii) | |
228 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
229 | --encodingmode MODE set the charset encoding mode (default: strict) | |
229 | --traceback always print a traceback on exception |
|
230 | --traceback always print a traceback on exception | |
230 | --time time how long the command takes |
|
231 | --time time how long the command takes | |
231 | --profile print command execution profile |
|
232 | --profile print command execution profile | |
232 | --version output version information and exit |
|
233 | --version output version information and exit | |
233 | -h --help display help and exit |
|
234 | -h --help display help and exit | |
234 | --hidden consider hidden changesets |
|
235 | --hidden consider hidden changesets | |
235 |
|
236 | |||
236 | [+] marked option can be specified multiple times |
|
237 | [+] marked option can be specified multiple times | |
237 | $ echo 'debugextension = !' >> $HGRCPATH |
|
238 | $ echo 'debugextension = !' >> $HGRCPATH | |
238 |
|
239 | |||
239 | Extension module help vs command help: |
|
240 | Extension module help vs command help: | |
240 |
|
241 | |||
241 | $ echo 'extdiff =' >> $HGRCPATH |
|
242 | $ echo 'extdiff =' >> $HGRCPATH | |
242 | $ hg help extdiff |
|
243 | $ hg help extdiff | |
243 | hg extdiff [OPT]... [FILE]... |
|
244 | hg extdiff [OPT]... [FILE]... | |
244 |
|
245 | |||
245 | use external program to diff repository (or selected files) |
|
246 | use external program to diff repository (or selected files) | |
246 |
|
247 | |||
247 | Show differences between revisions for the specified files, using an |
|
248 | Show differences between revisions for the specified files, using an | |
248 | external program. The default program used is diff, with default options |
|
249 | external program. The default program used is diff, with default options | |
249 | "-Npru". |
|
250 | "-Npru". | |
250 |
|
251 | |||
251 | To select a different program, use the -p/--program option. The program |
|
252 | To select a different program, use the -p/--program option. The program | |
252 | will be passed the names of two directories to compare. To pass additional |
|
253 | will be passed the names of two directories to compare. To pass additional | |
253 | options to the program, use -o/--option. These will be passed before the |
|
254 | options to the program, use -o/--option. These will be passed before the | |
254 | names of the directories to compare. |
|
255 | names of the directories to compare. | |
255 |
|
256 | |||
256 | When two revision arguments are given, then changes are shown between |
|
257 | When two revision arguments are given, then changes are shown between | |
257 | those revisions. If only one revision is specified then that revision is |
|
258 | those revisions. If only one revision is specified then that revision is | |
258 | compared to the working directory, and, when no revisions are specified, |
|
259 | compared to the working directory, and, when no revisions are specified, | |
259 | the working directory files are compared to its parent. |
|
260 | the working directory files are compared to its parent. | |
260 |
|
261 | |||
261 | use "hg help -e extdiff" to show help for the extdiff extension |
|
262 | use "hg help -e extdiff" to show help for the extdiff extension | |
262 |
|
263 | |||
263 | options: |
|
264 | options: | |
264 |
|
265 | |||
265 | -p --program CMD comparison program to run |
|
266 | -p --program CMD comparison program to run | |
266 | -o --option OPT [+] pass option to comparison program |
|
267 | -o --option OPT [+] pass option to comparison program | |
267 | -r --rev REV [+] revision |
|
268 | -r --rev REV [+] revision | |
268 | -c --change REV change made by revision |
|
269 | -c --change REV change made by revision | |
269 | -I --include PATTERN [+] include names matching the given patterns |
|
270 | -I --include PATTERN [+] include names matching the given patterns | |
270 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
271 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
271 |
|
272 | |||
272 | [+] marked option can be specified multiple times |
|
273 | [+] marked option can be specified multiple times | |
273 |
|
274 | |||
274 | use "hg -v help extdiff" to show the global options |
|
275 | use "hg -v help extdiff" to show the global options | |
275 |
|
276 | |||
276 | $ hg help --extension extdiff |
|
277 | $ hg help --extension extdiff | |
277 | extdiff extension - command to allow external programs to compare revisions |
|
278 | extdiff extension - command to allow external programs to compare revisions | |
278 |
|
279 | |||
279 | The extdiff Mercurial extension allows you to use external programs to compare |
|
280 | The extdiff Mercurial extension allows you to use external programs to compare | |
280 | revisions, or revision with working directory. The external diff programs are |
|
281 | revisions, or revision with working directory. The external diff programs are | |
281 | called with a configurable set of options and two non-option arguments: paths |
|
282 | called with a configurable set of options and two non-option arguments: paths | |
282 | to directories containing snapshots of files to compare. |
|
283 | to directories containing snapshots of files to compare. | |
283 |
|
284 | |||
284 | The extdiff extension also allows you to configure new diff commands, so you |
|
285 | The extdiff extension also allows you to configure new diff commands, so you | |
285 | do not need to type "hg extdiff -p kdiff3" always. |
|
286 | do not need to type "hg extdiff -p kdiff3" always. | |
286 |
|
287 | |||
287 | [extdiff] |
|
288 | [extdiff] | |
288 | # add new command that runs GNU diff(1) in 'context diff' mode |
|
289 | # add new command that runs GNU diff(1) in 'context diff' mode | |
289 | cdiff = gdiff -Nprc5 |
|
290 | cdiff = gdiff -Nprc5 | |
290 | ## or the old way: |
|
291 | ## or the old way: | |
291 | #cmd.cdiff = gdiff |
|
292 | #cmd.cdiff = gdiff | |
292 | #opts.cdiff = -Nprc5 |
|
293 | #opts.cdiff = -Nprc5 | |
293 |
|
294 | |||
294 | # add new command called vdiff, runs kdiff3 |
|
295 | # add new command called vdiff, runs kdiff3 | |
295 | vdiff = kdiff3 |
|
296 | vdiff = kdiff3 | |
296 |
|
297 | |||
297 | # add new command called meld, runs meld (no need to name twice) |
|
298 | # add new command called meld, runs meld (no need to name twice) | |
298 | meld = |
|
299 | meld = | |
299 |
|
300 | |||
300 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin |
|
301 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin | |
301 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non |
|
302 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non | |
302 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in |
|
303 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in | |
303 | # your .vimrc |
|
304 | # your .vimrc | |
304 | vimdiff = gvim -f "+next" \ |
|
305 | vimdiff = gvim -f "+next" \ | |
305 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
|
306 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" | |
306 |
|
307 | |||
307 | Tool arguments can include variables that are expanded at runtime: |
|
308 | Tool arguments can include variables that are expanded at runtime: | |
308 |
|
309 | |||
309 | $parent1, $plabel1 - filename, descriptive label of first parent |
|
310 | $parent1, $plabel1 - filename, descriptive label of first parent | |
310 | $child, $clabel - filename, descriptive label of child revision |
|
311 | $child, $clabel - filename, descriptive label of child revision | |
311 | $parent2, $plabel2 - filename, descriptive label of second parent |
|
312 | $parent2, $plabel2 - filename, descriptive label of second parent | |
312 | $root - repository root |
|
313 | $root - repository root | |
313 | $parent is an alias for $parent1. |
|
314 | $parent is an alias for $parent1. | |
314 |
|
315 | |||
315 | The extdiff extension will look in your [diff-tools] and [merge-tools] |
|
316 | The extdiff extension will look in your [diff-tools] and [merge-tools] | |
316 | sections for diff tool arguments, when none are specified in [extdiff]. |
|
317 | sections for diff tool arguments, when none are specified in [extdiff]. | |
317 |
|
318 | |||
318 | [extdiff] |
|
319 | [extdiff] | |
319 | kdiff3 = |
|
320 | kdiff3 = | |
320 |
|
321 | |||
321 | [diff-tools] |
|
322 | [diff-tools] | |
322 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
323 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child | |
323 |
|
324 | |||
324 | You can use -I/-X and list of file or directory names like normal "hg diff" |
|
325 | You can use -I/-X and list of file or directory names like normal "hg diff" | |
325 | command. The extdiff extension makes snapshots of only needed files, so |
|
326 | command. The extdiff extension makes snapshots of only needed files, so | |
326 | running the external diff program will actually be pretty fast (at least |
|
327 | running the external diff program will actually be pretty fast (at least | |
327 | faster than having to compare the entire tree). |
|
328 | faster than having to compare the entire tree). | |
328 |
|
329 | |||
329 | list of commands: |
|
330 | list of commands: | |
330 |
|
331 | |||
331 | extdiff use external program to diff repository (or selected files) |
|
332 | extdiff use external program to diff repository (or selected files) | |
332 |
|
333 | |||
333 | use "hg -v help extdiff" to show builtin aliases and global options |
|
334 | use "hg -v help extdiff" to show builtin aliases and global options | |
334 |
|
335 | |||
335 | $ echo 'extdiff = !' >> $HGRCPATH |
|
336 | $ echo 'extdiff = !' >> $HGRCPATH | |
336 |
|
337 | |||
337 | Test help topic with same name as extension |
|
338 | Test help topic with same name as extension | |
338 |
|
339 | |||
339 | $ cat > multirevs.py <<EOF |
|
340 | $ cat > multirevs.py <<EOF | |
340 | > from mercurial import commands |
|
341 | > from mercurial import commands | |
341 | > """multirevs extension |
|
342 | > """multirevs extension | |
342 | > Big multi-line module docstring.""" |
|
343 | > Big multi-line module docstring.""" | |
343 | > def multirevs(ui, repo, arg, *args, **opts): |
|
344 | > def multirevs(ui, repo, arg, *args, **opts): | |
344 | > """multirevs command""" |
|
345 | > """multirevs command""" | |
345 | > pass |
|
346 | > pass | |
346 | > cmdtable = { |
|
347 | > cmdtable = { | |
347 | > "multirevs": (multirevs, [], 'ARG') |
|
348 | > "multirevs": (multirevs, [], 'ARG') | |
348 | > } |
|
349 | > } | |
349 | > commands.norepo += ' multirevs' |
|
350 | > commands.norepo += ' multirevs' | |
350 | > EOF |
|
351 | > EOF | |
351 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
|
352 | $ echo "multirevs = multirevs.py" >> $HGRCPATH | |
352 |
|
353 | |||
353 | $ hg help multirevs |
|
354 | $ hg help multirevs | |
354 | Specifying Multiple Revisions |
|
355 | Specifying Multiple Revisions | |
355 |
|
356 | |||
356 | When Mercurial accepts more than one revision, they may be specified |
|
357 | When Mercurial accepts more than one revision, they may be specified | |
357 | individually, or provided as a topologically continuous range, separated |
|
358 | individually, or provided as a topologically continuous range, separated | |
358 | by the ":" character. |
|
359 | by the ":" character. | |
359 |
|
360 | |||
360 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END are |
|
361 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END are | |
361 | revision identifiers. Both BEGIN and END are optional. If BEGIN is not |
|
362 | revision identifiers. Both BEGIN and END are optional. If BEGIN is not | |
362 | specified, it defaults to revision number 0. If END is not specified, it |
|
363 | specified, it defaults to revision number 0. If END is not specified, it | |
363 | defaults to the tip. The range ":" thus means "all revisions". |
|
364 | defaults to the tip. The range ":" thus means "all revisions". | |
364 |
|
365 | |||
365 | If BEGIN is greater than END, revisions are treated in reverse order. |
|
366 | If BEGIN is greater than END, revisions are treated in reverse order. | |
366 |
|
367 | |||
367 | A range acts as a closed interval. This means that a range of 3:5 gives 3, |
|
368 | A range acts as a closed interval. This means that a range of 3:5 gives 3, | |
368 | 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. |
|
369 | 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. | |
369 |
|
370 | |||
370 | use "hg help -c multirevs" to see help for the multirevs command |
|
371 | use "hg help -c multirevs" to see help for the multirevs command | |
371 |
|
372 | |||
372 | $ hg help -c multirevs |
|
373 | $ hg help -c multirevs | |
373 | hg multirevs ARG |
|
374 | hg multirevs ARG | |
374 |
|
375 | |||
375 | multirevs command |
|
376 | multirevs command | |
376 |
|
377 | |||
377 | use "hg -v help multirevs" to show the global options |
|
378 | use "hg -v help multirevs" to show the global options | |
378 |
|
379 | |||
379 | $ hg multirevs |
|
380 | $ hg multirevs | |
380 | hg multirevs: invalid arguments |
|
381 | hg multirevs: invalid arguments | |
381 | hg multirevs ARG |
|
382 | hg multirevs ARG | |
382 |
|
383 | |||
383 | multirevs command |
|
384 | multirevs command | |
384 |
|
385 | |||
385 | use "hg help multirevs" to show the full help text |
|
386 | use "hg help multirevs" to show the full help text | |
386 | [255] |
|
387 | [255] | |
387 |
|
388 | |||
388 | $ echo "multirevs = !" >> $HGRCPATH |
|
389 | $ echo "multirevs = !" >> $HGRCPATH | |
389 |
|
390 | |||
390 | Issue811: Problem loading extensions twice (by site and by user) |
|
391 | Issue811: Problem loading extensions twice (by site and by user) | |
391 |
|
392 | |||
392 | $ debugpath=`pwd`/debugissue811.py |
|
393 | $ debugpath=`pwd`/debugissue811.py | |
393 | $ cat > debugissue811.py <<EOF |
|
394 | $ cat > debugissue811.py <<EOF | |
394 | > '''show all loaded extensions |
|
395 | > '''show all loaded extensions | |
395 | > ''' |
|
396 | > ''' | |
396 | > from mercurial import extensions, commands |
|
397 | > from mercurial import extensions, commands | |
397 | > |
|
398 | > | |
398 | > def debugextensions(ui): |
|
399 | > def debugextensions(ui): | |
399 | > "yet another debug command" |
|
400 | > "yet another debug command" | |
400 | > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()])) |
|
401 | > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()])) | |
401 | > |
|
402 | > | |
402 | > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")} |
|
403 | > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")} | |
403 | > commands.norepo += " debugextensions" |
|
404 | > commands.norepo += " debugextensions" | |
404 | > EOF |
|
405 | > EOF | |
405 | $ echo "debugissue811 = $debugpath" >> $HGRCPATH |
|
406 | $ echo "debugissue811 = $debugpath" >> $HGRCPATH | |
406 | $ echo "mq=" >> $HGRCPATH |
|
407 | $ echo "mq=" >> $HGRCPATH | |
407 | $ echo "hgext.mq=" >> $HGRCPATH |
|
408 | $ echo "hgext.mq=" >> $HGRCPATH | |
408 | $ echo "hgext/mq=" >> $HGRCPATH |
|
409 | $ echo "hgext/mq=" >> $HGRCPATH | |
409 |
|
410 | |||
410 | Show extensions: |
|
411 | Show extensions: | |
411 |
|
412 | |||
412 | $ hg debugextensions |
|
413 | $ hg debugextensions | |
413 | debugissue811 |
|
414 | debugissue811 | |
414 | mq |
|
415 | mq | |
415 |
|
416 | |||
416 | Disabled extension commands: |
|
417 | Disabled extension commands: | |
417 |
|
418 | |||
418 | $ HGRCPATH= |
|
419 | $ HGRCPATH= | |
419 | $ export HGRCPATH |
|
420 | $ export HGRCPATH | |
420 | $ hg help email |
|
421 | $ hg help email | |
421 | 'email' is provided by the following extension: |
|
422 | 'email' is provided by the following extension: | |
422 |
|
423 | |||
423 | patchbomb command to send changesets as (a series of) patch emails |
|
424 | patchbomb command to send changesets as (a series of) patch emails | |
424 |
|
425 | |||
425 | use "hg help extensions" for information on enabling extensions |
|
426 | use "hg help extensions" for information on enabling extensions | |
426 | $ hg qdel |
|
427 | $ hg qdel | |
427 | hg: unknown command 'qdel' |
|
428 | hg: unknown command 'qdel' | |
428 | 'qdelete' is provided by the following extension: |
|
429 | 'qdelete' is provided by the following extension: | |
429 |
|
430 | |||
430 | mq manage a stack of patches |
|
431 | mq manage a stack of patches | |
431 |
|
432 | |||
432 | use "hg help extensions" for information on enabling extensions |
|
433 | use "hg help extensions" for information on enabling extensions | |
433 | [255] |
|
434 | [255] | |
434 | $ hg churn |
|
435 | $ hg churn | |
435 | hg: unknown command 'churn' |
|
436 | hg: unknown command 'churn' | |
436 | 'churn' is provided by the following extension: |
|
437 | 'churn' is provided by the following extension: | |
437 |
|
438 | |||
438 | churn command to display statistics about repository history |
|
439 | churn command to display statistics about repository history | |
439 |
|
440 | |||
440 | use "hg help extensions" for information on enabling extensions |
|
441 | use "hg help extensions" for information on enabling extensions | |
441 | [255] |
|
442 | [255] | |
442 |
|
443 | |||
443 | Disabled extensions: |
|
444 | Disabled extensions: | |
444 |
|
445 | |||
445 | $ hg help churn |
|
446 | $ hg help churn | |
446 | churn extension - command to display statistics about repository history |
|
447 | churn extension - command to display statistics about repository history | |
447 |
|
448 | |||
448 | use "hg help extensions" for information on enabling extensions |
|
449 | use "hg help extensions" for information on enabling extensions | |
449 | $ hg help patchbomb |
|
450 | $ hg help patchbomb | |
450 | patchbomb extension - command to send changesets as (a series of) patch emails |
|
451 | patchbomb extension - command to send changesets as (a series of) patch emails | |
451 |
|
452 | |||
452 | use "hg help extensions" for information on enabling extensions |
|
453 | use "hg help extensions" for information on enabling extensions | |
453 |
|
454 | |||
454 | Broken disabled extension and command: |
|
455 | Broken disabled extension and command: | |
455 |
|
456 | |||
456 | $ mkdir hgext |
|
457 | $ mkdir hgext | |
457 | $ echo > hgext/__init__.py |
|
458 | $ echo > hgext/__init__.py | |
458 | $ cat > hgext/broken.py <<EOF |
|
459 | $ cat > hgext/broken.py <<EOF | |
459 | > "broken extension' |
|
460 | > "broken extension' | |
460 | > EOF |
|
461 | > EOF | |
461 | $ cat > path.py <<EOF |
|
462 | $ cat > path.py <<EOF | |
462 | > import os, sys |
|
463 | > import os, sys | |
463 | > sys.path.insert(0, os.environ['HGEXTPATH']) |
|
464 | > sys.path.insert(0, os.environ['HGEXTPATH']) | |
464 | > EOF |
|
465 | > EOF | |
465 | $ HGEXTPATH=`pwd` |
|
466 | $ HGEXTPATH=`pwd` | |
466 | $ export HGEXTPATH |
|
467 | $ export HGEXTPATH | |
467 |
|
468 | |||
468 | $ hg --config extensions.path=./path.py help broken |
|
469 | $ hg --config extensions.path=./path.py help broken | |
469 | broken extension - (no help text available) |
|
470 | broken extension - (no help text available) | |
470 |
|
471 | |||
471 | use "hg help extensions" for information on enabling extensions |
|
472 | use "hg help extensions" for information on enabling extensions | |
472 |
|
473 | |||
473 | $ cat > hgext/forest.py <<EOF |
|
474 | $ cat > hgext/forest.py <<EOF | |
474 | > cmdtable = None |
|
475 | > cmdtable = None | |
475 | > EOF |
|
476 | > EOF | |
476 | $ hg --config extensions.path=./path.py help foo > /dev/null |
|
477 | $ hg --config extensions.path=./path.py help foo > /dev/null | |
477 | warning: error finding commands in $TESTTMP/hgext/forest.py (glob) |
|
478 | warning: error finding commands in $TESTTMP/hgext/forest.py (glob) | |
478 | hg: unknown command 'foo' |
|
479 | hg: unknown command 'foo' | |
479 | warning: error finding commands in $TESTTMP/hgext/forest.py (glob) |
|
480 | warning: error finding commands in $TESTTMP/hgext/forest.py (glob) | |
480 | [255] |
|
481 | [255] | |
481 |
|
482 | |||
482 | $ cat > throw.py <<EOF |
|
483 | $ cat > throw.py <<EOF | |
483 | > from mercurial import cmdutil, commands |
|
484 | > from mercurial import cmdutil, commands | |
484 | > cmdtable = {} |
|
485 | > cmdtable = {} | |
485 | > command = cmdutil.command(cmdtable) |
|
486 | > command = cmdutil.command(cmdtable) | |
486 | > class Bogon(Exception): pass |
|
487 | > class Bogon(Exception): pass | |
487 | > |
|
488 | > | |
488 | > @command('throw', [], 'hg throw') |
|
489 | > @command('throw', [], 'hg throw') | |
489 | > def throw(ui, **opts): |
|
490 | > def throw(ui, **opts): | |
490 | > """throws an exception""" |
|
491 | > """throws an exception""" | |
491 | > raise Bogon() |
|
492 | > raise Bogon() | |
492 | > commands.norepo += " throw" |
|
493 | > commands.norepo += " throw" | |
493 | > EOF |
|
494 | > EOF | |
494 | No declared supported version, extension complains: |
|
495 | No declared supported version, extension complains: | |
495 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
496 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
496 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
497 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
497 | ** which supports versions unknown of Mercurial. |
|
498 | ** which supports versions unknown of Mercurial. | |
498 | ** Please disable throw and try your action again. |
|
499 | ** Please disable throw and try your action again. | |
499 | ** If that fixes the bug please report it to the extension author. |
|
500 | ** If that fixes the bug please report it to the extension author. | |
500 | ** Python * (glob) |
|
501 | ** Python * (glob) | |
501 | ** Mercurial Distributed SCM * (glob) |
|
502 | ** Mercurial Distributed SCM * (glob) | |
502 | ** Extensions loaded: throw |
|
503 | ** Extensions loaded: throw | |
503 | empty declaration of supported version, extension complains: |
|
504 | empty declaration of supported version, extension complains: | |
504 | $ echo "testedwith = ''" >> throw.py |
|
505 | $ echo "testedwith = ''" >> throw.py | |
505 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
506 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
506 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
507 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
507 | ** which supports versions unknown of Mercurial. |
|
508 | ** which supports versions unknown of Mercurial. | |
508 | ** Please disable throw and try your action again. |
|
509 | ** Please disable throw and try your action again. | |
509 | ** If that fixes the bug please report it to the extension author. |
|
510 | ** If that fixes the bug please report it to the extension author. | |
510 | ** Python * (glob) |
|
511 | ** Python * (glob) | |
511 | ** Mercurial Distributed SCM (*) (glob) |
|
512 | ** Mercurial Distributed SCM (*) (glob) | |
512 | ** Extensions loaded: throw |
|
513 | ** Extensions loaded: throw | |
513 | If the extension specifies a buglink, show that: |
|
514 | If the extension specifies a buglink, show that: | |
514 | $ echo 'buglink = "http://example.com/bts"' >> throw.py |
|
515 | $ echo 'buglink = "http://example.com/bts"' >> throw.py | |
515 | $ rm -f throw.pyc throw.pyo |
|
516 | $ rm -f throw.pyc throw.pyo | |
516 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
517 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
517 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
518 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
518 | ** which supports versions unknown of Mercurial. |
|
519 | ** which supports versions unknown of Mercurial. | |
519 | ** Please disable throw and try your action again. |
|
520 | ** Please disable throw and try your action again. | |
520 | ** If that fixes the bug please report it to http://example.com/bts |
|
521 | ** If that fixes the bug please report it to http://example.com/bts | |
521 | ** Python * (glob) |
|
522 | ** Python * (glob) | |
522 | ** Mercurial Distributed SCM (*) (glob) |
|
523 | ** Mercurial Distributed SCM (*) (glob) | |
523 | ** Extensions loaded: throw |
|
524 | ** Extensions loaded: throw | |
524 | If the extensions declare outdated versions, accuse the older extension first: |
|
525 | If the extensions declare outdated versions, accuse the older extension first: | |
525 | $ echo "from mercurial import util" >> older.py |
|
526 | $ echo "from mercurial import util" >> older.py | |
526 | $ echo "util.version = lambda:'2.2'" >> older.py |
|
527 | $ echo "util.version = lambda:'2.2'" >> older.py | |
527 | $ echo "testedwith = '1.9.3'" >> older.py |
|
528 | $ echo "testedwith = '1.9.3'" >> older.py | |
528 | $ echo "testedwith = '2.1.1'" >> throw.py |
|
529 | $ echo "testedwith = '2.1.1'" >> throw.py | |
529 | $ rm -f throw.pyc throw.pyo |
|
530 | $ rm -f throw.pyc throw.pyo | |
530 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
531 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
531 | > throw 2>&1 | egrep '^\*\*' |
|
532 | > throw 2>&1 | egrep '^\*\*' | |
532 | ** Unknown exception encountered with possibly-broken third-party extension older |
|
533 | ** Unknown exception encountered with possibly-broken third-party extension older | |
533 | ** which supports versions 1.9.3 of Mercurial. |
|
534 | ** which supports versions 1.9.3 of Mercurial. | |
534 | ** Please disable older and try your action again. |
|
535 | ** Please disable older and try your action again. | |
535 | ** If that fixes the bug please report it to the extension author. |
|
536 | ** If that fixes the bug please report it to the extension author. | |
536 | ** Python * (glob) |
|
537 | ** Python * (glob) | |
537 | ** Mercurial Distributed SCM (version 2.2) |
|
538 | ** Mercurial Distributed SCM (version 2.2) | |
538 | ** Extensions loaded: throw, older |
|
539 | ** Extensions loaded: throw, older | |
539 | One extension only tested with older, one only with newer versions: |
|
540 | One extension only tested with older, one only with newer versions: | |
540 | $ echo "util.version = lambda:'2.1.0'" >> older.py |
|
541 | $ echo "util.version = lambda:'2.1.0'" >> older.py | |
541 | $ rm -f older.pyc older.pyo |
|
542 | $ rm -f older.pyc older.pyo | |
542 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
543 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
543 | > throw 2>&1 | egrep '^\*\*' |
|
544 | > throw 2>&1 | egrep '^\*\*' | |
544 | ** Unknown exception encountered with possibly-broken third-party extension older |
|
545 | ** Unknown exception encountered with possibly-broken third-party extension older | |
545 | ** which supports versions 1.9.3 of Mercurial. |
|
546 | ** which supports versions 1.9.3 of Mercurial. | |
546 | ** Please disable older and try your action again. |
|
547 | ** Please disable older and try your action again. | |
547 | ** If that fixes the bug please report it to the extension author. |
|
548 | ** If that fixes the bug please report it to the extension author. | |
548 | ** Python * (glob) |
|
549 | ** Python * (glob) | |
549 | ** Mercurial Distributed SCM (version 2.1.0) |
|
550 | ** Mercurial Distributed SCM (version 2.1.0) | |
550 | ** Extensions loaded: throw, older |
|
551 | ** Extensions loaded: throw, older | |
551 | Older extension is tested with current version, the other only with newer: |
|
552 | Older extension is tested with current version, the other only with newer: | |
552 | $ echo "util.version = lambda:'1.9.3'" >> older.py |
|
553 | $ echo "util.version = lambda:'1.9.3'" >> older.py | |
553 | $ rm -f older.pyc older.pyo |
|
554 | $ rm -f older.pyc older.pyo | |
554 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
555 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
555 | > throw 2>&1 | egrep '^\*\*' |
|
556 | > throw 2>&1 | egrep '^\*\*' | |
556 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
557 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
557 | ** which supports versions 2.1.1 of Mercurial. |
|
558 | ** which supports versions 2.1.1 of Mercurial. | |
558 | ** Please disable throw and try your action again. |
|
559 | ** Please disable throw and try your action again. | |
559 | ** If that fixes the bug please report it to http://example.com/bts |
|
560 | ** If that fixes the bug please report it to http://example.com/bts | |
560 | ** Python * (glob) |
|
561 | ** Python * (glob) | |
561 | ** Mercurial Distributed SCM (version 1.9.3) |
|
562 | ** Mercurial Distributed SCM (version 1.9.3) | |
562 | ** Extensions loaded: throw, older |
|
563 | ** Extensions loaded: throw, older | |
563 |
|
564 | |||
564 | Declare the version as supporting this hg version, show regular bts link: |
|
565 | Declare the version as supporting this hg version, show regular bts link: | |
565 | $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'` |
|
566 | $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'` | |
566 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py |
|
567 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py | |
567 | $ rm -f throw.pyc throw.pyo |
|
568 | $ rm -f throw.pyc throw.pyo | |
568 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
569 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
569 | ** unknown exception encountered, please report by visiting |
|
570 | ** unknown exception encountered, please report by visiting | |
570 | ** http://mercurial.selenic.com/wiki/BugTracker |
|
571 | ** http://mercurial.selenic.com/wiki/BugTracker | |
571 | ** Python * (glob) |
|
572 | ** Python * (glob) | |
572 | ** Mercurial Distributed SCM (*) (glob) |
|
573 | ** Mercurial Distributed SCM (*) (glob) | |
573 | ** Extensions loaded: throw |
|
574 | ** Extensions loaded: throw |
@@ -1,109 +1,111 b'' | |||||
1 | This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is |
|
1 | This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is | |
2 | no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO |
|
2 | no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO | |
3 | should be used from d74fc8dec2b4 onward to route the request. |
|
3 | should be used from d74fc8dec2b4 onward to route the request. | |
4 |
|
4 | |||
5 | $ hg init repo |
|
5 | $ hg init repo | |
6 | $ cd repo |
|
6 | $ cd repo | |
7 | $ echo foo > bar |
|
7 | $ echo foo > bar | |
8 | $ hg add bar |
|
8 | $ hg add bar | |
9 | $ hg commit -m "test" |
|
9 | $ hg commit -m "test" | |
10 | $ hg tip |
|
10 | $ hg tip | |
11 | changeset: 0:61c9426e69fe |
|
11 | changeset: 0:61c9426e69fe | |
12 | tag: tip |
|
12 | tag: tip | |
13 | user: test |
|
13 | user: test | |
14 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
14 | date: Thu Jan 01 00:00:00 1970 +0000 | |
15 | summary: test |
|
15 | summary: test | |
16 |
|
16 | |||
17 | $ cat > request.py <<EOF |
|
17 | $ cat > request.py <<EOF | |
18 | > from mercurial.hgweb import hgweb, hgwebdir |
|
18 | > from mercurial.hgweb import hgweb, hgwebdir | |
19 | > from StringIO import StringIO |
|
19 | > from StringIO import StringIO | |
20 | > import os, sys |
|
20 | > import os, sys | |
21 | > |
|
21 | > | |
22 | > errors = StringIO() |
|
22 | > errors = StringIO() | |
23 | > input = StringIO() |
|
23 | > input = StringIO() | |
24 | > |
|
24 | > | |
25 | > def startrsp(status, headers): |
|
25 | > def startrsp(status, headers): | |
26 | > print '---- STATUS' |
|
26 | > print '---- STATUS' | |
27 | > print status |
|
27 | > print status | |
28 | > print '---- HEADERS' |
|
28 | > print '---- HEADERS' | |
29 | > print [i for i in headers if i[0] != 'ETag'] |
|
29 | > print [i for i in headers if i[0] != 'ETag'] | |
30 | > print '---- DATA' |
|
30 | > print '---- DATA' | |
31 | > return output.write |
|
31 | > return output.write | |
32 | > |
|
32 | > | |
33 | > env = { |
|
33 | > env = { | |
34 | > 'wsgi.version': (1, 0), |
|
34 | > 'wsgi.version': (1, 0), | |
35 | > 'wsgi.url_scheme': 'http', |
|
35 | > 'wsgi.url_scheme': 'http', | |
36 | > 'wsgi.errors': errors, |
|
36 | > 'wsgi.errors': errors, | |
37 | > 'wsgi.input': input, |
|
37 | > 'wsgi.input': input, | |
38 | > 'wsgi.multithread': False, |
|
38 | > 'wsgi.multithread': False, | |
39 | > 'wsgi.multiprocess': False, |
|
39 | > 'wsgi.multiprocess': False, | |
40 | > 'wsgi.run_once': False, |
|
40 | > 'wsgi.run_once': False, | |
41 | > 'REQUEST_METHOD': 'GET', |
|
41 | > 'REQUEST_METHOD': 'GET', | |
|
42 | > 'PATH_INFO': '/', | |||
42 | > 'SCRIPT_NAME': '', |
|
43 | > 'SCRIPT_NAME': '', | |
43 | > 'SERVER_NAME': '127.0.0.1', |
|
44 | > 'SERVER_NAME': '127.0.0.1', | |
44 | > 'SERVER_PORT': os.environ['HGPORT'], |
|
45 | > 'SERVER_PORT': os.environ['HGPORT'], | |
45 | > 'SERVER_PROTOCOL': 'HTTP/1.0' |
|
46 | > 'SERVER_PROTOCOL': 'HTTP/1.0' | |
46 | > } |
|
47 | > } | |
47 | > |
|
48 | > | |
48 | > def process(app): |
|
49 | > def process(app): | |
49 | > content = app(env, startrsp) |
|
50 | > content = app(env, startrsp) | |
50 | > sys.stdout.write(output.getvalue()) |
|
51 | > sys.stdout.write(output.getvalue()) | |
51 | > sys.stdout.write(''.join(content)) |
|
52 | > sys.stdout.write(''.join(content)) | |
|
53 | > getattr(content, 'close', lambda : None)() | |||
52 | > print '---- ERRORS' |
|
54 | > print '---- ERRORS' | |
53 | > print errors.getvalue() |
|
55 | > print errors.getvalue() | |
54 | > |
|
56 | > | |
55 | > output = StringIO() |
|
57 | > output = StringIO() | |
56 | > env['QUERY_STRING'] = 'style=atom' |
|
58 | > env['QUERY_STRING'] = 'style=atom' | |
57 | > process(hgweb('.', name='repo')) |
|
59 | > process(hgweb('.', name='repo')) | |
58 | > |
|
60 | > | |
59 | > output = StringIO() |
|
61 | > output = StringIO() | |
60 | > env['QUERY_STRING'] = 'style=raw' |
|
62 | > env['QUERY_STRING'] = 'style=raw' | |
61 | > process(hgwebdir({'repo': '.'})) |
|
63 | > process(hgwebdir({'repo': '.'})) | |
62 | > EOF |
|
64 | > EOF | |
63 | $ python request.py |
|
65 | $ python request.py | |
64 | ---- STATUS |
|
66 | ---- STATUS | |
65 | 200 Script output follows |
|
67 | 200 Script output follows | |
66 | ---- HEADERS |
|
68 | ---- HEADERS | |
67 | [('Content-Type', 'application/atom+xml; charset=ascii')] |
|
69 | [('Content-Type', 'application/atom+xml; charset=ascii')] | |
68 | ---- DATA |
|
70 | ---- DATA | |
69 | <?xml version="1.0" encoding="ascii"?> |
|
71 | <?xml version="1.0" encoding="ascii"?> | |
70 | <feed xmlns="http://www.w3.org/2005/Atom"> |
|
72 | <feed xmlns="http://www.w3.org/2005/Atom"> | |
71 | <!-- Changelog --> |
|
73 | <!-- Changelog --> | |
72 | <id>http://127.0.0.1:$HGPORT/</id> |
|
74 | <id>http://127.0.0.1:$HGPORT/</id> | |
73 | <link rel="self" href="http://127.0.0.1:$HGPORT/atom-log"/> |
|
75 | <link rel="self" href="http://127.0.0.1:$HGPORT/atom-log"/> | |
74 | <link rel="alternate" href="http://127.0.0.1:$HGPORT/"/> |
|
76 | <link rel="alternate" href="http://127.0.0.1:$HGPORT/"/> | |
75 | <title>repo Changelog</title> |
|
77 | <title>repo Changelog</title> | |
76 | <updated>1970-01-01T00:00:00+00:00</updated> |
|
78 | <updated>1970-01-01T00:00:00+00:00</updated> | |
77 |
|
79 | |||
78 | <entry> |
|
80 | <entry> | |
79 | <title>test</title> |
|
81 | <title>test</title> | |
80 | <id>http://127.0.0.1:$HGPORT/#changeset-61c9426e69fef294feed5e2bbfc97d39944a5b1c</id> |
|
82 | <id>http://127.0.0.1:$HGPORT/#changeset-61c9426e69fef294feed5e2bbfc97d39944a5b1c</id> | |
81 | <link href="http://127.0.0.1:$HGPORT/rev/61c9426e69fe"/> |
|
83 | <link href="http://127.0.0.1:$HGPORT/rev/61c9426e69fe"/> | |
82 | <author> |
|
84 | <author> | |
83 | <name>test</name> |
|
85 | <name>test</name> | |
84 | <email>test</email> |
|
86 | <email>test</email> | |
85 | </author> |
|
87 | </author> | |
86 | <updated>1970-01-01T00:00:00+00:00</updated> |
|
88 | <updated>1970-01-01T00:00:00+00:00</updated> | |
87 | <published>1970-01-01T00:00:00+00:00</published> |
|
89 | <published>1970-01-01T00:00:00+00:00</published> | |
88 | <content type="xhtml"> |
|
90 | <content type="xhtml"> | |
89 | <div xmlns="http://www.w3.org/1999/xhtml"> |
|
91 | <div xmlns="http://www.w3.org/1999/xhtml"> | |
90 | <pre xml:space="preserve">test</pre> |
|
92 | <pre xml:space="preserve">test</pre> | |
91 | </div> |
|
93 | </div> | |
92 | </content> |
|
94 | </content> | |
93 | </entry> |
|
95 | </entry> | |
94 |
|
96 | |||
95 | </feed> |
|
97 | </feed> | |
96 | ---- ERRORS |
|
98 | ---- ERRORS | |
97 |
|
99 | |||
98 | ---- STATUS |
|
100 | ---- STATUS | |
99 | 200 Script output follows |
|
101 | 200 Script output follows | |
100 | ---- HEADERS |
|
102 | ---- HEADERS | |
101 | [('Content-Type', 'text/plain; charset=ascii')] |
|
103 | [('Content-Type', 'text/plain; charset=ascii')] | |
102 | ---- DATA |
|
104 | ---- DATA | |
103 |
|
105 | |||
104 | repo/ |
|
106 | /repo/ | |
105 |
|
107 | |||
106 | ---- ERRORS |
|
108 | ---- ERRORS | |
107 |
|
109 | |||
108 |
|
110 | |||
109 | $ cd .. |
|
111 | $ cd .. |
@@ -1,143 +1,144 b'' | |||||
1 | This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is |
|
1 | This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is | |
2 | no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO |
|
2 | no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO | |
3 | should be used from d74fc8dec2b4 onward to route the request. |
|
3 | should be used from d74fc8dec2b4 onward to route the request. | |
4 |
|
4 | |||
5 | $ hg init repo |
|
5 | $ hg init repo | |
6 | $ cd repo |
|
6 | $ cd repo | |
7 | $ echo foo > bar |
|
7 | $ echo foo > bar | |
8 | $ hg add bar |
|
8 | $ hg add bar | |
9 | $ hg commit -m "test" |
|
9 | $ hg commit -m "test" | |
10 | $ hg tip |
|
10 | $ hg tip | |
11 | changeset: 0:61c9426e69fe |
|
11 | changeset: 0:61c9426e69fe | |
12 | tag: tip |
|
12 | tag: tip | |
13 | user: test |
|
13 | user: test | |
14 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
14 | date: Thu Jan 01 00:00:00 1970 +0000 | |
15 | summary: test |
|
15 | summary: test | |
16 |
|
16 | |||
17 | $ cat > request.py <<EOF |
|
17 | $ cat > request.py <<EOF | |
18 | > from mercurial.hgweb import hgweb, hgwebdir |
|
18 | > from mercurial.hgweb import hgweb, hgwebdir | |
19 | > from StringIO import StringIO |
|
19 | > from StringIO import StringIO | |
20 | > import os, sys |
|
20 | > import os, sys | |
21 | > |
|
21 | > | |
22 | > errors = StringIO() |
|
22 | > errors = StringIO() | |
23 | > input = StringIO() |
|
23 | > input = StringIO() | |
24 | > |
|
24 | > | |
25 | > def startrsp(status, headers): |
|
25 | > def startrsp(status, headers): | |
26 | > print '---- STATUS' |
|
26 | > print '---- STATUS' | |
27 | > print status |
|
27 | > print status | |
28 | > print '---- HEADERS' |
|
28 | > print '---- HEADERS' | |
29 | > print [i for i in headers if i[0] != 'ETag'] |
|
29 | > print [i for i in headers if i[0] != 'ETag'] | |
30 | > print '---- DATA' |
|
30 | > print '---- DATA' | |
31 | > return output.write |
|
31 | > return output.write | |
32 | > |
|
32 | > | |
33 | > env = { |
|
33 | > env = { | |
34 | > 'wsgi.version': (1, 0), |
|
34 | > 'wsgi.version': (1, 0), | |
35 | > 'wsgi.url_scheme': 'http', |
|
35 | > 'wsgi.url_scheme': 'http', | |
36 | > 'wsgi.errors': errors, |
|
36 | > 'wsgi.errors': errors, | |
37 | > 'wsgi.input': input, |
|
37 | > 'wsgi.input': input, | |
38 | > 'wsgi.multithread': False, |
|
38 | > 'wsgi.multithread': False, | |
39 | > 'wsgi.multiprocess': False, |
|
39 | > 'wsgi.multiprocess': False, | |
40 | > 'wsgi.run_once': False, |
|
40 | > 'wsgi.run_once': False, | |
41 | > 'REQUEST_METHOD': 'GET', |
|
41 | > 'REQUEST_METHOD': 'GET', | |
42 | > 'SCRIPT_NAME': '', |
|
42 | > 'SCRIPT_NAME': '', | |
43 | > 'SERVER_NAME': '127.0.0.1', |
|
43 | > 'SERVER_NAME': '127.0.0.1', | |
44 | > 'SERVER_PORT': os.environ['HGPORT'], |
|
44 | > 'SERVER_PORT': os.environ['HGPORT'], | |
45 | > 'SERVER_PROTOCOL': 'HTTP/1.0' |
|
45 | > 'SERVER_PROTOCOL': 'HTTP/1.0' | |
46 | > } |
|
46 | > } | |
47 | > |
|
47 | > | |
48 | > def process(app): |
|
48 | > def process(app): | |
49 | > content = app(env, startrsp) |
|
49 | > content = app(env, startrsp) | |
50 | > sys.stdout.write(output.getvalue()) |
|
50 | > sys.stdout.write(output.getvalue()) | |
51 | > sys.stdout.write(''.join(content)) |
|
51 | > sys.stdout.write(''.join(content)) | |
|
52 | > getattr(content, 'close', lambda : None)() | |||
52 | > print '---- ERRORS' |
|
53 | > print '---- ERRORS' | |
53 | > print errors.getvalue() |
|
54 | > print errors.getvalue() | |
54 | > |
|
55 | > | |
55 | > output = StringIO() |
|
56 | > output = StringIO() | |
56 | > env['PATH_INFO'] = '/' |
|
57 | > env['PATH_INFO'] = '/' | |
57 | > env['QUERY_STRING'] = 'style=atom' |
|
58 | > env['QUERY_STRING'] = 'style=atom' | |
58 | > process(hgweb('.', name = 'repo')) |
|
59 | > process(hgweb('.', name = 'repo')) | |
59 | > |
|
60 | > | |
60 | > output = StringIO() |
|
61 | > output = StringIO() | |
61 | > env['PATH_INFO'] = '/file/tip/' |
|
62 | > env['PATH_INFO'] = '/file/tip/' | |
62 | > env['QUERY_STRING'] = 'style=raw' |
|
63 | > env['QUERY_STRING'] = 'style=raw' | |
63 | > process(hgweb('.', name = 'repo')) |
|
64 | > process(hgweb('.', name = 'repo')) | |
64 | > |
|
65 | > | |
65 | > output = StringIO() |
|
66 | > output = StringIO() | |
66 | > env['PATH_INFO'] = '/' |
|
67 | > env['PATH_INFO'] = '/' | |
67 | > env['QUERY_STRING'] = 'style=raw' |
|
68 | > env['QUERY_STRING'] = 'style=raw' | |
68 | > process(hgwebdir({'repo': '.'})) |
|
69 | > process(hgwebdir({'repo': '.'})) | |
69 | > |
|
70 | > | |
70 | > output = StringIO() |
|
71 | > output = StringIO() | |
71 | > env['PATH_INFO'] = '/repo/file/tip/' |
|
72 | > env['PATH_INFO'] = '/repo/file/tip/' | |
72 | > env['QUERY_STRING'] = 'style=raw' |
|
73 | > env['QUERY_STRING'] = 'style=raw' | |
73 | > process(hgwebdir({'repo': '.'})) |
|
74 | > process(hgwebdir({'repo': '.'})) | |
74 | > EOF |
|
75 | > EOF | |
75 | $ python request.py |
|
76 | $ python request.py | |
76 | ---- STATUS |
|
77 | ---- STATUS | |
77 | 200 Script output follows |
|
78 | 200 Script output follows | |
78 | ---- HEADERS |
|
79 | ---- HEADERS | |
79 | [('Content-Type', 'application/atom+xml; charset=ascii')] |
|
80 | [('Content-Type', 'application/atom+xml; charset=ascii')] | |
80 | ---- DATA |
|
81 | ---- DATA | |
81 | <?xml version="1.0" encoding="ascii"?> |
|
82 | <?xml version="1.0" encoding="ascii"?> | |
82 | <feed xmlns="http://www.w3.org/2005/Atom"> |
|
83 | <feed xmlns="http://www.w3.org/2005/Atom"> | |
83 | <!-- Changelog --> |
|
84 | <!-- Changelog --> | |
84 | <id>http://127.0.0.1:$HGPORT/</id> |
|
85 | <id>http://127.0.0.1:$HGPORT/</id> | |
85 | <link rel="self" href="http://127.0.0.1:$HGPORT/atom-log"/> |
|
86 | <link rel="self" href="http://127.0.0.1:$HGPORT/atom-log"/> | |
86 | <link rel="alternate" href="http://127.0.0.1:$HGPORT/"/> |
|
87 | <link rel="alternate" href="http://127.0.0.1:$HGPORT/"/> | |
87 | <title>repo Changelog</title> |
|
88 | <title>repo Changelog</title> | |
88 | <updated>1970-01-01T00:00:00+00:00</updated> |
|
89 | <updated>1970-01-01T00:00:00+00:00</updated> | |
89 |
|
90 | |||
90 | <entry> |
|
91 | <entry> | |
91 | <title>test</title> |
|
92 | <title>test</title> | |
92 | <id>http://127.0.0.1:$HGPORT/#changeset-61c9426e69fef294feed5e2bbfc97d39944a5b1c</id> |
|
93 | <id>http://127.0.0.1:$HGPORT/#changeset-61c9426e69fef294feed5e2bbfc97d39944a5b1c</id> | |
93 | <link href="http://127.0.0.1:$HGPORT/rev/61c9426e69fe"/> |
|
94 | <link href="http://127.0.0.1:$HGPORT/rev/61c9426e69fe"/> | |
94 | <author> |
|
95 | <author> | |
95 | <name>test</name> |
|
96 | <name>test</name> | |
96 | <email>test</email> |
|
97 | <email>test</email> | |
97 | </author> |
|
98 | </author> | |
98 | <updated>1970-01-01T00:00:00+00:00</updated> |
|
99 | <updated>1970-01-01T00:00:00+00:00</updated> | |
99 | <published>1970-01-01T00:00:00+00:00</published> |
|
100 | <published>1970-01-01T00:00:00+00:00</published> | |
100 | <content type="xhtml"> |
|
101 | <content type="xhtml"> | |
101 | <div xmlns="http://www.w3.org/1999/xhtml"> |
|
102 | <div xmlns="http://www.w3.org/1999/xhtml"> | |
102 | <pre xml:space="preserve">test</pre> |
|
103 | <pre xml:space="preserve">test</pre> | |
103 | </div> |
|
104 | </div> | |
104 | </content> |
|
105 | </content> | |
105 | </entry> |
|
106 | </entry> | |
106 |
|
107 | |||
107 | </feed> |
|
108 | </feed> | |
108 | ---- ERRORS |
|
109 | ---- ERRORS | |
109 |
|
110 | |||
110 | ---- STATUS |
|
111 | ---- STATUS | |
111 | 200 Script output follows |
|
112 | 200 Script output follows | |
112 | ---- HEADERS |
|
113 | ---- HEADERS | |
113 | [('Content-Type', 'text/plain; charset=ascii')] |
|
114 | [('Content-Type', 'text/plain; charset=ascii')] | |
114 | ---- DATA |
|
115 | ---- DATA | |
115 |
|
116 | |||
116 | -rw-r--r-- 4 bar |
|
117 | -rw-r--r-- 4 bar | |
117 |
|
118 | |||
118 |
|
119 | |||
119 | ---- ERRORS |
|
120 | ---- ERRORS | |
120 |
|
121 | |||
121 | ---- STATUS |
|
122 | ---- STATUS | |
122 | 200 Script output follows |
|
123 | 200 Script output follows | |
123 | ---- HEADERS |
|
124 | ---- HEADERS | |
124 | [('Content-Type', 'text/plain; charset=ascii')] |
|
125 | [('Content-Type', 'text/plain; charset=ascii')] | |
125 | ---- DATA |
|
126 | ---- DATA | |
126 |
|
127 | |||
127 | /repo/ |
|
128 | /repo/ | |
128 |
|
129 | |||
129 | ---- ERRORS |
|
130 | ---- ERRORS | |
130 |
|
131 | |||
131 | ---- STATUS |
|
132 | ---- STATUS | |
132 | 200 Script output follows |
|
133 | 200 Script output follows | |
133 | ---- HEADERS |
|
134 | ---- HEADERS | |
134 | [('Content-Type', 'text/plain; charset=ascii')] |
|
135 | [('Content-Type', 'text/plain; charset=ascii')] | |
135 | ---- DATA |
|
136 | ---- DATA | |
136 |
|
137 | |||
137 | -rw-r--r-- 4 bar |
|
138 | -rw-r--r-- 4 bar | |
138 |
|
139 | |||
139 |
|
140 | |||
140 | ---- ERRORS |
|
141 | ---- ERRORS | |
141 |
|
142 | |||
142 |
|
143 | |||
143 | $ cd .. |
|
144 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now