Changeset 260

Show
Ignore:
Timestamp:
08/14/2006 06:53:41 PM
Author:
luedi
Message:

applied Micke changes from 17.06.2006:

  • correctly transfer the binary bit
  • Handle missing MOVE_FROM/MOVE_TO actions
  • fix for branch into destroyed project
  • another fix for moving files in/out of the orphaned cache
Files:

Legend:

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

    r248 r260  
    127127         last_version => $version, 
    128128         orphaned   => $orphaned, 
     129         was_binary => $row->{is_binary}, 
    129130        }; 
    130131 
     
    156157        return 0; 
    157158    } 
     159 
     160    $physinfo->{was_binary} = $row->{is_binary}; 
    158161 
    159162    # We need to track at least the version number, even if there is no 
     
    255258    my $version = $row->{version}; 
    256259    $version = $physinfo->{last_version} if (!defined $version); 
     260 
     261    $row->{is_binary} = $physinfo->{was_binary}; 
    257262 
    258263    # 'itempath' is the path for this new location (the share target); 
     
    334339#    } 
    335340 
     341    my $version = defined $row->{version} ? $row->{version} 
     342                    : $self->{version}; 
     343 
     344    # if we branch into a destroyed object, delete is the logical choice 
     345    if (!defined $version ) { 
     346      $self->{errmsg} .= "Attempt to branch '$oldphysname' into " 
     347                         "'$physname' at an unknown version number " 
     348                         "('$physname' probably destroyed)\n"; 
     349      $gOrphanedInfo{$physname} = 1; 
     350      $self->{action} = 'DELETE'; 
     351      $row->{physname} = $oldphysname; 
     352      $row->{info} = undef; 
     353      return $self->_delete_handler(); 
     354    } 
     355 
    336356    # treat the old path as deleted 
    337357    # we can't branch an item, that doesn't have a parent. This happens when the 
     
    390410    } 
    391411 
     412    if (!defined $row->{parentphys}) { 
     413      # Check if this is an orphaned item 
     414      if (scalar @{$physinfo->{order}} == 1) { 
     415        $row->{parentphys} = $physinfo->{order}[0]; 
     416      } else { 
     417        # Don't know from where to move. Share it there instead 
     418        $row->{parentphys} = $row->{info}; 
     419        $row->{info} = undef; 
     420        $self->{action} = 'SHARE'; 
     421        return $self->_share_handler(); 
     422      } 
     423    } 
     424 
    392425    # '$sourceinfo' is the path for the old location (the move source); 
    393426    my $parentpath = $self->_get_current_parent_path (); 
    394     my $sourceinfo = $parentpath . $row->{itemname}; 
     427    my $sourceinfo = $parentpath . $physinfo->{name}; # $row->{itemname}; 
     428 
     429    if (!defined ($row->{info})) { 
     430        # the target directory was destroyed, so there is no apropriate move 
     431        # target information. Fall back to a move to the orphaned cache 
     432        $row->{info} = '_' . $row->{physname}; 
     433    } 
    395434 
    396435    # '$itempath' contains the move target path 
    397436    my $itempath = $self->_get_parent_path ($row->{info}) . $row->{itemname}; 
    398437 
    399     if (!defined($sourceinfo)) { 
     438    if (!defined($parentpath)) { 
    400439        # We can't figure out the path for the parent that this move came from, 
    401440        # so it was either destroyed or corrupted. That means that this isn't 
     
    414453        $physinfo->{parents}->{$row->{parentphys}}->{deleted} = 1; 
    415454    } 
     455 
     456    # if the item mysteriously changed name during the move 
     457    $physinfo->{name} = $row->{itemname}; 
    416458 
    417459    # track the addition of the new parent 
  • trunk/script/vss2svn.pl

    r259 r260  
    630630            $update->execute( $row->{parentphys}, $child->{action_id} ); 
    631631        } 
    632          
    633         push(@delchild, $row->{action_id}); 
     632 
     633        if (scalar @$childrecs == 0) { 
     634            my $sql = <<"EOSQL"; 
     635UPDATE 
     636    PhysicalAction 
     637SET 
     638    parentphys = ?, 
     639    actiontype = 'MOVE', 
     640    info = ? 
     641WHERE 
     642    action_id = ? 
     643EOSQL 
     644            my $update; 
     645            $update = $gCfg{dbh}->prepare($sql); 
     646            $update->execute( undef, $row->{parentphys}, 
     647            $row->{action_id}); 
     648        } else { 
     649            push(@delchild, $row->{action_id}); 
     650        } 
    634651    } 
    635652 

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.