Show More
@@ -1,236 +1,240 b'' | |||
|
1 | The simple store doesn't escape paths robustly and can't store paths | |
|
2 | with periods, etc. So much of this test fails with it. | |
|
3 | #require no-reposimplestore | |
|
4 | ||
|
1 | 5 |
$ |
|
2 | 6 | |
|
3 | 7 | audit of .hg |
|
4 | 8 | |
|
5 | 9 | $ hg add .hg/00changelog.i |
|
6 | 10 | abort: path contains illegal component: .hg/00changelog.i |
|
7 | 11 | [255] |
|
8 | 12 | |
|
9 | 13 | #if symlink |
|
10 | 14 | |
|
11 | 15 | Symlinks |
|
12 | 16 | |
|
13 | 17 | $ mkdir a |
|
14 | 18 | $ echo a > a/a |
|
15 | 19 | $ hg ci -Ama |
|
16 | 20 | adding a/a |
|
17 | 21 | $ ln -s a b |
|
18 | 22 | $ echo b > a/b |
|
19 | 23 | $ hg add b/b |
|
20 | 24 | abort: path 'b/b' traverses symbolic link 'b' |
|
21 | 25 | [255] |
|
22 | 26 | $ hg add b |
|
23 | 27 | |
|
24 | 28 | should still fail - maybe |
|
25 | 29 | |
|
26 | 30 | $ hg add b/b |
|
27 | 31 | abort: path 'b/b' traverses symbolic link 'b' |
|
28 | 32 | [255] |
|
29 | 33 | |
|
30 | 34 | $ hg commit -m 'add symlink b' |
|
31 | 35 | |
|
32 | 36 | |
|
33 | 37 | Test symlink traversing when accessing history: |
|
34 | 38 | ----------------------------------------------- |
|
35 | 39 | |
|
36 | 40 | (build a changeset where the path exists as a directory) |
|
37 | 41 | |
|
38 | 42 | $ hg up 0 |
|
39 | 43 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
40 | 44 | $ mkdir b |
|
41 | 45 | $ echo c > b/a |
|
42 | 46 | $ hg add b/a |
|
43 | 47 | $ hg ci -m 'add directory b' |
|
44 | 48 | created new head |
|
45 | 49 | |
|
46 | 50 | Test that hg cat does not do anything wrong the working copy has 'b' as directory |
|
47 | 51 | |
|
48 | 52 | $ hg cat b/a |
|
49 | 53 | c |
|
50 | 54 | $ hg cat -r "desc(directory)" b/a |
|
51 | 55 | c |
|
52 | 56 | $ hg cat -r "desc(symlink)" b/a |
|
53 | 57 | b/a: no such file in rev bc151a1f53bd |
|
54 | 58 | [1] |
|
55 | 59 | |
|
56 | 60 | Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749) |
|
57 | 61 | |
|
58 | 62 | $ hg up 'desc(symlink)' |
|
59 | 63 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
60 | 64 | $ hg cat b/a |
|
61 | 65 | b/a: no such file in rev bc151a1f53bd |
|
62 | 66 | [1] |
|
63 | 67 | $ hg cat -r "desc(directory)" b/a |
|
64 | 68 | c |
|
65 | 69 | $ hg cat -r "desc(symlink)" b/a |
|
66 | 70 | b/a: no such file in rev bc151a1f53bd |
|
67 | 71 | [1] |
|
68 | 72 | |
|
69 | 73 | #endif |
|
70 | 74 | |
|
71 | 75 | |
|
72 | 76 | unbundle tampered bundle |
|
73 | 77 | |
|
74 | 78 | $ hg init target |
|
75 | 79 | $ cd target |
|
76 | 80 | $ hg unbundle "$TESTDIR/bundles/tampered.hg" |
|
77 | 81 | adding changesets |
|
78 | 82 | adding manifests |
|
79 | 83 | adding file changes |
|
80 | 84 | added 5 changesets with 6 changes to 6 files (+4 heads) |
|
81 | 85 | new changesets b7da9bf6b037:fc1393d727bc |
|
82 | 86 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
83 | 87 | |
|
84 | 88 | attack .hg/test |
|
85 | 89 | |
|
86 | 90 | $ hg manifest -r0 |
|
87 | 91 | .hg/test |
|
88 | 92 | $ hg update -Cr0 |
|
89 | 93 | abort: path contains illegal component: .hg/test |
|
90 | 94 | [255] |
|
91 | 95 | |
|
92 | 96 | attack foo/.hg/test |
|
93 | 97 | |
|
94 | 98 | $ hg manifest -r1 |
|
95 | 99 | foo/.hg/test |
|
96 | 100 | $ hg update -Cr1 |
|
97 | 101 | abort: path 'foo/.hg/test' is inside nested repo 'foo' |
|
98 | 102 | [255] |
|
99 | 103 | |
|
100 | 104 | attack back/test where back symlinks to .. |
|
101 | 105 | |
|
102 | 106 | $ hg manifest -r2 |
|
103 | 107 | back |
|
104 | 108 | back/test |
|
105 | 109 | #if symlink |
|
106 | 110 | $ hg update -Cr2 |
|
107 | 111 | abort: path 'back/test' traverses symbolic link 'back' |
|
108 | 112 | [255] |
|
109 | 113 | #else |
|
110 | 114 | ('back' will be a file and cause some other system specific error) |
|
111 | 115 | $ hg update -Cr2 |
|
112 | 116 | abort: $TESTTMP/target/back/test: $ENOTDIR$ |
|
113 | 117 | [255] |
|
114 | 118 | #endif |
|
115 | 119 | |
|
116 | 120 | attack ../test |
|
117 | 121 | |
|
118 | 122 | $ hg manifest -r3 |
|
119 | 123 | ../test |
|
120 | 124 | $ mkdir ../test |
|
121 | 125 | $ echo data > ../test/file |
|
122 | 126 | $ hg update -Cr3 |
|
123 | 127 | abort: path contains illegal component: ../test |
|
124 | 128 | [255] |
|
125 | 129 | $ cat ../test/file |
|
126 | 130 | data |
|
127 | 131 | |
|
128 | 132 | attack /tmp/test |
|
129 | 133 | |
|
130 | 134 | $ hg manifest -r4 |
|
131 | 135 | /tmp/test |
|
132 | 136 | $ hg update -Cr4 |
|
133 | 137 | abort: path contains illegal component: /tmp/test |
|
134 | 138 | [255] |
|
135 | 139 | |
|
136 | 140 | $ cd .. |
|
137 | 141 | |
|
138 | 142 | Test symlink traversal on merge: |
|
139 | 143 | -------------------------------- |
|
140 | 144 | |
|
141 | 145 | #if symlink |
|
142 | 146 | |
|
143 | 147 | set up symlink hell |
|
144 | 148 | |
|
145 | 149 | $ mkdir merge-symlink-out |
|
146 | 150 | $ hg init merge-symlink |
|
147 | 151 | $ cd merge-symlink |
|
148 | 152 | $ touch base |
|
149 | 153 | $ hg commit -qAm base |
|
150 | 154 | $ ln -s ../merge-symlink-out a |
|
151 | 155 | $ hg commit -qAm 'symlink a -> ../merge-symlink-out' |
|
152 | 156 | $ hg up -q 0 |
|
153 | 157 | $ mkdir a |
|
154 | 158 | $ touch a/poisoned |
|
155 | 159 | $ hg commit -qAm 'file a/poisoned' |
|
156 | 160 | $ hg log -G -T '{rev}: {desc}\n' |
|
157 | 161 | @ 2: file a/poisoned |
|
158 | 162 | | |
|
159 | 163 | | o 1: symlink a -> ../merge-symlink-out |
|
160 | 164 | |/ |
|
161 | 165 | o 0: base |
|
162 | 166 | |
|
163 | 167 | |
|
164 | 168 | try trivial merge |
|
165 | 169 | |
|
166 | 170 | $ hg up -qC 1 |
|
167 | 171 | $ hg merge 2 |
|
168 | 172 | abort: path 'a/poisoned' traverses symbolic link 'a' |
|
169 | 173 | [255] |
|
170 | 174 | |
|
171 | 175 | try rebase onto other revision: cache of audited paths should be discarded, |
|
172 | 176 | and the rebase should fail (issue5628) |
|
173 | 177 | |
|
174 | 178 | $ hg up -qC 2 |
|
175 | 179 | $ hg rebase -s 2 -d 1 --config extensions.rebase= |
|
176 | 180 | rebasing 2:e73c21d6b244 "file a/poisoned" (tip) |
|
177 | 181 | abort: path 'a/poisoned' traverses symbolic link 'a' |
|
178 | 182 | [255] |
|
179 | 183 | $ ls ../merge-symlink-out |
|
180 | 184 | |
|
181 | 185 | $ cd .. |
|
182 | 186 | |
|
183 | 187 | Test symlink traversal on update: |
|
184 | 188 | --------------------------------- |
|
185 | 189 | |
|
186 | 190 | $ mkdir update-symlink-out |
|
187 | 191 | $ hg init update-symlink |
|
188 | 192 | $ cd update-symlink |
|
189 | 193 | $ ln -s ../update-symlink-out a |
|
190 | 194 | $ hg commit -qAm 'symlink a -> ../update-symlink-out' |
|
191 | 195 | $ hg rm a |
|
192 | 196 | $ mkdir a && touch a/b |
|
193 | 197 | $ hg ci -qAm 'file a/b' a/b |
|
194 | 198 | $ hg up -qC 0 |
|
195 | 199 | $ hg rm a |
|
196 | 200 | $ mkdir a && touch a/c |
|
197 | 201 | $ hg ci -qAm 'rm a, file a/c' |
|
198 | 202 | $ hg log -G -T '{rev}: {desc}\n' |
|
199 | 203 | @ 2: rm a, file a/c |
|
200 | 204 | | |
|
201 | 205 | | o 1: file a/b |
|
202 | 206 | |/ |
|
203 | 207 | o 0: symlink a -> ../update-symlink-out |
|
204 | 208 | |
|
205 | 209 | |
|
206 | 210 | try linear update where symlink already exists: |
|
207 | 211 | |
|
208 | 212 | $ hg up -qC 0 |
|
209 | 213 | $ hg up 1 |
|
210 | 214 | abort: path 'a/b' traverses symbolic link 'a' |
|
211 | 215 | [255] |
|
212 | 216 | |
|
213 | 217 | try linear update including symlinked directory and its content: paths are |
|
214 | 218 | audited first by calculateupdates(), where no symlink is created so both |
|
215 | 219 | 'a' and 'a/b' are taken as good paths. still applyupdates() should fail. |
|
216 | 220 | |
|
217 | 221 | $ hg up -qC null |
|
218 | 222 | $ hg up 1 |
|
219 | 223 | abort: path 'a/b' traverses symbolic link 'a' |
|
220 | 224 | [255] |
|
221 | 225 | $ ls ../update-symlink-out |
|
222 | 226 | |
|
223 | 227 | try branch update replacing directory with symlink, and its content: the |
|
224 | 228 | path 'a' is audited as a directory first, which should be audited again as |
|
225 | 229 | a symlink. |
|
226 | 230 | |
|
227 | 231 | $ rm -f a |
|
228 | 232 | $ hg up -qC 2 |
|
229 | 233 | $ hg up 1 |
|
230 | 234 | abort: path 'a/b' traverses symbolic link 'a' |
|
231 | 235 | [255] |
|
232 | 236 | $ ls ../update-symlink-out |
|
233 | 237 | |
|
234 | 238 | $ cd .. |
|
235 | 239 | |
|
236 | 240 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now