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 strict;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
# Ensure that we're in the root of a writeable SVN trunk checkout
|
# Ensure that we're in the root of a writeable Git clone
|
||||||
my $in_svn_tree = 1;
|
my $in_git_clone = 1;
|
||||||
|
|
||||||
$in_svn_tree = 0
|
$in_git_clone = 0
|
||||||
if (! -d ".svn" || ! -f "AUTHORS");
|
if (! -d ".git" || ! -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);
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
# Run git log to get a list of committers
|
||||||
|
|
||||||
my $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
|
if (!exists($committers->{$1})) {
|
||||||
|
$committers->{$1} = { };
|
||||||
print "Running svn log... (will take a few minutes)\n";
|
print "Found Git commit email: $1\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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(SVN);
|
close(GIT);
|
||||||
|
|
||||||
# Read the existing AUTHORS file to get the header, footer, and SVN ID
|
# Read the existing AUTHORS file to get the header, footer, and Git
|
||||||
# -> (gecos, affiliation) mappings.
|
# email ID -> (gecos, affiliation) mappings.
|
||||||
|
|
||||||
my $header;
|
my $header;
|
||||||
my $footer;
|
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";
|
open (AUTHORS, "AUTHORS") || die "Can't open AUTHORS file";
|
||||||
my $in_header = 1;
|
my $in_header = 1;
|
||||||
@ -71,10 +45,10 @@ while (<AUTHORS>) {
|
|||||||
my $line = $_;
|
my $line = $_;
|
||||||
|
|
||||||
# Slurp down header lines until we hit a line that begins with an
|
# Slurp down header lines until we hit a line that begins with an
|
||||||
# SVN ID
|
# Git email
|
||||||
if ($in_header) {
|
if ($in_header) {
|
||||||
foreach my $svn_id (keys(%{$committers})) {
|
foreach my $git_email (keys(%{$committers})) {
|
||||||
if ($line =~ /$svn_id\s+/) {
|
if ($line =~ /$git_email\s+/) {
|
||||||
$in_header = 0;
|
$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
|
# and affiliations
|
||||||
if (!$in_header && !$in_footer) {
|
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.
|
# otherwise, fall through to the footer.
|
||||||
my $found = undef;
|
my $found = undef;
|
||||||
my $svn_id;
|
my $git_email;
|
||||||
foreach $svn_id (keys(%{$committers})) {
|
foreach $git_email (keys(%{$committers})) {
|
||||||
if ($line =~ /$svn_id\s+/) {
|
if ($line =~ /$git_email\s+/) {
|
||||||
$found = $svn_id;
|
$found = $git_email;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +88,7 @@ while (<AUTHORS>) {
|
|||||||
} else {
|
} else {
|
||||||
$committers->{$found}->{affiliation} = $aff;
|
$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
|
# Figure out the 3 column widths. The last line of the header
|
||||||
# contains -'s for each of the columns.
|
# contains -'s for each of the columns.
|
||||||
|
|
||||||
$header =~ m/\n([\-\s]+?)$/m;
|
$header =~ m/\n([\-\s]+?)$/m;
|
||||||
my $div_line = $1;
|
my $div_line = $1;
|
||||||
my @divs = split(/ /, $div_line);
|
my @divs = split(/ /, $div_line);
|
||||||
@ -139,9 +114,14 @@ open (AUTHORS, ">AUTHORS.new") || die "Can't write to AUTHORS file";
|
|||||||
print AUTHORS $header;
|
print AUTHORS $header;
|
||||||
my $i;
|
my $i;
|
||||||
my $have_unknowns = 0;
|
my $have_unknowns = 0;
|
||||||
foreach my $svn_id (sort(keys(%${committers}))) {
|
foreach my $git_email (sort(keys(%${committers}))) {
|
||||||
print AUTHORS $svn_id;
|
# Skip the automated accounts
|
||||||
$i = length($svn_id);
|
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) {
|
while ($i <= $id_col) {
|
||||||
print AUTHORS ' ';
|
print AUTHORS ' ';
|
||||||
++$i;
|
++$i;
|
||||||
@ -149,19 +129,19 @@ foreach my $svn_id (sort(keys(%${committers}))) {
|
|||||||
|
|
||||||
# if we have gecos/affiliation, print them. Otherwise, just end
|
# if we have gecos/affiliation, print them. Otherwise, just end
|
||||||
# the line here
|
# the line here
|
||||||
if ((exists($committers->{$svn_id}->{gecos}) &&
|
if ((exists($committers->{$git_email}->{gecos}) &&
|
||||||
$committers->{$svn_id}->{gecos} !~ /^\s+$/) ||
|
$committers->{$git_email}->{gecos} !~ /^\s+$/) ||
|
||||||
(exists($committers->{$svn_id}->{affiliation}) &&
|
(exists($committers->{$git_email}->{affiliation}) &&
|
||||||
$committers->{$svn_id}->{affiliation} !~ /^\s+$/)) {
|
$committers->{$git_email}->{affiliation} !~ /^\s+$/)) {
|
||||||
print AUTHORS $committers->{$svn_id}->{gecos};
|
print AUTHORS $committers->{$git_email}->{gecos};
|
||||||
$i = length($committers->{$svn_id}->{gecos});
|
$i = length($committers->{$git_email}->{gecos});
|
||||||
while ($i <= $gecos_col) {
|
while ($i <= $gecos_col) {
|
||||||
print AUTHORS ' ';
|
print AUTHORS ' ';
|
||||||
++$i;
|
++$i;
|
||||||
}
|
}
|
||||||
|
|
||||||
print AUTHORS $committers->{$svn_id}->{affiliation}
|
print AUTHORS $committers->{$git_email}->{affiliation}
|
||||||
if (exists($committers->{$svn_id}->{affiliation}));
|
if (exists($committers->{$git_email}->{affiliation}));
|
||||||
} else {
|
} else {
|
||||||
$have_unknowns = 1;
|
$have_unknowns = 1;
|
||||||
}
|
}
|
||||||
@ -175,8 +155,8 @@ rename("AUTHORS.new", "AUTHORS");
|
|||||||
|
|
||||||
print "New AUTHORS file written.\n";
|
print "New AUTHORS file written.\n";
|
||||||
if ($have_unknowns) {
|
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 {
|
} 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