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