From 94977f95016dfe82f0c6d26f81b8667b4650682d Mon Sep 17 00:00:00 2001 From: Dave Goodell Date: Wed, 17 Jul 2013 21:21:15 +0000 Subject: [PATCH] add authors-to-cvsimport.pl script Helpful when creating a git-svn clone of the OMPI repository. Reviewed by jsquyres@ cmr:v1.7:reviewer=jsquyres This commit was SVN r28825. --- contrib/authors-to-cvsimport.pl | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 contrib/authors-to-cvsimport.pl diff --git a/contrib/authors-to-cvsimport.pl b/contrib/authors-to-cvsimport.pl new file mode 100755 index 0000000000..3fa925151d --- /dev/null +++ b/contrib/authors-to-cvsimport.pl @@ -0,0 +1,46 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Feed the AUTHORS file to this script either on stdin or as an argument to the +# script. It will emit a cvsimport-formatted file which is suitable for +# feeding to 'git-svn' or other tools. + +use strict; +use warnings; + +my $EMAIL_DOMAIN = 'open-mpi-git-mirror.example.com'; +my $line; + +# discard preamble +do { + $line = <>; +} until ($line =~ m/^Username\s+Name\s+Affiliation/); + +unless (($line = <>) =~ m/^(-+ )(-+ )(-+)$/) { + die "expected properly formatted table header, stopped"; +} +my $login_len = length($1); +my $name_len = length($2); +my $affil_len = length($3); + +while ($line = <>) { + chomp($line); + last if ($line =~ m/^\s*$/); + + # 4th arg consumes the substring from $line as we go. + my $login = substr($line, 0, $login_len, ""); + my $name = substr($line, 0, $name_len, ""); + my $affil = substr($line, 0, $affil_len, ""); + + # strip trailing whitespace + $login =~ s/\s*$//; + $name =~ s/\s*$//; + $affil =~ s/\s*$//; + + printf("%s = %s <%s\@$EMAIL_DOMAIN>\n", $login, $name, $login); +} + +printf("%s = %s <%s\@$EMAIL_DOMAIN>\n", '(no author)', 'Unknown', 'unknown'); +