| ︙ | | | ︙ | |
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require struct::set ; # Set operations.
package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback
package require vc::tools::misc ; # Text formatting
# # ## ### ##### ######## ############# #####################
##
|
>
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require struct::set ; # Set operations.
package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::integrity ; # State integrity checks.
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback
package require vc::tools::misc ; # Text formatting
# # ## ### ##### ######## ############# #####################
##
|
| ︙ | | | ︙ | |
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
set myexecutable $executable
set myproject $project
set mytrunk [$myproject trunk]
return
}
method setid {id} {
if {$myid ne ""} { trouble internal "File '$mypath' already has an id, '$myid'" }
set myid $id
return
}
method id {} { return $myid }
method path {} { return $mypath }
method usrpath {} { return $myusrpath }
|
|
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
set myexecutable $executable
set myproject $project
set mytrunk [$myproject trunk]
return
}
method setid {id} {
integrity assert {$myid eq ""} {File '$mypath' already has an id, '$myid'}
set myid $id
return
}
method id {} { return $myid }
method path {} { return $mypath }
method usrpath {} { return $myusrpath }
|
| ︙ | | | ︙ | |
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
$branch setchildrevnr $branchrevnr
}
return
}
method Rev2Branch {revnr} {
if {[rev istrunkrevnr $revnr]} {
trouble internal "Expected a branch revision number"
}
return $mybranches([rev 2branchnr $revnr])
}
method AddUnlabeledBranch {branchnr} {
return [$self AddBranch unlabeled-$branchnr $branchnr]
}
|
|
<
<
|
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
$branch setchildrevnr $branchrevnr
}
return
}
method Rev2Branch {revnr} {
integrity assert {![rev istrunkrevnr $revnr]} {Expected a branch revision number}
return $mybranches([rev 2branchnr $revnr])
}
method AddUnlabeledBranch {branchnr} {
return [$self AddBranch unlabeled-$branchnr $branchnr]
}
|
| ︙ | | | ︙ | |
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
# checking all revisions we ensure that we can detect and
# report the case of multiple roots. Without that we could
# simply take one revision and follow the parent links to
# their root (sic!).
foreach {revnr rev} [array get myrev] {
if {[$rev hasparent]} continue
if {$myroot ne ""} { trouble internal "Multiple root revisions found" }
set myroot $rev
}
# In the future we also need a list, as branches can become
# severed from their parent, making them their own root.
set myroots [list $myroot]
return
|
|
|
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
|
# checking all revisions we ensure that we can detect and
# report the case of multiple roots. Without that we could
# simply take one revision and follow the parent links to
# their root (sic!).
foreach {revnr rev} [array get myrev] {
if {[$rev hasparent]} continue
integrity assert {$myroot eq ""} {Multiple root revisions found}
set myroot $rev
}
# In the future we also need a list, as branches can become
# severed from their parent, making them their own root.
set myroots [list $myroot]
return
|
| ︙ | | | ︙ | |
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
|
$stop cutfromparent
lappend myroots $stop ; # New root, after vendor branch
}
# Cut out the vendor branch symbol
set vendor [$first parentbranch]
if {$vendor eq ""} { trouble internal "First NTDB revision has no branch" }
if {[$vendor parent] eq $rev11} {
$rev11 removebranch $vendor
$rev11 removechildonbranch $first
$vendor cutchild
$first cutfromparentbranch
lappend myroots $first
}
|
|
|
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
|
$stop cutfromparent
lappend myroots $stop ; # New root, after vendor branch
}
# Cut out the vendor branch symbol
set vendor [$first parentbranch]
integrity assert {$vendor ne ""} {First NTDB revision has no branch}
if {[$vendor parent] eq $rev11} {
$rev11 removebranch $vendor
$rev11 removechildonbranch $first
$vendor cutchild
$first cutfromparentbranch
lappend myroots $first
}
|
| ︙ | | | ︙ | |
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
|
# questionable whether this handling is correct, since the
# non-trunk default branch revisions affect trunk and
# should therefore not just be discarded even if
# --trunk-only.
if {[$root hasdefaultbranchchild]} {
set ntdbchild [$root defaultbranchchild]
if {[$ntdbchild defaultbranchparent] ne $ntdbchild} {
trouble internal "ntdb - trunk linkage broken"
}
$ntdbchild cutdefaultbranchparent
if {[$ntdbchild hasparent]} {
lappend myroots [$ntdbchild parent]
}
}
set root [$root child]
}
return
}
method GraftNTDB2Trunk {root} {
# We can now graft the non-trunk default branch revisions to
# trunk. They should already be alone on a CVSBranch-less
# branch.
if {[$root hasparentbranch]} { trouble internal "NTDB root still has its branch symbol" }
if {[$root hasbranches]} { trouble internal "NTDB root still has spawned branches" }
set last $root
while {[$last haschild]} {set last [$last child]}
if {[$last hasdefaultbranchchild]} {
set rev12 [$last defaultbranchchild]
|
>
|
|
<
|
|
|
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
|
# questionable whether this handling is correct, since the
# non-trunk default branch revisions affect trunk and
# should therefore not just be discarded even if
# --trunk-only.
if {[$root hasdefaultbranchchild]} {
set ntdbchild [$root defaultbranchchild]
integrity assert {
[$ntdbchild defaultbranchparent] eq $ntdbchild
} {ntdb - trunk linkage broken}
$ntdbchild cutdefaultbranchparent
if {[$ntdbchild hasparent]} {
lappend myroots [$ntdbchild parent]
}
}
set root [$root child]
}
return
}
method GraftNTDB2Trunk {root} {
# We can now graft the non-trunk default branch revisions to
# trunk. They should already be alone on a CVSBranch-less
# branch.
integrity assert {![$root hasparentbranch]} {NTDB root still has its branch symbol}
integrity assert {![$root hasbranches]} {NTDB root still has spawned branches}
set last $root
while {[$last haschild]} {set last [$last child]}
if {[$last hasdefaultbranchchild]} {
set rev12 [$last defaultbranchchild]
|
| ︙ | | | ︙ | |
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
|
# Import not required, already a child namespace.
# namespace import ::vc::fossil::import::cvs::file::rev
# namespace import ::vc::fossil::import::cvs::file::sym
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
namespace import ::vc::fossil::import::cvs::state
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file 1.0
return
|
>
|
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
|
# Import not required, already a child namespace.
# namespace import ::vc::fossil::import::cvs::file::rev
# namespace import ::vc::fossil::import::cvs::file::sym
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file 1.0
return
|