| | @@ -691,14 +691,13 @@ |
| 691 | 691 | } |
| 692 | 692 | return |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | method RemoveIrrelevantDeletions {} { |
| 696 | | - # From cvs2fossil: |
| 697 | | - # If a file is added on a branch, then a trunk revision is |
| 698 | | - # added at the same time in the 'Dead' state. This revision |
| 699 | | - # doesn't do anything useful, so delete it. |
| 696 | + # From cvs2svn: If a file is added on a branch, then a trunk |
| 697 | + # revision is added at the same time in the 'Dead' state. |
| 698 | + # This revision doesn't do anything useful, so delete it. |
| 700 | 699 | |
| 701 | 700 | foreach root $myroots { |
| 702 | 701 | if {[$root isneeded]} continue |
| 703 | 702 | log write 2 file "Removing unnecessary dead revision [$root revnr]" |
| 704 | 703 | |
| | @@ -731,17 +730,80 @@ |
| 731 | 730 | # any tags that were set on it. |
| 732 | 731 | |
| 733 | 732 | $root removealltags |
| 734 | 733 | |
| 735 | 734 | # This can only happen once per file, and we might have |
| 736 | | - # just changed myroots, so break out of the loop: |
| 735 | + # just changed myroots, so end the loop |
| 737 | 736 | break |
| 738 | 737 | } |
| 739 | 738 | return |
| 740 | 739 | } |
| 741 | 740 | |
| 742 | 741 | method RemoveInitialBranchDeletions {} { |
| 742 | + # From cvs2svn: If the first revision on a branch is an |
| 743 | + # unnecessary delete, remove it. |
| 744 | + # |
| 745 | + # If a file is added on a branch (whether or not it already |
| 746 | + # existed on trunk), then new versions of CVS add a first |
| 747 | + # branch revision in the 'dead' state (to indicate that the |
| 748 | + # file did not exist on the branch when the branch was |
| 749 | + # created) followed by the second branch revision, which is an |
| 750 | + # add. When we encounter this situation, we sever the branch |
| 751 | + # from trunk and delete the first branch revision. |
| 752 | + |
| 753 | + # At this point we may have already multiple roots in myroots, |
| 754 | + # we have to process them all. |
| 755 | + |
| 756 | + set lodroots [$self LinesOfDevelopment] |
| 757 | + foreach root $lodroots { |
| 758 | + if {[$root isneededbranchdel]} continue |
| 759 | + log write 2 file "Removing unnecessary initial branch delete [$root revnr]" |
| 760 | + |
| 761 | + set branch [$root parentbranch] |
| 762 | + set parent [$root parent] |
| 763 | + set child [$root child] |
| 764 | + |
| 765 | + ldelete myroots $root |
| 766 | + unset myrev([$root revnr]) |
| 767 | + $child cutfromparent |
| 768 | + lappend myroots $child |
| 769 | + |
| 770 | + $parent removechildonbranch $root |
| 771 | + $parent removebranch $branch |
| 772 | + |
| 773 | + $branch destroy |
| 774 | + $root destroy |
| 775 | + } |
| 776 | + return |
| 777 | + } |
| 778 | + |
| 779 | + method LinesOfDevelopment {} { |
| 780 | + # Determine all lines of development for the file. This are |
| 781 | + # the known roots, and the root of all branches found on the |
| 782 | + # line of primary children. |
| 783 | + |
| 784 | + set lodroots {} |
| 785 | + foreach root $myroots { |
| 786 | + $self AddBranchedLinesOfDevelopment lodroots $root |
| 787 | + lappend lodroots $root |
| 788 | + } |
| 789 | + return $lodroots |
| 790 | + } |
| 791 | + |
| 792 | + method AddBranchedLinesOfDevelopment {lv root} { |
| 793 | + upvar 1 $lv lodroots |
| 794 | + while {$root ne ""} { |
| 795 | + foreach branch [$root branches] { |
| 796 | + if {![$branch haschild]} continue |
| 797 | + set child [$branch child] |
| 798 | + # Recurse into the branch for deeper branches. |
| 799 | + $self AddBranchedLinesOfDevelopment lodroots $child |
| 800 | + lappend lodroots $child |
| 801 | + } |
| 802 | + set root [$root child] |
| 803 | + } |
| 804 | + return |
| 743 | 805 | } |
| 744 | 806 | |
| 745 | 807 | method ExcludeNonTrunkInformation {} { |
| 746 | 808 | } |
| 747 | 809 | |
| 748 | 810 | |