Hi,

Please find attached my patching to get my VSS "database" to convert.

Status so far is:
* All files have correct name and location
* All folders have correct name and location
* All files have correct binary bit

I Still have problems with 11 files:
* 3 are one version too old. Ithink the containing folder was deleted and recovered. * 8 files are too new. The have been subject to "branch to an older version".

It seems the binary bit problem I wrote of earlier did not cause the checksum problem: it was the "branch to older version" that wasn't detected.

Best regards,
/Micke
Index: vss2svn.pl
===================================================================
--- vss2svn.pl  (revision 245)
+++ vss2svn.pl  (working copy)
@@ -545,14 +545,14 @@
     parentdata = ?
     AND physname = ?
     AND actiontype = ?
-    AND (? - timestamp IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25))
+    AND abs(? - timestamp) <= 60
     AND author = ?
 ORDER BY
-    timestamp
+    abs(? - timestamp)
 EOSQL
 
     my $sth = $gCfg{dbh}->prepare($sql);
-    $sth->execute( $parentdata, @{ $parentrec }{qw(physname actiontype 
timestamp author)} );
+    $sth->execute( $parentdata, @{ $parentrec }{qw(physname actiontype 
timestamp author timestamp)} );
 
     return $sth->fetchall_arrayref( {} );
 }  #  End GetChildRecs
@@ -627,8 +627,25 @@
             
             $update->execute( $row->{parentphys}, $child->{action_id} );
         }
-        
-        push(@delchild, $row->{action_id});
+
+        if (scalar @$childrecs == 0) {
+           my $sql = <<"EOSQL";
+UPDATE
+    PhysicalAction
+SET
+    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) {
Index: Vss2Svn/ActionHandler.pm
===================================================================
--- Vss2Svn/ActionHandler.pm    (revision 245)
+++ Vss2Svn/ActionHandler.pm    (working copy)
@@ -126,6 +126,7 @@
          parents    => {},
          last_version => $version,
          orphaned   => $orphaned,
+        was_binary => $row->{is_binary},
         };
 
     $self->_add_parent ($row->{physname}, $row->{parentphys});
@@ -156,6 +157,8 @@
         return 0;
     }
 
+    $physinfo->{was_binary} = $row->{is_binary};
+
     # We need to track at least the version number, even if there is no
     # active parent. This is necessary, if we later share this item, we need
     # to share from the latest seen version.
@@ -255,6 +258,8 @@
     my $version = $row->{version};
     $version = $physinfo->{last_version} if (!defined $version);
 
+    $row->{is_binary} = $physinfo->{was_binary};
+
     # 'itempath' is the path for this new location (the share target);
     # note: since we can share from a orphaned item, we use the itemname that
     # is provided in the row information for the share target and not the
@@ -333,6 +338,20 @@
 #        $oldphysinfo->{sharedphys} = $sharedphys;
 #    }
 
+    my $version = defined $row->{version} ? $row->{version}
+                    : $self->{version};
+    # if we branch into a destroyed object, delete is the logical choice
+    if (!defined $version ) {
+        $self->{errmsg} .= "Attempt to branch '$oldphysname' into "
+           . "'$physname' at an unknown version number "
+           . "('$physname' probably destroyed)\n";        
+        $gOrphanedInfo{$physname} = 1;
+       $self->{action} = 'DELETE';
+       $row->{physname} = $oldphysname;
+       $row->{info} = undef;
+       return $self->_delete_handler();
+    }
+
     # treat the old path as deleted
     # we can't branch an item, that doesn't have a parent. This happens when 
the
     # parent was destroyed. 
@@ -389,9 +408,22 @@
         return 0;
     }
 
+    if (!defined $row->{parentphys}) {
+       # Check if this is an orphaned item
+       if (scalar @{$physinfo->{order}} == 1) {
+           $row->{parentphys} = $physinfo->{order}[0];
+       } 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 . $row->{itemname};
+    my $sourceinfo = $parentpath . $physinfo->{name}; # $row->{itemname};
 
     # '$itempath' contains the move target path
     my $itempath = $self->_get_parent_path ($row->{info}) . $row->{itemname};
@@ -414,6 +446,9 @@
         $physinfo->{parents}->{$row->{parentphys}}->{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});
     
Index: Vss2Svn/DataCache.pm
===================================================================
--- Vss2Svn/DataCache.pm        (revision 245)
+++ Vss2Svn/DataCache.pm        (working copy)
@@ -24,7 +24,7 @@
          pkey => -1,
          verbose => $gCfg{verbose},
          fh => undef,
-         file => "$gCfg{cachedir}/datachache.$table.tmp.txt",
+         file => "$gCfg{cachedir}/datacache.$table.tmp.txt",
         };
 
     $self = bless($self, $class);
@@ -139,4 +139,4 @@
 }  #  End SetVerbose
 
 
-1;
\ No newline at end of file
+1;
_______________________________________________
vss2svn-users mailing list
Project homepage:
http://www.pumacode.org/projects/vss2svn/
Subscribe/Unsubscribe/Admin:
http://lists.pumacode.org/mailman/listinfo/vss2svn-users-lists.pumacode.org
Mailing list web interface (with searchable archives):
http://dir.gmane.org/gmane.comp.version-control.subversion.vss2svn.user

Reply via email to