Fossil SCM

Continued work on pass 8, added outline for handling of retrograde branches, extended changesets with predicate allowing us to find the branch changesets.

aku 2007-11-22 03:33 trunk
Commit 4866889e88a0324e60732d9b48b388c90ddd761f
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -20,11 +20,13 @@
2020
## Requirements
2121
2222
package require Tcl 8.4 ; # Required runtime.
2323
package require snit ; # OO system.
2424
package require struct::list ; # Higher order list operations.
25
+package require vc::tools::misc ; # Min, max.
2526
package require vc::tools::log ; # User feedback.
27
+package require vc::tools::trouble ; # Error reporting.
2628
package require vc::fossil::import::cvs::repository ; # Repository management.
2729
package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles.
2830
package require vc::fossil::import::cvs::state ; # State storage.
2931
package require vc::fossil::import::cvs::project::rev ; # Project level changesets
3032
@@ -105,10 +107,43 @@
105107
}
106108
107109
# # ## ### ##### ######## #############
108110
109111
proc BreakRetrogradeBranches {graph} {
112
+ # We go over all branch changesets, i.e. the changesets
113
+ # created by the symbols which are translated as branches, and
114
+ # break any which are 'retrograde'. Meaning that they have
115
+ # incoming revision changesets which are committed after some
116
+ # outgoing revision changeset.
117
+
118
+ # NOTE: We might be able to use our knowledge that we are
119
+ # looking at all changesets to create a sql which selects all
120
+ # the branch changesets from the state in one go instead of
121
+ # having to check each changeset separately. Consider this
122
+ # later, get the pass working first.
123
+ #
124
+ # NOTE 2: Might we even be able to select the retrograde
125
+ # changesets too ?
126
+
127
+ foreach cset [$graph nodes] {
128
+ if {![$cset isbranch]} continue
129
+ CheckAndBreakRetrograde $graph $cset
130
+ }
131
+ return
132
+ }
133
+
134
+ proc CheckAndBreakRetrograde {graph cset} {
135
+ while {[IsRetrograde $graph $cset]} {
136
+ log write 5 breakacycle "Breaking retrograde changeset <[$cset id]>"
137
+
138
+ break
139
+ }
140
+ return
141
+ }
142
+
143
+ proc IsRetrograde {dg cset} {
144
+ return 0
110145
}
111146
112147
# # ## ### ##### ######## #############
113148
114149
proc SaveOrder {cset pos} {
@@ -143,10 +178,12 @@
143178
namespace import ::vc::fossil::import::cvs::repository
144179
namespace import ::vc::fossil::import::cvs::state
145180
namespace eval project {
146181
namespace import ::vc::fossil::import::cvs::project::rev
147182
}
183
+ namespace import ::vc::tools::misc::*
184
+ namespace import ::vc::tools::trouble
148185
namespace import ::vc::tools::log
149186
log register breakacycle
150187
}
151188
}
152189
153190
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -20,11 +20,13 @@
20 ## Requirements
21
22 package require Tcl 8.4 ; # Required runtime.
23 package require snit ; # OO system.
24 package require struct::list ; # Higher order list operations.
 
25 package require vc::tools::log ; # User feedback.
 
26 package require vc::fossil::import::cvs::repository ; # Repository management.
27 package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles.
28 package require vc::fossil::import::cvs::state ; # State storage.
29 package require vc::fossil::import::cvs::project::rev ; # Project level changesets
30
@@ -105,10 +107,43 @@
105 }
106
107 # # ## ### ##### ######## #############
108
109 proc BreakRetrogradeBranches {graph} {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110 }
111
112 # # ## ### ##### ######## #############
113
114 proc SaveOrder {cset pos} {
@@ -143,10 +178,12 @@
143 namespace import ::vc::fossil::import::cvs::repository
144 namespace import ::vc::fossil::import::cvs::state
145 namespace eval project {
146 namespace import ::vc::fossil::import::cvs::project::rev
147 }
 
 
148 namespace import ::vc::tools::log
149 log register breakacycle
150 }
151 }
152
153
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -20,11 +20,13 @@
20 ## Requirements
21
22 package require Tcl 8.4 ; # Required runtime.
23 package require snit ; # OO system.
24 package require struct::list ; # Higher order list operations.
25 package require vc::tools::misc ; # Min, max.
26 package require vc::tools::log ; # User feedback.
27 package require vc::tools::trouble ; # Error reporting.
28 package require vc::fossil::import::cvs::repository ; # Repository management.
29 package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles.
30 package require vc::fossil::import::cvs::state ; # State storage.
31 package require vc::fossil::import::cvs::project::rev ; # Project level changesets
32
@@ -105,10 +107,43 @@
107 }
108
109 # # ## ### ##### ######## #############
110
111 proc BreakRetrogradeBranches {graph} {
112 # We go over all branch changesets, i.e. the changesets
113 # created by the symbols which are translated as branches, and
114 # break any which are 'retrograde'. Meaning that they have
115 # incoming revision changesets which are committed after some
116 # outgoing revision changeset.
117
118 # NOTE: We might be able to use our knowledge that we are
119 # looking at all changesets to create a sql which selects all
120 # the branch changesets from the state in one go instead of
121 # having to check each changeset separately. Consider this
122 # later, get the pass working first.
123 #
124 # NOTE 2: Might we even be able to select the retrograde
125 # changesets too ?
126
127 foreach cset [$graph nodes] {
128 if {![$cset isbranch]} continue
129 CheckAndBreakRetrograde $graph $cset
130 }
131 return
132 }
133
134 proc CheckAndBreakRetrograde {graph cset} {
135 while {[IsRetrograde $graph $cset]} {
136 log write 5 breakacycle "Breaking retrograde changeset <[$cset id]>"
137
138 break
139 }
140 return
141 }
142
143 proc IsRetrograde {dg cset} {
144 return 0
145 }
146
147 # # ## ### ##### ######## #############
148
149 proc SaveOrder {cset pos} {
@@ -143,10 +178,12 @@
178 namespace import ::vc::fossil::import::cvs::repository
179 namespace import ::vc::fossil::import::cvs::state
180 namespace eval project {
181 namespace import ::vc::fossil::import::cvs::project::rev
182 }
183 namespace import ::vc::tools::misc::*
184 namespace import ::vc::tools::trouble
185 namespace import ::vc::tools::log
186 log register breakacycle
187 }
188 }
189
190
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -20,10 +20,11 @@
2020
package require snit ; # OO system.
2121
package require vc::tools::misc ; # Text formatting
2222
package require vc::tools::trouble ; # Error reporting.
2323
package require vc::tools::log ; # User feedback.
2424
package require vc::fossil::import::cvs::state ; # State storage.
25
+package require vc::fossil::import::cvs::project::sym ; # Project level symbols
2526
2627
# # ## ### ##### ######## ############# #####################
2728
##
2829
2930
snit::type ::vc::fossil::import::cvs::project::rev {
@@ -58,10 +59,17 @@
5859
method bysymbol {} { return [expr {$mytype eq "sym"}] }
5960
method byrevision {} { return [expr {$mytype eq "rev"}] }
6061
6162
method setpos {p} { set mypos $p ; return }
6263
method pos {} { return $mypos }
64
+
65
+ method isbranch {} {
66
+ return [expr {($mytype eq "sym") &&
67
+ ($mybranchcode == [state one {
68
+ SELECT type FROM symbol WHERE sid = $mysrcid
69
+ }])}]
70
+ }
6371
6472
method successors {} {
6573
# NOTE / FUTURE: Possible bottleneck.
6674
set csets {}
6775
foreach {_ children} [$self nextmap] {
@@ -598,13 +606,19 @@
598606
# # ## ### ##### ######## #############
599607
600608
typevariable mychangesets {} ; # List of all known changesets.
601609
typevariable myrevmap -array {} ; # Map from revisions to their changeset.
602610
typevariable myidmap -array {} ; # Map from changeset id to changeset.
611
+ typevariable mybranchcode {} ; # Local copy of project::sym/mybranch.
603612
604613
typemethod all {} { return $mychangesets }
605614
typemethod of {id} { return $myidmap($id) }
615
+
616
+ typeconstructor {
617
+ set mybranchcode [project::sym branch]
618
+ return
619
+ }
606620
607621
# # ## ### ##### ######## #############
608622
## Configuration
609623
610624
pragma -hastypeinfo no ; # no type introspection
@@ -616,10 +630,13 @@
616630
617631
namespace eval ::vc::fossil::import::cvs::project {
618632
namespace export rev
619633
namespace eval rev {
620634
namespace import ::vc::fossil::import::cvs::state
635
+ namespace eval project {
636
+ namespace import ::vc::fossil::import::cvs::project::sym
637
+ }
621638
namespace import ::vc::tools::misc::*
622639
namespace import ::vc::tools::trouble
623640
namespace import ::vc::tools::log
624641
log register csets
625642
}
626643
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -20,10 +20,11 @@
20 package require snit ; # OO system.
21 package require vc::tools::misc ; # Text formatting
22 package require vc::tools::trouble ; # Error reporting.
23 package require vc::tools::log ; # User feedback.
24 package require vc::fossil::import::cvs::state ; # State storage.
 
25
26 # # ## ### ##### ######## ############# #####################
27 ##
28
29 snit::type ::vc::fossil::import::cvs::project::rev {
@@ -58,10 +59,17 @@
58 method bysymbol {} { return [expr {$mytype eq "sym"}] }
59 method byrevision {} { return [expr {$mytype eq "rev"}] }
60
61 method setpos {p} { set mypos $p ; return }
62 method pos {} { return $mypos }
 
 
 
 
 
 
 
63
64 method successors {} {
65 # NOTE / FUTURE: Possible bottleneck.
66 set csets {}
67 foreach {_ children} [$self nextmap] {
@@ -598,13 +606,19 @@
598 # # ## ### ##### ######## #############
599
600 typevariable mychangesets {} ; # List of all known changesets.
601 typevariable myrevmap -array {} ; # Map from revisions to their changeset.
602 typevariable myidmap -array {} ; # Map from changeset id to changeset.
 
603
604 typemethod all {} { return $mychangesets }
605 typemethod of {id} { return $myidmap($id) }
 
 
 
 
 
606
607 # # ## ### ##### ######## #############
608 ## Configuration
609
610 pragma -hastypeinfo no ; # no type introspection
@@ -616,10 +630,13 @@
616
617 namespace eval ::vc::fossil::import::cvs::project {
618 namespace export rev
619 namespace eval rev {
620 namespace import ::vc::fossil::import::cvs::state
 
 
 
621 namespace import ::vc::tools::misc::*
622 namespace import ::vc::tools::trouble
623 namespace import ::vc::tools::log
624 log register csets
625 }
626
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -20,10 +20,11 @@
20 package require snit ; # OO system.
21 package require vc::tools::misc ; # Text formatting
22 package require vc::tools::trouble ; # Error reporting.
23 package require vc::tools::log ; # User feedback.
24 package require vc::fossil::import::cvs::state ; # State storage.
25 package require vc::fossil::import::cvs::project::sym ; # Project level symbols
26
27 # # ## ### ##### ######## ############# #####################
28 ##
29
30 snit::type ::vc::fossil::import::cvs::project::rev {
@@ -58,10 +59,17 @@
59 method bysymbol {} { return [expr {$mytype eq "sym"}] }
60 method byrevision {} { return [expr {$mytype eq "rev"}] }
61
62 method setpos {p} { set mypos $p ; return }
63 method pos {} { return $mypos }
64
65 method isbranch {} {
66 return [expr {($mytype eq "sym") &&
67 ($mybranchcode == [state one {
68 SELECT type FROM symbol WHERE sid = $mysrcid
69 }])}]
70 }
71
72 method successors {} {
73 # NOTE / FUTURE: Possible bottleneck.
74 set csets {}
75 foreach {_ children} [$self nextmap] {
@@ -598,13 +606,19 @@
606 # # ## ### ##### ######## #############
607
608 typevariable mychangesets {} ; # List of all known changesets.
609 typevariable myrevmap -array {} ; # Map from revisions to their changeset.
610 typevariable myidmap -array {} ; # Map from changeset id to changeset.
611 typevariable mybranchcode {} ; # Local copy of project::sym/mybranch.
612
613 typemethod all {} { return $mychangesets }
614 typemethod of {id} { return $myidmap($id) }
615
616 typeconstructor {
617 set mybranchcode [project::sym branch]
618 return
619 }
620
621 # # ## ### ##### ######## #############
622 ## Configuration
623
624 pragma -hastypeinfo no ; # no type introspection
@@ -616,10 +630,13 @@
630
631 namespace eval ::vc::fossil::import::cvs::project {
632 namespace export rev
633 namespace eval rev {
634 namespace import ::vc::fossil::import::cvs::state
635 namespace eval project {
636 namespace import ::vc::fossil::import::cvs::project::sym
637 }
638 namespace import ::vc::tools::misc::*
639 namespace import ::vc::tools::trouble
640 namespace import ::vc::tools::log
641 log register csets
642 }
643

Keyboard Shortcuts

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