##// END OF EJS Templates
merge with stable
Martin von Zweigbergk -
r41891:3d5a73c8 merge default
parent child Browse files
Show More
@@ -1,662 +1,703 b''
1 Test illegal name
1 Test illegal name
2 -----------------
2 -----------------
3
3
4 on commit:
4 on commit:
5
5
6 $ hg init hgname
6 $ hg init hgname
7 $ cd hgname
7 $ cd hgname
8 $ mkdir sub
8 $ mkdir sub
9 $ hg init sub/.hg
9 $ hg init sub/.hg
10 $ echo 'sub/.hg = sub/.hg' >> .hgsub
10 $ echo 'sub/.hg = sub/.hg' >> .hgsub
11 $ hg ci -qAm 'add subrepo "sub/.hg"'
11 $ hg ci -qAm 'add subrepo "sub/.hg"'
12 abort: path 'sub/.hg' is inside nested repo 'sub'
12 abort: path 'sub/.hg' is inside nested repo 'sub'
13 [255]
13 [255]
14
14
15 prepare tampered repo (including the commit above):
15 prepare tampered repo (including the commit above):
16
16
17 $ hg import --bypass -qm 'add subrepo "sub/.hg"' - <<'EOF'
17 $ hg import --bypass -qm 'add subrepo "sub/.hg"' - <<'EOF'
18 > diff --git a/.hgsub b/.hgsub
18 > diff --git a/.hgsub b/.hgsub
19 > new file mode 100644
19 > new file mode 100644
20 > --- /dev/null
20 > --- /dev/null
21 > +++ b/.hgsub
21 > +++ b/.hgsub
22 > @@ -0,0 +1,1 @@
22 > @@ -0,0 +1,1 @@
23 > +sub/.hg = sub/.hg
23 > +sub/.hg = sub/.hg
24 > diff --git a/.hgsubstate b/.hgsubstate
24 > diff --git a/.hgsubstate b/.hgsubstate
25 > new file mode 100644
25 > new file mode 100644
26 > --- /dev/null
26 > --- /dev/null
27 > +++ b/.hgsubstate
27 > +++ b/.hgsubstate
28 > @@ -0,0 +1,1 @@
28 > @@ -0,0 +1,1 @@
29 > +0000000000000000000000000000000000000000 sub/.hg
29 > +0000000000000000000000000000000000000000 sub/.hg
30 > EOF
30 > EOF
31 $ cd ..
31 $ cd ..
32
32
33 on clone (and update):
33 on clone (and update):
34
34
35 $ hg clone -q hgname hgname2
35 $ hg clone -q hgname hgname2
36 abort: path 'sub/.hg' is inside nested repo 'sub'
36 abort: path 'sub/.hg' is inside nested repo 'sub'
37 [255]
37 [255]
38
38
39 Test absolute path
39 Test absolute path
40 ------------------
40 ------------------
41
41
42 on commit:
42 on commit:
43
43
44 $ hg init absolutepath
44 $ hg init absolutepath
45 $ cd absolutepath
45 $ cd absolutepath
46 $ hg init sub
46 $ hg init sub
47 $ echo '/sub = sub' >> .hgsub
47 $ echo '/sub = sub' >> .hgsub
48 $ hg ci -qAm 'add subrepo "/sub"'
48 $ hg ci -qAm 'add subrepo "/sub"'
49 abort: path contains illegal component: /sub
49 abort: path contains illegal component: /sub
50 [255]
50 [255]
51
51
52 prepare tampered repo (including the commit above):
52 prepare tampered repo (including the commit above):
53
53
54 $ hg import --bypass -qm 'add subrepo "/sub"' - <<'EOF'
54 $ hg import --bypass -qm 'add subrepo "/sub"' - <<'EOF'
55 > diff --git a/.hgsub b/.hgsub
55 > diff --git a/.hgsub b/.hgsub
56 > new file mode 100644
56 > new file mode 100644
57 > --- /dev/null
57 > --- /dev/null
58 > +++ b/.hgsub
58 > +++ b/.hgsub
59 > @@ -0,0 +1,1 @@
59 > @@ -0,0 +1,1 @@
60 > +/sub = sub
60 > +/sub = sub
61 > diff --git a/.hgsubstate b/.hgsubstate
61 > diff --git a/.hgsubstate b/.hgsubstate
62 > new file mode 100644
62 > new file mode 100644
63 > --- /dev/null
63 > --- /dev/null
64 > +++ b/.hgsubstate
64 > +++ b/.hgsubstate
65 > @@ -0,0 +1,1 @@
65 > @@ -0,0 +1,1 @@
66 > +0000000000000000000000000000000000000000 /sub
66 > +0000000000000000000000000000000000000000 /sub
67 > EOF
67 > EOF
68 $ cd ..
68 $ cd ..
69
69
70 on clone (and update):
70 on clone (and update):
71
71
72 $ hg clone -q absolutepath absolutepath2
72 $ hg clone -q absolutepath absolutepath2
73 abort: path contains illegal component: /sub
73 abort: path contains illegal component: /sub
74 [255]
74 [255]
75
75
76 Test root path
76 Test root path
77 --------------
77 --------------
78
78
79 on commit:
79 on commit:
80
80
81 $ hg init rootpath
81 $ hg init rootpath
82 $ cd rootpath
82 $ cd rootpath
83 $ hg init sub
83 $ hg init sub
84 $ echo '/ = sub' >> .hgsub
84 $ echo '/ = sub' >> .hgsub
85 $ hg ci -qAm 'add subrepo "/"'
85 $ hg ci -qAm 'add subrepo "/"'
86 abort: path ends in directory separator: /
86 abort: path ends in directory separator: /
87 [255]
87 [255]
88
88
89 prepare tampered repo (including the commit above):
89 prepare tampered repo (including the commit above):
90
90
91 $ hg import --bypass -qm 'add subrepo "/"' - <<'EOF'
91 $ hg import --bypass -qm 'add subrepo "/"' - <<'EOF'
92 > diff --git a/.hgsub b/.hgsub
92 > diff --git a/.hgsub b/.hgsub
93 > new file mode 100644
93 > new file mode 100644
94 > --- /dev/null
94 > --- /dev/null
95 > +++ b/.hgsub
95 > +++ b/.hgsub
96 > @@ -0,0 +1,1 @@
96 > @@ -0,0 +1,1 @@
97 > +/ = sub
97 > +/ = sub
98 > diff --git a/.hgsubstate b/.hgsubstate
98 > diff --git a/.hgsubstate b/.hgsubstate
99 > new file mode 100644
99 > new file mode 100644
100 > --- /dev/null
100 > --- /dev/null
101 > +++ b/.hgsubstate
101 > +++ b/.hgsubstate
102 > @@ -0,0 +1,1 @@
102 > @@ -0,0 +1,1 @@
103 > +0000000000000000000000000000000000000000 /
103 > +0000000000000000000000000000000000000000 /
104 > EOF
104 > EOF
105 $ cd ..
105 $ cd ..
106
106
107 on clone (and update):
107 on clone (and update):
108
108
109 $ hg clone -q rootpath rootpath2
109 $ hg clone -q rootpath rootpath2
110 abort: path ends in directory separator: /
110 abort: path ends in directory separator: /
111 [255]
111 [255]
112
112
113 Test empty path
113 Test empty path
114 ---------------
114 ---------------
115
115
116 on commit:
116 on commit:
117
117
118 $ hg init emptypath
118 $ hg init emptypath
119 $ cd emptypath
119 $ cd emptypath
120 $ hg init sub
120 $ hg init sub
121 $ echo '= sub' >> .hgsub
121 $ echo '= sub' >> .hgsub
122 $ hg ci -qAm 'add subrepo ""'
122 $ hg ci -qAm 'add subrepo ""'
123 hg: parse error at .hgsub:1: = sub
123 hg: parse error at .hgsub:1: = sub
124 [255]
124 [255]
125
125
126 prepare tampered repo (including the commit above):
126 prepare tampered repo (including the commit above):
127
127
128 $ hg import --bypass -qm 'add subrepo ""' - <<'EOF'
128 $ hg import --bypass -qm 'add subrepo ""' - <<'EOF'
129 > diff --git a/.hgsub b/.hgsub
129 > diff --git a/.hgsub b/.hgsub
130 > new file mode 100644
130 > new file mode 100644
131 > --- /dev/null
131 > --- /dev/null
132 > +++ b/.hgsub
132 > +++ b/.hgsub
133 > @@ -0,0 +1,1 @@
133 > @@ -0,0 +1,1 @@
134 > += sub
134 > += sub
135 > diff --git a/.hgsubstate b/.hgsubstate
135 > diff --git a/.hgsubstate b/.hgsubstate
136 > new file mode 100644
136 > new file mode 100644
137 > --- /dev/null
137 > --- /dev/null
138 > +++ b/.hgsubstate
138 > +++ b/.hgsubstate
139 > @@ -0,0 +1,1 @@
139 > @@ -0,0 +1,1 @@
140 > +0000000000000000000000000000000000000000
140 > +0000000000000000000000000000000000000000
141 > EOF
141 > EOF
142 $ cd ..
142 $ cd ..
143
143
144 on clone (and update):
144 on clone (and update):
145
145
146 $ hg clone -q emptypath emptypath2
146 $ hg clone -q emptypath emptypath2
147 hg: parse error at .hgsub:1: = sub
147 hg: parse error at .hgsub:1: = sub
148 [255]
148 [255]
149
149
150 Test current path
150 Test current path
151 -----------------
151 -----------------
152
152
153 on commit:
153 on commit:
154
154
155 $ hg init currentpath
155 $ hg init currentpath
156 $ cd currentpath
156 $ cd currentpath
157 $ hg init sub
157 $ hg init sub
158 $ echo '. = sub' >> .hgsub
158 $ echo '. = sub' >> .hgsub
159 $ hg ci -qAm 'add subrepo "."'
159 $ hg ci -qAm 'add subrepo "."'
160 abort: subrepo path contains illegal component: .
160 abort: subrepo path contains illegal component: .
161 [255]
161 [255]
162
162
163 prepare tampered repo (including the commit above):
163 prepare tampered repo (including the commit above):
164
164
165 $ hg import --bypass -qm 'add subrepo "."' - <<'EOF'
165 $ hg import --bypass -qm 'add subrepo "."' - <<'EOF'
166 > diff --git a/.hgsub b/.hgsub
166 > diff --git a/.hgsub b/.hgsub
167 > new file mode 100644
167 > new file mode 100644
168 > --- /dev/null
168 > --- /dev/null
169 > +++ b/.hgsub
169 > +++ b/.hgsub
170 > @@ -0,0 +1,1 @@
170 > @@ -0,0 +1,1 @@
171 > +.= sub
171 > +.= sub
172 > diff --git a/.hgsubstate b/.hgsubstate
172 > diff --git a/.hgsubstate b/.hgsubstate
173 > new file mode 100644
173 > new file mode 100644
174 > --- /dev/null
174 > --- /dev/null
175 > +++ b/.hgsubstate
175 > +++ b/.hgsubstate
176 > @@ -0,0 +1,1 @@
176 > @@ -0,0 +1,1 @@
177 > +0000000000000000000000000000000000000000 .
177 > +0000000000000000000000000000000000000000 .
178 > EOF
178 > EOF
179 $ cd ..
179 $ cd ..
180
180
181 on clone (and update):
181 on clone (and update):
182
182
183 $ hg clone -q currentpath currentpath2
183 $ hg clone -q currentpath currentpath2
184 abort: subrepo path contains illegal component: .
184 abort: subrepo path contains illegal component: .
185 [255]
185 [255]
186
186
187 Test outer path
187 Test outer path
188 ---------------
188 ---------------
189
189
190 on commit:
190 on commit:
191
191
192 $ mkdir outerpath
192 $ mkdir outerpath
193 $ cd outerpath
193 $ cd outerpath
194 $ hg init main
194 $ hg init main
195 $ cd main
195 $ cd main
196 $ hg init ../sub
196 $ hg init ../sub
197 $ echo '../sub = ../sub' >> .hgsub
197 $ echo '../sub = ../sub' >> .hgsub
198 $ hg ci -qAm 'add subrepo "../sub"'
198 $ hg ci -qAm 'add subrepo "../sub"'
199 abort: path contains illegal component: ../sub
199 abort: path contains illegal component: ../sub
200 [255]
200 [255]
201
201
202 prepare tampered repo (including the commit above):
202 prepare tampered repo (including the commit above):
203
203
204 $ hg import --bypass -qm 'add subrepo "../sub"' - <<'EOF'
204 $ hg import --bypass -qm 'add subrepo "../sub"' - <<'EOF'
205 > diff --git a/.hgsub b/.hgsub
205 > diff --git a/.hgsub b/.hgsub
206 > new file mode 100644
206 > new file mode 100644
207 > --- /dev/null
207 > --- /dev/null
208 > +++ b/.hgsub
208 > +++ b/.hgsub
209 > @@ -0,0 +1,1 @@
209 > @@ -0,0 +1,1 @@
210 > +../sub = ../sub
210 > +../sub = ../sub
211 > diff --git a/.hgsubstate b/.hgsubstate
211 > diff --git a/.hgsubstate b/.hgsubstate
212 > new file mode 100644
212 > new file mode 100644
213 > --- /dev/null
213 > --- /dev/null
214 > +++ b/.hgsubstate
214 > +++ b/.hgsubstate
215 > @@ -0,0 +1,1 @@
215 > @@ -0,0 +1,1 @@
216 > +0000000000000000000000000000000000000000 ../sub
216 > +0000000000000000000000000000000000000000 ../sub
217 > EOF
217 > EOF
218 $ cd ..
218 $ cd ..
219
219
220 on clone (and update):
220 on clone (and update):
221
221
222 $ hg clone -q main main2
222 $ hg clone -q main main2
223 abort: path contains illegal component: ../sub
223 abort: path contains illegal component: ../sub
224 [255]
224 [255]
225 $ cd ..
225 $ cd ..
226
226
227 Test variable expansion
227 Test variable expansion
228 -----------------------
228 -----------------------
229
229
230 Subrepository paths shouldn't be expanded, but we fail to handle them
230 Subrepository paths shouldn't be expanded, but we fail to handle them
231 properly. Any local repository paths are expanded.
231 properly. Any local repository paths are expanded.
232
232
233 on commit:
233 on commit:
234
234
235 $ mkdir envvar
235 $ mkdir envvar
236 $ cd envvar
236 $ cd envvar
237 $ hg init main
237 $ hg init main
238 $ cd main
238 $ cd main
239 $ hg init sub1
239 $ hg init sub1
240 $ cat <<'EOF' > sub1/hgrc
240 $ cat <<'EOF' > sub1/hgrc
241 > [hooks]
241 > [hooks]
242 > log = echo pwned
242 > log = echo pwned
243 > EOF
243 > EOF
244 $ hg -R sub1 ci -qAm 'add sub1 files'
244 $ hg -R sub1 ci -qAm 'add sub1 files'
245 $ hg -R sub1 log -r. -T '{node}\n'
245 $ hg -R sub1 log -r. -T '{node}\n'
246 39eb4b4d3e096527668784893a9280578a8f38b8
246 39eb4b4d3e096527668784893a9280578a8f38b8
247 $ echo '$SUB = sub1' >> .hgsub
247 $ echo '$SUB = sub1' >> .hgsub
248 $ SUB=sub1 hg ci -qAm 'add subrepo "$SUB"'
248 $ SUB=sub1 hg ci -qAm 'add subrepo "$SUB"'
249 abort: subrepo path contains illegal component: $SUB
249 abort: subrepo path contains illegal component: $SUB
250 [255]
250 [255]
251
251
252 prepare tampered repo (including the changes above as two commits):
252 prepare tampered repo (including the changes above as two commits):
253
253
254 $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF'
254 $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF'
255 > diff --git a/.hgsub b/.hgsub
255 > diff --git a/.hgsub b/.hgsub
256 > new file mode 100644
256 > new file mode 100644
257 > --- /dev/null
257 > --- /dev/null
258 > +++ b/.hgsub
258 > +++ b/.hgsub
259 > @@ -0,0 +1,1 @@
259 > @@ -0,0 +1,1 @@
260 > +$SUB = sub1
260 > +$SUB = sub1
261 > diff --git a/.hgsubstate b/.hgsubstate
261 > diff --git a/.hgsubstate b/.hgsubstate
262 > new file mode 100644
262 > new file mode 100644
263 > --- /dev/null
263 > --- /dev/null
264 > +++ b/.hgsubstate
264 > +++ b/.hgsubstate
265 > @@ -0,0 +1,1 @@
265 > @@ -0,0 +1,1 @@
266 > +0000000000000000000000000000000000000000 $SUB
266 > +0000000000000000000000000000000000000000 $SUB
267 > EOF
267 > EOF
268 $ hg debugsetparents 0
268 $ hg debugsetparents 0
269 $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF'
269 $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF'
270 > diff --git a/.hgsubstate b/.hgsubstate
270 > diff --git a/.hgsubstate b/.hgsubstate
271 > --- a/.hgsubstate
271 > --- a/.hgsubstate
272 > +++ b/.hgsubstate
272 > +++ b/.hgsubstate
273 > @@ -1,1 +1,1 @@
273 > @@ -1,1 +1,1 @@
274 > -0000000000000000000000000000000000000000 $SUB
274 > -0000000000000000000000000000000000000000 $SUB
275 > +39eb4b4d3e096527668784893a9280578a8f38b8 $SUB
275 > +39eb4b4d3e096527668784893a9280578a8f38b8 $SUB
276 > EOF
276 > EOF
277 $ cd ..
277 $ cd ..
278
278
279 on clone (and update) with various substitutions:
279 on clone (and update) with various substitutions:
280
280
281 $ hg clone -q main main2
281 $ hg clone -q main main2
282 abort: subrepo path contains illegal component: $SUB
282 abort: subrepo path contains illegal component: $SUB
283 [255]
283 [255]
284 $ ls main2
284 $ ls main2
285
285
286 $ SUB=sub1 hg clone -q main main3
286 $ SUB=sub1 hg clone -q main main3
287 abort: subrepo path contains illegal component: $SUB
287 abort: subrepo path contains illegal component: $SUB
288 [255]
288 [255]
289 $ ls main3
289 $ ls main3
290
290
291 $ SUB=sub2 hg clone -q main main4
291 $ SUB=sub2 hg clone -q main main4
292 abort: subrepo path contains illegal component: $SUB
292 abort: subrepo path contains illegal component: $SUB
293 [255]
293 [255]
294 $ ls main4
294 $ ls main4
295
295
296 on clone empty subrepo into .hg, then pull (and update), which at least fails:
296 on clone empty subrepo into .hg, then pull (and update), which at least fails:
297
297
298 $ SUB=.hg hg clone -qr0 main main5
298 $ SUB=.hg hg clone -qr0 main main5
299 abort: subrepo path contains illegal component: $SUB
299 abort: subrepo path contains illegal component: $SUB
300 [255]
300 [255]
301 $ ls main5
301 $ ls main5
302 $ test -d main5/.hg/.hg
302 $ test -d main5/.hg/.hg
303 [1]
303 [1]
304 $ SUB=.hg hg -R main5 pull -u
304 $ SUB=.hg hg -R main5 pull -u
305 pulling from $TESTTMP/envvar/main
305 pulling from $TESTTMP/envvar/main
306 searching for changes
306 searching for changes
307 adding changesets
307 adding changesets
308 adding manifests
308 adding manifests
309 adding file changes
309 adding file changes
310 added 1 changesets with 1 changes to 1 files
310 added 1 changesets with 1 changes to 1 files
311 new changesets 7a2f0e59146f
311 new changesets 7a2f0e59146f
312 .hgsubstate: untracked file differs
312 .hgsubstate: untracked file differs
313 abort: untracked files in working directory differ from files in requested revision
313 abort: untracked files in working directory differ from files in requested revision
314 [255]
314 [255]
315 $ cat main5/.hg/hgrc | grep pwned
315 $ cat main5/.hg/hgrc | grep pwned
316 [1]
316 [1]
317
317
318 on clone (and update) into .hg, which at least fails:
318 on clone (and update) into .hg, which at least fails:
319
319
320 $ SUB=.hg hg clone -q main main6
320 $ SUB=.hg hg clone -q main main6
321 abort: subrepo path contains illegal component: $SUB
321 abort: subrepo path contains illegal component: $SUB
322 [255]
322 [255]
323 $ ls main6
323 $ ls main6
324 $ cat main6/.hg/hgrc | grep pwned
324 $ cat main6/.hg/hgrc | grep pwned
325 [1]
325 [1]
326
326
327 on clone (and update) into .hg/* subdir:
327 on clone (and update) into .hg/* subdir:
328
328
329 $ SUB=.hg/foo hg clone -q main main7
329 $ SUB=.hg/foo hg clone -q main main7
330 abort: subrepo path contains illegal component: $SUB
330 abort: subrepo path contains illegal component: $SUB
331 [255]
331 [255]
332 $ ls main7
332 $ ls main7
333 $ test -d main7/.hg/.hg
333 $ test -d main7/.hg/.hg
334 [1]
334 [1]
335
335
336 on clone (and update) into outer tree:
336 on clone (and update) into outer tree:
337
337
338 $ SUB=../out-of-tree-write hg clone -q main main8
338 $ SUB=../out-of-tree-write hg clone -q main main8
339 abort: subrepo path contains illegal component: $SUB
339 abort: subrepo path contains illegal component: $SUB
340 [255]
340 [255]
341 $ ls main8
341 $ ls main8
342
342
343 on clone (and update) into e.g. $HOME, which doesn't work since subrepo paths
343 on clone (and update) into e.g. $HOME, which doesn't work since subrepo paths
344 are concatenated prior to variable expansion:
344 are concatenated prior to variable expansion:
345
345
346 $ SUB="$TESTTMP/envvar/fakehome" hg clone -q main main9
346 $ SUB="$TESTTMP/envvar/fakehome" hg clone -q main main9
347 abort: subrepo path contains illegal component: $SUB
347 abort: subrepo path contains illegal component: $SUB
348 [255]
348 [255]
349 $ ls main9 | wc -l
349 $ ls main9 | wc -l
350 \s*0 (re)
350 \s*0 (re)
351
351
352 $ ls
352 $ ls
353 main
353 main
354 main2
354 main2
355 main3
355 main3
356 main4
356 main4
357 main5
357 main5
358 main6
358 main6
359 main7
359 main7
360 main8
360 main8
361 main9
361 main9
362 $ cd ..
362 $ cd ..
363
363
364 Test tilde
364 Test tilde
365 ----------
365 ----------
366
366
367 The leading tilde may be expanded to $HOME, but it can be a valid subrepo
367 The leading tilde may be expanded to $HOME, but it can be a valid subrepo
368 path in theory. However, we want to prohibit it as there might be unsafe
368 path in theory. However, we want to prohibit it as there might be unsafe
369 handling of such paths.
369 handling of such paths.
370
370
371 on commit:
371 on commit:
372
372
373 $ hg init tilde
373 $ hg init tilde
374 $ cd tilde
374 $ cd tilde
375 $ hg init './~'
375 $ hg init './~'
376 $ echo '~ = ~' >> .hgsub
376 $ echo '~ = ~' >> .hgsub
377 $ hg ci -qAm 'add subrepo "~"'
377 $ hg ci -qAm 'add subrepo "~"'
378 abort: subrepo path contains illegal component: ~
378 abort: subrepo path contains illegal component: ~
379 [255]
379 [255]
380
380
381 prepare tampered repo (including the commit above):
381 prepare tampered repo (including the commit above):
382
382
383 $ hg import --bypass -qm 'add subrepo "~"' - <<'EOF'
383 $ hg import --bypass -qm 'add subrepo "~"' - <<'EOF'
384 > diff --git a/.hgsub b/.hgsub
384 > diff --git a/.hgsub b/.hgsub
385 > new file mode 100644
385 > new file mode 100644
386 > --- /dev/null
386 > --- /dev/null
387 > +++ b/.hgsub
387 > +++ b/.hgsub
388 > @@ -0,0 +1,1 @@
388 > @@ -0,0 +1,1 @@
389 > +~ = ~
389 > +~ = ~
390 > diff --git a/.hgsubstate b/.hgsubstate
390 > diff --git a/.hgsubstate b/.hgsubstate
391 > new file mode 100644
391 > new file mode 100644
392 > --- /dev/null
392 > --- /dev/null
393 > +++ b/.hgsubstate
393 > +++ b/.hgsubstate
394 > @@ -0,0 +1,1 @@
394 > @@ -0,0 +1,1 @@
395 > +0000000000000000000000000000000000000000 ~
395 > +0000000000000000000000000000000000000000 ~
396 > EOF
396 > EOF
397 $ cd ..
397 $ cd ..
398
398
399 on clone (and update):
399 on clone (and update):
400
400
401 $ hg clone -q tilde tilde2
401 $ hg clone -q tilde tilde2
402 abort: subrepo path contains illegal component: ~
402 abort: subrepo path contains illegal component: ~
403 [255]
403 [255]
404
404
405 Test direct symlink traversal
405 Test direct symlink traversal
406 -----------------------------
406 -----------------------------
407
407
408 #if symlink
408 #if symlink
409
409
410 on commit:
410 on commit:
411
411
412 $ mkdir hgsymdir
412 $ mkdir hgsymdir
413 $ hg init hgsymdir/root
413 $ hg init hgsymdir/root
414 $ cd hgsymdir/root
414 $ cd hgsymdir/root
415 $ ln -s ../out
415 $ ln -s ../out
416 $ hg ci -qAm 'add symlink "out"'
416 $ hg ci -qAm 'add symlink "out"'
417 $ hg init ../out
417 $ hg init ../out
418 $ echo 'out = out' >> .hgsub
418 $ echo 'out = out' >> .hgsub
419 $ hg ci -qAm 'add subrepo "out"'
419 $ hg ci -qAm 'add subrepo "out"'
420 abort: subrepo 'out' traverses symbolic link
420 abort: subrepo 'out' traverses symbolic link
421 [255]
421 [255]
422
422
423 prepare tampered repo (including the commit above):
423 prepare tampered repo (including the commit above):
424
424
425 $ hg import --bypass -qm 'add subrepo "out"' - <<'EOF'
425 $ hg import --bypass -qm 'add subrepo "out"' - <<'EOF'
426 > diff --git a/.hgsub b/.hgsub
426 > diff --git a/.hgsub b/.hgsub
427 > new file mode 100644
427 > new file mode 100644
428 > --- /dev/null
428 > --- /dev/null
429 > +++ b/.hgsub
429 > +++ b/.hgsub
430 > @@ -0,0 +1,1 @@
430 > @@ -0,0 +1,1 @@
431 > +out = out
431 > +out = out
432 > diff --git a/.hgsubstate b/.hgsubstate
432 > diff --git a/.hgsubstate b/.hgsubstate
433 > new file mode 100644
433 > new file mode 100644
434 > --- /dev/null
434 > --- /dev/null
435 > +++ b/.hgsubstate
435 > +++ b/.hgsubstate
436 > @@ -0,0 +1,1 @@
436 > @@ -0,0 +1,1 @@
437 > +0000000000000000000000000000000000000000 out
437 > +0000000000000000000000000000000000000000 out
438 > EOF
438 > EOF
439 $ cd ../..
439 $ cd ../..
440
440
441 on clone (and update):
441 on clone (and update):
442
442
443 $ mkdir hgsymdir2
443 $ mkdir hgsymdir2
444 $ hg clone -q hgsymdir/root hgsymdir2/root
444 $ hg clone -q hgsymdir/root hgsymdir2/root
445 abort: subrepo 'out' traverses symbolic link
445 abort: subrepo 'out' traverses symbolic link
446 [255]
446 [255]
447 $ ls hgsymdir2
447 $ ls hgsymdir2
448 root
448 root
449
449
450 #endif
450 #endif
451
451
452 Test indirect symlink traversal
452 Test indirect symlink traversal
453 -------------------------------
453 -------------------------------
454
454
455 #if symlink
455 #if symlink
456
456
457 on commit:
457 on commit:
458
458
459 $ mkdir hgsymin
459 $ mkdir hgsymin
460 $ hg init hgsymin/root
460 $ hg init hgsymin/root
461 $ cd hgsymin/root
461 $ cd hgsymin/root
462 $ ln -s ../out
462 $ ln -s ../out
463 $ hg ci -qAm 'add symlink "out"'
463 $ hg ci -qAm 'add symlink "out"'
464 $ mkdir ../out
464 $ mkdir ../out
465 $ hg init ../out/sub
465 $ hg init ../out/sub
466 $ echo 'out/sub = out/sub' >> .hgsub
466 $ echo 'out/sub = out/sub' >> .hgsub
467 $ hg ci -qAm 'add subrepo "out/sub"'
467 $ hg ci -qAm 'add subrepo "out/sub"'
468 abort: path 'out/sub' traverses symbolic link 'out'
468 abort: path 'out/sub' traverses symbolic link 'out'
469 [255]
469 [255]
470
470
471 prepare tampered repo (including the commit above):
471 prepare tampered repo (including the commit above):
472
472
473 $ hg import --bypass -qm 'add subrepo "out/sub"' - <<'EOF'
473 $ hg import --bypass -qm 'add subrepo "out/sub"' - <<'EOF'
474 > diff --git a/.hgsub b/.hgsub
474 > diff --git a/.hgsub b/.hgsub
475 > new file mode 100644
475 > new file mode 100644
476 > --- /dev/null
476 > --- /dev/null
477 > +++ b/.hgsub
477 > +++ b/.hgsub
478 > @@ -0,0 +1,1 @@
478 > @@ -0,0 +1,1 @@
479 > +out/sub = out/sub
479 > +out/sub = out/sub
480 > diff --git a/.hgsubstate b/.hgsubstate
480 > diff --git a/.hgsubstate b/.hgsubstate
481 > new file mode 100644
481 > new file mode 100644
482 > --- /dev/null
482 > --- /dev/null
483 > +++ b/.hgsubstate
483 > +++ b/.hgsubstate
484 > @@ -0,0 +1,1 @@
484 > @@ -0,0 +1,1 @@
485 > +0000000000000000000000000000000000000000 out/sub
485 > +0000000000000000000000000000000000000000 out/sub
486 > EOF
486 > EOF
487 $ cd ../..
487 $ cd ../..
488
488
489 on clone (and update):
489 on clone (and update):
490
490
491 $ mkdir hgsymin2
491 $ mkdir hgsymin2
492 $ hg clone -q hgsymin/root hgsymin2/root
492 $ hg clone -q hgsymin/root hgsymin2/root
493 abort: path 'out/sub' traverses symbolic link 'out'
493 abort: path 'out/sub' traverses symbolic link 'out'
494 [255]
494 [255]
495 $ ls hgsymin2
495 $ ls hgsymin2
496 root
496 root
497
497
498 #endif
498 #endif
499
499
500 Test symlink traversal by variable expansion
500 Test symlink traversal by variable expansion
501 --------------------------------------------
501 --------------------------------------------
502
502
503 #if symlink
503 #if symlink
504
504
505 $ FAKEHOME="$TESTTMP/envvarsym/fakehome"
505 $ FAKEHOME="$TESTTMP/envvarsym/fakehome"
506
506
507 on commit:
507 on commit:
508
508
509 $ mkdir envvarsym
509 $ mkdir envvarsym
510 $ cd envvarsym
510 $ cd envvarsym
511 $ hg init main
511 $ hg init main
512 $ cd main
512 $ cd main
513 $ ln -s "`echo "$FAKEHOME" | sed 's|\(.\)/.*|\1|'`"
513 $ ln -s "`echo "$FAKEHOME" | sed 's|\(.\)/.*|\1|'`"
514 $ hg ci -qAm 'add symlink to top-level system directory'
514 $ hg ci -qAm 'add symlink to top-level system directory'
515
515
516 $ hg init sub1
516 $ hg init sub1
517 $ echo pwned > sub1/pwned
517 $ echo pwned > sub1/pwned
518 $ hg -R sub1 ci -qAm 'add sub1 files'
518 $ hg -R sub1 ci -qAm 'add sub1 files'
519 $ hg -R sub1 log -r. -T '{node}\n'
519 $ hg -R sub1 log -r. -T '{node}\n'
520 f40c9134ba1b6961e12f250868823f0092fb68a8
520 f40c9134ba1b6961e12f250868823f0092fb68a8
521 $ echo '$SUB = sub1' >> .hgsub
521 $ echo '$SUB = sub1' >> .hgsub
522 $ SUB="$FAKEHOME" hg ci -qAm 'add subrepo "$SUB"'
522 $ SUB="$FAKEHOME" hg ci -qAm 'add subrepo "$SUB"'
523 abort: subrepo path contains illegal component: $SUB
523 abort: subrepo path contains illegal component: $SUB
524 [255]
524 [255]
525
525
526 prepare tampered repo (including the changes above as two commits):
526 prepare tampered repo (including the changes above as two commits):
527
527
528 $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF'
528 $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF'
529 > diff --git a/.hgsub b/.hgsub
529 > diff --git a/.hgsub b/.hgsub
530 > new file mode 100644
530 > new file mode 100644
531 > --- /dev/null
531 > --- /dev/null
532 > +++ b/.hgsub
532 > +++ b/.hgsub
533 > @@ -0,0 +1,1 @@
533 > @@ -0,0 +1,1 @@
534 > +$SUB = sub1
534 > +$SUB = sub1
535 > diff --git a/.hgsubstate b/.hgsubstate
535 > diff --git a/.hgsubstate b/.hgsubstate
536 > new file mode 100644
536 > new file mode 100644
537 > --- /dev/null
537 > --- /dev/null
538 > +++ b/.hgsubstate
538 > +++ b/.hgsubstate
539 > @@ -0,0 +1,1 @@
539 > @@ -0,0 +1,1 @@
540 > +0000000000000000000000000000000000000000 $SUB
540 > +0000000000000000000000000000000000000000 $SUB
541 > EOF
541 > EOF
542 $ hg debugsetparents 1
542 $ hg debugsetparents 1
543 $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF'
543 $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF'
544 > diff --git a/.hgsubstate b/.hgsubstate
544 > diff --git a/.hgsubstate b/.hgsubstate
545 > --- a/.hgsubstate
545 > --- a/.hgsubstate
546 > +++ b/.hgsubstate
546 > +++ b/.hgsubstate
547 > @@ -1,1 +1,1 @@
547 > @@ -1,1 +1,1 @@
548 > -0000000000000000000000000000000000000000 $SUB
548 > -0000000000000000000000000000000000000000 $SUB
549 > +f40c9134ba1b6961e12f250868823f0092fb68a8 $SUB
549 > +f40c9134ba1b6961e12f250868823f0092fb68a8 $SUB
550 > EOF
550 > EOF
551 $ cd ..
551 $ cd ..
552
552
553 on clone (and update) without fakehome directory:
553 on clone (and update) without fakehome directory:
554
554
555 $ rm -fR "$FAKEHOME"
555 $ rm -fR "$FAKEHOME"
556 $ SUB="$FAKEHOME" hg clone -q main main2
556 $ SUB="$FAKEHOME" hg clone -q main main2
557 abort: subrepo path contains illegal component: $SUB
557 abort: subrepo path contains illegal component: $SUB
558 [255]
558 [255]
559 $ test -d "$FAKEHOME"
559 $ test -d "$FAKEHOME"
560 [1]
560 [1]
561
561
562 on clone (and update) with empty fakehome directory:
562 on clone (and update) with empty fakehome directory:
563
563
564 $ rm -fR "$FAKEHOME"
564 $ rm -fR "$FAKEHOME"
565 $ mkdir "$FAKEHOME"
565 $ mkdir "$FAKEHOME"
566 $ SUB="$FAKEHOME" hg clone -q main main3
566 $ SUB="$FAKEHOME" hg clone -q main main3
567 abort: subrepo path contains illegal component: $SUB
567 abort: subrepo path contains illegal component: $SUB
568 [255]
568 [255]
569 $ ls "$FAKEHOME"
569 $ ls "$FAKEHOME"
570
570
571 on clone (and update) with non-empty fakehome directory:
571 on clone (and update) with non-empty fakehome directory:
572
572
573 $ rm -fR "$FAKEHOME"
573 $ rm -fR "$FAKEHOME"
574 $ mkdir "$FAKEHOME"
574 $ mkdir "$FAKEHOME"
575 $ touch "$FAKEHOME/a"
575 $ touch "$FAKEHOME/a"
576 $ SUB="$FAKEHOME" hg clone -q main main4
576 $ SUB="$FAKEHOME" hg clone -q main main4
577 abort: subrepo path contains illegal component: $SUB
577 abort: subrepo path contains illegal component: $SUB
578 [255]
578 [255]
579 $ ls "$FAKEHOME"
579 $ ls "$FAKEHOME"
580 a
580 a
581
581
582 on clone empty subrepo with non-empty fakehome directory,
582 on clone empty subrepo with non-empty fakehome directory,
583 then pull (and update):
583 then pull (and update):
584
584
585 $ rm -fR "$FAKEHOME"
585 $ rm -fR "$FAKEHOME"
586 $ mkdir "$FAKEHOME"
586 $ mkdir "$FAKEHOME"
587 $ touch "$FAKEHOME/a"
587 $ touch "$FAKEHOME/a"
588 $ SUB="$FAKEHOME" hg clone -qr1 main main5
588 $ SUB="$FAKEHOME" hg clone -qr1 main main5
589 abort: subrepo path contains illegal component: $SUB
589 abort: subrepo path contains illegal component: $SUB
590 [255]
590 [255]
591 $ ls "$FAKEHOME"
591 $ ls "$FAKEHOME"
592 a
592 a
593 $ test -d "$FAKEHOME/.hg"
593 $ test -d "$FAKEHOME/.hg"
594 [1]
594 [1]
595 $ SUB="$FAKEHOME" hg -R main5 pull -u
595 $ SUB="$FAKEHOME" hg -R main5 pull -u
596 pulling from $TESTTMP/envvarsym/main
596 pulling from $TESTTMP/envvarsym/main
597 searching for changes
597 searching for changes
598 adding changesets
598 adding changesets
599 adding manifests
599 adding manifests
600 adding file changes
600 adding file changes
601 added 1 changesets with 1 changes to 1 files
601 added 1 changesets with 1 changes to 1 files
602 new changesets * (glob)
602 new changesets * (glob)
603 .hgsubstate: untracked file differs
603 .hgsubstate: untracked file differs
604 abort: untracked files in working directory differ from files in requested revision
604 abort: untracked files in working directory differ from files in requested revision
605 [255]
605 [255]
606 $ ls "$FAKEHOME"
606 $ ls "$FAKEHOME"
607 a
607 a
608 $ test -d "$FAKEHOME/.hg"
608 $ test -d "$FAKEHOME/.hg"
609 [1]
609 [1]
610
610
611 on clone empty subrepo with hg-managed fakehome directory,
611 on clone empty subrepo with hg-managed fakehome directory,
612 then pull (and update):
612 then pull (and update):
613
613
614 $ rm -fR "$FAKEHOME"
614 $ rm -fR "$FAKEHOME"
615 $ hg init "$FAKEHOME"
615 $ hg init "$FAKEHOME"
616 $ touch "$FAKEHOME/a"
616 $ touch "$FAKEHOME/a"
617 $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file'
617 $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file'
618 $ SUB="$FAKEHOME" hg clone -qr1 main main6
618 $ SUB="$FAKEHOME" hg clone -qr1 main main6
619 abort: subrepo path contains illegal component: $SUB
619 abort: subrepo path contains illegal component: $SUB
620 [255]
620 [255]
621 $ ls "$FAKEHOME"
621 $ ls "$FAKEHOME"
622 a
622 a
623 $ SUB="$FAKEHOME" hg -R main6 pull -u
623 $ SUB="$FAKEHOME" hg -R main6 pull -u
624 pulling from $TESTTMP/envvarsym/main
624 pulling from $TESTTMP/envvarsym/main
625 searching for changes
625 searching for changes
626 adding changesets
626 adding changesets
627 adding manifests
627 adding manifests
628 adding file changes
628 adding file changes
629 added 1 changesets with 1 changes to 1 files
629 added 1 changesets with 1 changes to 1 files
630 new changesets * (glob)
630 new changesets * (glob)
631 .hgsubstate: untracked file differs
631 .hgsubstate: untracked file differs
632 abort: untracked files in working directory differ from files in requested revision
632 abort: untracked files in working directory differ from files in requested revision
633 [255]
633 [255]
634 $ ls "$FAKEHOME"
634 $ ls "$FAKEHOME"
635 a
635 a
636
636
637 on clone only symlink with hg-managed fakehome directory,
637 on clone only symlink with hg-managed fakehome directory,
638 then pull (and update):
638 then pull (and update):
639
639
640 $ rm -fR "$FAKEHOME"
640 $ rm -fR "$FAKEHOME"
641 $ hg init "$FAKEHOME"
641 $ hg init "$FAKEHOME"
642 $ touch "$FAKEHOME/a"
642 $ touch "$FAKEHOME/a"
643 $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file'
643 $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file'
644 $ SUB="$FAKEHOME" hg clone -qr0 main main7
644 $ SUB="$FAKEHOME" hg clone -qr0 main main7
645 $ ls "$FAKEHOME"
645 $ ls "$FAKEHOME"
646 a
646 a
647 $ SUB="$FAKEHOME" hg -R main7 pull -uf
647 $ SUB="$FAKEHOME" hg -R main7 pull -uf
648 pulling from $TESTTMP/envvarsym/main
648 pulling from $TESTTMP/envvarsym/main
649 searching for changes
649 searching for changes
650 adding changesets
650 adding changesets
651 adding manifests
651 adding manifests
652 adding file changes
652 adding file changes
653 added 2 changesets with 3 changes to 2 files
653 added 2 changesets with 3 changes to 2 files
654 new changesets * (glob)
654 new changesets * (glob)
655 abort: subrepo path contains illegal component: $SUB
655 abort: subrepo path contains illegal component: $SUB
656 [255]
656 [255]
657 $ ls "$FAKEHOME"
657 $ ls "$FAKEHOME"
658 a
658 a
659
659
660 $ cd ..
660 $ cd ..
661
661
662 #endif
662 #endif
663
664 Test drive letter
665 -----------------
666
667 Windows has a weird relative path that can change the drive letter, which
668 should also be prohibited on Windows.
669
670 prepare tampered repo:
671
672 $ hg init driveletter
673 $ cd driveletter
674 $ hg import --bypass -qm 'add subrepo "X:"' - <<'EOF'
675 > diff --git a/.hgsub b/.hgsub
676 > new file mode 100644
677 > --- /dev/null
678 > +++ b/.hgsub
679 > @@ -0,0 +1,1 @@
680 > +X: = foo
681 > diff --git a/.hgsubstate b/.hgsubstate
682 > new file mode 100644
683 > --- /dev/null
684 > +++ b/.hgsubstate
685 > @@ -0,0 +1,1 @@
686 > +0000000000000000000000000000000000000000 X:
687 > EOF
688 $ cd ..
689
690 on clone (and update):
691
692 #if windows
693
694 $ hg clone -q driveletter driveletter2
695 abort: path contains illegal component: X:
696
697 #else
698
699 $ hg clone -q driveletter driveletter2
700 $ ls driveletter2
701 X:
702
703 #endif
General Comments 0
You need to be logged in to leave comments. Login now