Changeset 312

Show
Ignore:
Timestamp:
06/11/2007 10:35:15 PM
Author:
toby
Message:

Fix #25 by using File::Copy to do buffered copy of vss output directly to dumpfile; thanks to Erik Bray for the patch

Files:

Legend:

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

    r311 r312  
    99use warnings; 
    1010use strict; 
     11 
     12use File::Copy; 
    1113 
    1214our %gHandlers = 
     
    216218 
    217219    if ($data->{itemtype} == 2) { 
    218         $self->get_export_contents($node, $data, $expdir); 
     220        $self->get_export_file($node, $data, $expdir); 
    219221    } 
    220222 
     
    244246 
    245247    if ($data->{itemtype} == 2) { 
    246         $self->get_export_contents($node, $data, $expdir); 
     248        $self->get_export_file($node, $data, $expdir); 
    247249    } 
    248250 
     
    707709 
    708710############################################################################### 
    709 #  get_export_contents 
    710 ############################################################################### 
    711 sub get_export_contents
     711#  get_export_file 
     712############################################################################### 
     713sub get_export_file
    712714    my($self, $node, $data, $expdir) = @_; 
    713715 
     
    720722    } 
    721723 
    722     my $file = "$expdir/$data->{physname}.$data->{version}"; 
    723  
    724     if (!open EXP, "$file") { 
    725         $self->add_error("Could not open export file '$file'"); 
    726         return 0; 
    727     } 
    728  
    729     binmode(EXP); 
    730  
    731 #   $node->{text} = join('', <EXP>); 
    732     $node->{text} = do { local( $/ ) ; <EXP> } ; 
    733  
    734     close EXP; 
    735  
     724    $node->{file} = "$expdir/$data->{physname}.$data->{version}"; 
    736725    return 1; 
    737726 
    738 }  #  End get_export_contents 
     727}  #  End get_export_file 
    739728 
    740729############################################################################### 
     
    748737    print $fh $string; 
    749738    $self->output_content($node->{hideprops}? undef : $node->{props}, 
    750                           $node->{text}); 
     739                          $node->{text}, $node->{file}); 
    751740}  #  End output_node 
    752741 
     
    755744############################################################################### 
    756745sub output_content { 
    757     my($self, $props, $text) = @_; 
     746    my($self, $props, $text, $file) = @_; 
    758747 
    759748    my $fh = $self->{fh}; 
    760749 
    761     $text = '' unless defined $text
     750    $text = '' unless defined $text || defined $file
    762751 
    763752    my $proplen = 0; 
     
    781770    } 
    782771 
    783     $textlen = length($text); 
     772    if(!defined $text && defined $file) { 
     773        $textlen = -s $file; 
     774    } else { 
     775        $textlen = length($text); 
     776    } 
    784777    return if ($textlen + $proplen == 0); 
    785778 
     
    793786 
    794787    print $fh "Content-length: " . ($proplen + $textlen) 
    795         . "\n\n$propout$text\n"; 
     788        . "\n\n$propout"; 
     789 
     790    if(!defined $text && defined $file) { 
     791        copy($file, $fh); 
     792        print $fh "\n"; 
     793    } else { 
     794        print $fh "$text\n"; 
     795    } 
    796796 
    797797}  #  End output_content 
  • trunk/script/Vss2Svn/Dumpfile/Node.pm

    r297 r312  
    3333         props => undef, 
    3434         hideprops => 0, 
     35         file => undef, 
    3536         text => undef, 
    3637        }; 

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