Changeset 297

Show
Ignore:
Timestamp:
02/10/2007 01:52:27 PM
Author:
luedi
Message:
  • do not output an empty Prop-Content. An empty prop-content block will remove all assigned "auto_properties" to a file.
  • changed the property handling to a hash structure, so that if the same properties is assigned twice, the last one will win.
  • The binary property from VSS is only assigned in the ADD handler. It is assigned prior to the auto_property, so that the auto_props can set a different svn:mime-type.
Files:

Legend:

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

    r292 r297  
    8282        @{ $data }{qw(revision_id author timestamp comment)}; 
    8383 
    84     my $props = []
     84    my $props = undef
    8585    my $fh = $self->{fh}; 
    8686 
     
    9191 
    9292    if ($revision > 0) { 
    93         push @$props, ['svn:log', $comment]; 
    94         push @$props, ['svn:author', $author]; 
    95     } 
    96  
    97     push @$props, ['svn:date', $self->svn_timestamp($timestamp)]; 
     93        $props = { 'svn:log' => $comment, 
     94                   'svn:author' => $author, 
     95                 }; 
     96    } 
     97 
     98    $props->{'svn:date'} = $self->svn_timestamp($timestamp); 
    9899 
    99100    $self->output_content($props); 
     
    205206    my $node = Vss2Svn::Dumpfile::Node->new(); 
    206207    $node->set_initial_props($itempath, $data); 
     208    if ($data->{is_binary}) { 
     209        $node->add_prop('svn:mime-type', 'application/octet-stream'); 
     210    } 
    207211    if (defined $self->{auto_props}) { 
    208212        $node->add_props ($self->{auto_props}->get_props ($itempath)); 
    209213    } 
    210      
     214 
    211215    $node->{action} = 'add'; 
    212216 
     
    728732    my($propout, $textout) = ('') x 2; 
    729733 
    730     my($key, $value); 
    731  
    732734    if (defined($props)) { 
    733         foreach my $prop (@$props) { 
    734             ($key, $value) = @$prop
     735        foreach my $key (keys %$props) { 
     736            my $value = $props->{$key}
    735737            $propout .= 'K ' . length($key) . "\n$key\n"; 
    736738            if (defined $value) { 
  • trunk/script/Vss2Svn/Dumpfile/AutoProps.pm

    r284 r297  
    3434    my($self, $path) = @_; 
    3535 
    36     my (@newprops); 
     36    my (%newprops); 
    3737 
    3838    $path =~ s:^/::; 
     
    4242    my ($glob, $autoprops); 
    4343    while (($glob, $autoprops) = each %{ $self->{autoprops} }) { 
    44         print $glob, $item, "\n"; 
     44#        print $glob, $item, "\n"; 
    4545        if (Text::Glob::match_glob($glob, $item)) { 
    4646            foreach my $autoprop (@$autoprops) 
     
    4949                foreach my $prop (@props) 
    5050                { 
    51                     my @keyvalue = split '=', $prop; 
    52                     push @newprops, [@keyvalue]
     51                    my ($key, $value) = split '=', $prop; 
     52                    $newprops{$key} = $value
    5353                } 
    5454            } 
     
    5656    } 
    5757     
    58     return @newprops; 
     58    return %newprops; 
    5959} 
    6060 
  • trunk/script/Vss2Svn/Dumpfile/Node.pm

    r284 r297  
    5050    $self->{path} = $itempath; 
    5151 
    52     if ($data->{is_binary}) { 
    53         $self->add_prop('svn:mime-type', 'application/octet-stream'); 
    54     } 
     52#    if ($data->{is_binary}) { 
     53#        $self->add_prop('svn:mime-type', 'application/octet-stream'); 
     54#    } 
    5555 
    5656}  #  End set_initial_props 
     
    6161sub add_prop { 
    6262    my($self, $key, $value) = @_; 
    63     push @{ $self->{props} }, [$key, $value]
     63    $self->{props}->{$key} = $value
    6464}  #  End add_prop 
    6565 
     
    6868############################################################################### 
    6969sub add_props { 
    70     my($self, @props) = @_; 
    71     push @{ $self->{props} }, @props; 
     70    my($self, %props) = @_; 
     71    foreach my $prop (keys %props) { 
     72        $self->{props}->{$prop} = $props{$prop}; 
     73    } 
    7274}  #  End add_props 
    7375 

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.