make-authors.pl: update for git
Этот коммит содержится в:
родитель
c682cf99b2
Коммит
3c15a87d72
112
contrib/dist/make-authors.pl
поставляемый
112
contrib/dist/make-authors.pl
поставляемый
@ -6,62 +6,36 @@
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
|
||||
# Ensure that we're in the root of a writeable SVN trunk checkout
|
||||
my $in_svn_tree = 1;
|
||||
# Ensure that we're in the root of a writeable Git clone
|
||||
my $in_git_clone = 1;
|
||||
|
||||
$in_svn_tree = 0
|
||||
if (! -d ".svn" || ! -f "AUTHORS");
|
||||
if ($in_svn_tree) {
|
||||
open (SVN, "svn info . |") || die "Can't run 'svn info .'";
|
||||
while (<SVN>) {
|
||||
chomp;
|
||||
if ($_ =~ m/^URL: (.+)$/) {
|
||||
$in_svn_tree = 0;
|
||||
if ($1 eq "https://svn.open-mpi.org/svn/ompi/trunk") {
|
||||
$in_svn_tree = 1;
|
||||
|
||||
# Can't just "last" here of svn will print an error
|
||||
# about a broken pipe to stderr -- so consume the rest
|
||||
# of the output
|
||||
while (<SVN>) { }
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(SVN);
|
||||
}
|
||||
|
||||
die "Sorry, this script must be run at the root of a writable SVN trunk checkout"
|
||||
if (!$in_svn_tree);
|
||||
$in_git_clone = 0
|
||||
if (! -d ".git" || ! -f "AUTHORS");
|
||||
|
||||
######################################################################
|
||||
|
||||
# Run git log to get a list of committers
|
||||
|
||||
my $committers;
|
||||
open (GIT, "git log --pretty=format:%ae|") || die "Can't run 'git log'.";
|
||||
while (<GIT>) {
|
||||
chomp;
|
||||
m/^\s*([\S]+)\s*$/;
|
||||
|
||||
# Run svn log to get the list of SVN IDs for committers
|
||||
|
||||
print "Running svn log... (will take a few minutes)\n";
|
||||
|
||||
open (SVN, "svn log --xml |") || die "Can't run 'svn log --xml'";
|
||||
while (<SVN>) {
|
||||
if ($_ =~ m@^<author>(.+)</author>@) {
|
||||
if ($1 !~ /^\s*$/) {
|
||||
if (!exists($committers->{$1})) {
|
||||
$committers->{$1} = { };
|
||||
print "Found SVN commit ID: $1\n";
|
||||
}
|
||||
}
|
||||
if (!exists($committers->{$1})) {
|
||||
$committers->{$1} = { };
|
||||
print "Found Git commit email: $1\n";
|
||||
}
|
||||
}
|
||||
close(SVN);
|
||||
close(GIT);
|
||||
|
||||
# Read the existing AUTHORS file to get the header, footer, and SVN ID
|
||||
# -> (gecos, affiliation) mappings.
|
||||
# Read the existing AUTHORS file to get the header, footer, and Git
|
||||
# email ID -> (gecos, affiliation) mappings.
|
||||
|
||||
my $header;
|
||||
my $footer;
|
||||
|
||||
print "Matching SVN ID's to existing names/affiliations...\n";
|
||||
print "Matching Git emails to existing names/affiliations...\n";
|
||||
|
||||
open (AUTHORS, "AUTHORS") || die "Can't open AUTHORS file";
|
||||
my $in_header = 1;
|
||||
@ -71,10 +45,10 @@ while (<AUTHORS>) {
|
||||
my $line = $_;
|
||||
|
||||
# Slurp down header lines until we hit a line that begins with an
|
||||
# SVN ID
|
||||
# Git email
|
||||
if ($in_header) {
|
||||
foreach my $svn_id (keys(%{$committers})) {
|
||||
if ($line =~ /$svn_id\s+/) {
|
||||
foreach my $git_email (keys(%{$committers})) {
|
||||
if ($line =~ /$git_email\s+/) {
|
||||
$in_header = 0;
|
||||
}
|
||||
}
|
||||
@ -83,17 +57,17 @@ while (<AUTHORS>) {
|
||||
}
|
||||
}
|
||||
|
||||
# If we're in the body, parse to get the existing SVN IDs, gecos,
|
||||
# If we're in the body, parse to get the existing Git emails, gecos,
|
||||
# and affiliations
|
||||
if (!$in_header && !$in_footer) {
|
||||
|
||||
# Make sure we have a line that begins with an SVN ID;
|
||||
# Make sure we have a line that begins with an Git email;
|
||||
# otherwise, fall through to the footer.
|
||||
my $found = undef;
|
||||
my $svn_id;
|
||||
foreach $svn_id (keys(%{$committers})) {
|
||||
if ($line =~ /$svn_id\s+/) {
|
||||
$found = $svn_id;
|
||||
my $git_email;
|
||||
foreach $git_email (keys(%{$committers})) {
|
||||
if ($line =~ /$git_email\s+/) {
|
||||
$found = $git_email;
|
||||
last;
|
||||
}
|
||||
}
|
||||
@ -114,7 +88,7 @@ while (<AUTHORS>) {
|
||||
} else {
|
||||
$committers->{$found}->{affiliation} = $aff;
|
||||
}
|
||||
print "SVN ID $found matches: $gecos / $aff\n";
|
||||
print "Git email $found matches: $gecos / $aff\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +101,7 @@ close(AUTHORS);
|
||||
|
||||
# Figure out the 3 column widths. The last line of the header
|
||||
# contains -'s for each of the columns.
|
||||
|
||||
$header =~ m/\n([\-\s]+?)$/m;
|
||||
my $div_line = $1;
|
||||
my @divs = split(/ /, $div_line);
|
||||
@ -139,9 +114,14 @@ open (AUTHORS, ">AUTHORS.new") || die "Can't write to AUTHORS file";
|
||||
print AUTHORS $header;
|
||||
my $i;
|
||||
my $have_unknowns = 0;
|
||||
foreach my $svn_id (sort(keys(%${committers}))) {
|
||||
print AUTHORS $svn_id;
|
||||
$i = length($svn_id);
|
||||
foreach my $git_email (sort(keys(%${committers}))) {
|
||||
# Skip the automated accounts
|
||||
next
|
||||
if ($git_email eq "no-author\@open-mpi.org" ||
|
||||
$git_email eq "mpiteam\@open-mpi.org");
|
||||
|
||||
print AUTHORS $git_email;
|
||||
$i = length($git_email);
|
||||
while ($i <= $id_col) {
|
||||
print AUTHORS ' ';
|
||||
++$i;
|
||||
@ -149,19 +129,19 @@ foreach my $svn_id (sort(keys(%${committers}))) {
|
||||
|
||||
# if we have gecos/affiliation, print them. Otherwise, just end
|
||||
# the line here
|
||||
if ((exists($committers->{$svn_id}->{gecos}) &&
|
||||
$committers->{$svn_id}->{gecos} !~ /^\s+$/) ||
|
||||
(exists($committers->{$svn_id}->{affiliation}) &&
|
||||
$committers->{$svn_id}->{affiliation} !~ /^\s+$/)) {
|
||||
print AUTHORS $committers->{$svn_id}->{gecos};
|
||||
$i = length($committers->{$svn_id}->{gecos});
|
||||
if ((exists($committers->{$git_email}->{gecos}) &&
|
||||
$committers->{$git_email}->{gecos} !~ /^\s+$/) ||
|
||||
(exists($committers->{$git_email}->{affiliation}) &&
|
||||
$committers->{$git_email}->{affiliation} !~ /^\s+$/)) {
|
||||
print AUTHORS $committers->{$git_email}->{gecos};
|
||||
$i = length($committers->{$git_email}->{gecos});
|
||||
while ($i <= $gecos_col) {
|
||||
print AUTHORS ' ';
|
||||
++$i;
|
||||
}
|
||||
|
||||
print AUTHORS $committers->{$svn_id}->{affiliation}
|
||||
if (exists($committers->{$svn_id}->{affiliation}));
|
||||
print AUTHORS $committers->{$git_email}->{affiliation}
|
||||
if (exists($committers->{$git_email}->{affiliation}));
|
||||
} else {
|
||||
$have_unknowns = 1;
|
||||
}
|
||||
@ -175,8 +155,8 @@ rename("AUTHORS.new", "AUTHORS");
|
||||
|
||||
print "New AUTHORS file written.\n";
|
||||
if ($have_unknowns) {
|
||||
print "*** WARNING: There were SVN committers with unknown real names and/or\n*** affiliations. You *MUST* edit the AUTHORS file to fill them in!\n";
|
||||
print "*** WARNING: There were Git committers with unknown real names and/or\n*** affiliations. You *MUST* edit the AUTHORS file to fill them in!\n";
|
||||
} else {
|
||||
print "All SVN ID's were matched! No need to hand-edit the AUTHORS file.\n";
|
||||
print "All Git emails were matched! No need to hand-edit the AUTHORS file.\n";
|
||||
}
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user