Permalink
Browse files

Make repo locations configurable from command line

This will let release managers be more flexible when generating the contributors list.
For automated releases, this will make the contributor generation step less
dependent on the current state of the rakudo repo.
  • Loading branch information...
zoffixznet committed Sep 6, 2016
1 parent 73c9dd5 commit bd3d430210d6d8c6f601718dd4b290c3c9753206
Showing with 46 additions and 36 deletions.
  1. +46 −36 tools/contributors.pl6
@@ -1,46 +1,56 @@
use v6;
my $last_release = @*ARGS.shift // do {
Date.new-from-daycount:
.daycount # daycount for 1st of previous month
+ (.day-of-week == 7 ?? 6 !! 6 - .day-of-week) # offset of the first Saturday
+ 2*7 # add two extra weeks, to get 3rd Saturday
given Date.today.earlier(:1month).truncated-to: 'month';
}
sub MAIN (
$last_release? is copy,
:$rakudo = '.',
:$doc = '../doc',
:$nqp = 'nqp',
:$moar = 'nqp/MoarVM',
:$roast = 't/spec',
) {
$last_release //= do {
Date.new-from-daycount:
.daycount # daycount for 1st of previous month
+ (.day-of-week == 7 ?? 6 !! 6 - .day-of-week) # offset of the first Saturday
+ 2*7 # add two extra weeks, to get 3rd Saturday
given Date.today.earlier(:1month).truncated-to: 'month';
}
# Check all the places with repos that may be applicable. Get all of the
# committers in that repo since the given date as commit ID => author pairs.
# Only keep the unique commit ID's (so that each author only gets credited
# once for a commit, even if multiple repo's are identical). Then take the
# authors and put them in a Bag. Sort the bag by frequency, highest first.
# Then take the keys (aka the authors), and join them in a list.
# Check all the places with repos that may be applicable. Get all of the
# committers in that repo since the given date as commit ID => author pairs.
# Only keep the unique commit ID's (so that each author only gets credited
# once for a commit, even if multiple repo's are identical). Then take the
# authors and put them in a Bag. Sort the bag by frequency, highest first.
# Then take the keys (aka the authors), and join them in a list.
my @repos = < . ../doc nqp nqp/MoarVM t/spec >;
note qq:to/END/;
###############################################################
Extracting contributor information from these locations.
@repos[]
Ensure those repositories exist and have all changes pulled in.
###############################################################
END
my @repos = $rakudo, $doc, $nqp, $roast;
note qq:to/END/;
###############################################################
Extracting contributor information from these locations.
@repos[]
Ensure those repositories exist and have all changes pulled in.
###############################################################
END
say "Contributors to Rakudo since the release on $last_release:";
my @contributors = @repos.map({
|get-committers($_,$last_release)
}).unique(:as(*.key))».value.Bag.sort(*.value).reverse».key;
say "Contributors to Rakudo since the release on $last_release:";
my $*CREDITS_FILE = $rakudo.IO.child: 'CREDITS';
my @contributors = @repos.map({
|get-committers($_,$last_release)
}).unique(:as(*.key))».value.Bag.sort(*.value).reverse».key;
for @contributors -> $name is rw {
state $length = 0;
$length += $name.chars + 2; # 2 extra for the comma and space after the name
if $length > 78 {
# prepend newline to name, so when we join and print the entire list,
# this name will start on the new line
$name = "\n$name";
$length = $name.chars + 2;
}
for @contributors -> $name is rw {
state $length = 0;
$length += $name.chars + 2; # 2 extra for the comma and space after the name
if $length > 78 {
# prepend newline to name, so when we join and print the entire list,
# this name will start on the new line
$name = "\n$name";
$length = $name.chars + 2;
}
}
say @contributors.join(', ');
}
say @contributors.join(', ');
sub get-committers($repo, $since) {
die "Expected a repo in `$repo` but did not find one"
@@ -74,7 +84,7 @@ sub get-committers($repo, $since) {
sub nick-to-name($nick) {
state %nick-to-name = do {
my $name;
gather for "CREDITS".IO.lines {
gather for $*CREDITS_FILE.IO.lines {
when /^N:/ {
$name = .substr(3);
}

0 comments on commit bd3d430

Please sign in to comment.