Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created June 1, 2009 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyanny/121255 to your computer and use it in GitHub Desktop.
Save kyanny/121255 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
my $pattern = shift @ARGV;
my $help;
GetOptions(
'help' => \$help,
) or pod2usage(2);
pod2usage(2) if $help;
###
$, = $\ = "\n";
my $delim_pattern = qr/^(-+)$/;
my $delimiter;
my @blocks;
my $block_number;
while (<>) {
chomp;
if (($delimiter) = /$delim_pattern/) {
$block_number++;
next;
}
push @{ $blocks[$block_number] }, $_;
}
@blocks = grep { defined } @blocks;
for my $block (@blocks) {
my @lines = @$block;
if ($pattern and ($lines[0] =~ /$pattern/)) {
print $delimiter, @lines;
}
}
__END__
=head1 NAME
svn-log-by-committer.pl -
=head1 SYNOPSIS
$ svn log | svn-log-by-committer.pl committer
=head1 DESCRIPTION
=cut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment