From vss2svn-commits at lists.pumacode.org Fri Mar 9 12:01:50 2007 From: vss2svn-commits at lists.pumacode.org (vss2svn-commits@lists.pumacode.org) Date: Fri Mar 9 12:01:55 2007 Subject: r302 - toby: in /trunk/script: ./ encodings/ encodings/source/ Message-ID: <20070309170150.C30C915CB08@cp.thetahost.com> Author: toby Date: Fri Mar 9 12:01:49 2007 New Revision: 302 Log: Add custom encodings to PerlApp build Added: trunk/script/encodings/ trunk/script/encodings/ibm866.enc (with props) trunk/script/encodings/koi8-r.enc (with props) trunk/script/encodings/source/ trunk/script/encodings/source/ibm866.xml (with props) trunk/script/encodings/source/koi8-r.xml (with props) trunk/script/encodings/source/windows-1251.xml (with props) trunk/script/encodings/source/windows-1253.xml (with props) trunk/script/encodings/windows-1251.enc (with props) trunk/script/encodings/windows-1253.enc (with props) Modified: trunk/script/build-vss2svn.perlapp Modified: trunk/script/build-vss2svn.perlapp ============================================================================== --- trunk/script/build-vss2svn.perlapp (original) +++ trunk/script/build-vss2svn.perlapp Fri Mar 9 12:01:49 2007 @@ -7,6 +7,7 @@ Add: integer Bind: big5.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\big5.enc,extract,mode=666] Bind: euc-kr.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\euc-kr.enc,extract,mode=666] +Bind: ibm866.enc[file=encodings\ibm866.enc,extract,mode=666] Bind: iso-8859-2.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-2.enc,extract,mode=666] Bind: iso-8859-3.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-3.enc,extract,mode=666] Bind: iso-8859-4.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-4.enc,extract,mode=666] @@ -14,8 +15,11 @@ Bind: iso-8859-7.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-7.enc,extract,mode=666] Bind: iso-8859-8.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-8.enc,extract,mode=666] Bind: iso-8859-9.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-9.enc,extract,mode=666] +Bind: koi8-r.enc[file=encodings\koi8-r.enc,extract,mode=666] Bind: windows-1250.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\windows-1250.enc,extract,mode=666] +Bind: windows-1251.enc[file=encodings\windows-1251.enc,extract,mode=666] Bind: windows-1252.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\windows-1252.enc,extract,mode=666] +Bind: windows-1253.enc[file=encodings\windows-1253.enc,extract,mode=666] Bind: x-euc-jp-jisx0221.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-euc-jp-jisx0221.enc,extract,mode=666] Bind: x-euc-jp-unicode.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-euc-jp-unicode.enc,extract,mode=666] Bind: x-sjis-cp932.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-cp932.enc,extract,mode=666] Added: trunk/script/encodings/ibm866.enc ============================================================================== Binary file - no diff available. Propchange: trunk/script/encodings/ibm866.enc ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/script/encodings/koi8-r.enc ============================================================================== Binary file - no diff available. Propchange: trunk/script/encodings/koi8-r.enc ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/script/encodings/source/ibm866.xml ============================================================================== --- trunk/script/encodings/source/ibm866.xml (added) +++ trunk/script/encodings/source/ibm866.xml Fri Mar 9 12:01:49 2007 @@ -1,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: trunk/script/encodings/source/ibm866.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/script/encodings/source/koi8-r.xml ============================================================================== --- trunk/script/encodings/source/koi8-r.xml (added) +++ trunk/script/encodings/source/koi8-r.xml Fri Mar 9 12:01:49 2007 @@ -1,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: trunk/script/encodings/source/koi8-r.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/script/encodings/source/windows-1251.xml ============================================================================== --- trunk/script/encodings/source/windows-1251.xml (added) +++ trunk/script/encodings/source/windows-1251.xml Fri Mar 9 12:01:49 2007 @@ -1,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: trunk/script/encodings/source/windows-1251.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/script/encodings/source/windows-1253.xml ============================================================================== --- trunk/script/encodings/source/windows-1253.xml (added) +++ trunk/script/encodings/source/windows-1253.xml Fri Mar 9 12:01:49 2007 @@ -1,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: trunk/script/encodings/source/windows-1253.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/script/encodings/windows-1251.enc ============================================================================== Binary file - no diff available. Propchange: trunk/script/encodings/windows-1251.enc ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/script/encodings/windows-1253.enc ============================================================================== Binary file - no diff available. Propchange: trunk/script/encodings/windows-1253.enc ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream From vss2svn-commits at lists.pumacode.org Fri Mar 9 14:34:38 2007 From: vss2svn-commits at lists.pumacode.org (vss2svn-commits@lists.pumacode.org) Date: Fri Mar 9 14:34:41 2007 Subject: r303 - toby: in /trunk/script: build-vss2svn.perlapp vss2svn.pl Message-ID: <20070309193438.E1E4E15CB18@cp.thetahost.com> Author: toby Date: Fri Mar 9 14:34:38 2007 New Revision: 303 Log: * Include ParserDetails.ini in .exe build to prevent warning message Modified: trunk/script/build-vss2svn.perlapp trunk/script/vss2svn.pl Modified: trunk/script/build-vss2svn.perlapp ============================================================================== --- trunk/script/build-vss2svn.perlapp (original) +++ trunk/script/build-vss2svn.perlapp Fri Mar 9 14:34:38 2007 @@ -16,6 +16,7 @@ Bind: iso-8859-8.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-8.enc,extract,mode=666] Bind: iso-8859-9.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-9.enc,extract,mode=666] Bind: koi8-r.enc[file=encodings\koi8-r.enc,extract,mode=666] +Bind: SAX/ParserDetails.ini[file=C:\Perl\site\lib\XML\SAX\ParserDetails.ini,extract,mode=666] Bind: windows-1250.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\windows-1250.enc,extract,mode=666] Bind: windows-1251.enc[file=encodings\windows-1251.enc,extract,mode=666] Bind: windows-1252.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\windows-1252.enc,extract,mode=666] Modified: trunk/script/vss2svn.pl ============================================================================== --- trunk/script/vss2svn.pl (original) +++ trunk/script/vss2svn.pl Fri Mar 9 14:34:38 2007 @@ -1625,6 +1625,11 @@ $gCfg{labeldir} = '/labels'; $gCfg{errortasks} = []; + + { + no warnings 'once'; + $gCfg{usingExe} = (defined($PerlApp::TOOL)); + } &ConfigureXmlParser(); @@ -1657,11 +1662,16 @@ $gCfg{xmlParser} = 'XML::Simple'; eval { require XML::SAX; }; + if($@) { # no XML::SAX; let XML::Simple use its own parser return 1; } - + elsif($gCfg{usingExe}) { + # Prevent the ParserDetails.ini error message when running from .exe + XML::SAX->load_parsers($INC[1]); + } + $gCfg{xmlParser} = 'XML::SAX::Expat'; $XML::SAX::ParserPackage = $gCfg{xmlParser}; From vss2svn-commits at lists.pumacode.org Fri Mar 9 14:57:17 2007 From: vss2svn-commits at lists.pumacode.org (vss2svn-commits@lists.pumacode.org) Date: Fri Mar 9 14:57:20 2007 Subject: r304 - toby: in /trunk/script: build-vss2svn.perlapp vss2svn.pl Message-ID: <20070309195717.E5DA915CB19@cp.thetahost.com> Author: toby Date: Fri Mar 9 14:57:16 2007 New Revision: 304 Log: * Have Expat parser look for an "encodings" directory regardless of whether running via .exe or .pl Modified: trunk/script/build-vss2svn.perlapp trunk/script/vss2svn.pl Modified: trunk/script/build-vss2svn.perlapp ============================================================================== --- trunk/script/build-vss2svn.perlapp (original) +++ trunk/script/build-vss2svn.perlapp Fri Mar 9 14:57:16 2007 @@ -5,28 +5,28 @@ Add: DBD::SQLite2 Add: XML::SAX::Expat Add: integer -Bind: big5.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\big5.enc,extract,mode=666] -Bind: euc-kr.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\euc-kr.enc,extract,mode=666] -Bind: ibm866.enc[file=encodings\ibm866.enc,extract,mode=666] -Bind: iso-8859-2.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-2.enc,extract,mode=666] -Bind: iso-8859-3.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-3.enc,extract,mode=666] -Bind: iso-8859-4.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-4.enc,extract,mode=666] -Bind: iso-8859-5.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-5.enc,extract,mode=666] -Bind: iso-8859-7.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-7.enc,extract,mode=666] -Bind: iso-8859-8.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-8.enc,extract,mode=666] -Bind: iso-8859-9.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-9.enc,extract,mode=666] -Bind: koi8-r.enc[file=encodings\koi8-r.enc,extract,mode=666] +Bind: encodings/big5.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\big5.enc,extract,mode=666] +Bind: encodings/euc-kr.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\euc-kr.enc,extract,mode=666] +Bind: encodings/ibm866.enc[file=encodings\ibm866.enc,extract,mode=666] +Bind: encodings/iso-8859-2.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-2.enc,extract,mode=666] +Bind: encodings/iso-8859-3.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-3.enc,extract,mode=666] +Bind: encodings/iso-8859-4.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-4.enc,extract,mode=666] +Bind: encodings/iso-8859-5.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-5.enc,extract,mode=666] +Bind: encodings/iso-8859-7.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-7.enc,extract,mode=666] +Bind: encodings/iso-8859-8.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-8.enc,extract,mode=666] +Bind: encodings/iso-8859-9.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\iso-8859-9.enc,extract,mode=666] +Bind: encodings/koi8-r.enc[file=encodings\koi8-r.enc,extract,mode=666] Bind: SAX/ParserDetails.ini[file=C:\Perl\site\lib\XML\SAX\ParserDetails.ini,extract,mode=666] -Bind: windows-1250.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\windows-1250.enc,extract,mode=666] -Bind: windows-1251.enc[file=encodings\windows-1251.enc,extract,mode=666] -Bind: windows-1252.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\windows-1252.enc,extract,mode=666] -Bind: windows-1253.enc[file=encodings\windows-1253.enc,extract,mode=666] -Bind: x-euc-jp-jisx0221.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-euc-jp-jisx0221.enc,extract,mode=666] -Bind: x-euc-jp-unicode.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-euc-jp-unicode.enc,extract,mode=666] -Bind: x-sjis-cp932.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-cp932.enc,extract,mode=666] -Bind: x-sjis-jdk117.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-jdk117.enc,extract,mode=666] -Bind: x-sjis-jisx0221.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-jisx0221.enc,extract,mode=666] -Bind: x-sjis-unicode.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-unicode.enc,extract,mode=666] +Bind: encodings/windows-1250.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\windows-1250.enc,extract,mode=666] +Bind: encodings/windows-1251.enc[file=encodings\windows-1251.enc,extract,mode=666] +Bind: encodings/windows-1252.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\windows-1252.enc,extract,mode=666] +Bind: encodings/windows-1253.enc[file=encodings\windows-1253.enc,extract,mode=666] +Bind: encodings/x-euc-jp-jisx0221.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-euc-jp-jisx0221.enc,extract,mode=666] +Bind: encodings/x-euc-jp-unicode.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-euc-jp-unicode.enc,extract,mode=666] +Bind: encodings/x-sjis-cp932.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-cp932.enc,extract,mode=666] +Bind: encodings/x-sjis-jdk117.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-jdk117.enc,extract,mode=666] +Bind: encodings/x-sjis-jisx0221.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-jisx0221.enc,extract,mode=666] +Bind: encodings/x-sjis-unicode.enc[file=C:\Perl\site\lib\XML\Parser\Encodings\x-sjis-unicode.enc,extract,mode=666] Clean: 0 Date: 2006-04-27 23:13:54 Debug: Modified: trunk/script/vss2svn.pl ============================================================================== --- trunk/script/vss2svn.pl (original) +++ trunk/script/vss2svn.pl Fri Mar 9 14:57:16 2007 @@ -1684,7 +1684,18 @@ # for exe version, XML::Parser::Expat needs help finding its encmaps no warnings 'once'; - push(@XML::Parser::Expat::Encoding_Path, @INC); + + my $encdir; + foreach my $dir (@INC) { + $encdir = "$dir/encodings"; + $encdir =~ s:\\:/:g; + $encdir =~ s://:/:g; + if(-d $encdir) { + print "Adding '$encdir' to encodings file path\n"; + push(@XML::Parser::Expat::Encoding_Path, $encdir); + } + } + return 1; } From vss2svn-commits at lists.pumacode.org Fri Mar 16 20:24:36 2007 From: vss2svn-commits at lists.pumacode.org (vss2svn-commits@lists.pumacode.org) Date: Fri Mar 16 20:24:40 2007 Subject: r305 - luedi: in /trunk/script: Vss2Svn/ActionHandler.pm Vss2Svn/Dumpfile.pm vss2svn.pl Message-ID: <20070317002437.1DB7C15CE05@cp.thetahost.com> Author: luedi Date: Fri Mar 16 20:24:35 2007 New Revision: 305 Log: * better move handling * when sharing/copying from orphan, turn into a move instead. Modified: trunk/script/Vss2Svn/ActionHandler.pm trunk/script/Vss2Svn/Dumpfile.pm trunk/script/vss2svn.pl Modified: trunk/script/Vss2Svn/ActionHandler.pm ============================================================================== --- trunk/script/Vss2Svn/ActionHandler.pm (original) +++ trunk/script/Vss2Svn/ActionHandler.pm Fri Mar 16 20:24:35 2007 @@ -251,13 +251,6 @@ return 0; } -# # if this is not a share+pin action, then add this item to the sharedphys -# # list. Otherwise, this item is pinned to a specific version and does not -# # participate in shared actions -# if (!defined $row->{version}) { -# push @{ $physinfo->{sharedphys} }, $row->{parentphys}; -# } - my $version = $row->{version}; $version = $physinfo->{last_version} if (!defined $version); @@ -283,13 +276,23 @@ # return $self->_add_handler(); } + # if this is a share from orphan, and not a share+pin action either, we can treat it as a move + elsif (!defined $row->{version} && # share+pin? + defined $physinfo->{orphaned} # orphaned? +# scalar @{$physinfo->{order}} == 1 # only one parent? + ) { + $physinfo->{parents}->{'_' . $row->{physname}}->{deleted} = 1; + undef $physinfo->{orphaned}; + $self->{action} = 'MOVE'; + } + # track the addition of the new parent $self->_add_parent ($physname, $row->{parentphys}); # if this is a share+pin action, then remember the pin version if (defined $row->{version}) { $physinfo->{parents}->{$row->{parentphys}}->{pinned} = $row->{version}; - } + } $self->{itempaths} = [$itempath]; $self->{info} = $sourceinfo; @@ -410,8 +413,6 @@ my($self) = @_; my $row = $self->{row}; - # Get the existing paths before the move; parent sub will get the new - # name my $physname = $row->{physname}; my $physinfo = $gPhysInfo{$physname}; @@ -422,58 +423,61 @@ return 0; } - if (!defined $row->{parentphys}) { + # row->{info} contains the source parent + # row->{parentphys} contains the target parent + + # check the source path + if (!defined $row->{info}) { # Check if this is an orphaned item - if (scalar @{$physinfo->{order}} == 1) { - $row->{parentphys} = $physinfo->{order}[0]; + if (defined $physinfo->{orphaned}) { + $row->{info} = '_' . $physname; + undef $physinfo->{orphaned}; } else { # Don't know from where to move. Share it there instead - $row->{parentphys} = $row->{info}; - $row->{info} = undef; $self->{action} = 'SHARE'; return $self->_share_handler(); } } # '$sourceinfo' is the path for the old location (the move source); - my $parentpath = $self->_get_current_parent_path (); - my $sourceinfo = $parentpath . $physinfo->{name}; # $row->{itemname}; - - if (!defined ($row->{info})) { + my $sourceparent = $self->_get_parent_path ($row->{info}); + my $sourceinfo = $sourceparent . $row->{itemname}; + + + # check the target path + if (!defined ($row->{parentphys})) { # the target directory was destroyed, so there is no apropriate move # target information. Fall back to a move to the orphaned cache - $row->{info} = '_' . $row->{physname}; + $physinfo->{orphaned} = 1; + $row->{parentphys} = '_' . $row->{physname}; } # '$itempath' contains the move target path - my $itempath = $self->_get_parent_path ($row->{info}) . $row->{itemname}; - - if (!defined($parentpath)) { + my $parentpath = $self->_get_current_parent_path (); + my $itempath = $parentpath . $physinfo->{name}; # $row->{itemname}; + + + if (!defined($sourceparent)) { # We can't figure out the path for the parent that this move came from, # so it was either destroyed or corrupted. That means that this isn't # a move anymore; it's a new add. $self->{action} = 'ADD'; -# $self->{version} = $version; -# return $self->_add_handler(); - - # we need to swap the source and the target path - $sourceinfo = $itempath; - undef $itempath; + undef $sourceinfo; } else { # set the old parent inactive - $physinfo->{parents}->{$row->{parentphys}}->{deleted} = 1; + $physinfo->{parents}->{$row->{info}}->{deleted} = 1; } # if the item mysteriously changed name during the move $physinfo->{name} = $row->{itemname}; # track the addition of the new parent - $self->_add_parent ($physname, $row->{info}); - - $self->{itempaths} = [$sourceinfo]; - $self->{info} = $itempath; + $self->_add_parent ($physname, $row->{parentphys}); + + $self->{itempaths} = [$itempath]; + $self->{info} = $sourceinfo; # the move target is now also a valid "copy from" itempath $self->_track_item_path ($physname, $row->{parentphys}, $physinfo->{last_version}, $itempath); @@ -745,11 +749,6 @@ return undef; } - #todo: make the behavoir of orphaned file tracking configurable -# if ($physinfo->{orphaned}) { -# return undef; -# } - $self->{physname_seen} .= "$physname, "; # In a move szenario, we can have one deleted and one active parent. We @@ -877,12 +876,6 @@ return undef; } - - #todo: make the behavoir of orphaned file tracking configurable -# if ($physinfo->{orphaned}) -# { -# return undef; -# } $self->{physname_seen} .= "$physname, "; @@ -1169,9 +1162,7 @@ my($self, $physname, $parentphys, $version, $deleted) = @_; my $physinfo = $gPhysInfo{$physname}; - if (!defined $physinfo) { - return undef; - } + # 1. check the parent requested, if there was an item name for this version # we can use this item name, since it was valid in that time my $parent = $physinfo->{parents}->{$parentphys}; Modified: trunk/script/Vss2Svn/Dumpfile.pm ============================================================================== --- trunk/script/Vss2Svn/Dumpfile.pm (original) +++ trunk/script/Vss2Svn/Dumpfile.pm Fri Mar 16 20:24:35 2007 @@ -392,43 +392,49 @@ # moving in SVN is the same as renaming; add the new and delete the old - my $newpath = $data->{info}; - - if ($self->{repository}->exists ($newpath)) { - $self->add_error("Attempt to move item '$itempath' to '$newpath' at " + my $oldpath = $data->{info}; + + if ($self->{repository}->exists ($itempath)) { + $self->add_error("Attempt to move item '$oldpath' to '$itempath' at " . "revision $data->{revision_id}, but destination already exists: possibly " . "missing delete; skipping"); return 0; } - if (!$self->{repository}->exists ($itempath)) { - $self->add_error("Attempt to move item '$itempath' to '$newpath' at " + if (!$self->{repository}->exists ($oldpath)) { + $self->add_error("Attempt to move item '$oldpath' to '$itempath' at " . "revision $data->{revision_id}, but source doesn't exists: possibly " . "missing recover; skipping"); return 0; } my $node = Vss2Svn::Dumpfile::Node->new(); - $node->set_initial_props($newpath, $data); + $node->set_initial_props($itempath, $data); $node->{action} = 'add'; my($copyrev, $copypath); $copyrev = $data->{revision_id} - 1; - $copypath = $itempath; + $copypath = $oldpath; $node->{copyrev} = $copyrev; $node->{copypath} = $copypath; push @$nodes, $node; -# $self->track_modified($data->{physname}, $data->{revision_id}, $newpath); -# $self->track_version ($data->{physname}, $data->{version}, $newpath); + # the new move target is a valid path. + $self->track_version ($data->{physname}, $data->{version}, $itempath); $node = Vss2Svn::Dumpfile::Node->new(); - $node->set_initial_props($itempath, $data); + $node->set_initial_props($oldpath, $data); $node->{action} = 'delete'; $node->{hideprops} = 1; + +# Deleted tracking is only necessary to be able to recover the item. But a move +# does not set a recover point, so we don't need to track the delete here. Additionally +# we do not have enough information for this operation. +# $self->track_deleted($data->{oldparentphys}, $data->{physname}, +# $data->{revision_id}, $oldpath); push @$nodes, $node; @@ -566,7 +572,7 @@ # as a valid share source. if (defined ($label)) { $label =~ s:/:_:g; - + my $vssitempath = $itempath; $vssitempath =~ s/^$main::gCfg{trunkdir}//; my $labelpath = "$main::gCfg{labeldir}/$label$vssitempath"; Modified: trunk/script/vss2svn.pl ============================================================================== --- trunk/script/vss2svn.pl (original) +++ trunk/script/vss2svn.pl Fri Mar 16 20:24:35 2007 @@ -611,48 +611,60 @@ $rows = $sth->fetchall_arrayref( {} ); my($childrecs, $child, $id); - my @delchild = (); foreach $row (@$rows) { - $row->{actiontype} = 'MOVE'; + $row->{actiontype} = 'MOVE_TO'; $childrecs = &GetChildRecs($row, 1); + my $source = undef; + my $target = $row->{parentphys}; + if (scalar @$childrecs > 1) { - &ThrowWarning("Multiple chidl recs for parent MOVE rec " + &ThrowWarning("Multiple child recs for parent MOVE rec " . "'$row->{action_id}'"); } - foreach $child (@$childrecs) { - my $update; - $update = $gCfg{dbh}->prepare('UPDATE PhysicalAction SET info = ?' - . 'WHERE action_id = ?'); - - $update->execute( $row->{parentphys}, $child->{action_id} ); - } - - if (scalar @$childrecs == 0) { - my $sql = <<"EOSQL"; + if (scalar @$childrecs >= 1) { + # only merge MOVE records that have the same timestamp + if ($row->{timestamp} == @$childrecs[0]->{timestamp}) { + $source = @$childrecs[0]->{parentphys}; + &DeleteChildRec(@$childrecs[0]->{action_id}); + } + } + + my $sql = <<"EOSQL"; UPDATE PhysicalAction SET + actiontype = 'MOVE', parentphys = ?, - actiontype = 'MOVE', info = ? WHERE action_id = ? EOSQL - my $update; - $update = $gCfg{dbh}->prepare($sql); - $update->execute( undef, $row->{parentphys}, - $row->{action_id}); - } else { - push(@delchild, $row->{action_id}); - } - } - - foreach $id (@delchild) { - &DeleteChildRec($id); - } + my $update; + $update = $gCfg{dbh}->prepare($sql); + + $update->execute( $target, $source, $row->{action_id}); + } + + + # change all remaining MOVE_TO records into MOVE records and swap the src and target + $sth = $gCfg{dbh}->prepare('SELECT * FROM PhysicalAction ' + . 'WHERE actiontype = "MOVE_TO"'); + $sth->execute(); + $rows = $sth->fetchall_arrayref( {} ); + + foreach $row (@$rows) { + my $update; + $update = $gCfg{dbh}->prepare('UPDATE PhysicalAction SET ' + . 'actiontype = "MOVE", ' + . 'parentphys = ?, ' + . 'info = ? ' + . 'WHERE action_id = ?'); + $update->execute($row->{info}, $row->{parentphys}, $row->{action_id}); + } + 1; @@ -764,7 +776,7 @@ # May contain add'l info for the action depending on type: # RENAME: the new name (without path) # SHARE: the source path which was shared - # MOVE: the new path + # MOVE: the old path # PIN: the path of the version that was pinned # LABEL: the name of the label $row->{info} = $handler->{info}; @@ -1333,7 +1345,7 @@ AddedProject => {type => 1, action => 'ADD'}, RestoredProject => {type => 1, action => 'RESTOREDPROJECT'}, RenamedProject => {type => 1, action => 'RENAME'}, - MovedProjectTo => {type => 1, action => 'MOVE'}, + MovedProjectTo => {type => 1, action => 'MOVE_TO'}, MovedProjectFrom => {type => 1, action => 'MOVE_FROM'}, DeletedProject => {type => 1, action => 'DELETE'}, DestroyedProject => {type => 1, action => 'DELETE'}, From vss2svn-commits at lists.pumacode.org Wed Mar 21 19:03:19 2007 From: vss2svn-commits at lists.pumacode.org (vss2svn-commits@lists.pumacode.org) Date: Wed Mar 21 19:03:23 2007 Subject: r306 - luedi: /trunk/script/vss2svn.pl Message-ID: <20070321230319.E930F15CFAB@cp.thetahost.com> Author: luedi Date: Wed Mar 21 19:03:18 2007 New Revision: 306 Log: perform a basic check on the linearity of timestamps. If this check fails, move the bad timestamp to one second after the last known timestamp. Modified: trunk/script/vss2svn.pl Modified: trunk/script/vss2svn.pl ============================================================================== --- trunk/script/vss2svn.pl (original) +++ trunk/script/vss2svn.pl Wed Mar 21 19:03:18 2007 @@ -297,14 +297,15 @@ my($parentdata, $version, $vernum, $action, $name, $actionid, $actiontype, $tphysname, $itemname, $itemtype, $parent, $user, $timestamp, $comment, $is_binary, $info, $priority, $sortkey, $label, $cachename); - + + my $last_timestamp = 0; + VERSION: foreach $version (@{ $xml->{Version} }) { $action = $version->{Action}; $name = $action->{SSName}; $tphysname = $action->{Physical} || $physname; $user = $version->{UserName}; - $timestamp = $version->{Date}; $itemname = &GetItemName($name); @@ -312,10 +313,23 @@ $info = $gActionType{$actionid}; if (!$info) { - warn "\nWARNING: Unknown action '$actionid'\n"; + &ThrowWarning ("'$physname': Unknown action '$actionid'\n"); next VERSION; } + # check the linear order of timestamps. It could be done better, for + # example checking the next version and calculate the middle time stamp + # but regardless of what we do here, the result is erroneous, since it + # will mess up the labeling. + $timestamp = $version->{Date}; + if ($timestamp < $last_timestamp) { + $timestamp = $last_timestamp + 1; + &ThrowWarning ("'$physname': wrong timestamp at version " + . "'$version->{VersionNumber}'; setting timestamp to " + . "'$timestamp'"); + } + $last_timestamp = $timestamp; + $itemtype = $info->{type}; $actiontype = $info->{action}; @@ -345,7 +359,7 @@ # we can have label actions and labes attached to versions if (defined $action->{Label} && !ref($action->{Label})) { $label = $action->{Label}; - + # append the label comment to a possible version comment if ($action->{LabelComment} && !ref($action->{LabelComment})) { if (defined $comment) { @@ -436,6 +450,18 @@ $itemtype, $timestamp, $user, $is_binary, $info, $priority, $sortkey, $parentdata, $label, $comment); + # Handle version comments as a secondary action for the same +# if (defined $version->{Label} && !ref($version->{Label})) { +# my ($labelComment); +# +# if ($version->{LabelComment} && !ref($version->{LabelComment})) { +# $labelComment = $version->{LabelComment}; +# } +# $cache->add($tphysname, $vernum, $parentphys, 'LABEL', $itemname, +# $itemtype, $timestamp, $user, $is_binary, $info, 5, +# $sortkey, $parentdata, $version->{Label}, $labelComment); +# } + } } # End GetVssItemVersions From vss2svn-commits at lists.pumacode.org Thu Mar 22 13:14:40 2007 From: vss2svn-commits at lists.pumacode.org (vss2svn-commits@lists.pumacode.org) Date: Thu Mar 22 13:14:41 2007 Subject: r307 - luedi: /trunk/script/vss2svn.pl Message-ID: <20070322171440.7009515D03C@cp.thetahost.com> Author: luedi Date: Thu Mar 22 13:14:38 2007 New Revision: 307 Log: * added support for version lables (alias Label promotion) * added better support for incremental updates. This will help, if your archive has changed and you run the converter with the "--resume --task INIT" flags. In this case, the cache is not cleaned and the extracted physical files are kept and updated if newer versions are available. Modified: trunk/script/vss2svn.pl Modified: trunk/script/vss2svn.pl ============================================================================== --- trunk/script/vss2svn.pl (original) +++ trunk/script/vss2svn.pl Thu Mar 22 13:14:38 2007 @@ -450,18 +450,25 @@ $itemtype, $timestamp, $user, $is_binary, $info, $priority, $sortkey, $parentdata, $label, $comment); - # Handle version comments as a secondary action for the same -# if (defined $version->{Label} && !ref($version->{Label})) { -# my ($labelComment); -# -# if ($version->{LabelComment} && !ref($version->{LabelComment})) { -# $labelComment = $version->{LabelComment}; -# } -# $cache->add($tphysname, $vernum, $parentphys, 'LABEL', $itemname, -# $itemtype, $timestamp, $user, $is_binary, $info, 5, -# $sortkey, $parentdata, $version->{Label}, $labelComment); -# } - + # Handle version labels as a secondary action for the same version + # version labels and label action use the same location to store the + # label. Therefore it is not possible to assign a version label to + # version where the actiontype was LABEL. But ssphys will report the + # same label twice. Therefore filter the Labeling versions here. + if (defined $version->{Label} && !ref($version->{Label}) + && $actiontype ne 'LABEL') { + my ($labelComment); + + if ($version->{LabelComment} && !ref($version->{LabelComment})) { + $labelComment = $version->{LabelComment}; + } + else { + $labelComment = "assigned label '$version->{Label}' to version $vernum of physical file '$tphysname'"; + } + $cache->add($tphysname, $vernum, $parentphys, 'LABEL', $itemname, + $itemtype, $timestamp, $user, $is_binary, $info, 5, + $sortkey, $parentdata, $version->{Label}, $labelComment); + } } } # End GetVssItemVersions @@ -894,17 +901,26 @@ $physname = $action->{physname}; $itemtype = $action->{itemtype}; - if (!exists $exported{$physname}) { - if ($itemtype == 2) { - $exported{$physname} = &ExportVssPhysFile($physname, $action->{version}); +# if (!exists $exported{$physname}) { + my $version = $action->{version}; + if ( !defined $version + && ( $action->{action} eq 'ADD' + || $action->{action} eq 'COMMIT')) { + &ThrowWarning("'$physname': no version specified for retrieval"); + + # fall through and try with version 1. + $version = 1; + } + + if ($itemtype == 2 && defined $version) { + $exported{$physname} = &ExportVssPhysFile($physname, $version); } else { $exported{$physname} = undef; } - } +# } # do_action needs to know the revision_id, so paste it on $action->{revision_id} = $revision; - $dumpfile->do_action($action, $exported{$physname}); } print "revision $revision: ", timestr(timediff(new Benchmark, $t0)),"\n" @@ -1653,7 +1669,7 @@ $gCfg{starttime} = scalar localtime($^T); - # trunkdir should (must?) be without leading slash + # trunkdir should (must?) be without trailing slash $gCfg{trunkdir} = '' unless defined $gCfg{trunkdir}; $gCfg{trunkdir} =~ s:\\:/:g; $gCfg{trunkdir} =~ s:/$::; From vss2svn-commits at lists.pumacode.org Tue Mar 27 22:47:34 2007 From: vss2svn-commits at lists.pumacode.org (vss2svn-commits@lists.pumacode.org) Date: Tue Mar 27 22:47:38 2007 Subject: r308 - toby: /trunk/script/vss2svn.pl Message-ID: <20070328024735.81E0E15B95C@cp.thetahost.com> Author: toby Date: Tue Mar 27 22:47:31 2007 New Revision: 308 Log: Fix #40: change default dumpfile suffix from .txt to .dat to prevent unwanted auto-translation of line endings in many FTP clients Modified: trunk/script/vss2svn.pl Modified: trunk/script/vss2svn.pl ============================================================================== --- trunk/script/vss2svn.pl (original) +++ trunk/script/vss2svn.pl Tue Mar 27 22:47:31 2007 @@ -1641,7 +1641,7 @@ &GiveHelp("Must specify --vssdir") if !defined($gCfg{vssdir}); $gCfg{tempdir} = './_vss2svn' if !defined($gCfg{tempdir}); - $gCfg{dumpfile} = 'vss2svn-dumpfile.txt' if !defined($gCfg{dumpfile}); + $gCfg{dumpfile} = 'vss2svn-dumpfile.dat' if !defined($gCfg{dumpfile}); $gCfg{sqlitedb} = "$gCfg{tempdir}/vss_data.db"; @@ -1790,7 +1790,7 @@ --tempdir : Temp directory to use during conversion; default is ./_vss2svn --dumpfile : specify the subversion dumpfile to be created; - default is ./vss2svn-dumpfile.txt + default is ./vss2svn-dumpfile.dat --revtimerange : specify the difference between two ss actions that are treated as one subversion revision; default is 3600 seconds (== 1hour) From vss2svn-commits at lists.pumacode.org Tue Mar 27 23:04:41 2007 From: vss2svn-commits at lists.pumacode.org (vss2svn-commits@lists.pumacode.org) Date: Tue Mar 27 23:04:45 2007 Subject: r309 - toby: /trunk/script/Vss2Svn/Dumpfile.pm Message-ID: <20070328030442.8DB4915B962@cp.thetahost.com> Author: toby Date: Tue Mar 27 23:04:41 2007 New Revision: 309 Log: Fix #48: Ensure labels don't have characters which are invalid in filenames Modified: trunk/script/Vss2Svn/Dumpfile.pm Modified: trunk/script/Vss2Svn/Dumpfile.pm ============================================================================== --- trunk/script/Vss2Svn/Dumpfile.pm (original) +++ trunk/script/Vss2Svn/Dumpfile.pm Tue Mar 27 23:04:41 2007 @@ -571,7 +571,7 @@ # the version->revision mapping, since the version could have been used # as a valid share source. if (defined ($label)) { - $label =~ s:/:_:g; + $label =~ s![\\/:*?"<>|]!_!g; my $vssitempath = $itempath; $vssitempath =~ s/^$main::gCfg{trunkdir}//;