Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added code able to exclude all non-trunk revisions upon user request. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
886b6f257bc784ae18865130f21f04ed |
| User & Date: | aku 2007-10-21 06:10:13.000 |
Context
|
2007-10-21
| ||
| 07:08 | Simplified the code for excluding non-trunk revisions a bit, using higher-level methods for some changes. Added missing revision destruction. ... (check-in: 436f17a5f0 user: aku tags: trunk) | |
| 06:10 | Added code able to exclude all non-trunk revisions upon user request. ... (check-in: 886b6f257b user: aku tags: trunk) | |
| 04:42 | Created a separate common class for the id databases used by the repository, and updated the repository code to use it. ... (check-in: 99e165d5c4 user: aku tags: trunk) | |
Changes
Changes to tools/cvs2fossil/lib/c2f_file.tcl.
| ︙ | ︙ | |||
665 666 667 668 669 670 671 |
# Move any tags and branches from the old to the new root.
$rev11 movesymbolsto $first
}
# Mark all the special revisions as such
foreach rev $revlist {
log write 3 file "Revision on default branch: [$rev revnr]"
| | | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 |
# Move any tags and branches from the old to the new root.
$rev11 movesymbolsto $first
}
# Mark all the special revisions as such
foreach rev $revlist {
log write 3 file "Revision on default branch: [$rev revnr]"
$rev setondefaultbranch 1
}
if {$stop ne ""} {
# Revision 1.2 logically follows the imported revisions,
# not 1.1. Accordingly, connect it to the last NTDBR and
# possibly change its type.
|
| ︙ | ︙ | |||
749 750 751 752 753 754 755 | # created) followed by the second branch revision, which is an # add. When we encounter this situation, we sever the branch # from trunk and delete the first branch revision. # At this point we may have already multiple roots in myroots, # we have to process them all. | | < | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 |
# created) followed by the second branch revision, which is an
# add. When we encounter this situation, we sever the branch
# from trunk and delete the first branch revision.
# At this point we may have already multiple roots in myroots,
# we have to process them all.
foreach root [$self LinesOfDevelopment] {
if {[$root isneededbranchdel]} continue
log write 2 file "Removing unnecessary initial branch delete [$root revnr]"
set branch [$root parentbranch]
set parent [$root parent]
set child [$root child]
|
| ︙ | ︙ | |||
801 802 803 804 805 806 807 808 809 810 811 812 813 814 |
}
set root [$root child]
}
return
}
method ExcludeNonTrunkInformation {} {
}
# # ## ### ##### ######## #############
## Configuration
pragma -hastypeinfo no ; # no type introspection
pragma -hasinfo no ; # no object introspection
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 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 |
}
set root [$root child]
}
return
}
method ExcludeNonTrunkInformation {} {
# Remove all non-trunk branches, revisions, and tags. We do
# keep the tags which are on the trunk.
set ntdbroot ""
foreach root [$self LinesOfDevelopment] {
# Note: Here the order of the roots is important,
# i.e. that we get them in depth first order. This ensures
# that the removal of a branch happens only after the
# branches spawned from it were removed. Otherwise the
# system might try to access deleted objects.
# Do not exclude the trunk.
if {[[$root lod] istrunk]} continue
$self ExcludeBranch $root ntdbroot
}
if {$ntdbroot ne ""} {
$self GraftNTDB2Trunk $ntdbroot
}
return
}
method ExcludeBranch {root nv} {
# Exclude the branch/lod starting at root, a revision.
#
# If the LOD starts with non-trunk default branch revisions,
# we leave them in place and do not delete the branch. In that
# case the command sets the variable in NV so that we can
# later rework these revisons to be purely trunk.
if {[$root isondefaultbranch]} {
# Handling a NTDB. This branch may consists not only of
# NTDB revisions, but also some non-NTDB. The latter are
# truly on a branch and have to be excluded. The following
# loop determines if there are such revisions.
upvar 1 $nv ntdbroot
set ntdbroot $root
set rev [$root child]
while {$rev ne ""} {
# See note [x].
$rev removeallbranches
if {[$rev isondefaultbranch]} {
set rev [$rev child]
} else {
set rev ""
}
}
# rev now contains the first non-NTDB revision after the
# NTDB, or is empty if there is no such. If we have some
# they have to removed.
if {$rev ne ""} {
set lastntdb [$rev parent]
$lastntdb cutfromchild
while {$rev ne ""} {
set next [$rev child]
unset myrev([$rev revnr])
$rev removealltags
# Note [x]: We may still have had branches on the
# revision. Branches without revisions committed
# on them do not show up in the list of roots aka
# lines of development).
$root removeallbranches
$rev destroy
set rev $next
}
}
return
}
# No NTDB stuff to deal with. First delete the branch object
# itself, after cutting all the various connections.
set branch [$root parentbranch]
if {$branch ne ""} {
set bparentrev [$branch parent]
$bparentrev removebranch $branch
$bparentrev removechildonbranch $root
$branch destroy
}
# The root is no such any longer either.
ldelete myroots $root
# Now go through the line and remove all its revisions.
while {$root ne ""} {
set next [$root child]
unset myrev([$root revnr])
$root removealltags
# Note: See the note [x].
$root removeallbranches
# From cvs2svn: If this is the last default revision on a
# non-trunk default branch followed by a 1.2 revision,
# then the 1.2 revision depends on this one. FIXME: It is
# 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]
}
}
$root destroy
set root $next
}
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]
$rev12 cutdefaultbranchparent
$last cutdefaultbranchchild
# TODO :: Combine into one method 'changeparent', or
# 'moveparent', etc.
$rev12 cutfromparent
$rev12 setparent $last
$last cutfromchild
$last setchild $rev12
ldelete myroots $rev12
# Note and remember that the type of rev12 was already
# adjusted by AdjustNonTrunkDefaultBranch, so we don't
# have to change its type here.
}
while {$root ne ""} {
$root setondefaultbranch 0
$root setlod $mytrunk
foreach tag [$root tags] {
$tag setlod $mytrunk
}
set root [$root child]
}
return
}
# # ## ### ##### ######## #############
## Configuration
pragma -hastypeinfo no ; # no type introspection
pragma -hasinfo no ; # no object introspection
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_frev.tcl.
| ︙ | ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
method setparentbranch {branch} {
if {$myparentbranch ne ""} { trouble internal "Branch parent already defined" }
set myparentbranch $branch
return
}
method parentbranch {} { return $myparentbranch }
method branches {} { return $mybranches }
method addbranch {branch} {
lappend mybranches $branch
return
}
| > > > | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
method setparentbranch {branch} {
if {$myparentbranch ne ""} { trouble internal "Branch parent already defined" }
set myparentbranch $branch
return
}
method hasparentbranch {} { return [expr {$myparentbranch ne ""}] }
method hasbranches {} { return [llength $mybranches] }
method parentbranch {} { return $myparentbranch }
method branches {} { return $mybranches }
method addbranch {branch} {
lappend mybranches $branch
return
}
|
| ︙ | ︙ | |||
218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# Tag linkage _________________________
method addtag {tag} {
lappend mytags $tag
return
}
method removealltags {} {
foreach tag $mytags { $tag destroy }
set mytags {}
return
}
method movetagsto {rev} {
| > > | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# Tag linkage _________________________
method addtag {tag} {
lappend mytags $tag
return
}
method tags {} { return $mytags }
method removealltags {} {
foreach tag $mytags { $tag destroy }
set mytags {}
return
}
method movetagsto {rev} {
|
| ︙ | ︙ | |||
266 267 268 269 270 271 272 |
set myoperation $myopstate([list $pdead $sdead])
return
}
method operation {} { return $myoperation }
method retype {x} { set myoperation $x ; return }
| > > | > > > > > > > > > | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
set myoperation $myopstate([list $pdead $sdead])
return
}
method operation {} { return $myoperation }
method retype {x} { set myoperation $x ; return }
method isondefaultbranch {} { return $myisondefaultbranch }
method setondefaultbranch {x} { set myisondefaultbranch $x ; return }
method setdefaultbranchchild {rev} { set mydbchild $rev ; return }
method setdefaultbranchparent {rev} {
set mydbparent $rev
# Retype the revision (may change from 'add' to 'change').
set sdead [expr {$myoperation ne "change"}]
set pdead [expr {[$rev operation] ne "change"}]
set myoperation $myopstate([list $pdead $sdead])
return
}
method cutdefaultbranchparent {} { set mydbparent "" ; return }
method cutdefaultbranchchild {} { set mydbchild "" ; return }
method defaultbranchchild {} { return $mydbchild }
method defaultbranchparent {} { return $mydbparent }
method hasdefaultbranchchild {} { return [expr {$mydbchild ne ""}] }
method hasdefaultbranchparent {} { return [expr {$mydbparent ne ""}] }
# # ## ### ##### ######## #############
## Type API
typemethod istrunkrevnr {revnr} {
return [expr {[llength [split $revnr .]] == 2}]
}
|
| ︙ | ︙ |