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.
Commit
678765068d56702bb06b73a5f43758c60a788f27
Parent
8c6488ded2d656b…
1 file changed
+66
-20
+66
-20
| --- tools/cvs2fossil/lib/c2f_prev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | ||
| @@ -419,10 +419,12 @@ | ||
| 419 | 419 | # See PullSuccessorRevisions below for the main explanation of |
| 420 | 420 | # the various cases. This piece is special in that it |
| 421 | 421 | # restricts the successors we look for to the same set of |
| 422 | 422 | # revisions we start from. Sensible as we are looking for |
| 423 | 423 | # changeset internal dependencies. |
| 424 | + | |
| 425 | + array set dep {} | |
| 424 | 426 | |
| 425 | 427 | foreach {rid child} [state run " |
| 426 | 428 | -- (1) Primary child |
| 427 | 429 | SELECT R.rid, R.child |
| 428 | 430 | FROM revision R |
| @@ -450,11 +452,53 @@ | ||
| 450 | 452 | # Consider moving this to the integrity module. |
| 451 | 453 | if {$rid == $child} { |
| 452 | 454 | trouble internal "Revision $rid depends on itself." |
| 453 | 455 | } |
| 454 | 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 | + } | |
| 455 | 498 | } |
| 499 | + return | |
| 456 | 500 | } |
| 457 | 501 | |
| 458 | 502 | proc PullSuccessorRevisions {dv revisions} { |
| 459 | 503 | upvar 1 $dv dependencies |
| 460 | 504 | set theset ('[join $revisions {','}]') |
| @@ -591,30 +635,32 @@ | ||
| 591 | 635 | # Note 2: start == end is not possible. It indicates a |
| 592 | 636 | # self-dependency due to the uniqueness of positions, |
| 593 | 637 | # and that is something we have ruled out already, see |
| 594 | 638 | # PullInternalSuccessorRevisions. |
| 595 | 639 | |
| 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 | + } | |
| 616 | 662 | } |
| 617 | 663 | |
| 618 | 664 | InitializeDeltas $revisions |
| 619 | 665 | return |
| 620 | 666 | } |
| 621 | 667 |
| --- 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 |