Changeset 332

Show
Ignore:
Timestamp:
10/30/2007 10:26:05 PM
Author:
ldavis
Message:

Remapping using label_mapper would cause replacements not changing the label directory to be put into some directory like 'labels/label-replacement/old-label', which is not what I expected. This code causes the same label to be placed at 'labels/label-replacement'. Those who like the old behavior can replace 'label-replacement' with 'label-replacement/old-label' in label_mapper.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/script/Vss2Svn/Dumpfile.pm

    r325 r332  
    617617         
    618618        if (defined $self->{label_mapper}) { 
    619             $labeldir = $self->{label_mapper}->remap ($main::gCfg{labeldir}, $label); 
     619            my $mapping = $self->{label_mapper}->remap ($main::gCfg{labeldir}, $label); 
     620            $labeldir = $mapping->{replacement} if $mapping->{is_labeldir}; 
     621            $label = $mapping->{replacement} unless $mapping->{is_labeldir}; 
    620622        } 
    621623        $labeldir =~ s:\\:/:g; 
  • trunk/script/Vss2Svn/Dumpfile/LabelMapper.pm

    r327 r332  
    44use strict; 
    55use Config::Ini; 
    6 use Text::Glob; 
    76 
    87############################################################################### 
     
    1211    my($class, $conf) = @_; 
    1312 
    14     my $self = 
    15         { 
    16          config => new Config::Ini( $conf, -commentdelim => "#" ), 
    17         }; 
     13    my $config = new Config::Ini( $conf, -commentdelim => "#" ); 
     14    my $self = (); 
    1815 
    19     $self->{labels} = $self->{config}->get (['labels']); 
     16    $self->{labels} = $config->get (['labels']); 
    2017    
    2118    $self = bless($self, $class); 
     
    3027    my($self, $labeldir, $label) = @_; 
    3128 
    32     my ($glob, $remap); 
    33      
     29 
     30    my $retval = (); 
     31    $retval->{is_labeldir} = 1; 
     32    $retval->{replacement} = $labeldir; 
     33 
    3434    # we need to reset the following each enumeration if we aborted the 
    3535    # previous one with a premature return 
    36     my $dummy = keys %{$self->{labels}}; 
     36    keys %{$self->{labels}}; 
    3737 
    38     while (($glob, $remap) = each %{ $self->{labels} }) { 
    39         if ( $label =~ /$glob/) { 
    40             if ($remap->[0] =~ m:^/:) { 
    41 #                print "remap label: $label to $remap->[0]\n"; 
    42                 return $remap->[0]; 
    43             } 
    44             else { 
    45 #                print "remap label: $label to $labeldir/$remap->[0]\n"; 
    46                 return $labeldir . "/" . $remap->[0]; 
    47             } 
    48              
     38    my ($label_path, $remap); 
     39    while (($label_path, $remap) = each %{ $self->{labels} }) { 
     40        if ( $label =~ /$label_path/) { 
     41            $retval->{replacement} = $remap->[0]; 
     42            $retval->{is_labeldir} = ($remap->[0] =~ m:^/:); 
     43            last; 
    4944        } 
    5045    } 
    51 #    print "$label not remaped\n"; 
    52     return $labeldir
     46 
     47    return $retval
    5348} 
    5449 

PumaCode.org recommends CVSDude for fast, professional Subversion and Trac hosting:

CVSDude.com

These ads are automatically generated by Google. Revenue from these ads helps to pay for hosting this site; however, these ads do not constitute an endorsement by PumaCode.org.