341
342
343
344
345
346
347
348
349
350
351
352
353
354
|
}
proc Fill3 {} {
cd $::work
exec echo Nisse > dir1/f11
exec echo Hult > dir2/f21
exec echo Lingonben >> f1
}
proc CreateRepo {type} {
set repoDir [tmpFile]
file mkdir $repoDir
switch $type {
FOSSIL {
set repo $repoDir/apa.fossil
|
>
>
>
>
>
>
>
|
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
}
proc Fill3 {} {
cd $::work
exec echo Nisse > dir1/f11
exec echo Hult > dir2/f21
exec echo Lingonben >> f1
}
proc Fill4 {} {
cd $::work
exec echo Musse > dir1/f11
exec echo Pigg > dir1/f12
exec echo Mimmi >> dir2/f21
exec echo Pluto >> f2
}
proc CreateRepo {type} {
set repoDir [tmpFile]
file mkdir $repoDir
switch $type {
FOSSIL {
set repo $repoDir/apa.fossil
|
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
HG { exec hg add {*}[glob *]}
}
exec {*}$cmt "First"
Fill2
exec {*}$cmt "Second"
Fill3
exec {*}$cmt "Third"
# Any cleanup?
switch $type {
SVN { exec svn update }
}
}
foreach type {FOSSIL GIT SVN HG} {
test rev-4.$type.1 {
Setup fake repo
} -body {
CreateRepo $type
# Dump info for debug of setup
if 0 {
switch $type {
FOSSIL { puts [exec fossil timeline -v] }
GIT { puts [exec git log --name-only] }
SVN { puts [exec svn log --verbose] }
}
}
list
}
test rev-4.$type.2 {
GetTopDir
|
>
>
>
>
>
>
|
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
HG { exec hg add {*}[glob *]}
}
exec {*}$cmt "First"
Fill2
exec {*}$cmt "Second"
Fill3
exec {*}$cmt "Third"
# Local changes
Fill4
# Any cleanup?
switch $type {
SVN { exec svn update }
FOSSIL {exec fossil status --sha1sum}
}
}
foreach type {FOSSIL GIT SVN HG} {
test rev-4.$type.1 {
Setup fake repo
} -body {
CreateRepo $type
# Dump info for debug of setup
if 0 {
puts "------------------- $type --------------------"
puts "--- $::work"
switch $type {
FOSSIL { puts [exec fossil timeline -v] }
GIT { puts [exec git log --name-only] }
SVN { puts [exec svn log --verbose] }
HG { puts [exec hg log --verbose] }
}
}
list
}
test rev-4.$type.2 {
GetTopDir
|
448
449
450
451
452
453
454
455
456
|
} -body {
cd ~
set f $::work/f1
set revs [eskil::rev::${type}::ParseRevs $f "-1 0"]
lsort -dictionary [eskil::rev::${type}::getChangedFiles $f $revs]
} -match regexp -result {^/\S+/dir1/f11 /\S+/dir2/f21 /\S+/f1$}
clearTmp
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
|
} -body {
cd ~
set f $::work/f1
set revs [eskil::rev::${type}::ParseRevs $f "-1 0"]
lsort -dictionary [eskil::rev::${type}::getChangedFiles $f $revs]
} -match regexp -result {^/\S+/dir1/f11 /\S+/dir2/f21 /\S+/f1$}
test rev-4.$type.16 {
getPatch, list of files
} -body {
# getPatch needs to be in the checkout
cd $::work
set files [list $::work/dir1 $::work/f1 $::work/f2]
if {$type in "SVN"} {
# SVN gives full paths when given full paths
set expect [list $::work/dir1/f11 $::work/dir1/f12 $::work/f2]
} else {
set expect [list dir1/f11 dir1/f12 f2]
}
set expect [lsort -dictionary $expect]
set patch [eskil::rev::${type}::getPatch {} $files outFileList]
if {$outFileList ne $expect} {
return $outFileList ;#$patch
} else {
return 1
}
} -result 1
test rev-4.$type.7 {
getPatch, list of files
} -body {
# getPatch needs to be in the checkout
cd $::work
set files [list dir1 f1 f2]
set expect [list dir1/f11 dir1/f12 f2]
set expect [lsort -dictionary $expect]
set patch [eskil::rev::${type}::getPatch {} $files outFileList]
if {$outFileList ne $expect} {
return $outFileList ;#$patch
} else {
return 1
}
} -result 1
test rev-4.$type.8 {
getPatch, list of files
} -body {
# getPatch needs to be in the checkout
cd $::work
set f f1
set revs [eskil::rev::${type}::ParseRevs $f "-1 0"]
set files [list dir1 f1 f2]
set expect [list dir1/f11 f1]
set expect [lsort -dictionary $expect]
set patch [eskil::rev::${type}::getPatch $revs $files outFileList]
if {$outFileList ne $expect} {
return $outFileList ;#$patch
} else {
return 1
}
} -result 1
clearTmp
}
|