Debian Codegraph @

tests/test-narrow-acl-excludes.t

raw
1 Test exclusion-based ACL enforcement
2 $ . "$TESTDIR/narrow-library.sh"
3
4 $ hg init master
5 $ cd master
6
7 $ for x in `$TESTDIR/seq.py 3`; do
8 > echo $x > "f$x"
9 > hg add "f$x"
10 > hg commit -m "Add $x"
11 > done
12 $ cat >> .hg/hgrc << EOF
13 > [narrowacl]
14 > default.includes=*
15 > default.excludes=f2 f3
16 > test.excludes=f3
17 > EOF
18 $ hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid
19 $ cat hg.pid >> "$DAEMON_PIDS"
20
21 $ cd ..
22 $ hg clone http://localhost:$HGPORT1 narrowclone1
23 requesting all changes
24 adding changesets
25 adding manifests
26 adding file changes
27 added 3 changesets with 2 changes to 2 files
28 new changesets * (glob)
29 updating to branch default
30 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
31
32 The clone directory should only contain f1 and f2
33 $ ls -A -1 narrowclone1 | sort
34 .hg
35 f1
36 f2
37
38 Requirements should contain narrowhg
39 $ hg debugrequires -R narrowclone1 | grep narrowhg
40 narrowhg-experimental
41
42 NarrowHG should exclude f3.
43 $ hg -R narrowclone1 tracked
44 I path:.
45 X path:f3
46
47 Narrow should not be able to widen to include f3
48 $ hg -R narrowclone1 tracked --addinclude f3
49 comparing with http://localhost:$HGPORT1/
50 searching for changes
51 adding changesets
52 adding manifests
53 adding file changes
54 $ ls -A -1 narrowclone1 | sort
55 .hg
56 f1
57 f2
58 $ hg -R narrowclone1 tracked
59 I path:.
60 X path:f3
61
62
63 Narrow should not be able to remove the exclusion for f3
64 $ hg -R narrowclone1 tracked --removeexclude f3
65 comparing with http://localhost:$HGPORT1/
66 searching for changes
67 abort: The following excludes cannot be removed for test: ['path:f3']
68 [255]
69 $ ls -A -1 narrowclone1 | sort
70 .hg
71 f1
72 f2
73 $ hg -R narrowclone1 tracked
74 I path:.
75 X path:f3