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