comparison tests/test-convert-cvs.t @ 12519:99232aa664d6

tests: unify test-convert-cvs
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Sep 2010 14:50:58 -0500
parents tests/test-convert-cvs@d598d24a7e67
children 6cc4b14fb76b
comparison
equal deleted inserted replaced
12518:89f1210a1238 12519:99232aa664d6
1
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
25
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
48
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
58
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 ..
71
72 convert fresh repo
73
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
97
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
124
125 convert full repository (issue1649)
126
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
153
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
163
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
185
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
207
208 commit branch
209
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
223
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
241
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
274
275 commit new file revisions with some fuzz
276
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
288
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
325
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
343
344 Members:
345 a:INITIAL->1.1
346
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
384
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
421
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
435
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
447
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