Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #7 from andrefs/master

Adding filter_out and filter_in options.
  • Loading branch information...
commit ae720c1e7207a79363c3d70e97d1f121f6fbb5c2 2 parents 0061b3a + 8507a95
Rocco Caputo authored
Showing with 40 additions and 0 deletions.
  1. +40 −0 lib/Dist/Zilla/Plugin/ChangelogFromGit.pm
40 lib/Dist/Zilla/Plugin/ChangelogFromGit.pm
View
@@ -82,6 +82,16 @@ has earliest_date => (
},
);
+has filter_in => (
+ is => 'ro',
+ isa => 'Str',
+);
+
+has filter_out => (
+ is => 'ro',
+ isa => 'Str',
+);
+
sub gather_files {
my ($self, $arg) = @_;
@@ -159,6 +169,15 @@ sub gather_files {
my $iter = Git::Repository::Log::Iterator->new($release_range);
while (my $log = $iter->next) {
+ if($self->filter_out) {
+ my $out_re = $self->filter_out();
+ next if $log->message =~ /$out_re/;
+ }
+ if($self->filter_in){
+ my $in_re = $self->filter_in();
+ next unless $log->message =~ /$in_re/;
+ }
+ #print STDERR "LOG: ".$log->message."\n";
warn(" ", $log->commit(), " ", $log->committer_localtime, "\n") if (
$self->debug()
@@ -473,6 +492,27 @@ runtime tracing on STDERR.
[ChangelogFromGit]
debug = 1
+=head2 filter_out = REGULAR_EXPRESSION
+
+C<filter_out> sets a regular expression which discards matching commit
+messages. This provides a way to exclude commit messages such as
+'forgot to include file X' or 'typo'.
+
+ [ChangelogFromGit]
+ filter_out = ^forgot
+
+=head2 filter_in = REGULAR_EXPRESSION
+
+C<filter_in> does the opposite of C<filter_out>: it sets a regular
+expression which commit messages must match in order to be included
+in the Changes file. This means that when making a commit whith a
+relevant message, you can include the regular expression pattern to
+have it included in the Changes file, and ignore all the irrelevant
+commit messages.
+
+ [ChangelogFromGit]
+ filter_in = ^Major
+
=head1 HOW IT WORKS
Dist::Zilla::ChangelogFromGit collects the tags matching C<tag_regexp>
Please sign in to comment.
Something went wrong with that request. Please try again.