import-trac: nicer name and committer
authorGreg Price <price@mit.edu>
Sun, 1 Feb 2009 07:17:47 +0000 (02:17 -0500)
committerGreg Price <price@mit.edu>
Sun, 1 Feb 2009 07:17:55 +0000 (02:17 -0500)
import-trac

index aadee09f336345ea2119acee7e8d05c73e3c6b96..f82f34133e3bf2b6e6329aed8ada61d2515a2301 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
 use DBI;
 use IPC::Open2;
 
@@ -6,6 +6,15 @@ system('mkdir doc') && die;
 chdir('doc');
 qx{git init};
 
+open AUTHORS, '../trac-authors' or die $!;
+my %authors = ();
+while (chomp ($line = <AUTHORS>)) {
+    my ($username, $name);
+    ($username, $name) = split / /, $line, 2;
+    print "$username $name\n";
+    $authors{$username} = $name;
+}
+
 $password = qx(perl -F= -lane 'print \$F[1] if (\$F[0] eq "password")' \\
                /mit/sipb-www/.my.cnf);
 chomp $password;
@@ -31,8 +40,12 @@ foreach $row (@$rows) {
   chomp($tree = <OUT>);
   waitpid $pid, 0;
 
-  $ENV{GIT_AUTHOR_NAME} = "$row->{author} via Trac";
+  $name = $authors{$row->{author}};
+
+  $ENV{GIT_AUTHOR_NAME} = "$name";
   $ENV{GIT_AUTHOR_EMAIL} = "$row->{author}\@mit.edu";
+  $ENV{GIT_COMMITTER_NAME} = "Trac";
+  $ENV{GIT_COMMITTER_EMAIL} = "sipb-www\@mit.edu";
   $ENV{GIT_AUTHOR_DATE} = $row->{time};
   $pid = open2(OUT, IN, qw{git commit-tree}, $tree, $head ? ('-p', $head) : ());
   print IN $row->{comment};