##// END OF EJS Templates
test-acl: mock up util.getuser() to trust $LOGNAME on Windows...
Yuya Nishihara -
r36524:74c033b9 default
parent child Browse files
Show More
@@ -1,2183 +1,2210
1 1 > do_push()
2 2 > {
3 3 > user=$1
4 4 > shift
5 5 > echo "Pushing as user $user"
6 6 > echo 'hgrc = """'
7 7 > sed -n '/\[[ha]/,$p' b/.hg/hgrc | grep -v fakegroups.py
8 8 > echo '"""'
9 9 > if test -f acl.config; then
10 10 > echo 'acl.config = """'
11 11 > cat acl.config
12 12 > echo '"""'
13 13 > fi
14 14 > # On AIX /etc/profile sets LOGNAME read-only. So
15 15 > # LOGNAME=$user hg --cws a --debug push ../b
16 16 > # fails with "This variable is read only."
17 17 > # Use env to work around this.
18 18 > env LOGNAME=$user hg --cwd a --debug push ../b
19 19 > hg --cwd b rollback
20 20 > hg --cwd b --quiet tip
21 21 > echo
22 22 > }
23 23
24 > cat > posixgetuser.py <<'EOF'
25 > import getpass
26 > from mercurial import pycompat, util
27 > def posixgetuser():
28 > return pycompat.fsencode(getpass.getuser())
29 > if not pycompat.isposix:
30 > util.getuser = posixgetuser # forcibly trust $LOGNAME
31 > EOF
32
24 33 > init_config()
25 34 > {
26 35 > cat > fakegroups.py <<EOF
27 36 > from hgext import acl
28 37 > def fakegetusers(ui, group):
29 38 > try:
30 39 > return acl._getusersorig(ui, group)
31 40 > except:
32 41 > return ["fred", "betty"]
33 42 > acl._getusersorig = acl._getusers
34 43 > acl._getusers = fakegetusers
35 44 > EOF
36 45 > rm -f acl.config
37 46 > cat > $config <<EOF
38 47 > [hooks]
39 48 > pretxnchangegroup.acl = python:hgext.acl.hook
40 49 > [acl]
41 50 > sources = push
42 51 > [extensions]
43 52 > f=`pwd`/fakegroups.py
53 > posixgetuser=$TESTTMP/posixgetuser.py
44 54 > EOF
45 55 > }
46 56
47 57 $ hg init a
48 58 $ cd a
49 59 $ mkdir foo foo/Bar quux
50 60 $ echo 'in foo' > foo/file.txt
51 61 $ echo 'in foo/Bar' > foo/Bar/file.txt
52 62 $ echo 'in quux' > quux/file.py
53 63 $ hg add -q
54 64 $ hg ci -m 'add files' -d '1000000 0'
55 65 $ echo >> foo/file.txt
56 66 $ hg ci -m 'change foo/file' -d '1000001 0'
57 67 $ echo >> foo/Bar/file.txt
58 68 $ hg ci -m 'change foo/Bar/file' -d '1000002 0'
59 69 $ echo >> quux/file.py
60 70 $ hg ci -m 'change quux/file' -d '1000003 0'
61 71 $ hg tip --quiet
62 72 3:911600dab2ae
63 73
64 74 $ cd ..
65 75 $ hg clone -r 0 a b
66 76 adding changesets
67 77 adding manifests
68 78 adding file changes
69 79 added 1 changesets with 3 changes to 3 files
70 80 new changesets 6675d58eff77
71 81 updating to branch default
72 82 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 83
74 84 $ config=b/.hg/hgrc
85 $ cat >> "$config" <<EOF
86 > [extensions]
87 > posixgetuser=$TESTTMP/posixgetuser.py
88 > EOF
75 89
76 90 Extension disabled for lack of a hook
77 91
78 92 $ do_push fred
79 93 Pushing as user fred
80 94 hgrc = """
81 95 """
82 96 pushing to ../b
83 97 query 1; heads
84 98 searching for changes
85 99 all remote heads known locally
86 100 listing keys for "phases"
87 101 checking for updated bookmarks
88 102 listing keys for "bookmarks"
89 103 listing keys for "bookmarks"
90 104 3 changesets found
91 105 list of changesets:
92 106 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
93 107 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
94 108 911600dab2ae7a9baff75958b84fe606851ce955
95 109 bundle2-output-bundle: "HG20", 5 parts total
96 110 bundle2-output-part: "replycaps" 188 bytes payload
97 111 bundle2-output-part: "check:phases" 24 bytes payload
98 112 bundle2-output-part: "check:heads" streamed payload
99 113 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
100 114 bundle2-output-part: "phase-heads" 24 bytes payload
101 115 bundle2-input-bundle: with-transaction
102 116 bundle2-input-part: "replycaps" supported
103 117 bundle2-input-part: total payload size 188
104 118 bundle2-input-part: "check:phases" supported
105 119 bundle2-input-part: total payload size 24
106 120 bundle2-input-part: "check:heads" supported
107 121 bundle2-input-part: total payload size 20
108 122 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
109 123 adding changesets
110 124 add changeset ef1ea85a6374
111 125 add changeset f9cafe1212c8
112 126 add changeset 911600dab2ae
113 127 adding manifests
114 128 adding file changes
115 129 adding foo/Bar/file.txt revisions
116 130 adding foo/file.txt revisions
117 131 adding quux/file.py revisions
118 132 added 3 changesets with 3 changes to 3 files
119 133 bundle2-input-part: total payload size 1553
120 134 bundle2-input-part: "phase-heads" supported
121 135 bundle2-input-part: total payload size 24
122 136 bundle2-input-bundle: 4 parts total
123 137 updating the branch cache
124 138 bundle2-output-bundle: "HG20", 1 parts total
125 139 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
126 140 bundle2-input-bundle: no-transaction
127 141 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
128 142 bundle2-input-bundle: 0 parts total
129 143 listing keys for "phases"
130 144 repository tip rolled back to revision 0 (undo push)
131 145 0:6675d58eff77
132 146
133 147
134 148 $ echo '[hooks]' >> $config
135 149 $ echo 'pretxnchangegroup.acl = python:hgext.acl.hook' >> $config
136 150
137 151 Extension disabled for lack of acl.sources
138 152
139 153 $ do_push fred
140 154 Pushing as user fred
141 155 hgrc = """
142 156 [hooks]
143 157 pretxnchangegroup.acl = python:hgext.acl.hook
144 158 """
145 159 pushing to ../b
146 160 query 1; heads
147 161 searching for changes
148 162 all remote heads known locally
149 163 listing keys for "phases"
150 164 checking for updated bookmarks
151 165 listing keys for "bookmarks"
152 166 listing keys for "bookmarks"
153 167 3 changesets found
154 168 list of changesets:
155 169 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
156 170 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
157 171 911600dab2ae7a9baff75958b84fe606851ce955
158 172 bundle2-output-bundle: "HG20", 5 parts total
159 173 bundle2-output-part: "replycaps" 188 bytes payload
160 174 bundle2-output-part: "check:phases" 24 bytes payload
161 175 bundle2-output-part: "check:heads" streamed payload
162 176 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
163 177 bundle2-output-part: "phase-heads" 24 bytes payload
164 178 bundle2-input-bundle: with-transaction
165 179 bundle2-input-part: "replycaps" supported
166 180 bundle2-input-part: total payload size 188
167 181 bundle2-input-part: "check:phases" supported
168 182 bundle2-input-part: total payload size 24
169 183 bundle2-input-part: "check:heads" supported
170 184 bundle2-input-part: total payload size 20
171 185 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
172 186 adding changesets
173 187 add changeset ef1ea85a6374
174 188 add changeset f9cafe1212c8
175 189 add changeset 911600dab2ae
176 190 adding manifests
177 191 adding file changes
178 192 adding foo/Bar/file.txt revisions
179 193 adding foo/file.txt revisions
180 194 adding quux/file.py revisions
181 195 added 3 changesets with 3 changes to 3 files
182 196 calling hook pretxnchangegroup.acl: hgext.acl.hook
183 197 acl: changes have source "push" - skipping
184 198 bundle2-input-part: total payload size 1553
185 199 bundle2-input-part: "phase-heads" supported
186 200 bundle2-input-part: total payload size 24
187 201 bundle2-input-bundle: 4 parts total
188 202 updating the branch cache
189 203 bundle2-output-bundle: "HG20", 1 parts total
190 204 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
191 205 bundle2-input-bundle: no-transaction
192 206 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
193 207 bundle2-input-bundle: 0 parts total
194 208 listing keys for "phases"
195 209 repository tip rolled back to revision 0 (undo push)
196 210 0:6675d58eff77
197 211
198 212
199 213 No [acl.allow]/[acl.deny]
200 214
201 215 $ echo '[acl]' >> $config
202 216 $ echo 'sources = push' >> $config
203 217 $ do_push fred
204 218 Pushing as user fred
205 219 hgrc = """
206 220 [hooks]
207 221 pretxnchangegroup.acl = python:hgext.acl.hook
208 222 [acl]
209 223 sources = push
210 224 """
211 225 pushing to ../b
212 226 query 1; heads
213 227 searching for changes
214 228 all remote heads known locally
215 229 listing keys for "phases"
216 230 checking for updated bookmarks
217 231 listing keys for "bookmarks"
218 232 listing keys for "bookmarks"
219 233 3 changesets found
220 234 list of changesets:
221 235 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
222 236 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
223 237 911600dab2ae7a9baff75958b84fe606851ce955
224 238 bundle2-output-bundle: "HG20", 5 parts total
225 239 bundle2-output-part: "replycaps" 188 bytes payload
226 240 bundle2-output-part: "check:phases" 24 bytes payload
227 241 bundle2-output-part: "check:heads" streamed payload
228 242 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
229 243 bundle2-output-part: "phase-heads" 24 bytes payload
230 244 bundle2-input-bundle: with-transaction
231 245 bundle2-input-part: "replycaps" supported
232 246 bundle2-input-part: total payload size 188
233 247 bundle2-input-part: "check:phases" supported
234 248 bundle2-input-part: total payload size 24
235 249 bundle2-input-part: "check:heads" supported
236 250 bundle2-input-part: total payload size 20
237 251 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
238 252 adding changesets
239 253 add changeset ef1ea85a6374
240 254 add changeset f9cafe1212c8
241 255 add changeset 911600dab2ae
242 256 adding manifests
243 257 adding file changes
244 258 adding foo/Bar/file.txt revisions
245 259 adding foo/file.txt revisions
246 260 adding quux/file.py revisions
247 261 added 3 changesets with 3 changes to 3 files
248 262 calling hook pretxnchangegroup.acl: hgext.acl.hook
249 263 acl: checking access for user "fred"
250 264 acl: acl.allow.branches not enabled
251 265 acl: acl.deny.branches not enabled
252 266 acl: acl.allow not enabled
253 267 acl: acl.deny not enabled
254 268 acl: branch access granted: "ef1ea85a6374" on branch "default"
255 269 acl: path access granted: "ef1ea85a6374"
256 270 acl: branch access granted: "f9cafe1212c8" on branch "default"
257 271 acl: path access granted: "f9cafe1212c8"
258 272 acl: branch access granted: "911600dab2ae" on branch "default"
259 273 acl: path access granted: "911600dab2ae"
260 274 bundle2-input-part: total payload size 1553
261 275 bundle2-input-part: "phase-heads" supported
262 276 bundle2-input-part: total payload size 24
263 277 bundle2-input-bundle: 4 parts total
264 278 updating the branch cache
265 279 bundle2-output-bundle: "HG20", 1 parts total
266 280 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
267 281 bundle2-input-bundle: no-transaction
268 282 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
269 283 bundle2-input-bundle: 0 parts total
270 284 listing keys for "phases"
271 285 repository tip rolled back to revision 0 (undo push)
272 286 0:6675d58eff77
273 287
274 288
275 289 Empty [acl.allow]
276 290
277 291 $ echo '[acl.allow]' >> $config
278 292 $ do_push fred
279 293 Pushing as user fred
280 294 hgrc = """
281 295 [hooks]
282 296 pretxnchangegroup.acl = python:hgext.acl.hook
283 297 [acl]
284 298 sources = push
285 299 [acl.allow]
286 300 """
287 301 pushing to ../b
288 302 query 1; heads
289 303 searching for changes
290 304 all remote heads known locally
291 305 listing keys for "phases"
292 306 checking for updated bookmarks
293 307 listing keys for "bookmarks"
294 308 listing keys for "bookmarks"
295 309 3 changesets found
296 310 list of changesets:
297 311 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
298 312 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
299 313 911600dab2ae7a9baff75958b84fe606851ce955
300 314 bundle2-output-bundle: "HG20", 5 parts total
301 315 bundle2-output-part: "replycaps" 188 bytes payload
302 316 bundle2-output-part: "check:phases" 24 bytes payload
303 317 bundle2-output-part: "check:heads" streamed payload
304 318 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
305 319 bundle2-output-part: "phase-heads" 24 bytes payload
306 320 bundle2-input-bundle: with-transaction
307 321 bundle2-input-part: "replycaps" supported
308 322 bundle2-input-part: total payload size 188
309 323 bundle2-input-part: "check:phases" supported
310 324 bundle2-input-part: total payload size 24
311 325 bundle2-input-part: "check:heads" supported
312 326 bundle2-input-part: total payload size 20
313 327 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
314 328 adding changesets
315 329 add changeset ef1ea85a6374
316 330 add changeset f9cafe1212c8
317 331 add changeset 911600dab2ae
318 332 adding manifests
319 333 adding file changes
320 334 adding foo/Bar/file.txt revisions
321 335 adding foo/file.txt revisions
322 336 adding quux/file.py revisions
323 337 added 3 changesets with 3 changes to 3 files
324 338 calling hook pretxnchangegroup.acl: hgext.acl.hook
325 339 acl: checking access for user "fred"
326 340 acl: acl.allow.branches not enabled
327 341 acl: acl.deny.branches not enabled
328 342 acl: acl.allow enabled, 0 entries for user fred
329 343 acl: acl.deny not enabled
330 344 acl: branch access granted: "ef1ea85a6374" on branch "default"
331 345 error: pretxnchangegroup.acl hook failed: acl: user "fred" not allowed on "foo/file.txt" (changeset "ef1ea85a6374")
332 346 bundle2-input-part: total payload size 1553
333 347 bundle2-input-part: total payload size 24
334 348 bundle2-input-bundle: 4 parts total
335 349 transaction abort!
336 350 rollback completed
337 351 abort: acl: user "fred" not allowed on "foo/file.txt" (changeset "ef1ea85a6374")
338 352 no rollback information available
339 353 0:6675d58eff77
340 354
341 355
342 356 fred is allowed inside foo/
343 357
344 358 $ echo 'foo/** = fred' >> $config
345 359 $ do_push fred
346 360 Pushing as user fred
347 361 hgrc = """
348 362 [hooks]
349 363 pretxnchangegroup.acl = python:hgext.acl.hook
350 364 [acl]
351 365 sources = push
352 366 [acl.allow]
353 367 foo/** = fred
354 368 """
355 369 pushing to ../b
356 370 query 1; heads
357 371 searching for changes
358 372 all remote heads known locally
359 373 listing keys for "phases"
360 374 checking for updated bookmarks
361 375 listing keys for "bookmarks"
362 376 listing keys for "bookmarks"
363 377 3 changesets found
364 378 list of changesets:
365 379 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
366 380 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
367 381 911600dab2ae7a9baff75958b84fe606851ce955
368 382 bundle2-output-bundle: "HG20", 5 parts total
369 383 bundle2-output-part: "replycaps" 188 bytes payload
370 384 bundle2-output-part: "check:phases" 24 bytes payload
371 385 bundle2-output-part: "check:heads" streamed payload
372 386 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
373 387 bundle2-output-part: "phase-heads" 24 bytes payload
374 388 bundle2-input-bundle: with-transaction
375 389 bundle2-input-part: "replycaps" supported
376 390 bundle2-input-part: total payload size 188
377 391 bundle2-input-part: "check:phases" supported
378 392 bundle2-input-part: total payload size 24
379 393 bundle2-input-part: "check:heads" supported
380 394 bundle2-input-part: total payload size 20
381 395 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
382 396 adding changesets
383 397 add changeset ef1ea85a6374
384 398 add changeset f9cafe1212c8
385 399 add changeset 911600dab2ae
386 400 adding manifests
387 401 adding file changes
388 402 adding foo/Bar/file.txt revisions
389 403 adding foo/file.txt revisions
390 404 adding quux/file.py revisions
391 405 added 3 changesets with 3 changes to 3 files
392 406 calling hook pretxnchangegroup.acl: hgext.acl.hook
393 407 acl: checking access for user "fred"
394 408 acl: acl.allow.branches not enabled
395 409 acl: acl.deny.branches not enabled
396 410 acl: acl.allow enabled, 1 entries for user fred
397 411 acl: acl.deny not enabled
398 412 acl: branch access granted: "ef1ea85a6374" on branch "default"
399 413 acl: path access granted: "ef1ea85a6374"
400 414 acl: branch access granted: "f9cafe1212c8" on branch "default"
401 415 acl: path access granted: "f9cafe1212c8"
402 416 acl: branch access granted: "911600dab2ae" on branch "default"
403 417 error: pretxnchangegroup.acl hook failed: acl: user "fred" not allowed on "quux/file.py" (changeset "911600dab2ae")
404 418 bundle2-input-part: total payload size 1553
405 419 bundle2-input-part: total payload size 24
406 420 bundle2-input-bundle: 4 parts total
407 421 transaction abort!
408 422 rollback completed
409 423 abort: acl: user "fred" not allowed on "quux/file.py" (changeset "911600dab2ae")
410 424 no rollback information available
411 425 0:6675d58eff77
412 426
413 427
414 428 Empty [acl.deny]
415 429
416 430 $ echo '[acl.deny]' >> $config
417 431 $ do_push barney
418 432 Pushing as user barney
419 433 hgrc = """
420 434 [hooks]
421 435 pretxnchangegroup.acl = python:hgext.acl.hook
422 436 [acl]
423 437 sources = push
424 438 [acl.allow]
425 439 foo/** = fred
426 440 [acl.deny]
427 441 """
428 442 pushing to ../b
429 443 query 1; heads
430 444 searching for changes
431 445 all remote heads known locally
432 446 listing keys for "phases"
433 447 checking for updated bookmarks
434 448 listing keys for "bookmarks"
435 449 listing keys for "bookmarks"
436 450 3 changesets found
437 451 list of changesets:
438 452 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
439 453 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
440 454 911600dab2ae7a9baff75958b84fe606851ce955
441 455 bundle2-output-bundle: "HG20", 5 parts total
442 456 bundle2-output-part: "replycaps" 188 bytes payload
443 457 bundle2-output-part: "check:phases" 24 bytes payload
444 458 bundle2-output-part: "check:heads" streamed payload
445 459 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
446 460 bundle2-output-part: "phase-heads" 24 bytes payload
447 461 bundle2-input-bundle: with-transaction
448 462 bundle2-input-part: "replycaps" supported
449 463 bundle2-input-part: total payload size 188
450 464 bundle2-input-part: "check:phases" supported
451 465 bundle2-input-part: total payload size 24
452 466 bundle2-input-part: "check:heads" supported
453 467 bundle2-input-part: total payload size 20
454 468 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
455 469 adding changesets
456 470 add changeset ef1ea85a6374
457 471 add changeset f9cafe1212c8
458 472 add changeset 911600dab2ae
459 473 adding manifests
460 474 adding file changes
461 475 adding foo/Bar/file.txt revisions
462 476 adding foo/file.txt revisions
463 477 adding quux/file.py revisions
464 478 added 3 changesets with 3 changes to 3 files
465 479 calling hook pretxnchangegroup.acl: hgext.acl.hook
466 480 acl: checking access for user "barney"
467 481 acl: acl.allow.branches not enabled
468 482 acl: acl.deny.branches not enabled
469 483 acl: acl.allow enabled, 0 entries for user barney
470 484 acl: acl.deny enabled, 0 entries for user barney
471 485 acl: branch access granted: "ef1ea85a6374" on branch "default"
472 486 error: pretxnchangegroup.acl hook failed: acl: user "barney" not allowed on "foo/file.txt" (changeset "ef1ea85a6374")
473 487 bundle2-input-part: total payload size 1553
474 488 bundle2-input-part: total payload size 24
475 489 bundle2-input-bundle: 4 parts total
476 490 transaction abort!
477 491 rollback completed
478 492 abort: acl: user "barney" not allowed on "foo/file.txt" (changeset "ef1ea85a6374")
479 493 no rollback information available
480 494 0:6675d58eff77
481 495
482 496
483 497 fred is allowed inside foo/, but not foo/bar/ (case matters)
484 498
485 499 $ echo 'foo/bar/** = fred' >> $config
486 500 $ do_push fred
487 501 Pushing as user fred
488 502 hgrc = """
489 503 [hooks]
490 504 pretxnchangegroup.acl = python:hgext.acl.hook
491 505 [acl]
492 506 sources = push
493 507 [acl.allow]
494 508 foo/** = fred
495 509 [acl.deny]
496 510 foo/bar/** = fred
497 511 """
498 512 pushing to ../b
499 513 query 1; heads
500 514 searching for changes
501 515 all remote heads known locally
502 516 listing keys for "phases"
503 517 checking for updated bookmarks
504 518 listing keys for "bookmarks"
505 519 listing keys for "bookmarks"
506 520 3 changesets found
507 521 list of changesets:
508 522 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
509 523 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
510 524 911600dab2ae7a9baff75958b84fe606851ce955
511 525 bundle2-output-bundle: "HG20", 5 parts total
512 526 bundle2-output-part: "replycaps" 188 bytes payload
513 527 bundle2-output-part: "check:phases" 24 bytes payload
514 528 bundle2-output-part: "check:heads" streamed payload
515 529 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
516 530 bundle2-output-part: "phase-heads" 24 bytes payload
517 531 bundle2-input-bundle: with-transaction
518 532 bundle2-input-part: "replycaps" supported
519 533 bundle2-input-part: total payload size 188
520 534 bundle2-input-part: "check:phases" supported
521 535 bundle2-input-part: total payload size 24
522 536 bundle2-input-part: "check:heads" supported
523 537 bundle2-input-part: total payload size 20
524 538 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
525 539 adding changesets
526 540 add changeset ef1ea85a6374
527 541 add changeset f9cafe1212c8
528 542 add changeset 911600dab2ae
529 543 adding manifests
530 544 adding file changes
531 545 adding foo/Bar/file.txt revisions
532 546 adding foo/file.txt revisions
533 547 adding quux/file.py revisions
534 548 added 3 changesets with 3 changes to 3 files
535 549 calling hook pretxnchangegroup.acl: hgext.acl.hook
536 550 acl: checking access for user "fred"
537 551 acl: acl.allow.branches not enabled
538 552 acl: acl.deny.branches not enabled
539 553 acl: acl.allow enabled, 1 entries for user fred
540 554 acl: acl.deny enabled, 1 entries for user fred
541 555 acl: branch access granted: "ef1ea85a6374" on branch "default"
542 556 acl: path access granted: "ef1ea85a6374"
543 557 acl: branch access granted: "f9cafe1212c8" on branch "default"
544 558 acl: path access granted: "f9cafe1212c8"
545 559 acl: branch access granted: "911600dab2ae" on branch "default"
546 560 error: pretxnchangegroup.acl hook failed: acl: user "fred" not allowed on "quux/file.py" (changeset "911600dab2ae")
547 561 bundle2-input-part: total payload size 1553
548 562 bundle2-input-part: total payload size 24
549 563 bundle2-input-bundle: 4 parts total
550 564 transaction abort!
551 565 rollback completed
552 566 abort: acl: user "fred" not allowed on "quux/file.py" (changeset "911600dab2ae")
553 567 no rollback information available
554 568 0:6675d58eff77
555 569
556 570
557 571 fred is allowed inside foo/, but not foo/Bar/
558 572
559 573 $ echo 'foo/Bar/** = fred' >> $config
560 574 $ do_push fred
561 575 Pushing as user fred
562 576 hgrc = """
563 577 [hooks]
564 578 pretxnchangegroup.acl = python:hgext.acl.hook
565 579 [acl]
566 580 sources = push
567 581 [acl.allow]
568 582 foo/** = fred
569 583 [acl.deny]
570 584 foo/bar/** = fred
571 585 foo/Bar/** = fred
572 586 """
573 587 pushing to ../b
574 588 query 1; heads
575 589 searching for changes
576 590 all remote heads known locally
577 591 listing keys for "phases"
578 592 checking for updated bookmarks
579 593 listing keys for "bookmarks"
580 594 listing keys for "bookmarks"
581 595 3 changesets found
582 596 list of changesets:
583 597 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
584 598 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
585 599 911600dab2ae7a9baff75958b84fe606851ce955
586 600 bundle2-output-bundle: "HG20", 5 parts total
587 601 bundle2-output-part: "replycaps" 188 bytes payload
588 602 bundle2-output-part: "check:phases" 24 bytes payload
589 603 bundle2-output-part: "check:heads" streamed payload
590 604 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
591 605 bundle2-output-part: "phase-heads" 24 bytes payload
592 606 bundle2-input-bundle: with-transaction
593 607 bundle2-input-part: "replycaps" supported
594 608 bundle2-input-part: total payload size 188
595 609 bundle2-input-part: "check:phases" supported
596 610 bundle2-input-part: total payload size 24
597 611 bundle2-input-part: "check:heads" supported
598 612 bundle2-input-part: total payload size 20
599 613 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
600 614 adding changesets
601 615 add changeset ef1ea85a6374
602 616 add changeset f9cafe1212c8
603 617 add changeset 911600dab2ae
604 618 adding manifests
605 619 adding file changes
606 620 adding foo/Bar/file.txt revisions
607 621 adding foo/file.txt revisions
608 622 adding quux/file.py revisions
609 623 added 3 changesets with 3 changes to 3 files
610 624 calling hook pretxnchangegroup.acl: hgext.acl.hook
611 625 acl: checking access for user "fred"
612 626 acl: acl.allow.branches not enabled
613 627 acl: acl.deny.branches not enabled
614 628 acl: acl.allow enabled, 1 entries for user fred
615 629 acl: acl.deny enabled, 2 entries for user fred
616 630 acl: branch access granted: "ef1ea85a6374" on branch "default"
617 631 acl: path access granted: "ef1ea85a6374"
618 632 acl: branch access granted: "f9cafe1212c8" on branch "default"
619 633 error: pretxnchangegroup.acl hook failed: acl: user "fred" denied on "foo/Bar/file.txt" (changeset "f9cafe1212c8")
620 634 bundle2-input-part: total payload size 1553
621 635 bundle2-input-part: total payload size 24
622 636 bundle2-input-bundle: 4 parts total
623 637 transaction abort!
624 638 rollback completed
625 639 abort: acl: user "fred" denied on "foo/Bar/file.txt" (changeset "f9cafe1212c8")
626 640 no rollback information available
627 641 0:6675d58eff77
628 642
629 643
630 644 $ echo 'barney is not mentioned => not allowed anywhere'
631 645 barney is not mentioned => not allowed anywhere
632 646 $ do_push barney
633 647 Pushing as user barney
634 648 hgrc = """
635 649 [hooks]
636 650 pretxnchangegroup.acl = python:hgext.acl.hook
637 651 [acl]
638 652 sources = push
639 653 [acl.allow]
640 654 foo/** = fred
641 655 [acl.deny]
642 656 foo/bar/** = fred
643 657 foo/Bar/** = fred
644 658 """
645 659 pushing to ../b
646 660 query 1; heads
647 661 searching for changes
648 662 all remote heads known locally
649 663 listing keys for "phases"
650 664 checking for updated bookmarks
651 665 listing keys for "bookmarks"
652 666 listing keys for "bookmarks"
653 667 3 changesets found
654 668 list of changesets:
655 669 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
656 670 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
657 671 911600dab2ae7a9baff75958b84fe606851ce955
658 672 bundle2-output-bundle: "HG20", 5 parts total
659 673 bundle2-output-part: "replycaps" 188 bytes payload
660 674 bundle2-output-part: "check:phases" 24 bytes payload
661 675 bundle2-output-part: "check:heads" streamed payload
662 676 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
663 677 bundle2-output-part: "phase-heads" 24 bytes payload
664 678 bundle2-input-bundle: with-transaction
665 679 bundle2-input-part: "replycaps" supported
666 680 bundle2-input-part: total payload size 188
667 681 bundle2-input-part: "check:phases" supported
668 682 bundle2-input-part: total payload size 24
669 683 bundle2-input-part: "check:heads" supported
670 684 bundle2-input-part: total payload size 20
671 685 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
672 686 adding changesets
673 687 add changeset ef1ea85a6374
674 688 add changeset f9cafe1212c8
675 689 add changeset 911600dab2ae
676 690 adding manifests
677 691 adding file changes
678 692 adding foo/Bar/file.txt revisions
679 693 adding foo/file.txt revisions
680 694 adding quux/file.py revisions
681 695 added 3 changesets with 3 changes to 3 files
682 696 calling hook pretxnchangegroup.acl: hgext.acl.hook
683 697 acl: checking access for user "barney"
684 698 acl: acl.allow.branches not enabled
685 699 acl: acl.deny.branches not enabled
686 700 acl: acl.allow enabled, 0 entries for user barney
687 701 acl: acl.deny enabled, 0 entries for user barney
688 702 acl: branch access granted: "ef1ea85a6374" on branch "default"
689 703 error: pretxnchangegroup.acl hook failed: acl: user "barney" not allowed on "foo/file.txt" (changeset "ef1ea85a6374")
690 704 bundle2-input-part: total payload size 1553
691 705 bundle2-input-part: total payload size 24
692 706 bundle2-input-bundle: 4 parts total
693 707 transaction abort!
694 708 rollback completed
695 709 abort: acl: user "barney" not allowed on "foo/file.txt" (changeset "ef1ea85a6374")
696 710 no rollback information available
697 711 0:6675d58eff77
698 712
699 713
700 714 barney is allowed everywhere
701 715
702 716 $ echo '[acl.allow]' >> $config
703 717 $ echo '** = barney' >> $config
704 718 $ do_push barney
705 719 Pushing as user barney
706 720 hgrc = """
707 721 [hooks]
708 722 pretxnchangegroup.acl = python:hgext.acl.hook
709 723 [acl]
710 724 sources = push
711 725 [acl.allow]
712 726 foo/** = fred
713 727 [acl.deny]
714 728 foo/bar/** = fred
715 729 foo/Bar/** = fred
716 730 [acl.allow]
717 731 ** = barney
718 732 """
719 733 pushing to ../b
720 734 query 1; heads
721 735 searching for changes
722 736 all remote heads known locally
723 737 listing keys for "phases"
724 738 checking for updated bookmarks
725 739 listing keys for "bookmarks"
726 740 listing keys for "bookmarks"
727 741 3 changesets found
728 742 list of changesets:
729 743 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
730 744 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
731 745 911600dab2ae7a9baff75958b84fe606851ce955
732 746 bundle2-output-bundle: "HG20", 5 parts total
733 747 bundle2-output-part: "replycaps" 188 bytes payload
734 748 bundle2-output-part: "check:phases" 24 bytes payload
735 749 bundle2-output-part: "check:heads" streamed payload
736 750 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
737 751 bundle2-output-part: "phase-heads" 24 bytes payload
738 752 bundle2-input-bundle: with-transaction
739 753 bundle2-input-part: "replycaps" supported
740 754 bundle2-input-part: total payload size 188
741 755 bundle2-input-part: "check:phases" supported
742 756 bundle2-input-part: total payload size 24
743 757 bundle2-input-part: "check:heads" supported
744 758 bundle2-input-part: total payload size 20
745 759 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
746 760 adding changesets
747 761 add changeset ef1ea85a6374
748 762 add changeset f9cafe1212c8
749 763 add changeset 911600dab2ae
750 764 adding manifests
751 765 adding file changes
752 766 adding foo/Bar/file.txt revisions
753 767 adding foo/file.txt revisions
754 768 adding quux/file.py revisions
755 769 added 3 changesets with 3 changes to 3 files
756 770 calling hook pretxnchangegroup.acl: hgext.acl.hook
757 771 acl: checking access for user "barney"
758 772 acl: acl.allow.branches not enabled
759 773 acl: acl.deny.branches not enabled
760 774 acl: acl.allow enabled, 1 entries for user barney
761 775 acl: acl.deny enabled, 0 entries for user barney
762 776 acl: branch access granted: "ef1ea85a6374" on branch "default"
763 777 acl: path access granted: "ef1ea85a6374"
764 778 acl: branch access granted: "f9cafe1212c8" on branch "default"
765 779 acl: path access granted: "f9cafe1212c8"
766 780 acl: branch access granted: "911600dab2ae" on branch "default"
767 781 acl: path access granted: "911600dab2ae"
768 782 bundle2-input-part: total payload size 1553
769 783 bundle2-input-part: "phase-heads" supported
770 784 bundle2-input-part: total payload size 24
771 785 bundle2-input-bundle: 4 parts total
772 786 updating the branch cache
773 787 bundle2-output-bundle: "HG20", 1 parts total
774 788 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
775 789 bundle2-input-bundle: no-transaction
776 790 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
777 791 bundle2-input-bundle: 0 parts total
778 792 listing keys for "phases"
779 793 repository tip rolled back to revision 0 (undo push)
780 794 0:6675d58eff77
781 795
782 796
783 797 wilma can change files with a .txt extension
784 798
785 799 $ echo '**/*.txt = wilma' >> $config
786 800 $ do_push wilma
787 801 Pushing as user wilma
788 802 hgrc = """
789 803 [hooks]
790 804 pretxnchangegroup.acl = python:hgext.acl.hook
791 805 [acl]
792 806 sources = push
793 807 [acl.allow]
794 808 foo/** = fred
795 809 [acl.deny]
796 810 foo/bar/** = fred
797 811 foo/Bar/** = fred
798 812 [acl.allow]
799 813 ** = barney
800 814 **/*.txt = wilma
801 815 """
802 816 pushing to ../b
803 817 query 1; heads
804 818 searching for changes
805 819 all remote heads known locally
806 820 listing keys for "phases"
807 821 checking for updated bookmarks
808 822 listing keys for "bookmarks"
809 823 listing keys for "bookmarks"
810 824 3 changesets found
811 825 list of changesets:
812 826 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
813 827 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
814 828 911600dab2ae7a9baff75958b84fe606851ce955
815 829 bundle2-output-bundle: "HG20", 5 parts total
816 830 bundle2-output-part: "replycaps" 188 bytes payload
817 831 bundle2-output-part: "check:phases" 24 bytes payload
818 832 bundle2-output-part: "check:heads" streamed payload
819 833 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
820 834 bundle2-output-part: "phase-heads" 24 bytes payload
821 835 bundle2-input-bundle: with-transaction
822 836 bundle2-input-part: "replycaps" supported
823 837 bundle2-input-part: total payload size 188
824 838 bundle2-input-part: "check:phases" supported
825 839 bundle2-input-part: total payload size 24
826 840 bundle2-input-part: "check:heads" supported
827 841 bundle2-input-part: total payload size 20
828 842 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
829 843 adding changesets
830 844 add changeset ef1ea85a6374
831 845 add changeset f9cafe1212c8
832 846 add changeset 911600dab2ae
833 847 adding manifests
834 848 adding file changes
835 849 adding foo/Bar/file.txt revisions
836 850 adding foo/file.txt revisions
837 851 adding quux/file.py revisions
838 852 added 3 changesets with 3 changes to 3 files
839 853 calling hook pretxnchangegroup.acl: hgext.acl.hook
840 854 acl: checking access for user "wilma"
841 855 acl: acl.allow.branches not enabled
842 856 acl: acl.deny.branches not enabled
843 857 acl: acl.allow enabled, 1 entries for user wilma
844 858 acl: acl.deny enabled, 0 entries for user wilma
845 859 acl: branch access granted: "ef1ea85a6374" on branch "default"
846 860 acl: path access granted: "ef1ea85a6374"
847 861 acl: branch access granted: "f9cafe1212c8" on branch "default"
848 862 acl: path access granted: "f9cafe1212c8"
849 863 acl: branch access granted: "911600dab2ae" on branch "default"
850 864 error: pretxnchangegroup.acl hook failed: acl: user "wilma" not allowed on "quux/file.py" (changeset "911600dab2ae")
851 865 bundle2-input-part: total payload size 1553
852 866 bundle2-input-part: total payload size 24
853 867 bundle2-input-bundle: 4 parts total
854 868 transaction abort!
855 869 rollback completed
856 870 abort: acl: user "wilma" not allowed on "quux/file.py" (changeset "911600dab2ae")
857 871 no rollback information available
858 872 0:6675d58eff77
859 873
860 874
861 875 file specified by acl.config does not exist
862 876
863 877 $ echo '[acl]' >> $config
864 878 $ echo 'config = ../acl.config' >> $config
865 879 $ do_push barney
866 880 Pushing as user barney
867 881 hgrc = """
868 882 [hooks]
869 883 pretxnchangegroup.acl = python:hgext.acl.hook
870 884 [acl]
871 885 sources = push
872 886 [acl.allow]
873 887 foo/** = fred
874 888 [acl.deny]
875 889 foo/bar/** = fred
876 890 foo/Bar/** = fred
877 891 [acl.allow]
878 892 ** = barney
879 893 **/*.txt = wilma
880 894 [acl]
881 895 config = ../acl.config
882 896 """
883 897 pushing to ../b
884 898 query 1; heads
885 899 searching for changes
886 900 all remote heads known locally
887 901 listing keys for "phases"
888 902 checking for updated bookmarks
889 903 listing keys for "bookmarks"
890 904 listing keys for "bookmarks"
891 905 3 changesets found
892 906 list of changesets:
893 907 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
894 908 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
895 909 911600dab2ae7a9baff75958b84fe606851ce955
896 910 bundle2-output-bundle: "HG20", 5 parts total
897 911 bundle2-output-part: "replycaps" 188 bytes payload
898 912 bundle2-output-part: "check:phases" 24 bytes payload
899 913 bundle2-output-part: "check:heads" streamed payload
900 914 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
901 915 bundle2-output-part: "phase-heads" 24 bytes payload
902 916 bundle2-input-bundle: with-transaction
903 917 bundle2-input-part: "replycaps" supported
904 918 bundle2-input-part: total payload size 188
905 919 bundle2-input-part: "check:phases" supported
906 920 bundle2-input-part: total payload size 24
907 921 bundle2-input-part: "check:heads" supported
908 922 bundle2-input-part: total payload size 20
909 923 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
910 924 adding changesets
911 925 add changeset ef1ea85a6374
912 926 add changeset f9cafe1212c8
913 927 add changeset 911600dab2ae
914 928 adding manifests
915 929 adding file changes
916 930 adding foo/Bar/file.txt revisions
917 931 adding foo/file.txt revisions
918 932 adding quux/file.py revisions
919 933 added 3 changesets with 3 changes to 3 files
920 934 calling hook pretxnchangegroup.acl: hgext.acl.hook
921 935 acl: checking access for user "barney"
922 936 error: pretxnchangegroup.acl hook raised an exception: [Errno *] * (glob)
923 937 bundle2-input-part: total payload size 1553
924 938 bundle2-input-part: total payload size 24
925 939 bundle2-input-bundle: 4 parts total
926 940 transaction abort!
927 941 rollback completed
928 942 abort: $ENOENT$: ../acl.config
929 943 no rollback information available
930 944 0:6675d58eff77
931 945
932 946
933 947 betty is allowed inside foo/ by a acl.config file
934 948
935 949 $ echo '[acl.allow]' >> acl.config
936 950 $ echo 'foo/** = betty' >> acl.config
937 951 $ do_push betty
938 952 Pushing as user betty
939 953 hgrc = """
940 954 [hooks]
941 955 pretxnchangegroup.acl = python:hgext.acl.hook
942 956 [acl]
943 957 sources = push
944 958 [acl.allow]
945 959 foo/** = fred
946 960 [acl.deny]
947 961 foo/bar/** = fred
948 962 foo/Bar/** = fred
949 963 [acl.allow]
950 964 ** = barney
951 965 **/*.txt = wilma
952 966 [acl]
953 967 config = ../acl.config
954 968 """
955 969 acl.config = """
956 970 [acl.allow]
957 971 foo/** = betty
958 972 """
959 973 pushing to ../b
960 974 query 1; heads
961 975 searching for changes
962 976 all remote heads known locally
963 977 listing keys for "phases"
964 978 checking for updated bookmarks
965 979 listing keys for "bookmarks"
966 980 listing keys for "bookmarks"
967 981 3 changesets found
968 982 list of changesets:
969 983 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
970 984 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
971 985 911600dab2ae7a9baff75958b84fe606851ce955
972 986 bundle2-output-bundle: "HG20", 5 parts total
973 987 bundle2-output-part: "replycaps" 188 bytes payload
974 988 bundle2-output-part: "check:phases" 24 bytes payload
975 989 bundle2-output-part: "check:heads" streamed payload
976 990 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
977 991 bundle2-output-part: "phase-heads" 24 bytes payload
978 992 bundle2-input-bundle: with-transaction
979 993 bundle2-input-part: "replycaps" supported
980 994 bundle2-input-part: total payload size 188
981 995 bundle2-input-part: "check:phases" supported
982 996 bundle2-input-part: total payload size 24
983 997 bundle2-input-part: "check:heads" supported
984 998 bundle2-input-part: total payload size 20
985 999 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
986 1000 adding changesets
987 1001 add changeset ef1ea85a6374
988 1002 add changeset f9cafe1212c8
989 1003 add changeset 911600dab2ae
990 1004 adding manifests
991 1005 adding file changes
992 1006 adding foo/Bar/file.txt revisions
993 1007 adding foo/file.txt revisions
994 1008 adding quux/file.py revisions
995 1009 added 3 changesets with 3 changes to 3 files
996 1010 calling hook pretxnchangegroup.acl: hgext.acl.hook
997 1011 acl: checking access for user "betty"
998 1012 acl: acl.allow.branches not enabled
999 1013 acl: acl.deny.branches not enabled
1000 1014 acl: acl.allow enabled, 1 entries for user betty
1001 1015 acl: acl.deny enabled, 0 entries for user betty
1002 1016 acl: branch access granted: "ef1ea85a6374" on branch "default"
1003 1017 acl: path access granted: "ef1ea85a6374"
1004 1018 acl: branch access granted: "f9cafe1212c8" on branch "default"
1005 1019 acl: path access granted: "f9cafe1212c8"
1006 1020 acl: branch access granted: "911600dab2ae" on branch "default"
1007 1021 error: pretxnchangegroup.acl hook failed: acl: user "betty" not allowed on "quux/file.py" (changeset "911600dab2ae")
1008 1022 bundle2-input-part: total payload size 1553
1009 1023 bundle2-input-part: total payload size 24
1010 1024 bundle2-input-bundle: 4 parts total
1011 1025 transaction abort!
1012 1026 rollback completed
1013 1027 abort: acl: user "betty" not allowed on "quux/file.py" (changeset "911600dab2ae")
1014 1028 no rollback information available
1015 1029 0:6675d58eff77
1016 1030
1017 1031
1018 1032 acl.config can set only [acl.allow]/[acl.deny]
1019 1033
1020 1034 $ echo '[hooks]' >> acl.config
1021 1035 $ echo 'changegroup.acl = false' >> acl.config
1022 1036 $ do_push barney
1023 1037 Pushing as user barney
1024 1038 hgrc = """
1025 1039 [hooks]
1026 1040 pretxnchangegroup.acl = python:hgext.acl.hook
1027 1041 [acl]
1028 1042 sources = push
1029 1043 [acl.allow]
1030 1044 foo/** = fred
1031 1045 [acl.deny]
1032 1046 foo/bar/** = fred
1033 1047 foo/Bar/** = fred
1034 1048 [acl.allow]
1035 1049 ** = barney
1036 1050 **/*.txt = wilma
1037 1051 [acl]
1038 1052 config = ../acl.config
1039 1053 """
1040 1054 acl.config = """
1041 1055 [acl.allow]
1042 1056 foo/** = betty
1043 1057 [hooks]
1044 1058 changegroup.acl = false
1045 1059 """
1046 1060 pushing to ../b
1047 1061 query 1; heads
1048 1062 searching for changes
1049 1063 all remote heads known locally
1050 1064 listing keys for "phases"
1051 1065 checking for updated bookmarks
1052 1066 listing keys for "bookmarks"
1053 1067 listing keys for "bookmarks"
1054 1068 3 changesets found
1055 1069 list of changesets:
1056 1070 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1057 1071 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1058 1072 911600dab2ae7a9baff75958b84fe606851ce955
1059 1073 bundle2-output-bundle: "HG20", 5 parts total
1060 1074 bundle2-output-part: "replycaps" 188 bytes payload
1061 1075 bundle2-output-part: "check:phases" 24 bytes payload
1062 1076 bundle2-output-part: "check:heads" streamed payload
1063 1077 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1064 1078 bundle2-output-part: "phase-heads" 24 bytes payload
1065 1079 bundle2-input-bundle: with-transaction
1066 1080 bundle2-input-part: "replycaps" supported
1067 1081 bundle2-input-part: total payload size 188
1068 1082 bundle2-input-part: "check:phases" supported
1069 1083 bundle2-input-part: total payload size 24
1070 1084 bundle2-input-part: "check:heads" supported
1071 1085 bundle2-input-part: total payload size 20
1072 1086 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1073 1087 adding changesets
1074 1088 add changeset ef1ea85a6374
1075 1089 add changeset f9cafe1212c8
1076 1090 add changeset 911600dab2ae
1077 1091 adding manifests
1078 1092 adding file changes
1079 1093 adding foo/Bar/file.txt revisions
1080 1094 adding foo/file.txt revisions
1081 1095 adding quux/file.py revisions
1082 1096 added 3 changesets with 3 changes to 3 files
1083 1097 calling hook pretxnchangegroup.acl: hgext.acl.hook
1084 1098 acl: checking access for user "barney"
1085 1099 acl: acl.allow.branches not enabled
1086 1100 acl: acl.deny.branches not enabled
1087 1101 acl: acl.allow enabled, 1 entries for user barney
1088 1102 acl: acl.deny enabled, 0 entries for user barney
1089 1103 acl: branch access granted: "ef1ea85a6374" on branch "default"
1090 1104 acl: path access granted: "ef1ea85a6374"
1091 1105 acl: branch access granted: "f9cafe1212c8" on branch "default"
1092 1106 acl: path access granted: "f9cafe1212c8"
1093 1107 acl: branch access granted: "911600dab2ae" on branch "default"
1094 1108 acl: path access granted: "911600dab2ae"
1095 1109 bundle2-input-part: total payload size 1553
1096 1110 bundle2-input-part: "phase-heads" supported
1097 1111 bundle2-input-part: total payload size 24
1098 1112 bundle2-input-bundle: 4 parts total
1099 1113 updating the branch cache
1100 1114 bundle2-output-bundle: "HG20", 1 parts total
1101 1115 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
1102 1116 bundle2-input-bundle: no-transaction
1103 1117 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
1104 1118 bundle2-input-bundle: 0 parts total
1105 1119 listing keys for "phases"
1106 1120 repository tip rolled back to revision 0 (undo push)
1107 1121 0:6675d58eff77
1108 1122
1109 1123
1110 1124 asterisk
1111 1125
1112 1126 $ init_config
1113 1127
1114 1128 asterisk test
1115 1129
1116 1130 $ echo '[acl.allow]' >> $config
1117 1131 $ echo "** = fred" >> $config
1118 1132
1119 1133 fred is always allowed
1120 1134
1121 1135 $ do_push fred
1122 1136 Pushing as user fred
1123 1137 hgrc = """
1124 1138 [hooks]
1125 1139 pretxnchangegroup.acl = python:hgext.acl.hook
1126 1140 [acl]
1127 1141 sources = push
1128 1142 [extensions]
1143 posixgetuser=$TESTTMP/posixgetuser.py
1129 1144 [acl.allow]
1130 1145 ** = fred
1131 1146 """
1132 1147 pushing to ../b
1133 1148 query 1; heads
1134 1149 searching for changes
1135 1150 all remote heads known locally
1136 1151 listing keys for "phases"
1137 1152 checking for updated bookmarks
1138 1153 listing keys for "bookmarks"
1139 1154 listing keys for "bookmarks"
1140 1155 3 changesets found
1141 1156 list of changesets:
1142 1157 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1143 1158 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1144 1159 911600dab2ae7a9baff75958b84fe606851ce955
1145 1160 bundle2-output-bundle: "HG20", 5 parts total
1146 1161 bundle2-output-part: "replycaps" 188 bytes payload
1147 1162 bundle2-output-part: "check:phases" 24 bytes payload
1148 1163 bundle2-output-part: "check:heads" streamed payload
1149 1164 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1150 1165 bundle2-output-part: "phase-heads" 24 bytes payload
1151 1166 bundle2-input-bundle: with-transaction
1152 1167 bundle2-input-part: "replycaps" supported
1153 1168 bundle2-input-part: total payload size 188
1154 1169 bundle2-input-part: "check:phases" supported
1155 1170 bundle2-input-part: total payload size 24
1156 1171 bundle2-input-part: "check:heads" supported
1157 1172 bundle2-input-part: total payload size 20
1158 1173 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1159 1174 adding changesets
1160 1175 add changeset ef1ea85a6374
1161 1176 add changeset f9cafe1212c8
1162 1177 add changeset 911600dab2ae
1163 1178 adding manifests
1164 1179 adding file changes
1165 1180 adding foo/Bar/file.txt revisions
1166 1181 adding foo/file.txt revisions
1167 1182 adding quux/file.py revisions
1168 1183 added 3 changesets with 3 changes to 3 files
1169 1184 calling hook pretxnchangegroup.acl: hgext.acl.hook
1170 1185 acl: checking access for user "fred"
1171 1186 acl: acl.allow.branches not enabled
1172 1187 acl: acl.deny.branches not enabled
1173 1188 acl: acl.allow enabled, 1 entries for user fred
1174 1189 acl: acl.deny not enabled
1175 1190 acl: branch access granted: "ef1ea85a6374" on branch "default"
1176 1191 acl: path access granted: "ef1ea85a6374"
1177 1192 acl: branch access granted: "f9cafe1212c8" on branch "default"
1178 1193 acl: path access granted: "f9cafe1212c8"
1179 1194 acl: branch access granted: "911600dab2ae" on branch "default"
1180 1195 acl: path access granted: "911600dab2ae"
1181 1196 bundle2-input-part: total payload size 1553
1182 1197 bundle2-input-part: "phase-heads" supported
1183 1198 bundle2-input-part: total payload size 24
1184 1199 bundle2-input-bundle: 4 parts total
1185 1200 updating the branch cache
1186 1201 bundle2-output-bundle: "HG20", 1 parts total
1187 1202 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
1188 1203 bundle2-input-bundle: no-transaction
1189 1204 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
1190 1205 bundle2-input-bundle: 0 parts total
1191 1206 listing keys for "phases"
1192 1207 repository tip rolled back to revision 0 (undo push)
1193 1208 0:6675d58eff77
1194 1209
1195 1210
1196 1211 $ echo '[acl.deny]' >> $config
1197 1212 $ echo "foo/Bar/** = *" >> $config
1198 1213
1199 1214 no one is allowed inside foo/Bar/
1200 1215
1201 1216 $ do_push fred
1202 1217 Pushing as user fred
1203 1218 hgrc = """
1204 1219 [hooks]
1205 1220 pretxnchangegroup.acl = python:hgext.acl.hook
1206 1221 [acl]
1207 1222 sources = push
1208 1223 [extensions]
1224 posixgetuser=$TESTTMP/posixgetuser.py
1209 1225 [acl.allow]
1210 1226 ** = fred
1211 1227 [acl.deny]
1212 1228 foo/Bar/** = *
1213 1229 """
1214 1230 pushing to ../b
1215 1231 query 1; heads
1216 1232 searching for changes
1217 1233 all remote heads known locally
1218 1234 listing keys for "phases"
1219 1235 checking for updated bookmarks
1220 1236 listing keys for "bookmarks"
1221 1237 listing keys for "bookmarks"
1222 1238 3 changesets found
1223 1239 list of changesets:
1224 1240 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1225 1241 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1226 1242 911600dab2ae7a9baff75958b84fe606851ce955
1227 1243 bundle2-output-bundle: "HG20", 5 parts total
1228 1244 bundle2-output-part: "replycaps" 188 bytes payload
1229 1245 bundle2-output-part: "check:phases" 24 bytes payload
1230 1246 bundle2-output-part: "check:heads" streamed payload
1231 1247 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1232 1248 bundle2-output-part: "phase-heads" 24 bytes payload
1233 1249 bundle2-input-bundle: with-transaction
1234 1250 bundle2-input-part: "replycaps" supported
1235 1251 bundle2-input-part: total payload size 188
1236 1252 bundle2-input-part: "check:phases" supported
1237 1253 bundle2-input-part: total payload size 24
1238 1254 bundle2-input-part: "check:heads" supported
1239 1255 bundle2-input-part: total payload size 20
1240 1256 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1241 1257 adding changesets
1242 1258 add changeset ef1ea85a6374
1243 1259 add changeset f9cafe1212c8
1244 1260 add changeset 911600dab2ae
1245 1261 adding manifests
1246 1262 adding file changes
1247 1263 adding foo/Bar/file.txt revisions
1248 1264 adding foo/file.txt revisions
1249 1265 adding quux/file.py revisions
1250 1266 added 3 changesets with 3 changes to 3 files
1251 1267 calling hook pretxnchangegroup.acl: hgext.acl.hook
1252 1268 acl: checking access for user "fred"
1253 1269 acl: acl.allow.branches not enabled
1254 1270 acl: acl.deny.branches not enabled
1255 1271 acl: acl.allow enabled, 1 entries for user fred
1256 1272 acl: acl.deny enabled, 1 entries for user fred
1257 1273 acl: branch access granted: "ef1ea85a6374" on branch "default"
1258 1274 acl: path access granted: "ef1ea85a6374"
1259 1275 acl: branch access granted: "f9cafe1212c8" on branch "default"
1260 1276 error: pretxnchangegroup.acl hook failed: acl: user "fred" denied on "foo/Bar/file.txt" (changeset "f9cafe1212c8")
1261 1277 bundle2-input-part: total payload size 1553
1262 1278 bundle2-input-part: total payload size 24
1263 1279 bundle2-input-bundle: 4 parts total
1264 1280 transaction abort!
1265 1281 rollback completed
1266 1282 abort: acl: user "fred" denied on "foo/Bar/file.txt" (changeset "f9cafe1212c8")
1267 1283 no rollback information available
1268 1284 0:6675d58eff77
1269 1285
1270 1286
1271 1287 Groups
1272 1288
1273 1289 $ init_config
1274 1290
1275 1291 OS-level groups
1276 1292
1277 1293 $ echo '[acl.allow]' >> $config
1278 1294 $ echo "** = @group1" >> $config
1279 1295
1280 1296 @group1 is always allowed
1281 1297
1282 1298 $ do_push fred
1283 1299 Pushing as user fred
1284 1300 hgrc = """
1285 1301 [hooks]
1286 1302 pretxnchangegroup.acl = python:hgext.acl.hook
1287 1303 [acl]
1288 1304 sources = push
1289 1305 [extensions]
1306 posixgetuser=$TESTTMP/posixgetuser.py
1290 1307 [acl.allow]
1291 1308 ** = @group1
1292 1309 """
1293 1310 pushing to ../b
1294 1311 query 1; heads
1295 1312 searching for changes
1296 1313 all remote heads known locally
1297 1314 listing keys for "phases"
1298 1315 checking for updated bookmarks
1299 1316 listing keys for "bookmarks"
1300 1317 listing keys for "bookmarks"
1301 1318 3 changesets found
1302 1319 list of changesets:
1303 1320 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1304 1321 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1305 1322 911600dab2ae7a9baff75958b84fe606851ce955
1306 1323 bundle2-output-bundle: "HG20", 5 parts total
1307 1324 bundle2-output-part: "replycaps" 188 bytes payload
1308 1325 bundle2-output-part: "check:phases" 24 bytes payload
1309 1326 bundle2-output-part: "check:heads" streamed payload
1310 1327 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1311 1328 bundle2-output-part: "phase-heads" 24 bytes payload
1312 1329 bundle2-input-bundle: with-transaction
1313 1330 bundle2-input-part: "replycaps" supported
1314 1331 bundle2-input-part: total payload size 188
1315 1332 bundle2-input-part: "check:phases" supported
1316 1333 bundle2-input-part: total payload size 24
1317 1334 bundle2-input-part: "check:heads" supported
1318 1335 bundle2-input-part: total payload size 20
1319 1336 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1320 1337 adding changesets
1321 1338 add changeset ef1ea85a6374
1322 1339 add changeset f9cafe1212c8
1323 1340 add changeset 911600dab2ae
1324 1341 adding manifests
1325 1342 adding file changes
1326 1343 adding foo/Bar/file.txt revisions
1327 1344 adding foo/file.txt revisions
1328 1345 adding quux/file.py revisions
1329 1346 added 3 changesets with 3 changes to 3 files
1330 1347 calling hook pretxnchangegroup.acl: hgext.acl.hook
1331 1348 acl: checking access for user "fred"
1332 1349 acl: acl.allow.branches not enabled
1333 1350 acl: acl.deny.branches not enabled
1334 1351 acl: "group1" not defined in [acl.groups]
1335 1352 acl: acl.allow enabled, 1 entries for user fred
1336 1353 acl: acl.deny not enabled
1337 1354 acl: branch access granted: "ef1ea85a6374" on branch "default"
1338 1355 acl: path access granted: "ef1ea85a6374"
1339 1356 acl: branch access granted: "f9cafe1212c8" on branch "default"
1340 1357 acl: path access granted: "f9cafe1212c8"
1341 1358 acl: branch access granted: "911600dab2ae" on branch "default"
1342 1359 acl: path access granted: "911600dab2ae"
1343 1360 bundle2-input-part: total payload size 1553
1344 1361 bundle2-input-part: "phase-heads" supported
1345 1362 bundle2-input-part: total payload size 24
1346 1363 bundle2-input-bundle: 4 parts total
1347 1364 updating the branch cache
1348 1365 bundle2-output-bundle: "HG20", 1 parts total
1349 1366 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
1350 1367 bundle2-input-bundle: no-transaction
1351 1368 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
1352 1369 bundle2-input-bundle: 0 parts total
1353 1370 listing keys for "phases"
1354 1371 repository tip rolled back to revision 0 (undo push)
1355 1372 0:6675d58eff77
1356 1373
1357 1374
1358 1375 $ echo '[acl.deny]' >> $config
1359 1376 $ echo "foo/Bar/** = @group1" >> $config
1360 1377
1361 1378 @group is allowed inside anything but foo/Bar/
1362 1379
1363 1380 $ do_push fred
1364 1381 Pushing as user fred
1365 1382 hgrc = """
1366 1383 [hooks]
1367 1384 pretxnchangegroup.acl = python:hgext.acl.hook
1368 1385 [acl]
1369 1386 sources = push
1370 1387 [extensions]
1388 posixgetuser=$TESTTMP/posixgetuser.py
1371 1389 [acl.allow]
1372 1390 ** = @group1
1373 1391 [acl.deny]
1374 1392 foo/Bar/** = @group1
1375 1393 """
1376 1394 pushing to ../b
1377 1395 query 1; heads
1378 1396 searching for changes
1379 1397 all remote heads known locally
1380 1398 listing keys for "phases"
1381 1399 checking for updated bookmarks
1382 1400 listing keys for "bookmarks"
1383 1401 listing keys for "bookmarks"
1384 1402 3 changesets found
1385 1403 list of changesets:
1386 1404 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1387 1405 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1388 1406 911600dab2ae7a9baff75958b84fe606851ce955
1389 1407 bundle2-output-bundle: "HG20", 5 parts total
1390 1408 bundle2-output-part: "replycaps" 188 bytes payload
1391 1409 bundle2-output-part: "check:phases" 24 bytes payload
1392 1410 bundle2-output-part: "check:heads" streamed payload
1393 1411 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1394 1412 bundle2-output-part: "phase-heads" 24 bytes payload
1395 1413 bundle2-input-bundle: with-transaction
1396 1414 bundle2-input-part: "replycaps" supported
1397 1415 bundle2-input-part: total payload size 188
1398 1416 bundle2-input-part: "check:phases" supported
1399 1417 bundle2-input-part: total payload size 24
1400 1418 bundle2-input-part: "check:heads" supported
1401 1419 bundle2-input-part: total payload size 20
1402 1420 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1403 1421 adding changesets
1404 1422 add changeset ef1ea85a6374
1405 1423 add changeset f9cafe1212c8
1406 1424 add changeset 911600dab2ae
1407 1425 adding manifests
1408 1426 adding file changes
1409 1427 adding foo/Bar/file.txt revisions
1410 1428 adding foo/file.txt revisions
1411 1429 adding quux/file.py revisions
1412 1430 added 3 changesets with 3 changes to 3 files
1413 1431 calling hook pretxnchangegroup.acl: hgext.acl.hook
1414 1432 acl: checking access for user "fred"
1415 1433 acl: acl.allow.branches not enabled
1416 1434 acl: acl.deny.branches not enabled
1417 1435 acl: "group1" not defined in [acl.groups]
1418 1436 acl: acl.allow enabled, 1 entries for user fred
1419 1437 acl: "group1" not defined in [acl.groups]
1420 1438 acl: acl.deny enabled, 1 entries for user fred
1421 1439 acl: branch access granted: "ef1ea85a6374" on branch "default"
1422 1440 acl: path access granted: "ef1ea85a6374"
1423 1441 acl: branch access granted: "f9cafe1212c8" on branch "default"
1424 1442 error: pretxnchangegroup.acl hook failed: acl: user "fred" denied on "foo/Bar/file.txt" (changeset "f9cafe1212c8")
1425 1443 bundle2-input-part: total payload size 1553
1426 1444 bundle2-input-part: total payload size 24
1427 1445 bundle2-input-bundle: 4 parts total
1428 1446 transaction abort!
1429 1447 rollback completed
1430 1448 abort: acl: user "fred" denied on "foo/Bar/file.txt" (changeset "f9cafe1212c8")
1431 1449 no rollback information available
1432 1450 0:6675d58eff77
1433 1451
1434 1452
1435 1453 Invalid group
1436 1454
1437 1455 Disable the fakegroups trick to get real failures
1438 1456
1439 1457 $ grep -v fakegroups $config > config.tmp
1440 1458 $ mv config.tmp $config
1441 1459 $ echo '[acl.allow]' >> $config
1442 1460 $ echo "** = @unlikelytoexist" >> $config
1443 1461 $ do_push fred 2>&1 | grep unlikelytoexist
1444 1462 ** = @unlikelytoexist
1445 1463 acl: "unlikelytoexist" not defined in [acl.groups]
1446 1464 error: pretxnchangegroup.acl hook failed: group 'unlikelytoexist' is undefined
1447 1465 abort: group 'unlikelytoexist' is undefined
1448 1466
1449 1467
1450 1468 Branch acl tests setup
1451 1469
1452 1470 $ init_config
1453 1471 $ cd b
1454 1472 $ hg up
1455 1473 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1456 1474 $ hg branch foobar
1457 1475 marked working directory as branch foobar
1458 1476 (branches are permanent and global, did you want a bookmark?)
1459 1477 $ hg commit -m 'create foobar'
1460 1478 $ echo 'foo contents' > abc.txt
1461 1479 $ hg add abc.txt
1462 1480 $ hg commit -m 'foobar contents'
1463 1481 $ cd ..
1464 1482 $ hg --cwd a pull ../b
1465 1483 pulling from ../b
1466 1484 searching for changes
1467 1485 adding changesets
1468 1486 adding manifests
1469 1487 adding file changes
1470 1488 added 2 changesets with 1 changes to 1 files (+1 heads)
1471 1489 new changesets 81fbf4469322:fb35475503ef
1472 1490 (run 'hg heads' to see heads)
1473 1491
1474 1492 Create additional changeset on foobar branch
1475 1493
1476 1494 $ cd a
1477 1495 $ hg up -C foobar
1478 1496 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1479 1497 $ echo 'foo contents2' > abc.txt
1480 1498 $ hg commit -m 'foobar contents2'
1481 1499 $ cd ..
1482 1500
1483 1501
1484 1502 No branch acls specified
1485 1503
1486 1504 $ do_push astro
1487 1505 Pushing as user astro
1488 1506 hgrc = """
1489 1507 [hooks]
1490 1508 pretxnchangegroup.acl = python:hgext.acl.hook
1491 1509 [acl]
1492 1510 sources = push
1493 1511 [extensions]
1512 posixgetuser=$TESTTMP/posixgetuser.py
1494 1513 """
1495 1514 pushing to ../b
1496 1515 query 1; heads
1497 1516 searching for changes
1498 1517 all remote heads known locally
1499 1518 listing keys for "phases"
1500 1519 checking for updated bookmarks
1501 1520 listing keys for "bookmarks"
1502 1521 listing keys for "bookmarks"
1503 1522 4 changesets found
1504 1523 list of changesets:
1505 1524 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1506 1525 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1507 1526 911600dab2ae7a9baff75958b84fe606851ce955
1508 1527 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
1509 1528 bundle2-output-bundle: "HG20", 5 parts total
1510 1529 bundle2-output-part: "replycaps" 188 bytes payload
1511 1530 bundle2-output-part: "check:phases" 48 bytes payload
1512 1531 bundle2-output-part: "check:heads" streamed payload
1513 1532 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1514 1533 bundle2-output-part: "phase-heads" 48 bytes payload
1515 1534 bundle2-input-bundle: with-transaction
1516 1535 bundle2-input-part: "replycaps" supported
1517 1536 bundle2-input-part: total payload size 188
1518 1537 bundle2-input-part: "check:phases" supported
1519 1538 bundle2-input-part: total payload size 48
1520 1539 bundle2-input-part: "check:heads" supported
1521 1540 bundle2-input-part: total payload size 20
1522 1541 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1523 1542 adding changesets
1524 1543 add changeset ef1ea85a6374
1525 1544 add changeset f9cafe1212c8
1526 1545 add changeset 911600dab2ae
1527 1546 add changeset e8fc755d4d82
1528 1547 adding manifests
1529 1548 adding file changes
1530 1549 adding abc.txt revisions
1531 1550 adding foo/Bar/file.txt revisions
1532 1551 adding foo/file.txt revisions
1533 1552 adding quux/file.py revisions
1534 1553 added 4 changesets with 4 changes to 4 files (+1 heads)
1535 1554 calling hook pretxnchangegroup.acl: hgext.acl.hook
1536 1555 acl: checking access for user "astro"
1537 1556 acl: acl.allow.branches not enabled
1538 1557 acl: acl.deny.branches not enabled
1539 1558 acl: acl.allow not enabled
1540 1559 acl: acl.deny not enabled
1541 1560 acl: branch access granted: "ef1ea85a6374" on branch "default"
1542 1561 acl: path access granted: "ef1ea85a6374"
1543 1562 acl: branch access granted: "f9cafe1212c8" on branch "default"
1544 1563 acl: path access granted: "f9cafe1212c8"
1545 1564 acl: branch access granted: "911600dab2ae" on branch "default"
1546 1565 acl: path access granted: "911600dab2ae"
1547 1566 acl: branch access granted: "e8fc755d4d82" on branch "foobar"
1548 1567 acl: path access granted: "e8fc755d4d82"
1549 1568 bundle2-input-part: total payload size 2068
1550 1569 bundle2-input-part: "phase-heads" supported
1551 1570 bundle2-input-part: total payload size 48
1552 1571 bundle2-input-bundle: 4 parts total
1553 1572 updating the branch cache
1554 1573 bundle2-output-bundle: "HG20", 1 parts total
1555 1574 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
1556 1575 bundle2-input-bundle: no-transaction
1557 1576 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
1558 1577 bundle2-input-bundle: 0 parts total
1559 1578 listing keys for "phases"
1560 1579 repository tip rolled back to revision 2 (undo push)
1561 1580 2:fb35475503ef
1562 1581
1563 1582
1564 1583 Branch acl deny test
1565 1584
1566 1585 $ echo "[acl.deny.branches]" >> $config
1567 1586 $ echo "foobar = *" >> $config
1568 1587 $ do_push astro
1569 1588 Pushing as user astro
1570 1589 hgrc = """
1571 1590 [hooks]
1572 1591 pretxnchangegroup.acl = python:hgext.acl.hook
1573 1592 [acl]
1574 1593 sources = push
1575 1594 [extensions]
1595 posixgetuser=$TESTTMP/posixgetuser.py
1576 1596 [acl.deny.branches]
1577 1597 foobar = *
1578 1598 """
1579 1599 pushing to ../b
1580 1600 query 1; heads
1581 1601 searching for changes
1582 1602 all remote heads known locally
1583 1603 listing keys for "phases"
1584 1604 checking for updated bookmarks
1585 1605 listing keys for "bookmarks"
1586 1606 listing keys for "bookmarks"
1587 1607 4 changesets found
1588 1608 list of changesets:
1589 1609 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1590 1610 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1591 1611 911600dab2ae7a9baff75958b84fe606851ce955
1592 1612 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
1593 1613 bundle2-output-bundle: "HG20", 5 parts total
1594 1614 bundle2-output-part: "replycaps" 188 bytes payload
1595 1615 bundle2-output-part: "check:phases" 48 bytes payload
1596 1616 bundle2-output-part: "check:heads" streamed payload
1597 1617 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1598 1618 bundle2-output-part: "phase-heads" 48 bytes payload
1599 1619 bundle2-input-bundle: with-transaction
1600 1620 bundle2-input-part: "replycaps" supported
1601 1621 bundle2-input-part: total payload size 188
1602 1622 bundle2-input-part: "check:phases" supported
1603 1623 bundle2-input-part: total payload size 48
1604 1624 bundle2-input-part: "check:heads" supported
1605 1625 bundle2-input-part: total payload size 20
1606 1626 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1607 1627 adding changesets
1608 1628 add changeset ef1ea85a6374
1609 1629 add changeset f9cafe1212c8
1610 1630 add changeset 911600dab2ae
1611 1631 add changeset e8fc755d4d82
1612 1632 adding manifests
1613 1633 adding file changes
1614 1634 adding abc.txt revisions
1615 1635 adding foo/Bar/file.txt revisions
1616 1636 adding foo/file.txt revisions
1617 1637 adding quux/file.py revisions
1618 1638 added 4 changesets with 4 changes to 4 files (+1 heads)
1619 1639 calling hook pretxnchangegroup.acl: hgext.acl.hook
1620 1640 acl: checking access for user "astro"
1621 1641 acl: acl.allow.branches not enabled
1622 1642 acl: acl.deny.branches enabled, 1 entries for user astro
1623 1643 acl: acl.allow not enabled
1624 1644 acl: acl.deny not enabled
1625 1645 acl: branch access granted: "ef1ea85a6374" on branch "default"
1626 1646 acl: path access granted: "ef1ea85a6374"
1627 1647 acl: branch access granted: "f9cafe1212c8" on branch "default"
1628 1648 acl: path access granted: "f9cafe1212c8"
1629 1649 acl: branch access granted: "911600dab2ae" on branch "default"
1630 1650 acl: path access granted: "911600dab2ae"
1631 1651 error: pretxnchangegroup.acl hook failed: acl: user "astro" denied on branch "foobar" (changeset "e8fc755d4d82")
1632 1652 bundle2-input-part: total payload size 2068
1633 1653 bundle2-input-part: total payload size 48
1634 1654 bundle2-input-bundle: 4 parts total
1635 1655 transaction abort!
1636 1656 rollback completed
1637 1657 abort: acl: user "astro" denied on branch "foobar" (changeset "e8fc755d4d82")
1638 1658 no rollback information available
1639 1659 2:fb35475503ef
1640 1660
1641 1661
1642 1662 Branch acl empty allow test
1643 1663
1644 1664 $ init_config
1645 1665 $ echo "[acl.allow.branches]" >> $config
1646 1666 $ do_push astro
1647 1667 Pushing as user astro
1648 1668 hgrc = """
1649 1669 [hooks]
1650 1670 pretxnchangegroup.acl = python:hgext.acl.hook
1651 1671 [acl]
1652 1672 sources = push
1653 1673 [extensions]
1674 posixgetuser=$TESTTMP/posixgetuser.py
1654 1675 [acl.allow.branches]
1655 1676 """
1656 1677 pushing to ../b
1657 1678 query 1; heads
1658 1679 searching for changes
1659 1680 all remote heads known locally
1660 1681 listing keys for "phases"
1661 1682 checking for updated bookmarks
1662 1683 listing keys for "bookmarks"
1663 1684 listing keys for "bookmarks"
1664 1685 4 changesets found
1665 1686 list of changesets:
1666 1687 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1667 1688 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1668 1689 911600dab2ae7a9baff75958b84fe606851ce955
1669 1690 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
1670 1691 bundle2-output-bundle: "HG20", 5 parts total
1671 1692 bundle2-output-part: "replycaps" 188 bytes payload
1672 1693 bundle2-output-part: "check:phases" 48 bytes payload
1673 1694 bundle2-output-part: "check:heads" streamed payload
1674 1695 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1675 1696 bundle2-output-part: "phase-heads" 48 bytes payload
1676 1697 bundle2-input-bundle: with-transaction
1677 1698 bundle2-input-part: "replycaps" supported
1678 1699 bundle2-input-part: total payload size 188
1679 1700 bundle2-input-part: "check:phases" supported
1680 1701 bundle2-input-part: total payload size 48
1681 1702 bundle2-input-part: "check:heads" supported
1682 1703 bundle2-input-part: total payload size 20
1683 1704 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1684 1705 adding changesets
1685 1706 add changeset ef1ea85a6374
1686 1707 add changeset f9cafe1212c8
1687 1708 add changeset 911600dab2ae
1688 1709 add changeset e8fc755d4d82
1689 1710 adding manifests
1690 1711 adding file changes
1691 1712 adding abc.txt revisions
1692 1713 adding foo/Bar/file.txt revisions
1693 1714 adding foo/file.txt revisions
1694 1715 adding quux/file.py revisions
1695 1716 added 4 changesets with 4 changes to 4 files (+1 heads)
1696 1717 calling hook pretxnchangegroup.acl: hgext.acl.hook
1697 1718 acl: checking access for user "astro"
1698 1719 acl: acl.allow.branches enabled, 0 entries for user astro
1699 1720 acl: acl.deny.branches not enabled
1700 1721 acl: acl.allow not enabled
1701 1722 acl: acl.deny not enabled
1702 1723 error: pretxnchangegroup.acl hook failed: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
1703 1724 bundle2-input-part: total payload size 2068
1704 1725 bundle2-input-part: total payload size 48
1705 1726 bundle2-input-bundle: 4 parts total
1706 1727 transaction abort!
1707 1728 rollback completed
1708 1729 abort: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
1709 1730 no rollback information available
1710 1731 2:fb35475503ef
1711 1732
1712 1733
1713 1734 Branch acl allow other
1714 1735
1715 1736 $ init_config
1716 1737 $ echo "[acl.allow.branches]" >> $config
1717 1738 $ echo "* = george" >> $config
1718 1739 $ do_push astro
1719 1740 Pushing as user astro
1720 1741 hgrc = """
1721 1742 [hooks]
1722 1743 pretxnchangegroup.acl = python:hgext.acl.hook
1723 1744 [acl]
1724 1745 sources = push
1725 1746 [extensions]
1747 posixgetuser=$TESTTMP/posixgetuser.py
1726 1748 [acl.allow.branches]
1727 1749 * = george
1728 1750 """
1729 1751 pushing to ../b
1730 1752 query 1; heads
1731 1753 searching for changes
1732 1754 all remote heads known locally
1733 1755 listing keys for "phases"
1734 1756 checking for updated bookmarks
1735 1757 listing keys for "bookmarks"
1736 1758 listing keys for "bookmarks"
1737 1759 4 changesets found
1738 1760 list of changesets:
1739 1761 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1740 1762 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1741 1763 911600dab2ae7a9baff75958b84fe606851ce955
1742 1764 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
1743 1765 bundle2-output-bundle: "HG20", 5 parts total
1744 1766 bundle2-output-part: "replycaps" 188 bytes payload
1745 1767 bundle2-output-part: "check:phases" 48 bytes payload
1746 1768 bundle2-output-part: "check:heads" streamed payload
1747 1769 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1748 1770 bundle2-output-part: "phase-heads" 48 bytes payload
1749 1771 bundle2-input-bundle: with-transaction
1750 1772 bundle2-input-part: "replycaps" supported
1751 1773 bundle2-input-part: total payload size 188
1752 1774 bundle2-input-part: "check:phases" supported
1753 1775 bundle2-input-part: total payload size 48
1754 1776 bundle2-input-part: "check:heads" supported
1755 1777 bundle2-input-part: total payload size 20
1756 1778 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1757 1779 adding changesets
1758 1780 add changeset ef1ea85a6374
1759 1781 add changeset f9cafe1212c8
1760 1782 add changeset 911600dab2ae
1761 1783 add changeset e8fc755d4d82
1762 1784 adding manifests
1763 1785 adding file changes
1764 1786 adding abc.txt revisions
1765 1787 adding foo/Bar/file.txt revisions
1766 1788 adding foo/file.txt revisions
1767 1789 adding quux/file.py revisions
1768 1790 added 4 changesets with 4 changes to 4 files (+1 heads)
1769 1791 calling hook pretxnchangegroup.acl: hgext.acl.hook
1770 1792 acl: checking access for user "astro"
1771 1793 acl: acl.allow.branches enabled, 0 entries for user astro
1772 1794 acl: acl.deny.branches not enabled
1773 1795 acl: acl.allow not enabled
1774 1796 acl: acl.deny not enabled
1775 1797 error: pretxnchangegroup.acl hook failed: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
1776 1798 bundle2-input-part: total payload size 2068
1777 1799 bundle2-input-part: total payload size 48
1778 1800 bundle2-input-bundle: 4 parts total
1779 1801 transaction abort!
1780 1802 rollback completed
1781 1803 abort: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
1782 1804 no rollback information available
1783 1805 2:fb35475503ef
1784 1806
1785 1807 $ do_push george
1786 1808 Pushing as user george
1787 1809 hgrc = """
1788 1810 [hooks]
1789 1811 pretxnchangegroup.acl = python:hgext.acl.hook
1790 1812 [acl]
1791 1813 sources = push
1792 1814 [extensions]
1815 posixgetuser=$TESTTMP/posixgetuser.py
1793 1816 [acl.allow.branches]
1794 1817 * = george
1795 1818 """
1796 1819 pushing to ../b
1797 1820 query 1; heads
1798 1821 searching for changes
1799 1822 all remote heads known locally
1800 1823 listing keys for "phases"
1801 1824 checking for updated bookmarks
1802 1825 listing keys for "bookmarks"
1803 1826 listing keys for "bookmarks"
1804 1827 4 changesets found
1805 1828 list of changesets:
1806 1829 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1807 1830 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1808 1831 911600dab2ae7a9baff75958b84fe606851ce955
1809 1832 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
1810 1833 bundle2-output-bundle: "HG20", 5 parts total
1811 1834 bundle2-output-part: "replycaps" 188 bytes payload
1812 1835 bundle2-output-part: "check:phases" 48 bytes payload
1813 1836 bundle2-output-part: "check:heads" streamed payload
1814 1837 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1815 1838 bundle2-output-part: "phase-heads" 48 bytes payload
1816 1839 bundle2-input-bundle: with-transaction
1817 1840 bundle2-input-part: "replycaps" supported
1818 1841 bundle2-input-part: total payload size 188
1819 1842 bundle2-input-part: "check:phases" supported
1820 1843 bundle2-input-part: total payload size 48
1821 1844 bundle2-input-part: "check:heads" supported
1822 1845 bundle2-input-part: total payload size 20
1823 1846 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1824 1847 adding changesets
1825 1848 add changeset ef1ea85a6374
1826 1849 add changeset f9cafe1212c8
1827 1850 add changeset 911600dab2ae
1828 1851 add changeset e8fc755d4d82
1829 1852 adding manifests
1830 1853 adding file changes
1831 1854 adding abc.txt revisions
1832 1855 adding foo/Bar/file.txt revisions
1833 1856 adding foo/file.txt revisions
1834 1857 adding quux/file.py revisions
1835 1858 added 4 changesets with 4 changes to 4 files (+1 heads)
1836 1859 calling hook pretxnchangegroup.acl: hgext.acl.hook
1837 1860 acl: checking access for user "george"
1838 1861 acl: acl.allow.branches enabled, 1 entries for user george
1839 1862 acl: acl.deny.branches not enabled
1840 1863 acl: acl.allow not enabled
1841 1864 acl: acl.deny not enabled
1842 1865 acl: branch access granted: "ef1ea85a6374" on branch "default"
1843 1866 acl: path access granted: "ef1ea85a6374"
1844 1867 acl: branch access granted: "f9cafe1212c8" on branch "default"
1845 1868 acl: path access granted: "f9cafe1212c8"
1846 1869 acl: branch access granted: "911600dab2ae" on branch "default"
1847 1870 acl: path access granted: "911600dab2ae"
1848 1871 acl: branch access granted: "e8fc755d4d82" on branch "foobar"
1849 1872 acl: path access granted: "e8fc755d4d82"
1850 1873 bundle2-input-part: total payload size 2068
1851 1874 bundle2-input-part: "phase-heads" supported
1852 1875 bundle2-input-part: total payload size 48
1853 1876 bundle2-input-bundle: 4 parts total
1854 1877 updating the branch cache
1855 1878 bundle2-output-bundle: "HG20", 1 parts total
1856 1879 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
1857 1880 bundle2-input-bundle: no-transaction
1858 1881 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
1859 1882 bundle2-input-bundle: 0 parts total
1860 1883 listing keys for "phases"
1861 1884 repository tip rolled back to revision 2 (undo push)
1862 1885 2:fb35475503ef
1863 1886
1864 1887
1865 1888 Branch acl conflicting allow
1866 1889 asterisk ends up applying to all branches and allowing george to
1867 1890 push foobar into the remote
1868 1891
1869 1892 $ init_config
1870 1893 $ echo "[acl.allow.branches]" >> $config
1871 1894 $ echo "foobar = astro" >> $config
1872 1895 $ echo "* = george" >> $config
1873 1896 $ do_push george
1874 1897 Pushing as user george
1875 1898 hgrc = """
1876 1899 [hooks]
1877 1900 pretxnchangegroup.acl = python:hgext.acl.hook
1878 1901 [acl]
1879 1902 sources = push
1880 1903 [extensions]
1904 posixgetuser=$TESTTMP/posixgetuser.py
1881 1905 [acl.allow.branches]
1882 1906 foobar = astro
1883 1907 * = george
1884 1908 """
1885 1909 pushing to ../b
1886 1910 query 1; heads
1887 1911 searching for changes
1888 1912 all remote heads known locally
1889 1913 listing keys for "phases"
1890 1914 checking for updated bookmarks
1891 1915 listing keys for "bookmarks"
1892 1916 listing keys for "bookmarks"
1893 1917 4 changesets found
1894 1918 list of changesets:
1895 1919 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1896 1920 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1897 1921 911600dab2ae7a9baff75958b84fe606851ce955
1898 1922 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
1899 1923 bundle2-output-bundle: "HG20", 5 parts total
1900 1924 bundle2-output-part: "replycaps" 188 bytes payload
1901 1925 bundle2-output-part: "check:phases" 48 bytes payload
1902 1926 bundle2-output-part: "check:heads" streamed payload
1903 1927 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1904 1928 bundle2-output-part: "phase-heads" 48 bytes payload
1905 1929 bundle2-input-bundle: with-transaction
1906 1930 bundle2-input-part: "replycaps" supported
1907 1931 bundle2-input-part: total payload size 188
1908 1932 bundle2-input-part: "check:phases" supported
1909 1933 bundle2-input-part: total payload size 48
1910 1934 bundle2-input-part: "check:heads" supported
1911 1935 bundle2-input-part: total payload size 20
1912 1936 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
1913 1937 adding changesets
1914 1938 add changeset ef1ea85a6374
1915 1939 add changeset f9cafe1212c8
1916 1940 add changeset 911600dab2ae
1917 1941 add changeset e8fc755d4d82
1918 1942 adding manifests
1919 1943 adding file changes
1920 1944 adding abc.txt revisions
1921 1945 adding foo/Bar/file.txt revisions
1922 1946 adding foo/file.txt revisions
1923 1947 adding quux/file.py revisions
1924 1948 added 4 changesets with 4 changes to 4 files (+1 heads)
1925 1949 calling hook pretxnchangegroup.acl: hgext.acl.hook
1926 1950 acl: checking access for user "george"
1927 1951 acl: acl.allow.branches enabled, 1 entries for user george
1928 1952 acl: acl.deny.branches not enabled
1929 1953 acl: acl.allow not enabled
1930 1954 acl: acl.deny not enabled
1931 1955 acl: branch access granted: "ef1ea85a6374" on branch "default"
1932 1956 acl: path access granted: "ef1ea85a6374"
1933 1957 acl: branch access granted: "f9cafe1212c8" on branch "default"
1934 1958 acl: path access granted: "f9cafe1212c8"
1935 1959 acl: branch access granted: "911600dab2ae" on branch "default"
1936 1960 acl: path access granted: "911600dab2ae"
1937 1961 acl: branch access granted: "e8fc755d4d82" on branch "foobar"
1938 1962 acl: path access granted: "e8fc755d4d82"
1939 1963 bundle2-input-part: total payload size 2068
1940 1964 bundle2-input-part: "phase-heads" supported
1941 1965 bundle2-input-part: total payload size 48
1942 1966 bundle2-input-bundle: 4 parts total
1943 1967 updating the branch cache
1944 1968 bundle2-output-bundle: "HG20", 1 parts total
1945 1969 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
1946 1970 bundle2-input-bundle: no-transaction
1947 1971 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
1948 1972 bundle2-input-bundle: 0 parts total
1949 1973 listing keys for "phases"
1950 1974 repository tip rolled back to revision 2 (undo push)
1951 1975 2:fb35475503ef
1952 1976
1953 1977 Branch acl conflicting deny
1954 1978
1955 1979 $ init_config
1956 1980 $ echo "[acl.deny.branches]" >> $config
1957 1981 $ echo "foobar = astro" >> $config
1958 1982 $ echo "default = astro" >> $config
1959 1983 $ echo "* = george" >> $config
1960 1984 $ do_push george
1961 1985 Pushing as user george
1962 1986 hgrc = """
1963 1987 [hooks]
1964 1988 pretxnchangegroup.acl = python:hgext.acl.hook
1965 1989 [acl]
1966 1990 sources = push
1967 1991 [extensions]
1992 posixgetuser=$TESTTMP/posixgetuser.py
1968 1993 [acl.deny.branches]
1969 1994 foobar = astro
1970 1995 default = astro
1971 1996 * = george
1972 1997 """
1973 1998 pushing to ../b
1974 1999 query 1; heads
1975 2000 searching for changes
1976 2001 all remote heads known locally
1977 2002 listing keys for "phases"
1978 2003 checking for updated bookmarks
1979 2004 listing keys for "bookmarks"
1980 2005 listing keys for "bookmarks"
1981 2006 4 changesets found
1982 2007 list of changesets:
1983 2008 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
1984 2009 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
1985 2010 911600dab2ae7a9baff75958b84fe606851ce955
1986 2011 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
1987 2012 bundle2-output-bundle: "HG20", 5 parts total
1988 2013 bundle2-output-part: "replycaps" 188 bytes payload
1989 2014 bundle2-output-part: "check:phases" 48 bytes payload
1990 2015 bundle2-output-part: "check:heads" streamed payload
1991 2016 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
1992 2017 bundle2-output-part: "phase-heads" 48 bytes payload
1993 2018 bundle2-input-bundle: with-transaction
1994 2019 bundle2-input-part: "replycaps" supported
1995 2020 bundle2-input-part: total payload size 188
1996 2021 bundle2-input-part: "check:phases" supported
1997 2022 bundle2-input-part: total payload size 48
1998 2023 bundle2-input-part: "check:heads" supported
1999 2024 bundle2-input-part: total payload size 20
2000 2025 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
2001 2026 adding changesets
2002 2027 add changeset ef1ea85a6374
2003 2028 add changeset f9cafe1212c8
2004 2029 add changeset 911600dab2ae
2005 2030 add changeset e8fc755d4d82
2006 2031 adding manifests
2007 2032 adding file changes
2008 2033 adding abc.txt revisions
2009 2034 adding foo/Bar/file.txt revisions
2010 2035 adding foo/file.txt revisions
2011 2036 adding quux/file.py revisions
2012 2037 added 4 changesets with 4 changes to 4 files (+1 heads)
2013 2038 calling hook pretxnchangegroup.acl: hgext.acl.hook
2014 2039 acl: checking access for user "george"
2015 2040 acl: acl.allow.branches not enabled
2016 2041 acl: acl.deny.branches enabled, 1 entries for user george
2017 2042 acl: acl.allow not enabled
2018 2043 acl: acl.deny not enabled
2019 2044 error: pretxnchangegroup.acl hook failed: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374")
2020 2045 bundle2-input-part: total payload size 2068
2021 2046 bundle2-input-part: total payload size 48
2022 2047 bundle2-input-bundle: 4 parts total
2023 2048 transaction abort!
2024 2049 rollback completed
2025 2050 abort: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374")
2026 2051 no rollback information available
2027 2052 2:fb35475503ef
2028 2053
2029 2054 User 'astro' must not be denied
2030 2055
2031 2056 $ init_config
2032 2057 $ echo "[acl.deny.branches]" >> $config
2033 2058 $ echo "default = !astro" >> $config
2034 2059 $ do_push astro
2035 2060 Pushing as user astro
2036 2061 hgrc = """
2037 2062 [hooks]
2038 2063 pretxnchangegroup.acl = python:hgext.acl.hook
2039 2064 [acl]
2040 2065 sources = push
2041 2066 [extensions]
2067 posixgetuser=$TESTTMP/posixgetuser.py
2042 2068 [acl.deny.branches]
2043 2069 default = !astro
2044 2070 """
2045 2071 pushing to ../b
2046 2072 query 1; heads
2047 2073 searching for changes
2048 2074 all remote heads known locally
2049 2075 listing keys for "phases"
2050 2076 checking for updated bookmarks
2051 2077 listing keys for "bookmarks"
2052 2078 listing keys for "bookmarks"
2053 2079 4 changesets found
2054 2080 list of changesets:
2055 2081 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
2056 2082 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
2057 2083 911600dab2ae7a9baff75958b84fe606851ce955
2058 2084 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
2059 2085 bundle2-output-bundle: "HG20", 5 parts total
2060 2086 bundle2-output-part: "replycaps" 188 bytes payload
2061 2087 bundle2-output-part: "check:phases" 48 bytes payload
2062 2088 bundle2-output-part: "check:heads" streamed payload
2063 2089 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
2064 2090 bundle2-output-part: "phase-heads" 48 bytes payload
2065 2091 bundle2-input-bundle: with-transaction
2066 2092 bundle2-input-part: "replycaps" supported
2067 2093 bundle2-input-part: total payload size 188
2068 2094 bundle2-input-part: "check:phases" supported
2069 2095 bundle2-input-part: total payload size 48
2070 2096 bundle2-input-part: "check:heads" supported
2071 2097 bundle2-input-part: total payload size 20
2072 2098 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
2073 2099 adding changesets
2074 2100 add changeset ef1ea85a6374
2075 2101 add changeset f9cafe1212c8
2076 2102 add changeset 911600dab2ae
2077 2103 add changeset e8fc755d4d82
2078 2104 adding manifests
2079 2105 adding file changes
2080 2106 adding abc.txt revisions
2081 2107 adding foo/Bar/file.txt revisions
2082 2108 adding foo/file.txt revisions
2083 2109 adding quux/file.py revisions
2084 2110 added 4 changesets with 4 changes to 4 files (+1 heads)
2085 2111 calling hook pretxnchangegroup.acl: hgext.acl.hook
2086 2112 acl: checking access for user "astro"
2087 2113 acl: acl.allow.branches not enabled
2088 2114 acl: acl.deny.branches enabled, 0 entries for user astro
2089 2115 acl: acl.allow not enabled
2090 2116 acl: acl.deny not enabled
2091 2117 acl: branch access granted: "ef1ea85a6374" on branch "default"
2092 2118 acl: path access granted: "ef1ea85a6374"
2093 2119 acl: branch access granted: "f9cafe1212c8" on branch "default"
2094 2120 acl: path access granted: "f9cafe1212c8"
2095 2121 acl: branch access granted: "911600dab2ae" on branch "default"
2096 2122 acl: path access granted: "911600dab2ae"
2097 2123 acl: branch access granted: "e8fc755d4d82" on branch "foobar"
2098 2124 acl: path access granted: "e8fc755d4d82"
2099 2125 bundle2-input-part: total payload size 2068
2100 2126 bundle2-input-part: "phase-heads" supported
2101 2127 bundle2-input-part: total payload size 48
2102 2128 bundle2-input-bundle: 4 parts total
2103 2129 updating the branch cache
2104 2130 bundle2-output-bundle: "HG20", 1 parts total
2105 2131 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
2106 2132 bundle2-input-bundle: no-transaction
2107 2133 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
2108 2134 bundle2-input-bundle: 0 parts total
2109 2135 listing keys for "phases"
2110 2136 repository tip rolled back to revision 2 (undo push)
2111 2137 2:fb35475503ef
2112 2138
2113 2139
2114 2140 Non-astro users must be denied
2115 2141
2116 2142 $ do_push george
2117 2143 Pushing as user george
2118 2144 hgrc = """
2119 2145 [hooks]
2120 2146 pretxnchangegroup.acl = python:hgext.acl.hook
2121 2147 [acl]
2122 2148 sources = push
2123 2149 [extensions]
2150 posixgetuser=$TESTTMP/posixgetuser.py
2124 2151 [acl.deny.branches]
2125 2152 default = !astro
2126 2153 """
2127 2154 pushing to ../b
2128 2155 query 1; heads
2129 2156 searching for changes
2130 2157 all remote heads known locally
2131 2158 listing keys for "phases"
2132 2159 checking for updated bookmarks
2133 2160 listing keys for "bookmarks"
2134 2161 listing keys for "bookmarks"
2135 2162 4 changesets found
2136 2163 list of changesets:
2137 2164 ef1ea85a6374b77d6da9dcda9541f498f2d17df7
2138 2165 f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
2139 2166 911600dab2ae7a9baff75958b84fe606851ce955
2140 2167 e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
2141 2168 bundle2-output-bundle: "HG20", 5 parts total
2142 2169 bundle2-output-part: "replycaps" 188 bytes payload
2143 2170 bundle2-output-part: "check:phases" 48 bytes payload
2144 2171 bundle2-output-part: "check:heads" streamed payload
2145 2172 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
2146 2173 bundle2-output-part: "phase-heads" 48 bytes payload
2147 2174 bundle2-input-bundle: with-transaction
2148 2175 bundle2-input-part: "replycaps" supported
2149 2176 bundle2-input-part: total payload size 188
2150 2177 bundle2-input-part: "check:phases" supported
2151 2178 bundle2-input-part: total payload size 48
2152 2179 bundle2-input-part: "check:heads" supported
2153 2180 bundle2-input-part: total payload size 20
2154 2181 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
2155 2182 adding changesets
2156 2183 add changeset ef1ea85a6374
2157 2184 add changeset f9cafe1212c8
2158 2185 add changeset 911600dab2ae
2159 2186 add changeset e8fc755d4d82
2160 2187 adding manifests
2161 2188 adding file changes
2162 2189 adding abc.txt revisions
2163 2190 adding foo/Bar/file.txt revisions
2164 2191 adding foo/file.txt revisions
2165 2192 adding quux/file.py revisions
2166 2193 added 4 changesets with 4 changes to 4 files (+1 heads)
2167 2194 calling hook pretxnchangegroup.acl: hgext.acl.hook
2168 2195 acl: checking access for user "george"
2169 2196 acl: acl.allow.branches not enabled
2170 2197 acl: acl.deny.branches enabled, 1 entries for user george
2171 2198 acl: acl.allow not enabled
2172 2199 acl: acl.deny not enabled
2173 2200 error: pretxnchangegroup.acl hook failed: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374")
2174 2201 bundle2-input-part: total payload size 2068
2175 2202 bundle2-input-part: total payload size 48
2176 2203 bundle2-input-bundle: 4 parts total
2177 2204 transaction abort!
2178 2205 rollback completed
2179 2206 abort: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374")
2180 2207 no rollback information available
2181 2208 2:fb35475503ef
2182 2209
2183 2210
General Comments 0
You need to be logged in to leave comments. Login now