Hello, this is my first message to the list and first set of patches to
vss2svn, so forgive me if I'm doing something wrong. For example, I'm not
sure if you prefer to receive patches via the mailing list or via the
ticket system, but the mailing list seemed the better option to me.

The first patch adds option --incremental to vss2svn.pl that makes it
create one dump file per revision. I'm converting 10 years of commits and
working with a single dump file was not an option (the first test dump was
about 2.2 GB; now I trimmed a few unused projects and some large files and
I'm down to a few hundred megabytes).

Note that my Perl skills are rather limited (let's say nonexistant) and I
tried to keep changes to a minimum so the actual implementation may be open
to improvements, but I can tell you it works because it just converted
11074 revisions overnight.

The second patch makes ssphys/SSPhysLib/SSFiles.cpp spell which file it's
not recognizing. I was getting that error and it turned out to be a problem
with uppercase/lowercase filenames, as I'm doing the conversion on Linux. I
added a note to that effect to the TODO.

-- 
Flavio Stanchina
Informatica e Servizi
Trento - Italy
Index: script/vss2svn.pl
===================================================================
--- script/vss2svn.pl   (revision 301)
+++ script/vss2svn.pl   (working copy)
@@ -813,9 +813,12 @@
     my $fh;
 
     my $file = $gCfg{dumpfile};
-    open $fh, ">$file"
-        or &ThrowError("Could not create dumpfile '$file'");
 
+    if (!$gCfg{incremental}) {
+        open $fh, ">$file"
+            or &ThrowError("Could not create dumpfile '$file'");
+    }
+
     my($sql, $sth, $action_sth, $row, $revision, $actions, $action, $physname, 
$itemtype);
 
     my %exported = ();
@@ -836,14 +839,26 @@
     $action_sth = $gCfg{dbh}->prepare($sql);
 
     my $autoprops = Vss2Svn::Dumpfile::AutoProps->new($gCfg{auto_props}) if 
$gCfg{auto_props};
-    my $dumpfile = Vss2Svn::Dumpfile->new($fh, $autoprops);
+    my $dumpfile;
 
+    if (!$gCfg{incremental}) {
+        $dumpfile = Vss2Svn::Dumpfile->new($fh, $autoprops);
+    }
+
 REVISION:
     while(defined($row = $sth->fetchrow_hashref() )) {
 
         my $t0 = new Benchmark;
 
         $revision = $row->{revision_id};
+        if ($gCfg{incremental}) {
+            my $paddedRev = sprintf("%06d", $revision);
+            $file = "$gCfg{dumpfile}.$paddedRev";
+            open $fh, ">$file"
+                or &ThrowError("Could not create dumpfile '$file'");
+            $dumpfile = Vss2Svn::Dumpfile->new($fh, $autoprops);
+        }
+
         $dumpfile->begin_revision($row);
 
 #        next REVISION if $revision == 0;
@@ -869,6 +884,12 @@
 
             $dumpfile->do_action($action, $exported{$physname});
         }
+
+        if ($gCfg{incremental}) {
+            $dumpfile->finish();
+            close $fh;
+        }
+
         print "revision $revision: ", timestr(timediff(new Benchmark, 
$t0)),"\n"
             if $gCfg{timing};
     }
@@ -879,8 +900,10 @@
         map { &ThrowWarning($_) } @err;
     }
 
-    $dumpfile->finish();
-    close $fh;
+    if (!$gCfg{incremental}) {
+        $dumpfile->finish();
+        close $fh;
+    }
 
 }  #  End CreateSvnDumpfile
 
@@ -1583,6 +1606,7 @@
     
     GetOptions(\%gCfg,'vssdir=s','tempdir=s','dumpfile=s','resume','verbose',
                'debug','timing+','task=s','revtimerange=i','ssphys=s',
+               'incremental',
                'encoding=s','trunkdir=s','auto_props=s');
 
     &GiveHelp("Must specify --vssdir") if !defined($gCfg{vssdir});
@@ -1716,6 +1740,9 @@
                         default is ./_vss2svn
     --dumpfile <file> : specify the subversion dumpfile to be created;
                         default is ./vss2svn-dumpfile.txt
+    --incremental     : one dump file per revision;
+                        the files will be named <file>.NNNNNN
+
     --revtimerange <sec> : specify the difference between two ss actions
                            that are treated as one subversion revision;
                            default is 3600 seconds (== 1hour)
Index: ssphys/SSPhysLib/SSFiles.cpp
===================================================================
--- ssphys/SSPhysLib/SSFiles.cpp        (revision 301)
+++ ssphys/SSPhysLib/SSFiles.cpp        (working copy)
@@ -213,7 +213,7 @@
   }
   
   if (fileTypeMap.find (type) == fileTypeMap.end ())
-    throw SSException  ("unrecognized file");
+    throw SSException  (std::string ("unrecognized file: ").append(fileName));
 
   switch (fileTypeMap[type])
   {
Index: ssphys/TODO
===================================================================
--- ssphys/TODO (revision 301)
+++ ssphys/TODO (working copy)
@@ -1,6 +1,7 @@
 TODO:
 
 +++ General +++
+ * handle uppercase/lowercase filenames [flavio]
  * better exception handling and error reporting
  + better command line argument handling (boost::program_options)
  * handle the missing actions
_______________________________________________
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