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