Fossil SCM

The handling of detached lines of development (floating branches) still had some bugs regarding the linkage to their revisions, especially the first revision on such branches. Fixed the relevant places, added early integrity checks and updated the main checks to handle the situation.

aku 2007-12-05 02:22 trunk
Commit c4003e7b9365bf8f26b8e1a1a22cf431279d6d7c
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -769,13 +769,11 @@
769769
770770
foreach branch [$root branches] {
771771
$branch cutbranchparent
772772
if {![$branch haschild]} continue
773773
set first [$branch child]
774
- $first cutfromparentbranch
775774
$first cutfromparent
776
- $branch cutchild
777775
lappend myroots $first
778776
}
779777
$root removeallbranches
780778
781779
# Tagging a dead revision doesn't do anything, so remove
@@ -814,13 +812,17 @@
814812
set child [$root child]
815813
816814
ldelete myroots $root
817815
lappend myroots $child
818816
817
+ $branch cutbranchparent
819818
$branch cutchild
820819
$child cutfromparent
821820
821
+ $branch setchild $child
822
+ $child setparentbranch $branch
823
+
822824
$parent removebranch $branch
823825
$parent removechildonbranch $root
824826
}
825827
return
826828
}
@@ -1017,13 +1019,23 @@
10171019
foreach root [$self LinesOfDevelopment] {
10181020
if {[$root hasparentbranch]} { lappend symbols [$root parentbranch] }
10191021
while {$root ne ""} {
10201022
lappend revisions $root
10211023
foreach tag [$root tags] { lappend symbols $tag }
1022
- foreach branch [$root branches] { lappend symbols $branch }
1024
+ foreach branch [$root branches] {
1025
+ integrity assert {
1026
+ [$branch parent] eq $root
1027
+ } {Backreference branch to its root is missing or wrong}
1028
+ lappend symbols $branch
1029
+ }
10231030
set lod [$root lod]
1024
- if {![$lod istrunk]} { lappend symbols $lod }
1031
+ if {![$lod istrunk]} {
1032
+ integrity assert {
1033
+ [$lod haschild]
1034
+ } {Branch is LOD symbol without revisions}
1035
+ lappend symbols $lod
1036
+ }
10251037
set root [$root child]
10261038
}
10271039
}
10281040
10291041
return [list [lsort -unique -dict $revisions] [lsort -unique -dict $symbols]]
10301042
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -769,13 +769,11 @@
769
770 foreach branch [$root branches] {
771 $branch cutbranchparent
772 if {![$branch haschild]} continue
773 set first [$branch child]
774 $first cutfromparentbranch
775 $first cutfromparent
776 $branch cutchild
777 lappend myroots $first
778 }
779 $root removeallbranches
780
781 # Tagging a dead revision doesn't do anything, so remove
@@ -814,13 +812,17 @@
814 set child [$root child]
815
816 ldelete myroots $root
817 lappend myroots $child
818
 
819 $branch cutchild
820 $child cutfromparent
821
 
 
 
822 $parent removebranch $branch
823 $parent removechildonbranch $root
824 }
825 return
826 }
@@ -1017,13 +1019,23 @@
1017 foreach root [$self LinesOfDevelopment] {
1018 if {[$root hasparentbranch]} { lappend symbols [$root parentbranch] }
1019 while {$root ne ""} {
1020 lappend revisions $root
1021 foreach tag [$root tags] { lappend symbols $tag }
1022 foreach branch [$root branches] { lappend symbols $branch }
 
 
 
 
 
1023 set lod [$root lod]
1024 if {![$lod istrunk]} { lappend symbols $lod }
 
 
 
 
 
1025 set root [$root child]
1026 }
1027 }
1028
1029 return [list [lsort -unique -dict $revisions] [lsort -unique -dict $symbols]]
1030
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -769,13 +769,11 @@
769
770 foreach branch [$root branches] {
771 $branch cutbranchparent
772 if {![$branch haschild]} continue
773 set first [$branch child]
 
774 $first cutfromparent
 
775 lappend myroots $first
776 }
777 $root removeallbranches
778
779 # Tagging a dead revision doesn't do anything, so remove
@@ -814,13 +812,17 @@
812 set child [$root child]
813
814 ldelete myroots $root
815 lappend myroots $child
816
817 $branch cutbranchparent
818 $branch cutchild
819 $child cutfromparent
820
821 $branch setchild $child
822 $child setparentbranch $branch
823
824 $parent removebranch $branch
825 $parent removechildonbranch $root
826 }
827 return
828 }
@@ -1017,13 +1019,23 @@
1019 foreach root [$self LinesOfDevelopment] {
1020 if {[$root hasparentbranch]} { lappend symbols [$root parentbranch] }
1021 while {$root ne ""} {
1022 lappend revisions $root
1023 foreach tag [$root tags] { lappend symbols $tag }
1024 foreach branch [$root branches] {
1025 integrity assert {
1026 [$branch parent] eq $root
1027 } {Backreference branch to its root is missing or wrong}
1028 lappend symbols $branch
1029 }
1030 set lod [$root lod]
1031 if {![$lod istrunk]} {
1032 integrity assert {
1033 [$lod haschild]
1034 } {Branch is LOD symbol without revisions}
1035 lappend symbols $lod
1036 }
1037 set root [$root child]
1038 }
1039 }
1040
1041 return [list [lsort -unique -dict $revisions] [lsort -unique -dict $symbols]]
1042
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -78,10 +78,13 @@
7878
method BranchParents {} {
7979
# The "obvious" parent of a branch is the branch holding the
8080
# revision spawning the branch. Any other branches that are
8181
# rooted at the same revision and were committed earlier than
8282
# the branch are also possible parents.
83
+
84
+ # Ignore this if the branch symbol is detached.
85
+ if {$mybranchparent eq ""} return
8386
8487
$mysymbol possibleparent [[$mybranchparent lod] symbol]
8588
8689
foreach branch [$mybranchparent branches] {
8790
# A branch cannot be its own parent. Nor can a branch
8891
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -78,10 +78,13 @@
78 method BranchParents {} {
79 # The "obvious" parent of a branch is the branch holding the
80 # revision spawning the branch. Any other branches that are
81 # rooted at the same revision and were committed earlier than
82 # the branch are also possible parents.
 
 
 
83
84 $mysymbol possibleparent [[$mybranchparent lod] symbol]
85
86 foreach branch [$mybranchparent branches] {
87 # A branch cannot be its own parent. Nor can a branch
88
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -78,10 +78,13 @@
78 method BranchParents {} {
79 # The "obvious" parent of a branch is the branch holding the
80 # revision spawning the branch. Any other branches that are
81 # rooted at the same revision and were committed earlier than
82 # the branch are also possible parents.
83
84 # Ignore this if the branch symbol is detached.
85 if {$mybranchparent eq ""} return
86
87 $mysymbol possibleparent [[$mybranchparent lod] symbol]
88
89 foreach branch [$mybranchparent branches] {
90 # A branch cannot be its own parent. Nor can a branch
91
--- tools/cvs2fossil/lib/c2f_integrity.tcl
+++ tools/cvs2fossil/lib/c2f_integrity.tcl
@@ -178,17 +178,20 @@
178178
;
179179
}
180180
# Find all revisions with a branch parent symbol which do not
181181
# have a parent.
182182
CheckRev \
183
- {Branch starting revisions have to have a parent} \
184
- {at the beginning of its branch has no parent} {
183
+ {Branch starting revisions have to have a parent, if not detached} \
184
+ {at the beginning of its branch has no parent, but its branch has} {
185185
SELECT F.name, R.rev
186
- FROM revision R, file F
186
+ FROM revision R, file F, branch B
187187
WHERE R.fid = F.fid
188188
AND R.bparent IS NOT NULL
189
- AND R.parent IS NULL
189
+ AND R.parent IS NULL
190
+ AND B.sid = R.bparent
191
+ AND B.fid = R.fid
192
+ AND B.root IS NOT NULL
190193
;
191194
}
192195
# Find all revisions with a branch parent symbol whose parent
193196
# has them as primary child.
194197
CheckRev \
195198
--- tools/cvs2fossil/lib/c2f_integrity.tcl
+++ tools/cvs2fossil/lib/c2f_integrity.tcl
@@ -178,17 +178,20 @@
178 ;
179 }
180 # Find all revisions with a branch parent symbol which do not
181 # have a parent.
182 CheckRev \
183 {Branch starting revisions have to have a parent} \
184 {at the beginning of its branch has no parent} {
185 SELECT F.name, R.rev
186 FROM revision R, file F
187 WHERE R.fid = F.fid
188 AND R.bparent IS NOT NULL
189 AND R.parent IS NULL
 
 
 
190 ;
191 }
192 # Find all revisions with a branch parent symbol whose parent
193 # has them as primary child.
194 CheckRev \
195
--- tools/cvs2fossil/lib/c2f_integrity.tcl
+++ tools/cvs2fossil/lib/c2f_integrity.tcl
@@ -178,17 +178,20 @@
178 ;
179 }
180 # Find all revisions with a branch parent symbol which do not
181 # have a parent.
182 CheckRev \
183 {Branch starting revisions have to have a parent, if not detached} \
184 {at the beginning of its branch has no parent, but its branch has} {
185 SELECT F.name, R.rev
186 FROM revision R, file F, branch B
187 WHERE R.fid = F.fid
188 AND R.bparent IS NOT NULL
189 AND R.parent IS NULL
190 AND B.sid = R.bparent
191 AND B.fid = R.fid
192 AND B.root IS NOT NULL
193 ;
194 }
195 # Find all revisions with a branch parent symbol whose parent
196 # has them as primary child.
197 CheckRev \
198

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button