Fossil SCM

Continued work on pass 8. Renamed 'retrograde' to 'Backward Branch', should be easier to understand, and completed the predicate testing if a branch changeset is backward or not.

aku 2007-11-22 03:47 trunk
Commit 4f1b60dd168e5629be8c174d521086a3ff95c3d8
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -62,11 +62,11 @@
6262
6363
typemethod run {} {
6464
# Pass manager interface. Executed to perform the
6565
# functionality of the pass.
6666
67
- cyclebreaker precmd [myproc BreakRetrogradeBranches]
67
+ cyclebreaker precmd [myproc BreakBackwardBranches]
6868
cyclebreaker savecmd [myproc SaveOrder]
6969
cyclebreaker breakcmd [myproc BreakCycle]
7070
7171
state transaction {
7272
LoadCommitOrder
@@ -106,16 +106,18 @@
106106
return
107107
}
108108
109109
# # ## ### ##### ######## #############
110110
111
- proc BreakRetrogradeBranches {graph} {
111
+ proc BreakBackwardBranches {graph} {
112112
# We go over all branch changesets, i.e. the changesets
113113
# 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.
114
+ # break any which are 'backward', which means that they have
115
+ # at least one incoming revision changeset which is committed
116
+ # after at least one of the outgoing revision changesets, per
117
+ # the order computed in pass 6. In "cvs2svn" this is called
118
+ # "retrograde".
117119
118120
# NOTE: We might be able to use our knowledge that we are
119121
# looking at all changesets to create a sql which selects all
120122
# the branch changesets from the state in one go instead of
121123
# having to check each changeset separately. Consider this
@@ -124,28 +126,67 @@
124126
# NOTE 2: Might we even be able to select the retrograde
125127
# changesets too ?
126128
127129
foreach cset [$graph nodes] {
128130
if {![$cset isbranch]} continue
129
- CheckAndBreakRetrograde $graph $cset
131
+ CheckAndBreakBackwardBranch $graph $cset
130132
}
131133
return
132134
}
133135
134
- proc CheckAndBreakRetrograde {graph cset} {
135
- while {[IsRetrograde $graph $cset]} {
136
- log write 5 breakacycle "Breaking retrograde changeset <[$cset id]>"
136
+ proc CheckAndBreakBackwardBranch {graph cset} {
137
+ while {[IsABackwardBranch $graph $cset]} {
138
+ log write 5 breakacycle "Breaking backward branch changeset <[$cset id]>"
137139
138140
break
139141
}
140142
return
141143
}
142144
143
- proc IsRetrograde {dg cset} {
144
- return 0
145
+ proc IsABackwardBranch {dg cset} {
146
+ # A branch is "backward" if it has at least one incoming
147
+ # revision changeset which is committed after at least one of
148
+ # the outgoing revision changesets, per the order computed in
149
+ # pass 6.
150
+
151
+ # Rephrased, the maximal commit position found among the
152
+ # incoming revision changesets is larger than the minimal
153
+ # commit position found among the outgoing revision
154
+ # changesets. Assuming that we have both incoming and outgoing
155
+ # revision changesets.
156
+
157
+ # The helper "Positions" computes the set of commit positions
158
+ # for a set of changesets, which can be a mix of revision and
159
+ # symbol changesets.
160
+
161
+ set predecessors [Positions [$dg nodes -in $cset]]
162
+ set successors [Positions [$dg nodes -out $cset]]
163
+
164
+ return [expr {
165
+ [llength $predecessors] &&
166
+ [llength $successors] &&
167
+ ([max $predecessors] >= [min $successors])
168
+ }]
169
+ }
170
+
171
+ proc Positions {changesets} {
172
+ # To compute the set of commit positions from the set of
173
+ # changesets we first map each changeset to its position (*)
174
+ # and then filter out the invalid responses (the empty string)
175
+ # returned by the symbol changesets.
176
+ #
177
+ # (*) This data was loaded into memory earlir in the pass, by
178
+ # LoadCommitOrder.
179
+
180
+ return [struct::list filter [struct::list map $changesets \
181
+ [myproc ToPosition]] \
182
+ [myproc ValidPosition]]
145183
}
146184
185
+ proc ToPosition {cset} { $cset pos }
186
+ proc ValidPosition {pos} { expr {$pos ne ""} }
187
+
147188
# # ## ### ##### ######## #############
148189
149190
proc SaveOrder {cset pos} {
150191
}
151192
152193
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -62,11 +62,11 @@
62
63 typemethod run {} {
64 # Pass manager interface. Executed to perform the
65 # functionality of the pass.
66
67 cyclebreaker precmd [myproc BreakRetrogradeBranches]
68 cyclebreaker savecmd [myproc SaveOrder]
69 cyclebreaker breakcmd [myproc BreakCycle]
70
71 state transaction {
72 LoadCommitOrder
@@ -106,16 +106,18 @@
106 return
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
@@ -124,28 +126,67 @@
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} {
150 }
151
152
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -62,11 +62,11 @@
62
63 typemethod run {} {
64 # Pass manager interface. Executed to perform the
65 # functionality of the pass.
66
67 cyclebreaker precmd [myproc BreakBackwardBranches]
68 cyclebreaker savecmd [myproc SaveOrder]
69 cyclebreaker breakcmd [myproc BreakCycle]
70
71 state transaction {
72 LoadCommitOrder
@@ -106,16 +106,18 @@
106 return
107 }
108
109 # # ## ### ##### ######## #############
110
111 proc BreakBackwardBranches {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 'backward', which means that they have
115 # at least one incoming revision changeset which is committed
116 # after at least one of the outgoing revision changesets, per
117 # the order computed in pass 6. In "cvs2svn" this is called
118 # "retrograde".
119
120 # NOTE: We might be able to use our knowledge that we are
121 # looking at all changesets to create a sql which selects all
122 # the branch changesets from the state in one go instead of
123 # having to check each changeset separately. Consider this
@@ -124,28 +126,67 @@
126 # NOTE 2: Might we even be able to select the retrograde
127 # changesets too ?
128
129 foreach cset [$graph nodes] {
130 if {![$cset isbranch]} continue
131 CheckAndBreakBackwardBranch $graph $cset
132 }
133 return
134 }
135
136 proc CheckAndBreakBackwardBranch {graph cset} {
137 while {[IsABackwardBranch $graph $cset]} {
138 log write 5 breakacycle "Breaking backward branch changeset <[$cset id]>"
139
140 break
141 }
142 return
143 }
144
145 proc IsABackwardBranch {dg cset} {
146 # A branch is "backward" if it has at least one incoming
147 # revision changeset which is committed after at least one of
148 # the outgoing revision changesets, per the order computed in
149 # pass 6.
150
151 # Rephrased, the maximal commit position found among the
152 # incoming revision changesets is larger than the minimal
153 # commit position found among the outgoing revision
154 # changesets. Assuming that we have both incoming and outgoing
155 # revision changesets.
156
157 # The helper "Positions" computes the set of commit positions
158 # for a set of changesets, which can be a mix of revision and
159 # symbol changesets.
160
161 set predecessors [Positions [$dg nodes -in $cset]]
162 set successors [Positions [$dg nodes -out $cset]]
163
164 return [expr {
165 [llength $predecessors] &&
166 [llength $successors] &&
167 ([max $predecessors] >= [min $successors])
168 }]
169 }
170
171 proc Positions {changesets} {
172 # To compute the set of commit positions from the set of
173 # changesets we first map each changeset to its position (*)
174 # and then filter out the invalid responses (the empty string)
175 # returned by the symbol changesets.
176 #
177 # (*) This data was loaded into memory earlir in the pass, by
178 # LoadCommitOrder.
179
180 return [struct::list filter [struct::list map $changesets \
181 [myproc ToPosition]] \
182 [myproc ValidPosition]]
183 }
184
185 proc ToPosition {cset} { $cset pos }
186 proc ValidPosition {pos} { expr {$pos ne ""} }
187
188 # # ## ### ##### ######## #############
189
190 proc SaveOrder {cset pos} {
191 }
192
193

Keyboard Shortcuts

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