Changeset 306

Show
Ignore:
Timestamp:
03/21/2007 07:03:18 PM
Author:
luedi
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/script/vss2svn.pl

    r305 r306  
    298298       $tphysname, $itemname, $itemtype, $parent, $user, $timestamp, $comment, 
    299299       $is_binary, $info, $priority, $sortkey, $label, $cachename); 
    300  
     300     
     301    my $last_timestamp = 0; 
     302     
    301303VERSION: 
    302304    foreach $version (@{ $xml->{Version} }) { 
     
    305307        $tphysname = $action->{Physical} || $physname; 
    306308        $user = $version->{UserName}; 
    307         $timestamp = $version->{Date}; 
    308309 
    309310        $itemname = &GetItemName($name); 
     
    313314 
    314315        if (!$info) { 
    315             warn "\nWARNING: Unknown action '$actionid'\n"
     316            &ThrowWarning ("'$physname': Unknown action '$actionid'\n")
    316317            next VERSION; 
    317318        } 
    318319 
     320        # check the linear order of timestamps. It could be done better, for 
     321        # example checking the next version and calculate the middle time stamp 
     322        # but regardless of what we do here, the result is erroneous, since it 
     323        # will mess up the labeling. 
     324        $timestamp = $version->{Date}; 
     325        if ($timestamp < $last_timestamp) { 
     326            $timestamp = $last_timestamp + 1; 
     327            &ThrowWarning ("'$physname': wrong timestamp at version " 
     328                           . "'$version->{VersionNumber}'; setting timestamp to " 
     329                           . "'$timestamp'"); 
     330        } 
     331        $last_timestamp = $timestamp; 
     332         
    319333        $itemtype = $info->{type}; 
    320334        $actiontype = $info->{action}; 
     
    346360        if (defined $action->{Label} && !ref($action->{Label})) { 
    347361            $label = $action->{Label}; 
    348              
     362 
    349363            # append the label comment to a possible version comment 
    350364            if ($action->{LabelComment} && !ref($action->{LabelComment})) { 
     
    437451                    $sortkey, $parentdata, $label, $comment); 
    438452 
     453        # Handle version comments as a secondary action for the same  
     454#        if (defined $version->{Label} && !ref($version->{Label})) { 
     455#            my ($labelComment); 
     456#             
     457#            if ($version->{LabelComment} && !ref($version->{LabelComment})) { 
     458#                $labelComment = $version->{LabelComment}; 
     459#            } 
     460#            $cache->add($tphysname, $vernum, $parentphys, 'LABEL', $itemname, 
     461#                        $itemtype, $timestamp, $user, $is_binary, $info, 5, 
     462#                        $sortkey, $parentdata, $version->{Label}, $labelComment); 
     463#        } 
     464         
    439465    } 
    440466 

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.