##// END OF EJS Templates
Merge with crew
Matt Mackall -
r3437:d96429dd merge default
parent child Browse files
Show More
@@ -0,0 +1,109 b''
1 #!/bin/sh
2
3 do_push()
4 {
5 user=$1
6 shift
7
8 echo "Pushing as user $user"
9 echo 'hgrc = """'
10 sed -e 1,2d b/.hg/hgrc
11 echo '"""'
12 if [ -e acl.config ]; then
13 echo 'acl.config = """'
14 cat acl.config
15 echo '"""'
16 fi
17 LOGNAME=$user hg --cwd a --debug push ../b
18 hg --cwd b rollback
19 hg --cwd b --quiet tip
20 echo
21 }
22
23 hg init a
24 cd a
25 mkdir foo foo/Bar quux
26 echo 'in foo' > foo/file.txt
27 echo 'in foo/Bar' > foo/Bar/file.txt
28 echo 'in quux' > quux/file.py
29 hg add
30 hg ci -m 'add files' -d '1000000 0'
31 echo >> foo/file.txt
32 hg ci -m 'change foo/file' -d '1000001 0'
33 echo >> foo/Bar/file.txt
34 hg ci -m 'change foo/Bar/file' -d '1000002 0'
35 echo >> quux/file.py
36 hg ci -m 'change quux/file' -d '1000003 0'
37 hg tip --quiet
38
39 cd ..
40 hg clone -r 0 a b
41
42 echo '[extensions]' >> $HGRCPATH
43 echo 'hgext.acl =' >> $HGRCPATH
44
45 config=b/.hg/hgrc
46
47 echo
48
49 echo 'Extension disabled for lack of a hook'
50 do_push fred
51
52 echo '[hooks]' >> $config
53 echo 'pretxnchangegroup.acl = python:hgext.acl.hook' >> $config
54
55 echo 'Extension disabled for lack of acl.sources'
56 do_push fred
57
58 echo 'No [acl.allow]/[acl.deny]'
59 echo '[acl]' >> $config
60 echo 'sources = push' >> $config
61 do_push fred
62
63 echo 'Empty [acl.allow]'
64 echo '[acl.allow]' >> $config
65 do_push fred
66
67 echo 'fred is allowed inside foo/'
68 echo 'foo/** = fred' >> $config
69 do_push fred
70
71 echo 'Empty [acl.deny]'
72 echo '[acl.deny]' >> $config
73 do_push barney
74
75 echo 'fred is allowed inside foo/, but not foo/bar/ (case matters)'
76 echo 'foo/bar/** = fred' >> $config
77 do_push fred
78
79 echo 'fred is allowed inside foo/, but not foo/Bar/'
80 echo 'foo/Bar/** = fred' >> $config
81 do_push fred
82
83 echo 'barney is not mentioned => not allowed anywhere'
84 do_push barney
85
86 echo 'barney is allowed everywhere'
87 echo '[acl.allow]' >> $config
88 echo '** = barney' >> $config
89 do_push barney
90
91 echo 'wilma can change files with a .txt extension'
92 echo '**/*.txt = wilma' >> $config
93 do_push wilma
94
95 echo 'file specified by acl.config does not exist'
96 echo '[acl]' >> $config
97 echo 'config = ../acl.config' >> $config
98 do_push barney
99
100 echo 'betty is allowed inside foo/ by a acl.config file'
101 echo '[acl.allow]' >> acl.config
102 echo 'foo/** = betty' >> acl.config
103 do_push betty
104
105 echo 'acl.config can set only [acl.allow]/[acl.deny]'
106 echo '[hooks]' >> acl.config
107 echo 'changegroup.acl = false' >> acl.config
108 do_push barney
109
This diff has been collapsed as it changes many lines, (517 lines changed) Show them Hide them
@@ -0,0 +1,517 b''
1 adding foo/Bar/file.txt
2 adding foo/file.txt
3 adding quux/file.py
4 3:911600dab2ae
5 requesting all changes
6 adding changesets
7 adding manifests
8 adding file changes
9 added 1 changesets with 3 changes to 3 files
10 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
11
12 Extension disabled for lack of a hook
13 Pushing as user fred
14 hgrc = """
15 """
16 pushing to ../b
17 searching for changes
18 common changesets up to 6675d58eff77
19 adding changesets
20 add changeset ef1ea85a6374
21 add changeset f9cafe1212c8
22 add changeset 911600dab2ae
23 adding manifests
24 adding file changes
25 adding foo/Bar/file.txt revisions
26 adding foo/file.txt revisions
27 adding quux/file.py revisions
28 added 3 changesets with 3 changes to 3 files
29 rolling back last transaction
30 0:6675d58eff77
31
32 Extension disabled for lack of acl.sources
33 Pushing as user fred
34 hgrc = """
35 [hooks]
36 pretxnchangegroup.acl = python:hgext.acl.hook
37 """
38 pushing to ../b
39 searching for changes
40 common changesets up to 6675d58eff77
41 adding changesets
42 add changeset ef1ea85a6374
43 add changeset f9cafe1212c8
44 add changeset 911600dab2ae
45 adding manifests
46 adding file changes
47 adding foo/Bar/file.txt revisions
48 adding foo/file.txt revisions
49 adding quux/file.py revisions
50 added 3 changesets with 3 changes to 3 files
51 calling hook pretxnchangegroup.acl: hgext.acl.hook
52 acl: acl.allow not enabled
53 acl: acl.deny not enabled
54 acl: changes have source "push" - skipping
55 rolling back last transaction
56 0:6675d58eff77
57
58 No [acl.allow]/[acl.deny]
59 Pushing as user fred
60 hgrc = """
61 [hooks]
62 pretxnchangegroup.acl = python:hgext.acl.hook
63 [acl]
64 sources = push
65 """
66 pushing to ../b
67 searching for changes
68 common changesets up to 6675d58eff77
69 adding changesets
70 add changeset ef1ea85a6374
71 add changeset f9cafe1212c8
72 add changeset 911600dab2ae
73 adding manifests
74 adding file changes
75 adding foo/Bar/file.txt revisions
76 adding foo/file.txt revisions
77 adding quux/file.py revisions
78 added 3 changesets with 3 changes to 3 files
79 calling hook pretxnchangegroup.acl: hgext.acl.hook
80 acl: acl.allow not enabled
81 acl: acl.deny not enabled
82 acl: allowing changeset ef1ea85a6374
83 acl: allowing changeset f9cafe1212c8
84 acl: allowing changeset 911600dab2ae
85 rolling back last transaction
86 0:6675d58eff77
87
88 Empty [acl.allow]
89 Pushing as user fred
90 hgrc = """
91 [hooks]
92 pretxnchangegroup.acl = python:hgext.acl.hook
93 [acl]
94 sources = push
95 [acl.allow]
96 """
97 pushing to ../b
98 searching for changes
99 common changesets up to 6675d58eff77
100 adding changesets
101 add changeset ef1ea85a6374
102 add changeset f9cafe1212c8
103 add changeset 911600dab2ae
104 adding manifests
105 adding file changes
106 adding foo/Bar/file.txt revisions
107 adding foo/file.txt revisions
108 adding quux/file.py revisions
109 added 3 changesets with 3 changes to 3 files
110 calling hook pretxnchangegroup.acl: hgext.acl.hook
111 acl: acl.allow enabled, 0 entries for user fred
112 acl: acl.deny not enabled
113 acl: user fred not allowed on foo/file.txt
114 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
115 abort: acl: access denied for changeset ef1ea85a6374
116 transaction abort!
117 rollback completed
118 no rollback information available
119 0:6675d58eff77
120
121 fred is allowed inside foo/
122 Pushing as user fred
123 hgrc = """
124 [hooks]
125 pretxnchangegroup.acl = python:hgext.acl.hook
126 [acl]
127 sources = push
128 [acl.allow]
129 foo/** = fred
130 """
131 pushing to ../b
132 searching for changes
133 common changesets up to 6675d58eff77
134 adding changesets
135 add changeset ef1ea85a6374
136 add changeset f9cafe1212c8
137 add changeset 911600dab2ae
138 adding manifests
139 adding file changes
140 adding foo/Bar/file.txt revisions
141 adding foo/file.txt revisions
142 adding quux/file.py revisions
143 added 3 changesets with 3 changes to 3 files
144 calling hook pretxnchangegroup.acl: hgext.acl.hook
145 acl: acl.allow enabled, 1 entries for user fred
146 acl: acl.deny not enabled
147 acl: allowing changeset ef1ea85a6374
148 acl: allowing changeset f9cafe1212c8
149 acl: user fred not allowed on quux/file.py
150 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
151 abort: acl: access denied for changeset 911600dab2ae
152 transaction abort!
153 rollback completed
154 no rollback information available
155 0:6675d58eff77
156
157 Empty [acl.deny]
158 Pushing as user barney
159 hgrc = """
160 [hooks]
161 pretxnchangegroup.acl = python:hgext.acl.hook
162 [acl]
163 sources = push
164 [acl.allow]
165 foo/** = fred
166 [acl.deny]
167 """
168 pushing to ../b
169 searching for changes
170 common changesets up to 6675d58eff77
171 adding changesets
172 add changeset ef1ea85a6374
173 add changeset f9cafe1212c8
174 add changeset 911600dab2ae
175 adding manifests
176 adding file changes
177 adding foo/Bar/file.txt revisions
178 adding foo/file.txt revisions
179 adding quux/file.py revisions
180 added 3 changesets with 3 changes to 3 files
181 calling hook pretxnchangegroup.acl: hgext.acl.hook
182 acl: acl.allow enabled, 0 entries for user barney
183 acl: acl.deny enabled, 0 entries for user barney
184 acl: user barney not allowed on foo/file.txt
185 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
186 abort: acl: access denied for changeset ef1ea85a6374
187 transaction abort!
188 rollback completed
189 no rollback information available
190 0:6675d58eff77
191
192 fred is allowed inside foo/, but not foo/bar/ (case matters)
193 Pushing as user fred
194 hgrc = """
195 [hooks]
196 pretxnchangegroup.acl = python:hgext.acl.hook
197 [acl]
198 sources = push
199 [acl.allow]
200 foo/** = fred
201 [acl.deny]
202 foo/bar/** = fred
203 """
204 pushing to ../b
205 searching for changes
206 common changesets up to 6675d58eff77
207 adding changesets
208 add changeset ef1ea85a6374
209 add changeset f9cafe1212c8
210 add changeset 911600dab2ae
211 adding manifests
212 adding file changes
213 adding foo/Bar/file.txt revisions
214 adding foo/file.txt revisions
215 adding quux/file.py revisions
216 added 3 changesets with 3 changes to 3 files
217 calling hook pretxnchangegroup.acl: hgext.acl.hook
218 acl: acl.allow enabled, 1 entries for user fred
219 acl: acl.deny enabled, 1 entries for user fred
220 acl: allowing changeset ef1ea85a6374
221 acl: allowing changeset f9cafe1212c8
222 acl: user fred not allowed on quux/file.py
223 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
224 abort: acl: access denied for changeset 911600dab2ae
225 transaction abort!
226 rollback completed
227 no rollback information available
228 0:6675d58eff77
229
230 fred is allowed inside foo/, but not foo/Bar/
231 Pushing as user fred
232 hgrc = """
233 [hooks]
234 pretxnchangegroup.acl = python:hgext.acl.hook
235 [acl]
236 sources = push
237 [acl.allow]
238 foo/** = fred
239 [acl.deny]
240 foo/bar/** = fred
241 foo/Bar/** = fred
242 """
243 pushing to ../b
244 searching for changes
245 common changesets up to 6675d58eff77
246 adding changesets
247 add changeset ef1ea85a6374
248 add changeset f9cafe1212c8
249 add changeset 911600dab2ae
250 adding manifests
251 adding file changes
252 adding foo/Bar/file.txt revisions
253 adding foo/file.txt revisions
254 adding quux/file.py revisions
255 added 3 changesets with 3 changes to 3 files
256 calling hook pretxnchangegroup.acl: hgext.acl.hook
257 acl: acl.allow enabled, 1 entries for user fred
258 acl: acl.deny enabled, 2 entries for user fred
259 acl: allowing changeset ef1ea85a6374
260 acl: user fred denied on foo/Bar/file.txt
261 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset f9cafe1212c8
262 abort: acl: access denied for changeset f9cafe1212c8
263 transaction abort!
264 rollback completed
265 no rollback information available
266 0:6675d58eff77
267
268 barney is not mentioned => not allowed anywhere
269 Pushing as user barney
270 hgrc = """
271 [hooks]
272 pretxnchangegroup.acl = python:hgext.acl.hook
273 [acl]
274 sources = push
275 [acl.allow]
276 foo/** = fred
277 [acl.deny]
278 foo/bar/** = fred
279 foo/Bar/** = fred
280 """
281 pushing to ../b
282 searching for changes
283 common changesets up to 6675d58eff77
284 adding changesets
285 add changeset ef1ea85a6374
286 add changeset f9cafe1212c8
287 add changeset 911600dab2ae
288 adding manifests
289 adding file changes
290 adding foo/Bar/file.txt revisions
291 adding foo/file.txt revisions
292 adding quux/file.py revisions
293 added 3 changesets with 3 changes to 3 files
294 calling hook pretxnchangegroup.acl: hgext.acl.hook
295 acl: acl.allow enabled, 0 entries for user barney
296 acl: acl.deny enabled, 0 entries for user barney
297 acl: user barney not allowed on foo/file.txt
298 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
299 abort: acl: access denied for changeset ef1ea85a6374
300 transaction abort!
301 rollback completed
302 no rollback information available
303 0:6675d58eff77
304
305 barney is allowed everywhere
306 Pushing as user barney
307 hgrc = """
308 [hooks]
309 pretxnchangegroup.acl = python:hgext.acl.hook
310 [acl]
311 sources = push
312 [acl.allow]
313 foo/** = fred
314 [acl.deny]
315 foo/bar/** = fred
316 foo/Bar/** = fred
317 [acl.allow]
318 ** = barney
319 """
320 pushing to ../b
321 searching for changes
322 common changesets up to 6675d58eff77
323 adding changesets
324 add changeset ef1ea85a6374
325 add changeset f9cafe1212c8
326 add changeset 911600dab2ae
327 adding manifests
328 adding file changes
329 adding foo/Bar/file.txt revisions
330 adding foo/file.txt revisions
331 adding quux/file.py revisions
332 added 3 changesets with 3 changes to 3 files
333 calling hook pretxnchangegroup.acl: hgext.acl.hook
334 acl: acl.allow enabled, 1 entries for user barney
335 acl: acl.deny enabled, 0 entries for user barney
336 acl: allowing changeset ef1ea85a6374
337 acl: allowing changeset f9cafe1212c8
338 acl: allowing changeset 911600dab2ae
339 rolling back last transaction
340 0:6675d58eff77
341
342 wilma can change files with a .txt extension
343 Pushing as user wilma
344 hgrc = """
345 [hooks]
346 pretxnchangegroup.acl = python:hgext.acl.hook
347 [acl]
348 sources = push
349 [acl.allow]
350 foo/** = fred
351 [acl.deny]
352 foo/bar/** = fred
353 foo/Bar/** = fred
354 [acl.allow]
355 ** = barney
356 **/*.txt = wilma
357 """
358 pushing to ../b
359 searching for changes
360 common changesets up to 6675d58eff77
361 adding changesets
362 add changeset ef1ea85a6374
363 add changeset f9cafe1212c8
364 add changeset 911600dab2ae
365 adding manifests
366 adding file changes
367 adding foo/Bar/file.txt revisions
368 adding foo/file.txt revisions
369 adding quux/file.py revisions
370 added 3 changesets with 3 changes to 3 files
371 calling hook pretxnchangegroup.acl: hgext.acl.hook
372 acl: acl.allow enabled, 1 entries for user wilma
373 acl: acl.deny enabled, 0 entries for user wilma
374 acl: allowing changeset ef1ea85a6374
375 acl: allowing changeset f9cafe1212c8
376 acl: user wilma not allowed on quux/file.py
377 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
378 abort: acl: access denied for changeset 911600dab2ae
379 transaction abort!
380 rollback completed
381 no rollback information available
382 0:6675d58eff77
383
384 file specified by acl.config does not exist
385 Pushing as user barney
386 hgrc = """
387 [hooks]
388 pretxnchangegroup.acl = python:hgext.acl.hook
389 [acl]
390 sources = push
391 [acl.allow]
392 foo/** = fred
393 [acl.deny]
394 foo/bar/** = fred
395 foo/Bar/** = fred
396 [acl.allow]
397 ** = barney
398 **/*.txt = wilma
399 [acl]
400 config = ../acl.config
401 """
402 pushing to ../b
403 searching for changes
404 common changesets up to 6675d58eff77
405 adding changesets
406 add changeset ef1ea85a6374
407 add changeset f9cafe1212c8
408 add changeset 911600dab2ae
409 adding manifests
410 adding file changes
411 adding foo/Bar/file.txt revisions
412 adding foo/file.txt revisions
413 adding quux/file.py revisions
414 added 3 changesets with 3 changes to 3 files
415 calling hook pretxnchangegroup.acl: hgext.acl.hook
416 acl: acl.allow enabled, 1 entries for user barney
417 acl: acl.deny enabled, 0 entries for user barney
418 acl: allowing changeset ef1ea85a6374
419 acl: allowing changeset f9cafe1212c8
420 acl: allowing changeset 911600dab2ae
421 rolling back last transaction
422 0:6675d58eff77
423
424 betty is allowed inside foo/ by a acl.config file
425 Pushing as user betty
426 hgrc = """
427 [hooks]
428 pretxnchangegroup.acl = python:hgext.acl.hook
429 [acl]
430 sources = push
431 [acl.allow]
432 foo/** = fred
433 [acl.deny]
434 foo/bar/** = fred
435 foo/Bar/** = fred
436 [acl.allow]
437 ** = barney
438 **/*.txt = wilma
439 [acl]
440 config = ../acl.config
441 """
442 acl.config = """
443 [acl.allow]
444 foo/** = betty
445 """
446 pushing to ../b
447 searching for changes
448 common changesets up to 6675d58eff77
449 adding changesets
450 add changeset ef1ea85a6374
451 add changeset f9cafe1212c8
452 add changeset 911600dab2ae
453 adding manifests
454 adding file changes
455 adding foo/Bar/file.txt revisions
456 adding foo/file.txt revisions
457 adding quux/file.py revisions
458 added 3 changesets with 3 changes to 3 files
459 calling hook pretxnchangegroup.acl: hgext.acl.hook
460 acl: acl.allow enabled, 1 entries for user betty
461 acl: acl.deny enabled, 0 entries for user betty
462 acl: allowing changeset ef1ea85a6374
463 acl: allowing changeset f9cafe1212c8
464 acl: user betty not allowed on quux/file.py
465 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
466 abort: acl: access denied for changeset 911600dab2ae
467 transaction abort!
468 rollback completed
469 no rollback information available
470 0:6675d58eff77
471
472 acl.config can set only [acl.allow]/[acl.deny]
473 Pushing as user barney
474 hgrc = """
475 [hooks]
476 pretxnchangegroup.acl = python:hgext.acl.hook
477 [acl]
478 sources = push
479 [acl.allow]
480 foo/** = fred
481 [acl.deny]
482 foo/bar/** = fred
483 foo/Bar/** = fred
484 [acl.allow]
485 ** = barney
486 **/*.txt = wilma
487 [acl]
488 config = ../acl.config
489 """
490 acl.config = """
491 [acl.allow]
492 foo/** = betty
493 [hooks]
494 changegroup.acl = false
495 """
496 pushing to ../b
497 searching for changes
498 common changesets up to 6675d58eff77
499 adding changesets
500 add changeset ef1ea85a6374
501 add changeset f9cafe1212c8
502 add changeset 911600dab2ae
503 adding manifests
504 adding file changes
505 adding foo/Bar/file.txt revisions
506 adding foo/file.txt revisions
507 adding quux/file.py revisions
508 added 3 changesets with 3 changes to 3 files
509 calling hook pretxnchangegroup.acl: hgext.acl.hook
510 acl: acl.allow enabled, 1 entries for user barney
511 acl: acl.deny enabled, 0 entries for user barney
512 acl: allowing changeset ef1ea85a6374
513 acl: allowing changeset f9cafe1212c8
514 acl: allowing changeset 911600dab2ae
515 rolling back last transaction
516 0:6675d58eff77
517
@@ -0,0 +1,7 b''
1 #!/bin/sh
2
3 echo '[Section]' >> $HGRCPATH
4 echo 'KeY = Case Sensitive' >> $HGRCPATH
5 echo 'key = lower case' >> $HGRCPATH
6
7 hg showconfig
@@ -0,0 +1,2 b''
1 Section.KeY=Case Sensitive
2 Section.key=lower case
@@ -2,7 +2,7 b' include hg'
2 recursive-include mercurial *.py
2 recursive-include mercurial *.py
3 include hgweb.cgi hgwebdir.cgi
3 include hgweb.cgi hgwebdir.cgi
4 include hgeditor rewrite-log
4 include hgeditor rewrite-log
5 include tests/README tests/*.py tests/test-*[a-z0-9] tests/*.out
5 include tests/README tests/*.py tests/test-*[a-z0-9] tests/*.out tests/*.bin
6 prune tests/*.err
6 prune tests/*.err
7 include *.txt
7 include *.txt
8 include doc/README doc/Makefile doc/gendoc.py doc/*.txt doc/*.html doc/*.[0-9]
8 include doc/README doc/Makefile doc/gendoc.py doc/*.txt doc/*.html doc/*.[0-9]
@@ -25,7 +25,7 b''
25 <p class="p2"><br></p>
25 <p class="p2"><br></p>
26 <p class="p1"><b>After you install</b></p>
26 <p class="p1"><b>After you install</b></p>
27 <p class="p2"><br></p>
27 <p class="p2"><br></p>
28 <p class="p3">This package installs the <span class="s2">hg</span> executable in <span class="s2">/usr/local/bin</span>. This directory may not be in your shell's search path. Don't forget to check.</p>
28 <p class="p3">This package installs the <span class="s2">hg</span> executable in <span class="s2">/Library/Frameworks/Python.framework/Versions/Current/bin</span>. This directory may not be in your shell's search path. The MacPython installer will have created an entry in <span class="s2">.profile</span> for it but if your shell doesn't use <span class="s2">.profile</span> you'll need configure it yourself or create a symlink from a directory already in your path.</p>
29 <p class="p2"><br></p>
29 <p class="p2"><br></p>
30 <p class="p1"><b>Reporting problems</b></p>
30 <p class="p1"><b>Reporting problems</b></p>
31 <p class="p2"><br></p>
31 <p class="p2"><br></p>
@@ -46,7 +46,7 b' hg'
46 other Mercurial commands should work fine for you.</p>
46 other Mercurial commands should work fine for you.</p>
47
47
48 <h1>Configuration notes</h1>
48 <h1>Configuration notes</h1>
49 <p>The default editor for commit messages is 'vi'. You can set the EDITOR
49 <p>The default editor for commit messages is 'notepad'. You can set the EDITOR
50 (or HGEDITOR) environment variable to specify your preference or set it in
50 (or HGEDITOR) environment variable to specify your preference or set it in
51 mercurial.ini:</p>
51 mercurial.ini:</p>
52 <pre>
52 <pre>
@@ -3,6 +3,9 b''
3 ; USERNAME is your Windows user name:
3 ; USERNAME is your Windows user name:
4 ; C:\Documents and Settings\USERNAME\Mercurial.ini
4 ; C:\Documents and Settings\USERNAME\Mercurial.ini
5
5
6 [ui]
7 editor = notepad
8
6 ; By default, we try to encode and decode all files that do not
9 ; By default, we try to encode and decode all files that do not
7 ; contain ASCII NUL characters. What this means is that we try to set
10 ; contain ASCII NUL characters. What this means is that we try to set
8 ; line endings to Windows style on update, and to Unix style on
11 ; line endings to Windows style on update, and to Unix style on
@@ -80,7 +80,7 b' class checker(object):'
80 self.user = getpass.getuser()
80 self.user = getpass.getuser()
81 cfg = self.ui.config('acl', 'config')
81 cfg = self.ui.config('acl', 'config')
82 if cfg:
82 if cfg:
83 self.ui.readconfig(cfg)
83 self.ui.readsections(cfg, 'acl.allow', 'acl.deny')
84 self.allow, self.allowable = self.buildmatch('acl.allow')
84 self.allow, self.allowable = self.buildmatch('acl.allow')
85 self.deny, self.deniable = self.buildmatch('acl.deny')
85 self.deny, self.deniable = self.buildmatch('acl.deny')
86
86
@@ -74,7 +74,7 b' class bugzilla_2_16(object):'
74 timeout = int(self.ui.config('bugzilla', 'timeout', 5))
74 timeout = int(self.ui.config('bugzilla', 'timeout', 5))
75 usermap = self.ui.config('bugzilla', 'usermap')
75 usermap = self.ui.config('bugzilla', 'usermap')
76 if usermap:
76 if usermap:
77 self.ui.readconfig(usermap)
77 self.ui.readsections(usermap, 'usermap')
78 self.ui.note(_('connecting to %s:%s as %s, password %s\n') %
78 self.ui.note(_('connecting to %s:%s as %s, password %s\n') %
79 (host, db, user, '*' * len(passwd)))
79 (host, db, user, '*' * len(passwd)))
80 self.conn = MySQLdb.connect(host=host, user=user, passwd=passwd,
80 self.conn = MySQLdb.connect(host=host, user=user, passwd=passwd,
@@ -102,7 +102,7 b' class notifier(object):'
102 self.ui = ui
102 self.ui = ui
103 cfg = self.ui.config('notify', 'config')
103 cfg = self.ui.config('notify', 'config')
104 if cfg:
104 if cfg:
105 self.ui.readconfig(cfg)
105 self.ui.readsections(cfg, 'usersubs', 'reposubs')
106 self.repo = repo
106 self.repo = repo
107 self.stripcount = int(self.ui.config('notify', 'strip', 0))
107 self.stripcount = int(self.ui.config('notify', 'strip', 0))
108 self.root = self.strip(self.repo.root)
108 self.root = self.strip(self.repo.root)
@@ -233,10 +233,12 b' class bundlerepository(localrepo.localre'
233 self.bundlefile.close()
233 self.bundlefile.close()
234
234
235 def __del__(self):
235 def __del__(self):
236 if not self.bundlefile.closed:
236 bundlefile = getattr(self, 'bundlefile', None)
237 self.bundlefile.close()
237 if bundlefile and not bundlefile.closed:
238 if self.tempfile is not None:
238 bundlefile.close()
239 os.unlink(self.tempfile)
239 tempfile = getattr(self, 'tempfile', None)
240 if tempfile is not None:
241 os.unlink(tempfile)
240
242
241 def instance(ui, path, create):
243 def instance(ui, path, create):
242 if create:
244 if create:
@@ -28,7 +28,7 b' def _up(p):'
28 return "/"
28 return "/"
29 return up + "/"
29 return up + "/"
30
30
31 def revnavgen(pos, pagelen, limit):
31 def revnavgen(pos, pagelen, limit, nodefunc):
32 def seq(factor, limit=None):
32 def seq(factor, limit=None):
33 if limit:
33 if limit:
34 yield limit
34 yield limit
@@ -50,16 +50,19 b' def revnavgen(pos, pagelen, limit):'
50 break
50 break
51 last = f
51 last = f
52 if pos + f < limit:
52 if pos + f < limit:
53 l.append(("+%d" % f, pos + f))
53 l.append(("+%d" % f, hex(nodefunc(pos + f).node())))
54 if pos - f >= 0:
54 if pos - f >= 0:
55 l.insert(0, ("-%d" % f, pos - f))
55 l.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node())))
56
57 try:
58 yield {"label": "(0)", "node": hex(nodefunc('0').node())}
56
59
57 yield {"label": "(0)", "rev": 0}
60 for label, node in l:
61 yield {"label": label, "node": node}
58
62
59 for label, rev in l:
63 yield {"label": "tip", "node": "tip"}
60 yield {"label": label, "rev": rev}
64 except hg.RepoError:
61
65 pass
62 yield {"label": "tip", "rev": "tip"}
63
66
64 return nav
67 return nav
65
68
@@ -215,7 +218,7 b' class hgweb(object):'
215 end = min(count, start + maxchanges)
218 end = min(count, start + maxchanges)
216 pos = end - 1
219 pos = end - 1
217
220
218 changenav = revnavgen(pos, maxchanges, count)
221 changenav = revnavgen(pos, maxchanges, count, self.repo.changectx)
219
222
220 yield self.t(shortlog and 'shortlog' or 'changelog',
223 yield self.t(shortlog and 'shortlog' or 'changelog',
221 changenav=changenav,
224 changenav=changenav,
@@ -338,7 +341,8 b' class hgweb(object):'
338 for e in l:
341 for e in l:
339 yield e
342 yield e
340
343
341 nav = revnavgen(pos, pagelen, count)
344 nodefunc = lambda x: fctx.filectx(fileid=x)
345 nav = revnavgen(pos, pagelen, count, nodefunc)
342 yield self.t("filelog", file=f, node=hex(fctx.node()), nav=nav,
346 yield self.t("filelog", file=f, node=hex(fctx.node()), nav=nav,
343 entries=entries)
347 entries=entries)
344
348
@@ -743,13 +747,9 b' class hgweb(object):'
743 style = req.form['style'][0]
747 style = req.form['style'][0]
744 mapfile = style_map(self.templatepath, style)
748 mapfile = style_map(self.templatepath, style)
745
749
746 if not req.url:
750 port = req.env["SERVER_PORT"]
747 port = req.env["SERVER_PORT"]
751 port = port != "80" and (":" + port) or ""
748 port = port != "80" and (":" + port) or ""
752 urlbase = 'http://%s%s' % (req.env['SERVER_NAME'], port)
749 uri = req.env["REQUEST_URI"]
750 if "?" in uri:
751 uri = uri.split("?")[0]
752 req.url = "http://%s%s%s" % (req.env["SERVER_NAME"], port, uri)
753
753
754 if not self.reponame:
754 if not self.reponame:
755 self.reponame = (self.repo.ui.config("web", "name")
755 self.reponame = (self.repo.ui.config("web", "name")
@@ -758,6 +758,7 b' class hgweb(object):'
758
758
759 self.t = templater.templater(mapfile, templater.common_filters,
759 self.t = templater.templater(mapfile, templater.common_filters,
760 defaults={"url": req.url,
760 defaults={"url": req.url,
761 "urlbase": urlbase,
761 "repo": self.reponame,
762 "repo": self.reponame,
762 "header": header,
763 "header": header,
763 "footer": footer,
764 "footer": footer,
@@ -8,7 +8,7 b''
8
8
9 import os
9 import os
10 from mercurial.demandload import demandload
10 from mercurial.demandload import demandload
11 demandload(globals(), "ConfigParser mimetools cStringIO")
11 demandload(globals(), "mimetools cStringIO")
12 demandload(globals(), "mercurial:ui,hg,util,templater")
12 demandload(globals(), "mercurial:ui,hg,util,templater")
13 demandload(globals(), "mercurial.hgweb.hgweb_mod:hgweb")
13 demandload(globals(), "mercurial.hgweb.hgweb_mod:hgweb")
14 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile,style_map")
14 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile,style_map")
@@ -30,7 +30,7 b' class hgwebdir(object):'
30 self.repos = cleannames(config.items())
30 self.repos = cleannames(config.items())
31 self.repos.sort()
31 self.repos.sort()
32 else:
32 else:
33 cp = ConfigParser.SafeConfigParser()
33 cp = util.configparser()
34 cp.read(config)
34 cp.read(config)
35 self.repos = []
35 self.repos = []
36 if cp.has_section('web'):
36 if cp.has_section('web'):
@@ -11,12 +11,14 b' demandload(globals(), "errno getpass os '
11 demandload(globals(), "ConfigParser traceback util")
11 demandload(globals(), "ConfigParser traceback util")
12
12
13 def dupconfig(orig):
13 def dupconfig(orig):
14 new = ConfigParser.SafeConfigParser(orig.defaults())
14 new = util.configparser(orig.defaults())
15 updateconfig(orig, new)
15 updateconfig(orig, new)
16 return new
16 return new
17
17
18 def updateconfig(source, dest):
18 def updateconfig(source, dest, sections=None):
19 for section in source.sections():
19 if not sections:
20 sections = source.sections()
21 for section in sections:
20 if not dest.has_section(section):
22 if not dest.has_section(section):
21 dest.add_section(section)
23 dest.add_section(section)
22 for name, value in source.items(section, raw=True):
24 for name, value in source.items(section, raw=True):
@@ -37,7 +39,7 b' class ui(object):'
37 self.debugflag = debug
39 self.debugflag = debug
38 self.interactive = interactive
40 self.interactive = interactive
39 self.traceback = traceback
41 self.traceback = traceback
40 self.cdata = ConfigParser.SafeConfigParser()
42 self.cdata = util.configparser()
41 self.readconfig(util.rcpath())
43 self.readconfig(util.rcpath())
42 self.updateopts(verbose, debug, quiet, interactive)
44 self.updateopts(verbose, debug, quiet, interactive)
43 else:
45 else:
@@ -100,6 +102,23 b' class ui(object):'
100 def addreadhook(self, hook):
102 def addreadhook(self, hook):
101 self.readhooks.append(hook)
103 self.readhooks.append(hook)
102
104
105 def readsections(self, filename, *sections):
106 "read filename and add only the specified sections to the config data"
107 if not sections:
108 return
109
110 cdata = util.configparser()
111 try:
112 cdata.read(filename)
113 except ConfigParser.ParsingError, inst:
114 raise util.Abort(_("failed to parse %s\n%s") % (f, inst))
115
116 for section in sections:
117 if not cdata.has_section(section):
118 cdata.add_section(section)
119
120 updateconfig(cdata, self.cdata, sections)
121
103 def fixconfig(self, section=None, name=None, value=None, root=None):
122 def fixconfig(self, section=None, name=None, value=None, root=None):
104 # translate paths relative to root (or home) into absolute paths
123 # translate paths relative to root (or home) into absolute paths
105 if section is None or section == 'paths':
124 if section is None or section == 'paths':
@@ -126,7 +145,7 b' class ui(object):'
126
145
127 def setconfig(self, section, name, value):
146 def setconfig(self, section, name, value):
128 if not self.overlay:
147 if not self.overlay:
129 self.overlay = ConfigParser.SafeConfigParser()
148 self.overlay = util.configparser()
130 for cdata in (self.overlay, self.cdata):
149 for cdata in (self.overlay, self.cdata):
131 if not cdata.has_section(section):
150 if not cdata.has_section(section):
132 cdata.add_section(section)
151 cdata.add_section(section)
@@ -15,7 +15,7 b' platform-specific details from the core.'
15 from i18n import gettext as _
15 from i18n import gettext as _
16 from demandload import *
16 from demandload import *
17 demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile")
17 demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile")
18 demandload(globals(), "os threading time calendar")
18 demandload(globals(), "os threading time calendar ConfigParser")
19
19
20 # used by parsedate
20 # used by parsedate
21 defaultdateformats = ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M',
21 defaultdateformats = ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M',
@@ -24,6 +24,11 b" defaultdateformats = ('%Y-%m-%d %H:%M:%S"
24 class SignalInterrupt(Exception):
24 class SignalInterrupt(Exception):
25 """Exception raised on SIGTERM and SIGHUP."""
25 """Exception raised on SIGTERM and SIGHUP."""
26
26
27 # like SafeConfigParser but with case-sensitive keys
28 class configparser(ConfigParser.SafeConfigParser):
29 def optionxform(self, optionstr):
30 return optionstr
31
27 def cachefunc(func):
32 def cachefunc(func):
28 '''cache the result of function calls'''
33 '''cache the result of function calls'''
29 # XXX doesn't handle keywords args
34 # XXX doesn't handle keywords args
@@ -5,9 +5,9 b' search = search.tmpl'
5 changelog = changelog.tmpl
5 changelog = changelog.tmpl
6 summary = summary.tmpl
6 summary = summary.tmpl
7 error = error.tmpl
7 error = error.tmpl
8 naventry = '<a href="#url#log/#rev#{sessionvars%urlparameter}">#label|escape#</a> '
8 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
9 navshortentry = '<a href="#url#shortlog/#rev#{sessionvars%urlparameter}">#label|escape#</a> '
9 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
10 filenaventry = '<a href="{url}log/{rev}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
10 filenaventry = '<a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
11 filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
11 filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
12 filenodelink = '<tr class="parity#parity#"><td><a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">#file|escape#</a></td><td></td><td class="link"><a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">file</a> | <a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}">annotate</a> | <a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">diff</a> | <a href="#url#log/#node|short#/#file|urlescape#{sessionvars%urlparameter}">revisions</a></td></tr>'
12 filenodelink = '<tr class="parity#parity#"><td><a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">#file|escape#</a></td><td></td><td class="link"><a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">file</a> | <a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}">annotate</a> | <a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">diff</a> | <a href="#url#log/#node|short#/#file|urlescape#{sessionvars%urlparameter}">revisions</a></td></tr>'
13 fileellipses = '...'
13 fileellipses = '...'
@@ -5,9 +5,9 b' search = search.tmpl'
5 changelog = changelog.tmpl
5 changelog = changelog.tmpl
6 shortlog = shortlog.tmpl
6 shortlog = shortlog.tmpl
7 shortlogentry = shortlogentry.tmpl
7 shortlogentry = shortlogentry.tmpl
8 naventry = '<a href="#url#log/#rev#{sessionvars%urlparameter}">#label|escape#</a> '
8 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
9 navshortentry = '<a href="#url#shortlog/#rev#{sessionvars%urlparameter}">#label|escape#</a> '
9 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
10 filenaventry = '<a href="{url}log/{rev}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
10 filenaventry = '<a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
11 filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
11 filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
12 filenodelink = '<a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
12 filenodelink = '<a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
13 fileellipses = '...'
13 fileellipses = '...'
@@ -5,8 +5,8 b' search = search.tmpl'
5 changelog = changelog.tmpl
5 changelog = changelog.tmpl
6 shortlog = shortlog.tmpl
6 shortlog = shortlog.tmpl
7 shortlogentry = shortlogentry.tmpl
7 shortlogentry = shortlogentry.tmpl
8 naventry = '<a href="?cl=#rev#">#label|escape#</a> '
8 naventry = '<a href="?cl={node|short}">{label|escape}</a> '
9 navshortentry = '<a href="?sl=#rev#">#label|escape#</a> '
9 navshortentry = '<a href="?sl={node|short}">{label|escape}</a> '
10 filedifflink = '<a href="?fd=#node|short#;file=#file|urlescape#">#file|escape#</a> '
10 filedifflink = '<a href="?fd=#node|short#;file=#file|urlescape#">#file|escape#</a> '
11 filenodelink = '<a href="?f=#node|short#;file=#file|urlescape#">#file|escape#</a> '
11 filenodelink = '<a href="?f=#node|short#;file=#file|urlescape#">#file|escape#</a> '
12 fileellipses = '...'
12 fileellipses = '...'
@@ -1,6 +1,6 b''
1 <item>
1 <item>
2 <title>#desc|strip|firstline|strip|escape#</title>
2 <title>#desc|strip|firstline|strip|escape#</title>
3 <link>#url#?cs=#node|short#</link>
3 <link>{urlbase}{url}rev/{node|short}</link>
4 <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
4 <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
5 <author>#author|obfuscate#</author>
5 <author>#author|obfuscate#</author>
6 <pubDate>#date|rfc822date#</pubDate>
6 <pubDate>#date|rfc822date#</pubDate>
@@ -1,6 +1,6 b''
1 <item>
1 <item>
2 <title>#desc|strip|firstline|strip|escape#</title>
2 <title>#desc|strip|firstline|strip|escape#</title>
3 <link>#url#?f=#node|short#;file=#file|urlescape#</link>
3 <link>{urlbase}{url}log{#node|short#}/{file|urlescape}</link>
4 <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
4 <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
5 <author>#author|obfuscate#</author>
5 <author>#author|obfuscate#</author>
6 <pubDate>#date|rfc822date#</pubDate>
6 <pubDate>#date|rfc822date#</pubDate>
@@ -2,5 +2,5 b' Content-type: text/xml'
2
2
3 <rss version="2.0">
3 <rss version="2.0">
4 <channel>
4 <channel>
5 <link>#url#</link>
5 <link>{urlbase}{url}</link>
6 <language>en-us</language>
6 <language>en-us</language>
@@ -1,6 +1,6 b''
1 <item>
1 <item>
2 <title>#tag|escape#</title>
2 <title>#tag|escape#</title>
3 <link>#url#?cs=#node|short#</link>
3 <link>{urlbase}{url}rev/{node|short}</link>
4 <description><![CDATA[#tag|strip|escape|addbreaks#]]></description>
4 <description><![CDATA[#tag|strip|escape|addbreaks#]]></description>
5 <pubDate>#date|rfc822date#</pubDate>
5 <pubDate>#date|rfc822date#</pubDate>
6 </item>
6 </item>
@@ -2,7 +2,7 b''
2
2
3 hg clone http://localhost:20059/ copy
3 hg clone http://localhost:20059/ copy
4 echo $?
4 echo $?
5 ls copy 2>/dev/null || echo copy: No such file or directory
5 test -e copy || echo copy: No such file or directory
6
6
7 cat > dumb.py <<EOF
7 cat > dumb.py <<EOF
8 import BaseHTTPServer, SimpleHTTPServer, signal
8 import BaseHTTPServer, SimpleHTTPServer, signal
@@ -57,4 +57,5 b' cd partial'
57 hg -R bundle://../full.hg log
57 hg -R bundle://../full.hg log
58 hg incoming bundle://../full.hg
58 hg incoming bundle://../full.hg
59 hg -R bundle://../full.hg outgoing ../partial2
59 hg -R bundle://../full.hg outgoing ../partial2
60 hg -R bundle://../does-not-exist.hg outgoing ../partial2
60 cd ..
61 cd ..
@@ -208,3 +208,4 b' user: test'
208 date: Mon Jan 12 13:46:40 1970 +0000
208 date: Mon Jan 12 13:46:40 1970 +0000
209 summary: 0.3m
209 summary: 0.3m
210
210
211 abort: No such file or directory: ../does-not-exist.hg
@@ -11,6 +11,6 b' hg commit -m "second" -d "1000000 0" sub'
11 cat sub/b
11 cat sub/b
12 hg co 0
12 hg co 0
13 cat sub/b 2>/dev/null || echo "sub/b not present"
13 cat sub/b 2>/dev/null || echo "sub/b not present"
14 ls sub 2>/dev/null || echo "sub not present"
14 test -e sub || echo "sub not present"
15
15
16 true
16 true
@@ -2,7 +2,7 b''
2
2
3 http_proxy= hg clone static-http://localhost:20059/ copy
3 http_proxy= hg clone static-http://localhost:20059/ copy
4 echo $?
4 echo $?
5 ls copy 2>/dev/null || echo copy: No such file or directory
5 test -e copy || echo copy: No such file or directory
6
6
7 # This server doesn't do range requests so it's basically only good for
7 # This server doesn't do range requests so it's basically only good for
8 # one pull
8 # one pull
General Comments 0
You need to be logged in to leave comments. Login now