Fossil SCM

Added a number of assertions and must-not-happens with associated log output. Plus some small tweaks, and notes.

aku 2007-11-24 04:15 trunk
Commit eabaea870afdc22be494d98edac5b2fab37a30df
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -171,18 +171,42 @@
171171
foreach succ [$cset successors] {
172172
# Changesets may have dependencies outside of the
173173
# chosen set. These are ignored
174174
if {![$dg node exists $succ]} continue
175175
$dg arc insert $cset $succ
176
+
177
+ # Check for changesets referencing themselves. Such a
178
+ # loop shows that the changeset in question has
179
+ # internal dependencies. Something which is supposed
180
+ # to be not possible, as pass 5 (InitCsets) takes care
181
+ # to transform internal into external dependencies by
182
+ # breaking the relevant changesets apart. So having
183
+ # one indicates big trouble in pass 5. We report them
184
+ # and dump internal structures to make it easier to
185
+ # trace the links causing the problem.
186
+ if {$succ eq $cset} {
187
+ trouble fatal "Self-referencing changeset <[$cset id]>"
188
+ log write 2 cyclebreaker "LOOP changeset <[$cset id]> __________________"
189
+ array set nmap [$cset nextmap]
190
+ foreach r [lsort -dict [array names nmap]] {
191
+ foreach succrev $nmap($r) {
192
+ log write 2 cyclebreaker \
193
+ "LOOP * rev <$r> --> rev <$succrev> --> cs [join [struct::list map [project::rev ofrev $succrev] [myproc ID]] { }]"
194
+ }
195
+ }
196
+ }
176197
}
177198
}
178199
179200
# Run the user hook to manipulate the graph before
180201
# consummation.
181202
182203
if {$log} { Mark $dg -start }
183204
PreHook $dg
205
+
206
+ # This kills the application if loops (see above) were found.
207
+ trouble abort?
184208
return $dg
185209
}
186210
187211
# Instead of searching the whole graph for the degree-0 nodes in
188212
# each iteration we compute the list once to start, and then only
@@ -282,10 +306,11 @@
282306
# The cycle we have gotten is broken by breaking apart one or
283307
# more of the changesets in the cycle. This causes us to
284308
# create one or more changesets which are to be committed,
285309
# added to the graph, etc. pp.
286310
311
+ # NOTE/TODO. Move this map operation to project::rev, as typemethod.
287312
set cprint [join [struct::list map $cycle [myproc ID]] { }]
288313
289314
lappend cycle [lindex $cycle 0] [lindex $cycle 1]
290315
set bestlink {}
291316
set bestnode {}
@@ -373,10 +398,13 @@
373398
foreach succ [$cset successors] {
374399
# The new changesets may have dependencies outside of
375400
# the chosen set. These are ignored
376401
if {![$dg node exists $succ]} continue
377402
$dg arc insert $cset $succ
403
+ if {$succ eq $cset} {
404
+ trouble internal "Self-referencing changeset <[$cset id]>"
405
+ }
378406
}
379407
}
380408
foreach cset $pre {
381409
foreach succ [$cset successors] {
382410
# Note that the arc may already exist in the graph. If
383411
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -171,18 +171,42 @@
171 foreach succ [$cset successors] {
172 # Changesets may have dependencies outside of the
173 # chosen set. These are ignored
174 if {![$dg node exists $succ]} continue
175 $dg arc insert $cset $succ
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176 }
177 }
178
179 # Run the user hook to manipulate the graph before
180 # consummation.
181
182 if {$log} { Mark $dg -start }
183 PreHook $dg
 
 
 
184 return $dg
185 }
186
187 # Instead of searching the whole graph for the degree-0 nodes in
188 # each iteration we compute the list once to start, and then only
@@ -282,10 +306,11 @@
282 # The cycle we have gotten is broken by breaking apart one or
283 # more of the changesets in the cycle. This causes us to
284 # create one or more changesets which are to be committed,
285 # added to the graph, etc. pp.
286
 
287 set cprint [join [struct::list map $cycle [myproc ID]] { }]
288
289 lappend cycle [lindex $cycle 0] [lindex $cycle 1]
290 set bestlink {}
291 set bestnode {}
@@ -373,10 +398,13 @@
373 foreach succ [$cset successors] {
374 # The new changesets may have dependencies outside of
375 # the chosen set. These are ignored
376 if {![$dg node exists $succ]} continue
377 $dg arc insert $cset $succ
 
 
 
378 }
379 }
380 foreach cset $pre {
381 foreach succ [$cset successors] {
382 # Note that the arc may already exist in the graph. If
383
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -171,18 +171,42 @@
171 foreach succ [$cset successors] {
172 # Changesets may have dependencies outside of the
173 # chosen set. These are ignored
174 if {![$dg node exists $succ]} continue
175 $dg arc insert $cset $succ
176
177 # Check for changesets referencing themselves. Such a
178 # loop shows that the changeset in question has
179 # internal dependencies. Something which is supposed
180 # to be not possible, as pass 5 (InitCsets) takes care
181 # to transform internal into external dependencies by
182 # breaking the relevant changesets apart. So having
183 # one indicates big trouble in pass 5. We report them
184 # and dump internal structures to make it easier to
185 # trace the links causing the problem.
186 if {$succ eq $cset} {
187 trouble fatal "Self-referencing changeset <[$cset id]>"
188 log write 2 cyclebreaker "LOOP changeset <[$cset id]> __________________"
189 array set nmap [$cset nextmap]
190 foreach r [lsort -dict [array names nmap]] {
191 foreach succrev $nmap($r) {
192 log write 2 cyclebreaker \
193 "LOOP * rev <$r> --> rev <$succrev> --> cs [join [struct::list map [project::rev ofrev $succrev] [myproc ID]] { }]"
194 }
195 }
196 }
197 }
198 }
199
200 # Run the user hook to manipulate the graph before
201 # consummation.
202
203 if {$log} { Mark $dg -start }
204 PreHook $dg
205
206 # This kills the application if loops (see above) were found.
207 trouble abort?
208 return $dg
209 }
210
211 # Instead of searching the whole graph for the degree-0 nodes in
212 # each iteration we compute the list once to start, and then only
@@ -282,10 +306,11 @@
306 # The cycle we have gotten is broken by breaking apart one or
307 # more of the changesets in the cycle. This causes us to
308 # create one or more changesets which are to be committed,
309 # added to the graph, etc. pp.
310
311 # NOTE/TODO. Move this map operation to project::rev, as typemethod.
312 set cprint [join [struct::list map $cycle [myproc ID]] { }]
313
314 lappend cycle [lindex $cycle 0] [lindex $cycle 1]
315 set bestlink {}
316 set bestnode {}
@@ -373,10 +398,13 @@
398 foreach succ [$cset successors] {
399 # The new changesets may have dependencies outside of
400 # the chosen set. These are ignored
401 if {![$dg node exists $succ]} continue
402 $dg arc insert $cset $succ
403 if {$succ eq $cset} {
404 trouble internal "Self-referencing changeset <[$cset id]>"
405 }
406 }
407 }
408 foreach cset $pre {
409 foreach succ [$cset successors] {
410 # Note that the arc may already exist in the graph. If
411
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -315,10 +315,13 @@
315315
$cset drop
316316
$cset destroy
317317
318318
set newcsets {}
319319
foreach fragmentrevisions $args {
320
+ if {![llength $fragmentrevisions]} {
321
+ trouble internal "Attempted to create an empty changeset, i.e. without revisions"
322
+ }
320323
lappend newcsets [$type %AUTO% $project $cstype $cssrc $fragmentrevisions]
321324
}
322325
323326
foreach c $newcsets { $c persist }
324327
return $newcsets
@@ -428,10 +431,11 @@
428431
if {$rid == $child} {
429432
trouble internal "Revision $rid depends on itself."
430433
}
431434
lappend dependencies($rid) $child
432435
}
436
+ return
433437
}
434438
435439
proc PullPredecessorRevisions {dv revisions} {
436440
upvar 1 $dv dependencies
437441
set theset ('[join $revisions {','}]')
@@ -453,10 +457,11 @@
453457
if {$rid == $parent} {
454458
trouble internal "Revision $rid depends on itself."
455459
}
456460
lappend dependencies($rid) $parent
457461
}
462
+ return
458463
}
459464
460465
proc InitializeBreakState {revisions} {
461466
upvar 1 pos pos cross cross range range depc depc delta delta \
462467
dependencies dependencies
463468
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -315,10 +315,13 @@
315 $cset drop
316 $cset destroy
317
318 set newcsets {}
319 foreach fragmentrevisions $args {
 
 
 
320 lappend newcsets [$type %AUTO% $project $cstype $cssrc $fragmentrevisions]
321 }
322
323 foreach c $newcsets { $c persist }
324 return $newcsets
@@ -428,10 +431,11 @@
428 if {$rid == $child} {
429 trouble internal "Revision $rid depends on itself."
430 }
431 lappend dependencies($rid) $child
432 }
 
433 }
434
435 proc PullPredecessorRevisions {dv revisions} {
436 upvar 1 $dv dependencies
437 set theset ('[join $revisions {','}]')
@@ -453,10 +457,11 @@
453 if {$rid == $parent} {
454 trouble internal "Revision $rid depends on itself."
455 }
456 lappend dependencies($rid) $parent
457 }
 
458 }
459
460 proc InitializeBreakState {revisions} {
461 upvar 1 pos pos cross cross range range depc depc delta delta \
462 dependencies dependencies
463
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -315,10 +315,13 @@
315 $cset drop
316 $cset destroy
317
318 set newcsets {}
319 foreach fragmentrevisions $args {
320 if {![llength $fragmentrevisions]} {
321 trouble internal "Attempted to create an empty changeset, i.e. without revisions"
322 }
323 lappend newcsets [$type %AUTO% $project $cstype $cssrc $fragmentrevisions]
324 }
325
326 foreach c $newcsets { $c persist }
327 return $newcsets
@@ -428,10 +431,11 @@
431 if {$rid == $child} {
432 trouble internal "Revision $rid depends on itself."
433 }
434 lappend dependencies($rid) $child
435 }
436 return
437 }
438
439 proc PullPredecessorRevisions {dv revisions} {
440 upvar 1 $dv dependencies
441 set theset ('[join $revisions {','}]')
@@ -453,10 +457,11 @@
457 if {$rid == $parent} {
458 trouble internal "Revision $rid depends on itself."
459 }
460 lappend dependencies($rid) $parent
461 }
462 return
463 }
464
465 proc InitializeBreakState {revisions} {
466 upvar 1 pos pos cross cross range range depc depc delta delta \
467 dependencies dependencies
468

Keyboard Shortcuts

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