On Monday 29 January 2007 18:36, Scott Nowell wrote:
>
> ------- Committed revision 2737 >>>
>
> <<< Started new transaction, based on original revision 2738
>      * editing path : MS04/Documents/PSAC-MS04.doc ... done.
>
> ------- Committed revision 2738 >>>
>
> <<< Started new transaction, based on original revision 2739
>      * adding path : MS01/Source/UnitTests/Scripts/ManualTests.c ...
> done.
>
> ------- Committed revision 2739 >>>
>
> <<< Started new transaction, based on original revision 2740
>      * adding path : labels/Ready for MS01 Validation Run ... done.
>      * adding path : labels/Ready for MS01 Validation Run/UC00 ... done.
>      * adding path : labels/Ready for MS01 Validation Run/UC00/Source
> ... done.
>      * adding path : labels/Ready for MS01 Validation
> Run/UC00/Source/MicroCOS ... done.
> <SNIP about 80 similar lines>
>      * adding path : labels/Ready for MS01 Validation
> Run/MS01/Source/UnitTests/
> Test/setenv.bat ...COPIED... done.
> svnadmin: Invalid change ordering: new node revision ID without delete
>

Hi Scott,

I've seen this error because child and parent creation order were reversed due 
to bogus timestamps. If that is the case in your dataset the attached patch 
may help you.


Index: script/vss2svn.pl
===================================================================
--- script/vss2svn.pl	(revision 289)
+++ script/vss2svn.pl	(working copy)
@@ -513,6 +513,7 @@
         foreach $child (@$childrecs) {
             &UpdateParentRec($row, $child);
             push(@delchild, $child->{action_id});
+			last;
         }
     }
 
@@ -618,7 +619,7 @@
         $childrecs = &GetChildRecs($row, 1);
 
         if (scalar @$childrecs > 1) {
-            &ThrowWarning("Multiple chidl recs for parent MOVE rec "
+            &ThrowWarning("Multiple child recs for parent MOVE rec "
                           . "'$row->{action_id}'");
         }
 
@@ -628,6 +629,7 @@
                                           . 'WHERE action_id = ?');
             
             $update->execute( $row->{parentphys}, $child->{action_id} );
+			last;
         }
 
         if (scalar @$childrecs == 0) {
@@ -654,6 +656,8 @@
         &DeleteChildRec($id);
     }
 
+	FixAddParentTimestamp();
+
     1;
 
 }  #  End MergeMoveData
@@ -671,6 +675,61 @@
 }  #  End DeleteChildRec
 
 ###############################################################################
+#  FixAddParentTimestamp
+###############################################################################
+sub FixAddParentTimestamp {
+
+# This fixes the timestamps of ADD records for parents that have child records that are
+# dated before the parents creation. This would cause the svn import to fail.
+# Because adjusting the timestamp of the parent could push their creation date before
+# the grandparent this has to be repeated in a loop until no more records could be found.
+
+	my $sth;
+
+    $sth = $gCfg{dbh}->prepare('CREATE INDEX PhysicalActionIdx_parentphys on PhysicalAction(parentphys)');
+    $sth->execute;
+
+    $sth = $gCfg{dbh}->prepare('CREATE INDEX PhysicalActionIdx_physname on PhysicalAction(physname)');
+    $sth->execute;
+
+    $sth = $gCfg{dbh}->prepare('CREATE INDEX PhysicalActionIdx_actiontype on PhysicalAction(actiontype)');
+    $sth->execute;
+
+
+    my $sql = 'SELECT parent.*, min(child.timestamp) mintime FROM PhysicalAction parent, PhysicalAction child '
+			. 'where parent.actiontype="ADD" '
+            . 'and child.parentphys = parent.physname and parent.timestamp > child.timestamp '
+			. 'group by parent.action_id';
+
+	my $prio = 1;
+
+	while (1)
+	{
+	    $sth = $gCfg{dbh}->prepare($sql);
+		$sth->execute();
+
+		my $rows = $sth->fetchall_arrayref( {} );
+		last if (scalar @$rows == 0);
+
+		my $row;
+
+		foreach $row (@$rows) {
+				my $sql = "UPDATE PhysicalAction SET timestamp = ?,priority = ? "
+						. "WHERE action_id = ?";
+
+				my $update;
+				$update = $gCfg{dbh}->prepare($sql);
+				$update->execute( $row->{mintime}, $prio, $row->{action_id});
+		}
+
+		# To ensure that grandparents are created before parents their priority is decreased for every
+		# generation. The timestamp cannot provide this because the adjustment process would assign
+		# the same timestamp for all.
+		$prio = $prio - 1;
+	}
+}
+
+###############################################################################
 #  BuildVssActionHistory
 ###############################################################################
 sub BuildVssActionHistory {
Index: script/Vss2Svn/Dumpfile.pm
===================================================================
--- script/Vss2Svn/Dumpfile.pm	(revision 289)
+++ script/Vss2Svn/Dumpfile.pm	(working copy)
@@ -720,8 +720,6 @@
 
     my $fh = $self->{fh};
 
-    $text = '' unless defined $text;
-
     my $proplen = 0;
     my $textlen = 0;
     my($propout, $textout) = ('') x 2;
@@ -744,20 +742,23 @@
         $proplen = length($propout);
     }
 
-    $textlen = length($text);
-    return if ($textlen + $proplen == 0);
+    return if (!defined ($text) && $proplen == 0);
 
     if ($proplen > 0) {
         print $fh "Prop-content-length: $proplen\n";
     }
 
-    if ($textlen > 0) {
+    if (defined ($text)) {
+	    $textlen = length($text);
         print $fh "Text-content-length: $textlen\n";
+		print $fh "Content-length: " . ($proplen + $textlen)
+			. "\n\n$propout$text\n";
     }
+    else {
+		print $fh "Content-length: " . ($proplen)
+			. "\n\n$propout\n";
+	}
 
-    print $fh "Content-length: " . ($proplen + $textlen)
-        . "\n\n$propout$text\n";
-
 }  #  End output_content
 
 ###############################################################################
_______________________________________________
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