##// 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()
2 $ "$TESTDIR/hghave" cvs || exit 80
6 {
3 $ cvscall()
7 cvs -f "$@"
4 > {
8 }
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()
26 create cvs repository
11 {
27
12 hg --cwd src-hg cat -r tip "$1"
28 $ mkdir cvsrepo
13 }
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
49 $ cvscall -q import -m import src INITIAL start
16 echo "convert = " >> $HGRCPATH
50 N src/a
17 echo "graphlog = " >> $HGRCPATH
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
59 $ cvscall -q checkout src
20 def cvslog(ui,repo,hooktype,log):
60 U src/a
21 print "%s hook: %d entries"%(hooktype,len(log))
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):
72 convert fresh repo
24 print "%s hook: %d changesets"%(hooktype,len(changesets))
25 EOF
26 hookpath=`pwd`
27
73
28 echo "[hooks]" >> $HGRCPATH
74 $ hg convert src src-hg
29 echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH
75 initializing destination src-hg repository
30 echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH
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
98 $ echo include b/c > filemap
33 mkdir cvsrepo
99 $ hg convert --filemap filemap src src-filemap
34 cd cvsrepo
100 initializing destination src-filemap repository
35 CVSROOT=`pwd`
101 connecting to */cvsrepo (glob)
36 export CVSROOT
102 scanning source...
37 CVS_OPTIONS=-f
103 collecting CVS rlog
38 export CVS_OPTIONS
104 5 log entries
39 cd ..
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
127 $ cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
44 mkdir src-temp
128 U srcfull/src/a
45 cd src-temp
129 U srcfull/src/b/c
46 echo a > a
130 $ ls srcfull
47 mkdir b
131 CVS
48 cd b
132 CVSROOT
49 echo c > c
133 src
50 cd ..
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
154 $ cd src
53 cvscall -q import -m import src INITIAL start
155 $ echo a >> a
54 cd ..
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
164 $ hg convert src src-hg
57 cvscall -q checkout src
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
186 $ hg convert --filemap filemap src src-filemap
60 cd src
187 connecting to */cvsrepo (glob)
61 sleep 1
188 scanning source...
62 echo c >> b/c
189 collecting CVS rlog
63 cvscall -q commit -mci0 . | grep '<--' |\
190 7 log entries
64 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
191 cvslog hook: 7 entries
65 cd ..
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
208 commit branch
68 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
69 hgcat a
70 hgcat b/c
71
209
72 echo % convert fresh repo with --filemap
210 $ cd src
73 echo include b/c > filemap
211 $ cvs -q update -r1.1 b/c
74 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
212 U b/c
75 hgcat b/c
213 $ cvs -q tag -b branch
76 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
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)'
224 $ hg convert src src-hg
79 cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
225 connecting to */cvsrepo (glob)
80 ls srcfull
226 scanning source...
81 hg convert srcfull srcfull-hg \
227 collecting CVS rlog
82 | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' \
228 8 log entries
83 | grep -v 'log entries' | grep -v 'hook:' \
229 cvslog hook: 8 entries
84 | grep -v '^[0-3] .*' # filter instable changeset order
230 creating changesets
85 hg cat -r tip srcfull-hg/src/a
231 5 changeset entries
86 hg cat -r tip srcfull-hg/src/b/c
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
242 $ hg convert --filemap filemap src src-filemap
89 cd src
243 connecting to */cvsrepo (glob)
90 echo a >> a
244 scanning source...
91 echo c >> b/c
245 collecting CVS rlog
92 cvscall -q commit -mci1 . | grep '<--' |\
246 8 log entries
93 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
247 cvslog hook: 8 entries
94 cd ..
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
275 commit new file revisions with some fuzz
97 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
98 hgcat a
99 hgcat b/c
100
276
101 echo % convert again with --filemap
277 $ sleep 1
102 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
278 $ echo f >> a
103 hgcat b/c
279 $ cvscall -q commit -mfuzzy . | grep '<--'
104 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
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
289 $ hg convert --config convert.cvsps.fuzz=2 src src-hg
107 cd src
290 connecting to */cvsrepo (glob)
108 cvs -q update -r1.1 b/c
291 scanning source...
109 cvs -q tag -b branch
292 collecting CVS rlog
110 cvs -q update -r branch > /dev/null
293 11 log entries
111 echo d >> b/c
294 cvslog hook: 11 entries
112 cvs -q commit -mci2 . | grep '<--' |\
295 creating changesets
113 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
296 8 changeset entries
114 cd ..
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
326 $ cd src
117 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
327 $ hg debugcvsps --fuzz=2
118 hgcat b/c
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
344 Members:
121 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
345 a:INITIAL->1.1
122 hgcat b/c
123 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
124
346
125 echo % commit a new revision with funny log message
347 ---------------------
126 cd src
348 PatchSet 2
127 sleep 1
349 Date: * (glob)
128 echo e >> a
350 Author: * (glob)
129 cvscall -q commit -m'funny
351 Branch: HEAD
130 ----------------------------
352 Tag: (none)
131 log message' . | grep '<--' |\
353 Branchpoints: INITIAL, branch
132 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
354 Log:
133 cd ..
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
385 ---------------------
136 cd src
386 PatchSet 5
137 sleep 1
387 Date: * (glob)
138 echo f >> a
388 Author: * (glob)
139 cvscall -q commit -mfuzzy . | grep '<--' |\
389 Branch: HEAD
140 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
390 Tag: (none)
141 sleep 4 # the two changes will be split if fuzz < 4
391 Branchpoints: branch
142 echo g >> b/c
392 Log:
143 cvscall -q commit -mfuzzy . | grep '<--' |\
393 ci1
144 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
394
145 cd ..
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
422 ---------------------
148 hg convert --config convert.cvsps.fuzz=2 src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
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
448 ---------------------
153 cd src
449 PatchSet 10
154 hg debugcvsps --fuzz=2 | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/'
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
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now