Fossil SCM

Bugfixes when generating revision changesets. (1) The dependencies for a revision are a list, not single. (2) Use pseudo-dependencies to separate revisions of the same file from each other if they have no direct dependencies in the state.

aku 2007-11-27 05:08 trunk
Commit 678765068d56702bb06b73a5f43758c60a788f27
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -419,10 +419,12 @@
419419
# See PullSuccessorRevisions below for the main explanation of
420420
# the various cases. This piece is special in that it
421421
# restricts the successors we look for to the same set of
422422
# revisions we start from. Sensible as we are looking for
423423
# changeset internal dependencies.
424
+
425
+ array set dep {}
424426
425427
foreach {rid child} [state run "
426428
-- (1) Primary child
427429
SELECT R.rid, R.child
428430
FROM revision R
@@ -450,11 +452,53 @@
450452
# Consider moving this to the integrity module.
451453
if {$rid == $child} {
452454
trouble internal "Revision $rid depends on itself."
453455
}
454456
lappend dependencies($rid) $child
457
+ set dep($rid,$child) .
458
+ }
459
+
460
+ # The sql statements above looks only for direct dependencies
461
+ # between revision in the changeset. However due to the
462
+ # vagaries of meta data it is possible for two revisions of
463
+ # the same file to end up in the same changeset, without a
464
+ # direct dependency between them. However we know that there
465
+ # has to be a an indirect dependency, be it through primary
466
+ # children, branch children, or a combination thereof.
467
+
468
+ # We now fill in these pseudo-dependencies, if no such
469
+ # dependency exists already. The direction of the dependency
470
+ # is actually irrelevant for this.
471
+
472
+ # NOTE: This is different from cvs2svn. Our spiritual ancestor
473
+ # does not use such pseudo-dependencies, however it uses a
474
+ # COMMIT_THRESHOLD, a time interval commits should fall. This
475
+ # will greatly reduces the risk of getting far separated
476
+ # revisions of the same file into one changeset.
477
+
478
+ # We allow revisions to be far apart in time in the same
479
+ # changeset, but need the pseudo-dependencies for this.
480
+
481
+ array set fids {}
482
+ foreach {rid fid} [state run "
483
+ SELECT R.rid, R.fid FROM revision R WHERE R.rid IN $theset
484
+ "] { lappend fids($fid) $rid }
485
+
486
+ foreach {fid rids} [array get fids] {
487
+ if {[llength $rids] < 2} continue
488
+ foreach a $rids {
489
+ foreach b $rids {
490
+ if {$a == $b} continue
491
+ if {[info exists dep($a,$b)]} continue
492
+ if {[info exists dep($b,$a)]} continue
493
+ lappend dependencies($a) $b
494
+ set dep($a,$b) .
495
+ set dep($b,$a) .
496
+ }
497
+ }
455498
}
499
+ return
456500
}
457501
458502
proc PullSuccessorRevisions {dv revisions} {
459503
upvar 1 $dv dependencies
460504
set theset ('[join $revisions {','}]')
@@ -591,30 +635,32 @@
591635
# Note 2: start == end is not possible. It indicates a
592636
# self-dependency due to the uniqueness of positions,
593637
# and that is something we have ruled out already, see
594638
# PullInternalSuccessorRevisions.
595639
596
- foreach {rid child} [array get dependencies] {
597
- set dkey [list $rid $child]
598
- set start $pos($rid)
599
- set end $pos($child)
600
- set crosses {}
601
-
602
- if {$start > $end} {
603
- while {$end < $start} {
604
- lappend crosses $end
605
- incr cross($end)
606
- incr end
607
- }
608
- } else {
609
- while {$start < $end} {
610
- lappend crosses $start
611
- incr cross($start)
612
- incr start
613
- }
614
- }
615
- set depc($dkey) $crosses
640
+ foreach {rid children} [array get dependencies] {
641
+ foreach child $children {
642
+ set dkey [list $rid $child]
643
+ set start $pos($rid)
644
+ set end $pos($child)
645
+ set crosses {}
646
+
647
+ if {$start > $end} {
648
+ while {$end < $start} {
649
+ lappend crosses $end
650
+ incr cross($end)
651
+ incr end
652
+ }
653
+ } else {
654
+ while {$start < $end} {
655
+ lappend crosses $start
656
+ incr cross($start)
657
+ incr start
658
+ }
659
+ }
660
+ set depc($dkey) $crosses
661
+ }
616662
}
617663
618664
InitializeDeltas $revisions
619665
return
620666
}
621667
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -419,10 +419,12 @@
419 # See PullSuccessorRevisions below for the main explanation of
420 # the various cases. This piece is special in that it
421 # restricts the successors we look for to the same set of
422 # revisions we start from. Sensible as we are looking for
423 # changeset internal dependencies.
 
 
424
425 foreach {rid child} [state run "
426 -- (1) Primary child
427 SELECT R.rid, R.child
428 FROM revision R
@@ -450,11 +452,53 @@
450 # Consider moving this to the integrity module.
451 if {$rid == $child} {
452 trouble internal "Revision $rid depends on itself."
453 }
454 lappend dependencies($rid) $child
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455 }
 
456 }
457
458 proc PullSuccessorRevisions {dv revisions} {
459 upvar 1 $dv dependencies
460 set theset ('[join $revisions {','}]')
@@ -591,30 +635,32 @@
591 # Note 2: start == end is not possible. It indicates a
592 # self-dependency due to the uniqueness of positions,
593 # and that is something we have ruled out already, see
594 # PullInternalSuccessorRevisions.
595
596 foreach {rid child} [array get dependencies] {
597 set dkey [list $rid $child]
598 set start $pos($rid)
599 set end $pos($child)
600 set crosses {}
601
602 if {$start > $end} {
603 while {$end < $start} {
604 lappend crosses $end
605 incr cross($end)
606 incr end
607 }
608 } else {
609 while {$start < $end} {
610 lappend crosses $start
611 incr cross($start)
612 incr start
613 }
614 }
615 set depc($dkey) $crosses
 
 
616 }
617
618 InitializeDeltas $revisions
619 return
620 }
621
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -419,10 +419,12 @@
419 # See PullSuccessorRevisions below for the main explanation of
420 # the various cases. This piece is special in that it
421 # restricts the successors we look for to the same set of
422 # revisions we start from. Sensible as we are looking for
423 # changeset internal dependencies.
424
425 array set dep {}
426
427 foreach {rid child} [state run "
428 -- (1) Primary child
429 SELECT R.rid, R.child
430 FROM revision R
@@ -450,11 +452,53 @@
452 # Consider moving this to the integrity module.
453 if {$rid == $child} {
454 trouble internal "Revision $rid depends on itself."
455 }
456 lappend dependencies($rid) $child
457 set dep($rid,$child) .
458 }
459
460 # The sql statements above looks only for direct dependencies
461 # between revision in the changeset. However due to the
462 # vagaries of meta data it is possible for two revisions of
463 # the same file to end up in the same changeset, without a
464 # direct dependency between them. However we know that there
465 # has to be a an indirect dependency, be it through primary
466 # children, branch children, or a combination thereof.
467
468 # We now fill in these pseudo-dependencies, if no such
469 # dependency exists already. The direction of the dependency
470 # is actually irrelevant for this.
471
472 # NOTE: This is different from cvs2svn. Our spiritual ancestor
473 # does not use such pseudo-dependencies, however it uses a
474 # COMMIT_THRESHOLD, a time interval commits should fall. This
475 # will greatly reduces the risk of getting far separated
476 # revisions of the same file into one changeset.
477
478 # We allow revisions to be far apart in time in the same
479 # changeset, but need the pseudo-dependencies for this.
480
481 array set fids {}
482 foreach {rid fid} [state run "
483 SELECT R.rid, R.fid FROM revision R WHERE R.rid IN $theset
484 "] { lappend fids($fid) $rid }
485
486 foreach {fid rids} [array get fids] {
487 if {[llength $rids] < 2} continue
488 foreach a $rids {
489 foreach b $rids {
490 if {$a == $b} continue
491 if {[info exists dep($a,$b)]} continue
492 if {[info exists dep($b,$a)]} continue
493 lappend dependencies($a) $b
494 set dep($a,$b) .
495 set dep($b,$a) .
496 }
497 }
498 }
499 return
500 }
501
502 proc PullSuccessorRevisions {dv revisions} {
503 upvar 1 $dv dependencies
504 set theset ('[join $revisions {','}]')
@@ -591,30 +635,32 @@
635 # Note 2: start == end is not possible. It indicates a
636 # self-dependency due to the uniqueness of positions,
637 # and that is something we have ruled out already, see
638 # PullInternalSuccessorRevisions.
639
640 foreach {rid children} [array get dependencies] {
641 foreach child $children {
642 set dkey [list $rid $child]
643 set start $pos($rid)
644 set end $pos($child)
645 set crosses {}
646
647 if {$start > $end} {
648 while {$end < $start} {
649 lappend crosses $end
650 incr cross($end)
651 incr end
652 }
653 } else {
654 while {$start < $end} {
655 lappend crosses $start
656 incr cross($start)
657 incr start
658 }
659 }
660 set depc($dkey) $crosses
661 }
662 }
663
664 InitializeDeltas $revisions
665 return
666 }
667

Keyboard Shortcuts

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