Hi,
I've some patches for the restore-widetime branch that addresses the
following issues.
There are some zero length file checkins in my database probably done to
avoid file deletions which VSS does not really handle very well. These
are omitted from the output of dumpfile.pm. The patch fixes this.
The change in line 769 just moves the timestamps into my timezone
(UTC+2h). This would be a candidate for a command line parameter.
The FixAddParentTimestamp corrects the problem that some parents are
created after their childs which causes the svn import to fail.
I've inserted the two 'last' statements because the loops looked wrong
to me. When the
"ORDER BY ABS(? - timestamp)"
query returns the closest child first this should be the only one that
is matched with the parent record. I't didn't make much of a difference
in the result though. Obviously multiple matches are very rare.
With these changes the number of defects got down from 1% to 0.03%.
Therefore I can recommend the widetime branch as an improvement. There
are still some issues left. I've identified some cases:
Files that have beed deleted, recovered then shared and pinned back past
the point where they had been recovered. They have a newer version than
they are pinned to.
I've found one file that has been branched first then shared. No idea
how this could happen.
And one file that was recovered has seen a commit while it was deleted.
Maybe someone has a idea how this could be corrected.
Index: script/vss2svn.pl
===================================================================
--- script/vss2svn.pl (revision 272)
+++ script/vss2svn.pl (working copy)
@@ -512,6 +512,7 @@
foreach $child (@$childrecs) {
&UpdateParentRec($row, $child);
push(@delchild, $child->{action_id});
+ last;
}
}
@@ -617,7 +618,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}'");
}
@@ -627,6 +628,7 @@
. 'WHERE action_id = ?');
$update->execute( $row->{parentphys}, $child->{action_id} );
+ last;
}
if (scalar @$childrecs == 0) {
@@ -653,6 +655,8 @@
&DeleteChildRec($id);
}
+ FixAddParentTimestamp();
+
1;
} # End MergeMoveData
@@ -670,6 +674,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 272)
+++ script/Vss2Svn/Dumpfile.pm (working copy)
@@ -715,8 +715,6 @@
my $fh = $self->{fh};
- $text = '' unless defined $text;
-
my $proplen = 0;
my $textlen = 0;
my($propout, $textout) = ('') x 2;
@@ -734,20 +732,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
###############################################################################
@@ -766,7 +767,7 @@
sub SvnTimestamp {
my($vss_timestamp) = @_;
- my($sec, $min, $hour, $day, $mon, $year) = gmtime($vss_timestamp);
+ my($sec, $min, $hour, $day, $mon, $year) = gmtime($vss_timestamp -
7200);
$year += 1900;
$mon += 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