Moving from SVN to ClearCase

前端 未结 2 847
说谎
说谎 2020-12-06 15:48

So, it\'s the opposite way round this time - I need to migrate a SVN-based project into ClearCase. Is there any tools out there that\'d make the process a bit easier (rather

2条回答
  •  隐瞒了意图╮
    2020-12-06 15:56

    When using the svn2cc script, you'll end up with a playall.bat.

    If you run the following script, then it'll label between revisions so that they are easier to access later on.

    A bit excessive perhaps, but some may find it useful. I make no apologies for the quality of the code :)

    # File Name ......................... revision_labeller.pl
    # Written By ........................ Stuart Davidson
    # Date .............................. 21/07/2009
    #
    # Description :
    # Adds the auto-generation and application of labels to an SVN import. 
    # 
    # Usage : 
    # revision_labeller.pl -label SVN-IMPORT-MYPROJECT -playall playall.bat
    
    
    use strict;
    use warnings;
    use Getopt::Long;
    
    use vars qw($label $playall_path);
    
    GetOptions(
       'label=s'            => \$label,
       'playall=s'          => \$playall_path,
    ) or exit 2;
    
    my $revisions = 0;
    my $output = "";
    
    # Count how many chout_x there are.
    open(PLAY, "<$playall_path");
    
    while()
    {
        if($_ =~ /^call chout_\d{1,3}.bat/)
        {
            $revisions++;
        }
        $output .= $_;
    }
    close(PLAY);
    
    # Add the ability to make labels.
    $output =~ s/call chin_(\d{1,3}).bat/call chin_$1.bat\ncleartool mklabel -recurse ($label)_$1 ./g;
    $output =~ s/\($label\)/$label/g;
    
    # For each revision, at the start, create the label
    my $create_labels = "";
    for(my $i = 1; $i <= $revisions; $i++)
    {
        $create_labels .= "cleartool mklbtype -cfile \"comments_" . $i . ".txt\" " . $label . "_" . $i . "\n";
    }
    $output = $create_labels . $output;
    
    # For each revision, at the end, lock the label
    my $lock_labels = "";
    for(my $i = 1; $i <= $revisions; $i++)
    {
        $lock_labels .= "cleartool lock lbtype:" . $label . "_" . $i . "\n";
    }
    $output = $output . $lock_labels;
    
    print $output;
    

提交回复
热议问题