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