Skip to content

Commit

Permalink
Simplify helper script through the power of set operators
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Nov 15, 2017
1 parent 99f38f9 commit 6db51f9
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tools/build/missing-commits.pl6
Expand Up @@ -5,23 +5,21 @@ sub commit($line) { $line.starts-with('commit ') ?? $line.substr(7,8) !! Nil }
# The commit that did the last VERSION bump
my $version-bump-commit = commit( qx/git log -- VERSION/.lines.head );

# Make a SetHash with all of the commits since the last VERSION bump
my %commits is SetHash = qx/git log/.lines.map( {
# Make a Set with all of the commits since the last VERSION bump minus
# all the commits that have been documented in ChangeLog since the last
# bump. Note that we assume that an empty line indicates the boundary
# between releases.
my $missing = qx/git log/.lines.map( {
if commit($_) -> \commit {
last if commit eq $version-bump-commit;
commit
}
} );

# Remove the commits that have been documented in ChangeLog since bump
# Note that we assume here that an empty line indicates boundary between
# releases.
%commits{ "docs/ChangeLog".IO.lines.map( {
} ) (-) "docs/ChangeLog".IO.lines.map: {
$_
?? |.comb( / <?after \[> ( <[ 0..9 a..f A..F ]> ** 8 ) <?before \]> / )
!! last
} ) }:delete;
}

# Let the world know the result
say "%commits.elems() commits not yet documented in ChangeLog:";
%commits.keys.sort.batch(9).map: *.Str.say;
say "$missing.elems() commits not yet documented in ChangeLog:";
$missing.keys.sort.batch(9).map: *.Str.say;

0 comments on commit 6db51f9

Please sign in to comment.