##// END OF EJS Templates
py3: use print as a function in tests/test-subrepo-svn.t...
Pulkit Goyal -
r39759:5495ceab default
parent child Browse files
Show More
@@ -1,690 +1,690 b''
1 #require svn15
1 #require svn15
2
2
3 $ SVNREPOPATH=`pwd`/svn-repo
3 $ SVNREPOPATH=`pwd`/svn-repo
4 #if windows
4 #if windows
5 $ SVNREPOURL=file:///`"$PYTHON" -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
5 $ SVNREPOURL=file:///`"$PYTHON" -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
6 #else
6 #else
7 $ SVNREPOURL=file://`"$PYTHON" -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
7 $ SVNREPOURL=file://`"$PYTHON" -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
8 #endif
8 #endif
9
9
10 $ filter_svn_output () {
10 $ filter_svn_output () {
11 > egrep -v 'Committing|Transmitting|Updating|(^$)' || true
11 > egrep -v 'Committing|Transmitting|Updating|(^$)' || true
12 > }
12 > }
13
13
14 create subversion repo
14 create subversion repo
15
15
16 $ WCROOT="`pwd`/svn-wc"
16 $ WCROOT="`pwd`/svn-wc"
17 $ svnadmin create svn-repo
17 $ svnadmin create svn-repo
18 $ svn co "$SVNREPOURL" svn-wc
18 $ svn co "$SVNREPOURL" svn-wc
19 Checked out revision 0.
19 Checked out revision 0.
20 $ cd svn-wc
20 $ cd svn-wc
21 $ mkdir src
21 $ mkdir src
22 $ echo alpha > src/alpha
22 $ echo alpha > src/alpha
23 $ svn add src
23 $ svn add src
24 A src
24 A src
25 A src/alpha
25 A src/alpha
26 $ mkdir externals
26 $ mkdir externals
27 $ echo other > externals/other
27 $ echo other > externals/other
28 $ svn add externals
28 $ svn add externals
29 A externals
29 A externals
30 A externals/other
30 A externals/other
31 $ svn ci -qm 'Add alpha'
31 $ svn ci -qm 'Add alpha'
32 $ svn up -q
32 $ svn up -q
33 $ echo "externals -r1 $SVNREPOURL/externals" > extdef
33 $ echo "externals -r1 $SVNREPOURL/externals" > extdef
34 $ svn propset -F extdef svn:externals src
34 $ svn propset -F extdef svn:externals src
35 property 'svn:externals' set on 'src'
35 property 'svn:externals' set on 'src'
36 $ svn ci -qm 'Setting externals'
36 $ svn ci -qm 'Setting externals'
37 $ cd ..
37 $ cd ..
38
38
39 create hg repo
39 create hg repo
40
40
41 $ mkdir sub
41 $ mkdir sub
42 $ cd sub
42 $ cd sub
43 $ hg init t
43 $ hg init t
44 $ cd t
44 $ cd t
45
45
46 first revision, no sub
46 first revision, no sub
47
47
48 $ echo a > a
48 $ echo a > a
49 $ hg ci -Am0
49 $ hg ci -Am0
50 adding a
50 adding a
51
51
52 add first svn sub with leading whitespaces
52 add first svn sub with leading whitespaces
53
53
54 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
54 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
55 $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub
55 $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub
56 $ svn co --quiet "$SVNREPOURL"/src s
56 $ svn co --quiet "$SVNREPOURL"/src s
57 $ mkdir subdir
57 $ mkdir subdir
58 $ svn co --quiet "$SVNREPOURL"/src subdir/s
58 $ svn co --quiet "$SVNREPOURL"/src subdir/s
59 $ hg add .hgsub
59 $ hg add .hgsub
60
60
61 svn subrepo is disabled by default
61 svn subrepo is disabled by default
62
62
63 $ hg ci -m1
63 $ hg ci -m1
64 abort: svn subrepos not allowed
64 abort: svn subrepos not allowed
65 (see 'hg help config.subrepos' for details)
65 (see 'hg help config.subrepos' for details)
66 [255]
66 [255]
67
67
68 so enable it
68 so enable it
69
69
70 $ cat >> $HGRCPATH <<EOF
70 $ cat >> $HGRCPATH <<EOF
71 > [subrepos]
71 > [subrepos]
72 > svn:allowed = true
72 > svn:allowed = true
73 > EOF
73 > EOF
74
74
75 $ hg ci -m1
75 $ hg ci -m1
76
76
77 make sure we avoid empty commits (issue2445)
77 make sure we avoid empty commits (issue2445)
78
78
79 $ hg sum
79 $ hg sum
80 parent: 1:* tip (glob)
80 parent: 1:* tip (glob)
81 1
81 1
82 branch: default
82 branch: default
83 commit: (clean)
83 commit: (clean)
84 update: (current)
84 update: (current)
85 phases: 2 draft
85 phases: 2 draft
86 $ hg ci -moops
86 $ hg ci -moops
87 nothing changed
87 nothing changed
88 [1]
88 [1]
89
89
90 debugsub
90 debugsub
91
91
92 $ hg debugsub
92 $ hg debugsub
93 path s
93 path s
94 source file:/*/$TESTTMP/svn-repo/src (glob)
94 source file:/*/$TESTTMP/svn-repo/src (glob)
95 revision 2
95 revision 2
96 path subdir/s
96 path subdir/s
97 source file:/*/$TESTTMP/svn-repo/src (glob)
97 source file:/*/$TESTTMP/svn-repo/src (glob)
98 revision 2
98 revision 2
99
99
100 change file in svn and hg, commit
100 change file in svn and hg, commit
101
101
102 $ echo a >> a
102 $ echo a >> a
103 $ echo alpha >> s/alpha
103 $ echo alpha >> s/alpha
104 $ hg sum
104 $ hg sum
105 parent: 1:* tip (glob)
105 parent: 1:* tip (glob)
106 1
106 1
107 branch: default
107 branch: default
108 commit: 1 modified, 1 subrepos
108 commit: 1 modified, 1 subrepos
109 update: (current)
109 update: (current)
110 phases: 2 draft
110 phases: 2 draft
111 $ hg commit --subrepos -m 'Message!' | filter_svn_output
111 $ hg commit --subrepos -m 'Message!' | filter_svn_output
112 committing subrepository s
112 committing subrepository s
113 Sending*s/alpha (glob)
113 Sending*s/alpha (glob)
114 Committed revision 3.
114 Committed revision 3.
115 Fetching external item into '*s/externals'* (glob)
115 Fetching external item into '*s/externals'* (glob)
116 External at revision 1.
116 External at revision 1.
117 At revision 3.
117 At revision 3.
118 $ hg debugsub
118 $ hg debugsub
119 path s
119 path s
120 source file:/*/$TESTTMP/svn-repo/src (glob)
120 source file:/*/$TESTTMP/svn-repo/src (glob)
121 revision 3
121 revision 3
122 path subdir/s
122 path subdir/s
123 source file:/*/$TESTTMP/svn-repo/src (glob)
123 source file:/*/$TESTTMP/svn-repo/src (glob)
124 revision 2
124 revision 2
125
125
126 missing svn file, commit should fail
126 missing svn file, commit should fail
127
127
128 $ rm s/alpha
128 $ rm s/alpha
129 $ hg commit --subrepos -m 'abort on missing file'
129 $ hg commit --subrepos -m 'abort on missing file'
130 committing subrepository s
130 committing subrepository s
131 abort: cannot commit missing svn entries (in subrepository "s")
131 abort: cannot commit missing svn entries (in subrepository "s")
132 [255]
132 [255]
133 $ svn revert s/alpha > /dev/null
133 $ svn revert s/alpha > /dev/null
134
134
135 add an unrelated revision in svn and update the subrepo to without
135 add an unrelated revision in svn and update the subrepo to without
136 bringing any changes.
136 bringing any changes.
137
137
138 $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated'
138 $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated'
139 $ svn up -q s
139 $ svn up -q s
140 $ hg sum
140 $ hg sum
141 parent: 2:* tip (glob)
141 parent: 2:* tip (glob)
142 Message!
142 Message!
143 branch: default
143 branch: default
144 commit: (clean)
144 commit: (clean)
145 update: (current)
145 update: (current)
146 phases: 3 draft
146 phases: 3 draft
147
147
148 $ echo a > s/a
148 $ echo a > s/a
149
149
150 should be empty despite change to s/a
150 should be empty despite change to s/a
151
151
152 $ hg st
152 $ hg st
153
153
154 add a commit from svn
154 add a commit from svn
155
155
156 $ cd "$WCROOT/src"
156 $ cd "$WCROOT/src"
157 $ svn up -q
157 $ svn up -q
158 $ echo xyz >> alpha
158 $ echo xyz >> alpha
159 $ svn propset svn:mime-type 'text/xml' alpha
159 $ svn propset svn:mime-type 'text/xml' alpha
160 property 'svn:mime-type' set on 'alpha'
160 property 'svn:mime-type' set on 'alpha'
161 $ svn ci -qm 'amend a from svn'
161 $ svn ci -qm 'amend a from svn'
162 $ cd ../../sub/t
162 $ cd ../../sub/t
163
163
164 this commit from hg will fail
164 this commit from hg will fail
165
165
166 $ echo zzz >> s/alpha
166 $ echo zzz >> s/alpha
167 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
167 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
168 committing subrepository s
168 committing subrepository s
169 abort: svn:*Commit failed (details follow): (glob)
169 abort: svn:*Commit failed (details follow): (glob)
170 [255]
170 [255]
171 $ svn revert -q s/alpha
171 $ svn revert -q s/alpha
172
172
173 this commit fails because of meta changes
173 this commit fails because of meta changes
174
174
175 $ svn propset svn:mime-type 'text/html' s/alpha
175 $ svn propset svn:mime-type 'text/html' s/alpha
176 property 'svn:mime-type' set on 's/alpha'
176 property 'svn:mime-type' set on 's/alpha'
177 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
177 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
178 committing subrepository s
178 committing subrepository s
179 abort: svn:*Commit failed (details follow): (glob)
179 abort: svn:*Commit failed (details follow): (glob)
180 [255]
180 [255]
181 $ svn revert -q s/alpha
181 $ svn revert -q s/alpha
182
182
183 this commit fails because of externals changes
183 this commit fails because of externals changes
184
184
185 $ echo zzz > s/externals/other
185 $ echo zzz > s/externals/other
186 $ hg ci --subrepos -m 'amend externals from hg'
186 $ hg ci --subrepos -m 'amend externals from hg'
187 committing subrepository s
187 committing subrepository s
188 abort: cannot commit svn externals (in subrepository "s")
188 abort: cannot commit svn externals (in subrepository "s")
189 [255]
189 [255]
190 $ hg diff --subrepos -r 1:2 | grep -v diff
190 $ hg diff --subrepos -r 1:2 | grep -v diff
191 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
191 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
192 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
192 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
193 @@ -1,2 +1,2 @@
193 @@ -1,2 +1,2 @@
194 -2 s
194 -2 s
195 +3 s
195 +3 s
196 2 subdir/s
196 2 subdir/s
197 --- a/a Thu Jan 01 00:00:00 1970 +0000
197 --- a/a Thu Jan 01 00:00:00 1970 +0000
198 +++ b/a Thu Jan 01 00:00:00 1970 +0000
198 +++ b/a Thu Jan 01 00:00:00 1970 +0000
199 @@ -1,1 +1,2 @@
199 @@ -1,1 +1,2 @@
200 a
200 a
201 +a
201 +a
202 $ svn revert -q s/externals/other
202 $ svn revert -q s/externals/other
203
203
204 this commit fails because of externals meta changes
204 this commit fails because of externals meta changes
205
205
206 $ svn propset svn:mime-type 'text/html' s/externals/other
206 $ svn propset svn:mime-type 'text/html' s/externals/other
207 property 'svn:mime-type' set on 's/externals/other'
207 property 'svn:mime-type' set on 's/externals/other'
208 $ hg ci --subrepos -m 'amend externals from hg'
208 $ hg ci --subrepos -m 'amend externals from hg'
209 committing subrepository s
209 committing subrepository s
210 abort: cannot commit svn externals (in subrepository "s")
210 abort: cannot commit svn externals (in subrepository "s")
211 [255]
211 [255]
212 $ svn revert -q s/externals/other
212 $ svn revert -q s/externals/other
213
213
214 clone
214 clone
215
215
216 $ cd ..
216 $ cd ..
217 $ hg clone t tc
217 $ hg clone t tc
218 updating to branch default
218 updating to branch default
219 A tc/s/alpha
219 A tc/s/alpha
220 U tc/s
220 U tc/s
221
221
222 Fetching external item into 'tc/s/externals'* (glob)
222 Fetching external item into 'tc/s/externals'* (glob)
223 A tc/s/externals/other
223 A tc/s/externals/other
224 Checked out external at revision 1.
224 Checked out external at revision 1.
225
225
226 Checked out revision 3.
226 Checked out revision 3.
227 A tc/subdir/s/alpha
227 A tc/subdir/s/alpha
228 U tc/subdir/s
228 U tc/subdir/s
229
229
230 Fetching external item into 'tc/subdir/s/externals'* (glob)
230 Fetching external item into 'tc/subdir/s/externals'* (glob)
231 A tc/subdir/s/externals/other
231 A tc/subdir/s/externals/other
232 Checked out external at revision 1.
232 Checked out external at revision 1.
233
233
234 Checked out revision 2.
234 Checked out revision 2.
235 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
235 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 $ cd tc
236 $ cd tc
237
237
238 debugsub in clone
238 debugsub in clone
239
239
240 $ hg debugsub
240 $ hg debugsub
241 path s
241 path s
242 source file:/*/$TESTTMP/svn-repo/src (glob)
242 source file:/*/$TESTTMP/svn-repo/src (glob)
243 revision 3
243 revision 3
244 path subdir/s
244 path subdir/s
245 source file:/*/$TESTTMP/svn-repo/src (glob)
245 source file:/*/$TESTTMP/svn-repo/src (glob)
246 revision 2
246 revision 2
247
247
248 verify subrepo is contained within the repo directory
248 verify subrepo is contained within the repo directory
249
249
250 $ "$PYTHON" -c "import os.path; print os.path.exists('s')"
250 $ "$PYTHON" -c "from __future__ import print_function; import os.path; print(os.path.exists('s'))"
251 True
251 True
252
252
253 update to nullrev (must delete the subrepo)
253 update to nullrev (must delete the subrepo)
254
254
255 $ hg up null
255 $ hg up null
256 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
256 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
257 $ ls
257 $ ls
258
258
259 Check hg update --clean
259 Check hg update --clean
260 $ cd "$TESTTMP/sub/t"
260 $ cd "$TESTTMP/sub/t"
261 $ cd s
261 $ cd s
262 $ echo c0 > alpha
262 $ echo c0 > alpha
263 $ echo c1 > f1
263 $ echo c1 > f1
264 $ echo c1 > f2
264 $ echo c1 > f2
265 $ svn add f1 -q
265 $ svn add f1 -q
266 $ svn status | sort
266 $ svn status | sort
267
267
268 ? * a (glob)
268 ? * a (glob)
269 ? * f2 (glob)
269 ? * f2 (glob)
270 A * f1 (glob)
270 A * f1 (glob)
271 M * alpha (glob)
271 M * alpha (glob)
272 Performing status on external item at 'externals'* (glob)
272 Performing status on external item at 'externals'* (glob)
273 X * externals (glob)
273 X * externals (glob)
274 $ cd ../..
274 $ cd ../..
275 $ hg -R t update -C
275 $ hg -R t update -C
276
276
277 Fetching external item into 't/s/externals'* (glob)
277 Fetching external item into 't/s/externals'* (glob)
278 Checked out external at revision 1.
278 Checked out external at revision 1.
279
279
280 Checked out revision 3.
280 Checked out revision 3.
281 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
282 $ cd t/s
282 $ cd t/s
283 $ svn status | sort
283 $ svn status | sort
284
284
285 ? * a (glob)
285 ? * a (glob)
286 ? * f1 (glob)
286 ? * f1 (glob)
287 ? * f2 (glob)
287 ? * f2 (glob)
288 Performing status on external item at 'externals'* (glob)
288 Performing status on external item at 'externals'* (glob)
289 X * externals (glob)
289 X * externals (glob)
290
290
291 Sticky subrepositories, no changes
291 Sticky subrepositories, no changes
292 $ cd "$TESTTMP/sub/t"
292 $ cd "$TESTTMP/sub/t"
293 $ hg id -n
293 $ hg id -n
294 2
294 2
295 $ cd s
295 $ cd s
296 $ svnversion
296 $ svnversion
297 3
297 3
298 $ cd ..
298 $ cd ..
299 $ hg update 1
299 $ hg update 1
300 U *s/alpha (glob)
300 U *s/alpha (glob)
301
301
302 Fetching external item into '*s/externals'* (glob)
302 Fetching external item into '*s/externals'* (glob)
303 Checked out external at revision 1.
303 Checked out external at revision 1.
304
304
305 Checked out revision 2.
305 Checked out revision 2.
306 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
306 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
307 $ hg id -n
307 $ hg id -n
308 1
308 1
309 $ cd s
309 $ cd s
310 $ svnversion
310 $ svnversion
311 2
311 2
312 $ cd ..
312 $ cd ..
313
313
314 Sticky subrepositories, file changes
314 Sticky subrepositories, file changes
315 $ touch s/f1
315 $ touch s/f1
316 $ cd s
316 $ cd s
317 $ svn add f1
317 $ svn add f1
318 A f1
318 A f1
319 $ cd ..
319 $ cd ..
320 $ hg id -n
320 $ hg id -n
321 1+
321 1+
322 $ cd s
322 $ cd s
323 $ svnversion
323 $ svnversion
324 2M
324 2M
325 $ cd ..
325 $ cd ..
326 $ hg update tip
326 $ hg update tip
327 subrepository s diverged (local revision: 2, remote revision: 3)
327 subrepository s diverged (local revision: 2, remote revision: 3)
328 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
328 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
329 subrepository sources for s differ
329 subrepository sources for s differ
330 use (l)ocal source (2) or (r)emote source (3)? l
330 use (l)ocal source (2) or (r)emote source (3)? l
331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 $ hg id -n
332 $ hg id -n
333 2+
333 2+
334 $ cd s
334 $ cd s
335 $ svnversion
335 $ svnversion
336 2M
336 2M
337 $ cd ..
337 $ cd ..
338 $ hg update --clean tip
338 $ hg update --clean tip
339 U *s/alpha (glob)
339 U *s/alpha (glob)
340
340
341 Fetching external item into '*s/externals'* (glob)
341 Fetching external item into '*s/externals'* (glob)
342 Checked out external at revision 1.
342 Checked out external at revision 1.
343
343
344 Checked out revision 3.
344 Checked out revision 3.
345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
346
346
347 Sticky subrepository, revision updates
347 Sticky subrepository, revision updates
348 $ hg id -n
348 $ hg id -n
349 2
349 2
350 $ cd s
350 $ cd s
351 $ svnversion
351 $ svnversion
352 3
352 3
353 $ cd ..
353 $ cd ..
354 $ cd s
354 $ cd s
355 $ svn update -qr 1
355 $ svn update -qr 1
356 $ cd ..
356 $ cd ..
357 $ hg update 1
357 $ hg update 1
358 subrepository s diverged (local revision: 3, remote revision: 2)
358 subrepository s diverged (local revision: 3, remote revision: 2)
359 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
359 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
360 subrepository sources for s differ (in checked out version)
360 subrepository sources for s differ (in checked out version)
361 use (l)ocal source (1) or (r)emote source (2)? l
361 use (l)ocal source (1) or (r)emote source (2)? l
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 $ hg id -n
363 $ hg id -n
364 1+
364 1+
365 $ cd s
365 $ cd s
366 $ svnversion
366 $ svnversion
367 1
367 1
368 $ cd ..
368 $ cd ..
369
369
370 Sticky subrepository, file changes and revision updates
370 Sticky subrepository, file changes and revision updates
371 $ touch s/f1
371 $ touch s/f1
372 $ cd s
372 $ cd s
373 $ svn add f1
373 $ svn add f1
374 A f1
374 A f1
375 $ svnversion
375 $ svnversion
376 1M
376 1M
377 $ cd ..
377 $ cd ..
378 $ hg id -n
378 $ hg id -n
379 1+
379 1+
380 $ hg update tip
380 $ hg update tip
381 subrepository s diverged (local revision: 3, remote revision: 3)
381 subrepository s diverged (local revision: 3, remote revision: 3)
382 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
382 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
383 subrepository sources for s differ
383 subrepository sources for s differ
384 use (l)ocal source (1) or (r)emote source (3)? l
384 use (l)ocal source (1) or (r)emote source (3)? l
385 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
385 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
386 $ hg id -n
386 $ hg id -n
387 2+
387 2+
388 $ cd s
388 $ cd s
389 $ svnversion
389 $ svnversion
390 1M
390 1M
391 $ cd ..
391 $ cd ..
392
392
393 Sticky repository, update --clean
393 Sticky repository, update --clean
394 $ hg update --clean tip | grep -v 's[/\]externals[/\]other'
394 $ hg update --clean tip | grep -v 's[/\]externals[/\]other'
395 U *s/alpha (glob)
395 U *s/alpha (glob)
396 U *s (glob)
396 U *s (glob)
397
397
398 Fetching external item into '*s/externals'* (glob)
398 Fetching external item into '*s/externals'* (glob)
399 Checked out external at revision 1.
399 Checked out external at revision 1.
400
400
401 Checked out revision 3.
401 Checked out revision 3.
402 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
402 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
403 $ hg id -n
403 $ hg id -n
404 2
404 2
405 $ cd s
405 $ cd s
406 $ svnversion
406 $ svnversion
407 3
407 3
408 $ cd ..
408 $ cd ..
409
409
410 Test subrepo already at intended revision:
410 Test subrepo already at intended revision:
411 $ cd s
411 $ cd s
412 $ svn update -qr 2
412 $ svn update -qr 2
413 $ cd ..
413 $ cd ..
414 $ hg update 1
414 $ hg update 1
415 subrepository s diverged (local revision: 3, remote revision: 2)
415 subrepository s diverged (local revision: 3, remote revision: 2)
416 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
416 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
417 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
417 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
418 $ hg id -n
418 $ hg id -n
419 1+
419 1+
420 $ cd s
420 $ cd s
421 $ svnversion
421 $ svnversion
422 2
422 2
423 $ cd ..
423 $ cd ..
424
424
425 Test case where subversion would fail to update the subrepo because there
425 Test case where subversion would fail to update the subrepo because there
426 are unknown directories being replaced by tracked ones (happens with rebase).
426 are unknown directories being replaced by tracked ones (happens with rebase).
427
427
428 $ cd "$WCROOT/src"
428 $ cd "$WCROOT/src"
429 $ mkdir dir
429 $ mkdir dir
430 $ echo epsilon.py > dir/epsilon.py
430 $ echo epsilon.py > dir/epsilon.py
431 $ svn add dir
431 $ svn add dir
432 A dir
432 A dir
433 A dir/epsilon.py
433 A dir/epsilon.py
434 $ svn ci -qm 'Add dir/epsilon.py'
434 $ svn ci -qm 'Add dir/epsilon.py'
435 $ cd ../..
435 $ cd ../..
436 $ hg init rebaserepo
436 $ hg init rebaserepo
437 $ cd rebaserepo
437 $ cd rebaserepo
438 $ svn co -r5 --quiet "$SVNREPOURL"/src s
438 $ svn co -r5 --quiet "$SVNREPOURL"/src s
439 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
439 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
440 $ hg add .hgsub
440 $ hg add .hgsub
441 $ hg ci -m addsub
441 $ hg ci -m addsub
442 $ echo a > a
442 $ echo a > a
443 $ hg add .
443 $ hg add .
444 adding a
444 adding a
445 $ hg ci -m adda
445 $ hg ci -m adda
446 $ hg up 0
446 $ hg up 0
447 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
447 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
448 $ svn up -qr6 s
448 $ svn up -qr6 s
449 $ hg ci -m updatesub
449 $ hg ci -m updatesub
450 created new head
450 created new head
451 $ echo pyc > s/dir/epsilon.pyc
451 $ echo pyc > s/dir/epsilon.pyc
452 $ hg up 1
452 $ hg up 1
453 D *s/dir (glob)
453 D *s/dir (glob)
454
454
455 Fetching external item into '*s/externals'* (glob)
455 Fetching external item into '*s/externals'* (glob)
456 Checked out external at revision 1.
456 Checked out external at revision 1.
457
457
458 Checked out revision 5.
458 Checked out revision 5.
459 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
460 $ hg up -q 2
460 $ hg up -q 2
461
461
462 Modify one of the externals to point to a different path so we can
462 Modify one of the externals to point to a different path so we can
463 test having obstructions when switching branches on checkout:
463 test having obstructions when switching branches on checkout:
464 $ hg checkout tip
464 $ hg checkout tip
465 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
465 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
466 $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub
466 $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub
467 $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct
467 $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct
468 $ hg commit -m 'Start making obstructed working copy'
468 $ hg commit -m 'Start making obstructed working copy'
469 $ hg book other
469 $ hg book other
470 $ hg co -r 'p1(tip)'
470 $ hg co -r 'p1(tip)'
471 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
471 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
472 (leaving bookmark other)
472 (leaving bookmark other)
473 $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub
473 $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub
474 $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
474 $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
475 $ hg commit -m 'Other branch which will be obstructed'
475 $ hg commit -m 'Other branch which will be obstructed'
476 created new head
476 created new head
477
477
478 Switching back to the head where we have another path mapped to the
478 Switching back to the head where we have another path mapped to the
479 same subrepo should work if the subrepo is clean.
479 same subrepo should work if the subrepo is clean.
480 $ hg co other
480 $ hg co other
481 A *obstruct/other (glob)
481 A *obstruct/other (glob)
482 Checked out revision 1.
482 Checked out revision 1.
483 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
483 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
484 (activating bookmark other)
484 (activating bookmark other)
485
485
486 This is surprising, but is also correct based on the current code:
486 This is surprising, but is also correct based on the current code:
487 $ echo "updating should (maybe) fail" > obstruct/other
487 $ echo "updating should (maybe) fail" > obstruct/other
488 $ hg co tip
488 $ hg co tip
489 abort: uncommitted changes
489 abort: uncommitted changes
490 (commit or update --clean to discard changes)
490 (commit or update --clean to discard changes)
491 [255]
491 [255]
492
492
493 Point to a Subversion branch which has since been deleted and recreated
493 Point to a Subversion branch which has since been deleted and recreated
494 First, create that condition in the repository.
494 First, create that condition in the repository.
495
495
496 $ hg ci --subrepos -m cleanup | filter_svn_output
496 $ hg ci --subrepos -m cleanup | filter_svn_output
497 committing subrepository obstruct
497 committing subrepository obstruct
498 Sending obstruct/other
498 Sending obstruct/other
499 Committed revision 7.
499 Committed revision 7.
500 At revision 7.
500 At revision 7.
501 $ svn mkdir -qm "baseline" $SVNREPOURL/trunk
501 $ svn mkdir -qm "baseline" $SVNREPOURL/trunk
502 $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch
502 $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch
503 $ svn co --quiet "$SVNREPOURL"/branch tempwc
503 $ svn co --quiet "$SVNREPOURL"/branch tempwc
504 $ cd tempwc
504 $ cd tempwc
505 $ echo "something old" > somethingold
505 $ echo "something old" > somethingold
506 $ svn add somethingold
506 $ svn add somethingold
507 A somethingold
507 A somethingold
508 $ svn ci -qm 'Something old'
508 $ svn ci -qm 'Something old'
509 $ svn rm -qm "remove branch" $SVNREPOURL/branch
509 $ svn rm -qm "remove branch" $SVNREPOURL/branch
510 $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch
510 $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch
511 $ svn up -q
511 $ svn up -q
512 $ echo "something new" > somethingnew
512 $ echo "something new" > somethingnew
513 $ svn add somethingnew
513 $ svn add somethingnew
514 A somethingnew
514 A somethingnew
515 $ svn ci -qm 'Something new'
515 $ svn ci -qm 'Something new'
516 $ cd ..
516 $ cd ..
517 $ rm -rf tempwc
517 $ rm -rf tempwc
518 $ svn co "$SVNREPOURL/branch"@10 recreated
518 $ svn co "$SVNREPOURL/branch"@10 recreated
519 A recreated/somethingold
519 A recreated/somethingold
520 Checked out revision 10.
520 Checked out revision 10.
521 $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub
521 $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub
522 $ hg ci -m addsub
522 $ hg ci -m addsub
523 $ cd recreated
523 $ cd recreated
524 $ svn up -q
524 $ svn up -q
525 $ cd ..
525 $ cd ..
526 $ hg ci -m updatesub
526 $ hg ci -m updatesub
527 $ hg up -r-2
527 $ hg up -r-2
528 D *recreated/somethingnew (glob)
528 D *recreated/somethingnew (glob)
529 A *recreated/somethingold (glob)
529 A *recreated/somethingold (glob)
530 Checked out revision 10.
530 Checked out revision 10.
531 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 (leaving bookmark other)
532 (leaving bookmark other)
533 $ test -f recreated/somethingold
533 $ test -f recreated/somethingold
534
534
535 Test archive
535 Test archive
536
536
537 $ hg archive -S ../archive-all --debug --config progress.debug=true
537 $ hg archive -S ../archive-all --debug --config progress.debug=true
538 archiving: 0/2 files (0.00%)
538 archiving: 0/2 files (0.00%)
539 archiving: .hgsub 1/2 files (50.00%)
539 archiving: .hgsub 1/2 files (50.00%)
540 archiving: .hgsubstate 2/2 files (100.00%)
540 archiving: .hgsubstate 2/2 files (100.00%)
541 archiving (obstruct): 0/1 files (0.00%)
541 archiving (obstruct): 0/1 files (0.00%)
542 archiving (obstruct): 1/1 files (100.00%)
542 archiving (obstruct): 1/1 files (100.00%)
543 archiving (recreated): 0/1 files (0.00%)
543 archiving (recreated): 0/1 files (0.00%)
544 archiving (recreated): 1/1 files (100.00%)
544 archiving (recreated): 1/1 files (100.00%)
545 archiving (s): 0/2 files (0.00%)
545 archiving (s): 0/2 files (0.00%)
546 archiving (s): 1/2 files (50.00%)
546 archiving (s): 1/2 files (50.00%)
547 archiving (s): 2/2 files (100.00%)
547 archiving (s): 2/2 files (100.00%)
548
548
549 $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old
549 $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old
550 archiving: 0/2 files (0.00%)
550 archiving: 0/2 files (0.00%)
551 archiving: .hgsub 1/2 files (50.00%)
551 archiving: .hgsub 1/2 files (50.00%)
552 archiving: .hgsubstate 2/2 files (100.00%)
552 archiving: .hgsubstate 2/2 files (100.00%)
553 archiving (obstruct): 0/1 files (0.00%)
553 archiving (obstruct): 0/1 files (0.00%)
554 archiving (obstruct): 1/1 files (100.00%)
554 archiving (obstruct): 1/1 files (100.00%)
555 archiving (recreated): 0 files
555 archiving (recreated): 0 files
556 archiving (s): 0/2 files (0.00%)
556 archiving (s): 0/2 files (0.00%)
557 archiving (s): 1/2 files (50.00%)
557 archiving (s): 1/2 files (50.00%)
558 archiving (s): 2/2 files (100.00%)
558 archiving (s): 2/2 files (100.00%)
559 $ find ../archive-exclude | sort
559 $ find ../archive-exclude | sort
560 ../archive-exclude
560 ../archive-exclude
561 ../archive-exclude/.hg_archival.txt
561 ../archive-exclude/.hg_archival.txt
562 ../archive-exclude/.hgsub
562 ../archive-exclude/.hgsub
563 ../archive-exclude/.hgsubstate
563 ../archive-exclude/.hgsubstate
564 ../archive-exclude/obstruct
564 ../archive-exclude/obstruct
565 ../archive-exclude/obstruct/other
565 ../archive-exclude/obstruct/other
566 ../archive-exclude/s
566 ../archive-exclude/s
567 ../archive-exclude/s/alpha
567 ../archive-exclude/s/alpha
568 ../archive-exclude/s/dir
568 ../archive-exclude/s/dir
569 ../archive-exclude/s/dir/epsilon.py
569 ../archive-exclude/s/dir/epsilon.py
570
570
571 Test forgetting files, not implemented in svn subrepo, used to
571 Test forgetting files, not implemented in svn subrepo, used to
572 traceback
572 traceback
573
573
574 $ hg forget 'notafile*'
574 $ hg forget 'notafile*'
575 notafile*: $ENOENT$
575 notafile*: $ENOENT$
576 [1]
576 [1]
577
577
578 Test a subrepo referencing a just moved svn path. Last commit rev will
578 Test a subrepo referencing a just moved svn path. Last commit rev will
579 be different from the revision, and the path will be different as
579 be different from the revision, and the path will be different as
580 well.
580 well.
581
581
582 $ cd "$WCROOT"
582 $ cd "$WCROOT"
583 $ svn up > /dev/null
583 $ svn up > /dev/null
584 $ mkdir trunk/subdir branches
584 $ mkdir trunk/subdir branches
585 $ echo a > trunk/subdir/a
585 $ echo a > trunk/subdir/a
586 $ svn add trunk/subdir branches
586 $ svn add trunk/subdir branches
587 A trunk/subdir
587 A trunk/subdir
588 A trunk/subdir/a
588 A trunk/subdir/a
589 A branches
589 A branches
590 $ svn ci -qm addsubdir
590 $ svn ci -qm addsubdir
591 $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
591 $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
592 $ cd ..
592 $ cd ..
593
593
594 $ hg init repo2
594 $ hg init repo2
595 $ cd repo2
595 $ cd repo2
596 $ svn co $SVNREPOURL/branches/somebranch/subdir
596 $ svn co $SVNREPOURL/branches/somebranch/subdir
597 A subdir/a
597 A subdir/a
598 Checked out revision 15.
598 Checked out revision 15.
599 $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
599 $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
600 $ hg add .hgsub
600 $ hg add .hgsub
601 $ hg ci -m addsub
601 $ hg ci -m addsub
602 $ hg up null
602 $ hg up null
603 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
603 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
604 $ hg up
604 $ hg up
605 A *subdir/a (glob)
605 A *subdir/a (glob)
606 Checked out revision 15.
606 Checked out revision 15.
607 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 $ cd ..
608 $ cd ..
609
609
610 Test sanitizing ".hg/hgrc" in subrepo
610 Test sanitizing ".hg/hgrc" in subrepo
611
611
612 $ cd sub/t
612 $ cd sub/t
613 $ hg update -q -C tip
613 $ hg update -q -C tip
614 $ cd s
614 $ cd s
615 $ mkdir .hg
615 $ mkdir .hg
616 $ echo '.hg/hgrc in svn repo' > .hg/hgrc
616 $ echo '.hg/hgrc in svn repo' > .hg/hgrc
617 $ mkdir -p sub/.hg
617 $ mkdir -p sub/.hg
618 $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc
618 $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc
619 $ svn add .hg sub
619 $ svn add .hg sub
620 A .hg
620 A .hg
621 A .hg/hgrc
621 A .hg/hgrc
622 A sub
622 A sub
623 A sub/.hg
623 A sub/.hg
624 A sub/.hg/hgrc
624 A sub/.hg/hgrc
625 $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update'
625 $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update'
626 $ svn up -q
626 $ svn up -q
627 $ cd ..
627 $ cd ..
628 $ hg commit -S -m 'commit with svn revision including .hg/hgrc'
628 $ hg commit -S -m 'commit with svn revision including .hg/hgrc'
629 $ grep ' s$' .hgsubstate
629 $ grep ' s$' .hgsubstate
630 16 s
630 16 s
631 $ cd ..
631 $ cd ..
632
632
633 $ hg -R tc pull -u -q 2>&1 | sort
633 $ hg -R tc pull -u -q 2>&1 | sort
634 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg'
634 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg'
635 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg'
635 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg'
636 $ cd tc
636 $ cd tc
637 $ grep ' s$' .hgsubstate
637 $ grep ' s$' .hgsubstate
638 16 s
638 16 s
639 $ test -f s/.hg/hgrc
639 $ test -f s/.hg/hgrc
640 [1]
640 [1]
641 $ test -f s/sub/.hg/hgrc
641 $ test -f s/sub/.hg/hgrc
642 [1]
642 [1]
643
643
644 Test that sanitizing is omitted in meta data area:
644 Test that sanitizing is omitted in meta data area:
645
645
646 $ mkdir s/.svn/.hg
646 $ mkdir s/.svn/.hg
647 $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc
647 $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc
648 $ hg update -q -C '.^1'
648 $ hg update -q -C '.^1'
649
649
650 $ cd ../..
650 $ cd ../..
651
651
652 SEC: test for ssh exploit
652 SEC: test for ssh exploit
653
653
654 $ hg init ssh-vuln
654 $ hg init ssh-vuln
655 $ cd ssh-vuln
655 $ cd ssh-vuln
656 $ echo "s = [svn]$SVNREPOURL/src" >> .hgsub
656 $ echo "s = [svn]$SVNREPOURL/src" >> .hgsub
657 $ svn co --quiet "$SVNREPOURL"/src s
657 $ svn co --quiet "$SVNREPOURL"/src s
658 $ hg add .hgsub
658 $ hg add .hgsub
659 $ hg ci -m1
659 $ hg ci -m1
660 $ echo "s = [svn]svn+ssh://-oProxyCommand=touch%20owned%20nested" > .hgsub
660 $ echo "s = [svn]svn+ssh://-oProxyCommand=touch%20owned%20nested" > .hgsub
661 $ hg ci -m2
661 $ hg ci -m2
662 $ cd ..
662 $ cd ..
663 $ hg clone ssh-vuln ssh-vuln-clone
663 $ hg clone ssh-vuln ssh-vuln-clone
664 updating to branch default
664 updating to branch default
665 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s")
665 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s")
666 [255]
666 [255]
667
667
668 also check that a percent encoded '-' (%2D) doesn't work
668 also check that a percent encoded '-' (%2D) doesn't work
669
669
670 $ cd ssh-vuln
670 $ cd ssh-vuln
671 $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20nested" > .hgsub
671 $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20nested" > .hgsub
672 $ hg ci -m3
672 $ hg ci -m3
673 $ cd ..
673 $ cd ..
674 $ rm -r ssh-vuln-clone
674 $ rm -r ssh-vuln-clone
675 $ hg clone ssh-vuln ssh-vuln-clone
675 $ hg clone ssh-vuln ssh-vuln-clone
676 updating to branch default
676 updating to branch default
677 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s")
677 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s")
678 [255]
678 [255]
679
679
680 also check that hiding the attack in the username doesn't work:
680 also check that hiding the attack in the username doesn't work:
681
681
682 $ cd ssh-vuln
682 $ cd ssh-vuln
683 $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20foo@example.com/nested" > .hgsub
683 $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20foo@example.com/nested" > .hgsub
684 $ hg ci -m3
684 $ hg ci -m3
685 $ cd ..
685 $ cd ..
686 $ rm -r ssh-vuln-clone
686 $ rm -r ssh-vuln-clone
687 $ hg clone ssh-vuln ssh-vuln-clone
687 $ hg clone ssh-vuln ssh-vuln-clone
688 updating to branch default
688 updating to branch default
689 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned foo@example.com/nested' (in subrepository "s")
689 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned foo@example.com/nested' (in subrepository "s")
690 [255]
690 [255]
General Comments 0
You need to be logged in to leave comments. Login now