##// END OF EJS Templates
tests: unify test-convert-cvs
Matt Mackall -
r12519:99232aa6 default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (562 lines changed) Show them Hide them
@@ -1,154 +1,460 b''
1 #!/bin/sh
2
3 "$TESTDIR/hghave" cvs || exit 80
4 1
5 cvscall()
6 {
7 cvs -f "$@"
8 }
2 $ "$TESTDIR/hghave" cvs || exit 80
3 $ cvscall()
4 > {
5 > cvs -f "$@"
6 > }
7 $ hgcat()
8 > {
9 > hg --cwd src-hg cat -r tip "$1"
10 > }
11 $ echo "[extensions]" >> $HGRCPATH
12 $ echo "convert = " >> $HGRCPATH
13 $ echo "graphlog = " >> $HGRCPATH
14 $ cat > cvshooks.py <<EOF
15 > def cvslog(ui,repo,hooktype,log):
16 > print "%s hook: %d entries"%(hooktype,len(log))
17 >
18 > def cvschangesets(ui,repo,hooktype,changesets):
19 > print "%s hook: %d changesets"%(hooktype,len(changesets))
20 > EOF
21 $ hookpath=`pwd`
22 $ echo "[hooks]" >> $HGRCPATH
23 $ echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH
24 $ echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH
9 25
10 hgcat()
11 {
12 hg --cwd src-hg cat -r tip "$1"
13 }
26 create cvs repository
27
28 $ mkdir cvsrepo
29 $ cd cvsrepo
30 $ CVSROOT=`pwd`
31 $ export CVSROOT
32 $ CVS_OPTIONS=-f
33 $ export CVS_OPTIONS
34 $ cd ..
35 $ cvscall -q -d "$CVSROOT" init
36
37 create source directory
38
39 $ mkdir src-temp
40 $ cd src-temp
41 $ echo a > a
42 $ mkdir b
43 $ cd b
44 $ echo c > c
45 $ cd ..
46
47 import source directory
14 48
15 echo "[extensions]" >> $HGRCPATH
16 echo "convert = " >> $HGRCPATH
17 echo "graphlog = " >> $HGRCPATH
49 $ cvscall -q import -m import src INITIAL start
50 N src/a
51 N src/b/c
52
53 No conflicts created by this import
54
55 $ cd ..
56
57 checkout source directory
18 58
19 cat > cvshooks.py <<EOF
20 def cvslog(ui,repo,hooktype,log):
21 print "%s hook: %d entries"%(hooktype,len(log))
59 $ cvscall -q checkout src
60 U src/a
61 U src/b/c
62
63 commit a new revision changing b/c
64
65 $ cd src
66 $ sleep 1
67 $ echo c >> b/c
68 $ cvscall -q commit -mci0 . | grep '<--'
69 */cvsrepo/src/b/c,v <-- *c (glob)
70 $ cd ..
22 71
23 def cvschangesets(ui,repo,hooktype,changesets):
24 print "%s hook: %d changesets"%(hooktype,len(changesets))
25 EOF
26 hookpath=`pwd`
72 convert fresh repo
27 73
28 echo "[hooks]" >> $HGRCPATH
29 echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH
30 echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH
74 $ hg convert src src-hg
75 initializing destination src-hg repository
76 connecting to */cvsrepo (glob)
77 scanning source...
78 collecting CVS rlog
79 5 log entries
80 cvslog hook: 5 entries
81 creating changesets
82 3 changeset entries
83 cvschangesets hook: 3 changesets
84 sorting...
85 converting...
86 2 Initial revision
87 1 import
88 0 ci0
89 updating tags
90 $ hgcat a
91 a
92 $ hgcat b/c
93 c
94 c
95
96 convert fresh repo with --filemap
31 97
32 echo % create cvs repository
33 mkdir cvsrepo
34 cd cvsrepo
35 CVSROOT=`pwd`
36 export CVSROOT
37 CVS_OPTIONS=-f
38 export CVS_OPTIONS
39 cd ..
98 $ echo include b/c > filemap
99 $ hg convert --filemap filemap src src-filemap
100 initializing destination src-filemap repository
101 connecting to */cvsrepo (glob)
102 scanning source...
103 collecting CVS rlog
104 5 log entries
105 cvslog hook: 5 entries
106 creating changesets
107 3 changeset entries
108 cvschangesets hook: 3 changesets
109 sorting...
110 converting...
111 2 Initial revision
112 1 import
113 filtering out empty revision
114 rolling back to revision 0 (undo commit)
115 0 ci0
116 updating tags
117 $ hgcat b/c
118 c
119 c
120 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
121 2 update tags files: .hgtags
122 1 ci0 files: b/c
123 0 Initial revision files: b/c
40 124
41 cvscall -q -d "$CVSROOT" init
125 convert full repository (issue1649)
42 126
43 echo % create source directory
44 mkdir src-temp
45 cd src-temp
46 echo a > a
47 mkdir b
48 cd b
49 echo c > c
50 cd ..
127 $ cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
128 U srcfull/src/a
129 U srcfull/src/b/c
130 $ ls srcfull
131 CVS
132 CVSROOT
133 src
134 $ hg convert srcfull srcfull-hg \
135 > | grep -v 'log entries' | grep -v 'hook:' \
136 > | grep -v '^[0-3] .*' # filter instable changeset order
137 initializing destination srcfull-hg repository
138 connecting to */cvsrepo (glob)
139 scanning source...
140 collecting CVS rlog
141 creating changesets
142 4 changeset entries
143 sorting...
144 converting...
145 updating tags
146 $ hg cat -r tip srcfull-hg/src/a
147 a
148 $ hg cat -r tip srcfull-hg/src/b/c
149 c
150 c
151
152 commit new file revisions
51 153
52 echo % import source directory
53 cvscall -q import -m import src INITIAL start
54 cd ..
154 $ cd src
155 $ echo a >> a
156 $ echo c >> b/c
157 $ cvscall -q commit -mci1 . | grep '<--'
158 */cvsrepo/src/a,v <-- a (glob)
159 */cvsrepo/src/b/c,v <-- *c (glob)
160 $ cd ..
161
162 convert again
55 163
56 echo % checkout source directory
57 cvscall -q checkout src
164 $ hg convert src src-hg
165 connecting to */cvsrepo (glob)
166 scanning source...
167 collecting CVS rlog
168 7 log entries
169 cvslog hook: 7 entries
170 creating changesets
171 4 changeset entries
172 cvschangesets hook: 4 changesets
173 sorting...
174 converting...
175 0 ci1
176 $ hgcat a
177 a
178 a
179 $ hgcat b/c
180 c
181 c
182 c
183
184 convert again with --filemap
58 185
59 echo % commit a new revision changing b/c
60 cd src
61 sleep 1
62 echo c >> b/c
63 cvscall -q commit -mci0 . | grep '<--' |\
64 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
65 cd ..
186 $ hg convert --filemap filemap src src-filemap
187 connecting to */cvsrepo (glob)
188 scanning source...
189 collecting CVS rlog
190 7 log entries
191 cvslog hook: 7 entries
192 creating changesets
193 4 changeset entries
194 cvschangesets hook: 4 changesets
195 sorting...
196 converting...
197 0 ci1
198 $ hgcat b/c
199 c
200 c
201 c
202 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
203 3 ci1 files: b/c
204 2 update tags files: .hgtags
205 1 ci0 files: b/c
206 0 Initial revision files: b/c
66 207
67 echo % convert fresh repo
68 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
69 hgcat a
70 hgcat b/c
208 commit branch
71 209
72 echo % convert fresh repo with --filemap
73 echo include b/c > filemap
74 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
75 hgcat b/c
76 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
210 $ cd src
211 $ cvs -q update -r1.1 b/c
212 U b/c
213 $ cvs -q tag -b branch
214 T a
215 T b/c
216 $ cvs -q update -r branch > /dev/null
217 $ echo d >> b/c
218 $ cvs -q commit -mci2 . | grep '<--'
219 */cvsrepo/src/b/c,v <-- *c (glob)
220 $ cd ..
221
222 convert again
77 223
78 echo % 'convert full repository (issue1649)'
79 cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
80 ls srcfull
81 hg convert srcfull srcfull-hg \
82 | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' \
83 | grep -v 'log entries' | grep -v 'hook:' \
84 | grep -v '^[0-3] .*' # filter instable changeset order
85 hg cat -r tip srcfull-hg/src/a
86 hg cat -r tip srcfull-hg/src/b/c
224 $ hg convert src src-hg
225 connecting to */cvsrepo (glob)
226 scanning source...
227 collecting CVS rlog
228 8 log entries
229 cvslog hook: 8 entries
230 creating changesets
231 5 changeset entries
232 cvschangesets hook: 5 changesets
233 sorting...
234 converting...
235 0 ci2
236 $ hgcat b/c
237 c
238 d
239
240 convert again with --filemap
87 241
88 echo % commit new file revisions
89 cd src
90 echo a >> a
91 echo c >> b/c
92 cvscall -q commit -mci1 . | grep '<--' |\
93 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
94 cd ..
242 $ hg convert --filemap filemap src src-filemap
243 connecting to */cvsrepo (glob)
244 scanning source...
245 collecting CVS rlog
246 8 log entries
247 cvslog hook: 8 entries
248 creating changesets
249 5 changeset entries
250 cvschangesets hook: 5 changesets
251 sorting...
252 converting...
253 0 ci2
254 $ hgcat b/c
255 c
256 d
257 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
258 4 ci2 files: b/c
259 3 ci1 files: b/c
260 2 update tags files: .hgtags
261 1 ci0 files: b/c
262 0 Initial revision files: b/c
263
264 commit a new revision with funny log message
265
266 $ cd src
267 $ sleep 1
268 $ echo e >> a
269 $ cvscall -q commit -m'funny
270 > ----------------------------
271 > log message' . | grep '<--' |\
272 > sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
273 checking in src/a,v
95 274
96 echo % convert again
97 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
98 hgcat a
99 hgcat b/c
275 commit new file revisions with some fuzz
100 276
101 echo % convert again with --filemap
102 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
103 hgcat b/c
104 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
277 $ sleep 1
278 $ echo f >> a
279 $ cvscall -q commit -mfuzzy . | grep '<--'
280 */cvsrepo/src/a,v <-- a (glob)
281 $ sleep 4 # the two changes will be split if fuzz < 4
282 $ echo g >> b/c
283 $ cvscall -q commit -mfuzzy . | grep '<--'
284 */cvsrepo/src/b/c,v <-- *c (glob)
285 $ cd ..
286
287 convert again
105 288
106 echo % commit branch
107 cd src
108 cvs -q update -r1.1 b/c
109 cvs -q tag -b branch
110 cvs -q update -r branch > /dev/null
111 echo d >> b/c
112 cvs -q commit -mci2 . | grep '<--' |\
113 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
114 cd ..
289 $ hg convert --config convert.cvsps.fuzz=2 src src-hg
290 connecting to */cvsrepo (glob)
291 scanning source...
292 collecting CVS rlog
293 11 log entries
294 cvslog hook: 11 entries
295 creating changesets
296 8 changeset entries
297 cvschangesets hook: 8 changesets
298 sorting...
299 converting...
300 2 funny
301 1 fuzzy
302 0 fuzzy
303 $ hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
304 o 8 (branch) fuzzy files: b/c
305 |
306 o 7 (branch) fuzzy files: a
307 |
308 o 6 (branch) funny
309 | ----------------------------
310 | log message files: a
311 o 5 (branch) ci2 files: b/c
312
313 o 4 () ci1 files: a b/c
314 |
315 o 3 () update tags files: .hgtags
316 |
317 o 2 () ci0 files: b/c
318 |
319 | o 1 (INITIAL) import files:
320 |/
321 o 0 () Initial revision files: a b/c
322
323
324 testing debugcvsps
115 325
116 echo % convert again
117 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
118 hgcat b/c
326 $ cd src
327 $ hg debugcvsps --fuzz=2
328 collecting CVS rlog
329 11 log entries
330 cvslog hook: 11 entries
331 creating changesets
332 10 changeset entries
333 cvschangesets hook: 10 changesets
334 ---------------------
335 PatchSet 1
336 Date: * (glob)
337 Author: * (glob)
338 Branch: HEAD
339 Tag: (none)
340 Branchpoints: INITIAL
341 Log:
342 Initial revision
119 343
120 echo % convert again with --filemap
121 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
122 hgcat b/c
123 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
344 Members:
345 a:INITIAL->1.1
124 346
125 echo % commit a new revision with funny log message
126 cd src
127 sleep 1
128 echo e >> a
129 cvscall -q commit -m'funny
130 ----------------------------
131 log message' . | grep '<--' |\
132 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
133 cd ..
347 ---------------------
348 PatchSet 2
349 Date: * (glob)
350 Author: * (glob)
351 Branch: HEAD
352 Tag: (none)
353 Branchpoints: INITIAL, branch
354 Log:
355 Initial revision
356
357 Members:
358 b/c:INITIAL->1.1
359
360 ---------------------
361 PatchSet 3
362 Date: * (glob)
363 Author: * (glob)
364 Branch: INITIAL
365 Tag: start
366 Log:
367 import
368
369 Members:
370 a:1.1->1.1.1.1
371 b/c:1.1->1.1.1.1
372
373 ---------------------
374 PatchSet 4
375 Date: * (glob)
376 Author: * (glob)
377 Branch: HEAD
378 Tag: (none)
379 Log:
380 ci0
381
382 Members:
383 b/c:1.1->1.2
134 384
135 echo % commit new file revisions with some fuzz
136 cd src
137 sleep 1
138 echo f >> a
139 cvscall -q commit -mfuzzy . | grep '<--' |\
140 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
141 sleep 4 # the two changes will be split if fuzz < 4
142 echo g >> b/c
143 cvscall -q commit -mfuzzy . | grep '<--' |\
144 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
145 cd ..
385 ---------------------
386 PatchSet 5
387 Date: * (glob)
388 Author: * (glob)
389 Branch: HEAD
390 Tag: (none)
391 Branchpoints: branch
392 Log:
393 ci1
394
395 Members:
396 a:1.1->1.2
397
398 ---------------------
399 PatchSet 6
400 Date: * (glob)
401 Author: * (glob)
402 Branch: HEAD
403 Tag: (none)
404 Log:
405 ci1
406
407 Members:
408 b/c:1.2->1.3
409
410 ---------------------
411 PatchSet 7
412 Date: * (glob)
413 Author: * (glob)
414 Branch: branch
415 Tag: (none)
416 Log:
417 ci2
418
419 Members:
420 b/c:1.1->1.1.2.1
146 421
147 echo % convert again
148 hg convert --config convert.cvsps.fuzz=2 src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
422 ---------------------
423 PatchSet 8
424 Date: * (glob)
425 Author: * (glob)
426 Branch: branch
427 Tag: (none)
428 Log:
429 funny
430 ----------------------------
431 log message
432
433 Members:
434 a:1.2->1.2.2.1
149 435
150 hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
436 ---------------------
437 PatchSet 9
438 Date: * (glob)
439 Author: * (glob)
440 Branch: branch
441 Tag: (none)
442 Log:
443 fuzzy
444
445 Members:
446 a:1.2.2.1->1.2.2.2
151 447
152 echo % testing debugcvsps
153 cd src
154 hg debugcvsps --fuzz=2 | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/'
448 ---------------------
449 PatchSet 10
450 Date: * (glob)
451 Author: * (glob)
452 Branch: branch
453 Tag: (none)
454 Log:
455 fuzzy
456
457 Members:
458 b/c:1.1.2.1->1.1.2.2
459
460
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now