=head1 SYNOPSIS
perl Porting/acknowledgements.pl v5.15.0..HEAD
-
+
=head1 DESCRIPTION
This generates the text which goes in the Acknowledgements section in
use Time::Piece;
use Time::Seconds;
use version;
-$Text::Wrap::columns = 80;
+$Text::Wrap::columns = 77;
my $since_until = shift;
my $next_version = next_version();
my $development_time = development_time();
-my ( $changes, $files ) = changes_files();
+my ( $changes, $files, $code_changes, $code_files ) = changes_files();
my $formatted_changes = commify( round($changes) );
my $formatted_files = commify( round($files) );
+my $formatted_code_changes = commify( round($code_changes) );
+my $formatted_code_files = commify( round($code_files) );
my $authors = authors();
my $nauthors = $authors =~ tr/,/,/;
since Perl $previous_version and contains approximately $formatted_changes
lines of changes across $formatted_files files from $nauthors authors.
-Perl continues to flourish into its third decade thanks to a vibrant
-community of users and developers. The following people are known to
+Excluding auto-generated files, documentation and release tools, there
+were approximately $formatted_code_changes lines of changes to
+$formatted_code_files .pm, .t, .c and .h files.
+
+Perl continues to flourish into its fourth decade thanks to a vibrant
+community of users and developers. The following people are known to
have contributed the improvements that became Perl $next_version:
$authors
community for helping Perl to flourish.
For a more complete list of all of Perl's historical contributors,
-please see the F<AUTHORS> file in the Perl source distribution.
-";
+please see the F<AUTHORS> file in the Perl source distribution.";
my $wrapped = fill( '', '', $text );
print "$wrapped\n";
# returns the development time since the previous version in weeks
# or months
sub development_time {
- my $dates = qx(git log --pretty=format:%ct --summary $since_until);
- my $first_timestamp;
- foreach my $line ( split $/, $dates ) {
- next unless $line;
- next unless $line =~ /^\d+$/;
- $first_timestamp = $line;
- }
+ my $first_timestamp = qx(git log -1 --pretty=format:%ct --summary $since);
+ my $last_timestamp = qx(git log -1 --pretty=format:%ct --summary $until);
die "Missing first timestamp" unless $first_timestamp;
+ die "Missing last timestamp" unless $last_timestamp;
- my $now = localtime;
- my $then = localtime($first_timestamp);
- my $seconds = $now - $then;
- my $weeks = ceil( $seconds / ONE_WEEK );
- my $months = ceil( $seconds / ONE_MONTH );
+ my $seconds = localtime($last_timestamp) - localtime($first_timestamp);
+ my $weeks = _round( $seconds / ONE_WEEK );
+ my $months = _round( $seconds / ONE_MONTH );
my $development_time;
if ( $months < 2 ) {
- return "$weeks weeks";
+ return "$weeks @{[$weeks == 1 ? q(week) : q(weeks)]}";
} else {
return "$months months";
}
}
+sub _round {
+ my $val = shift;
+
+ my $int = int $val;
+ my $remainder = $val - $int;
+
+ return $remainder >= 0.5 ? $int + 1 : $int;
+}
+
# returns the number of changed lines and files since the previous
# version
sub changes_files {
my $output = qx(git diff --shortstat $since_until);
+ my $q = ($^O =~ /^(?:MSWin32|NetWare|VMS)$/io) ? '"' : "'";
+ my @filenames = qx(git diff --numstat $since_until | $^X -anle ${q}next if m{^dist/Module-CoreList} or not /\\.(?:pm|c|h|t)\\z/; print \$F[2]$q);
+ chomp @filenames;
+ my $output_code_changed = qx# git diff --shortstat $since_until -- @filenames #;
+
+ return ( _changes_from_cmd ( $output ),
+ _changes_from_cmd ( $output_code_changed ) );
+}
+
+sub _changes_from_cmd {
+ my $output = shift || die "No git diff command output";
# 585 files changed, 156329 insertions(+), 53586 deletions(-)
my ( $files, $insertions, $deletions )