Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 75 lines (63 sloc) 1.661 kb
#!/usr/bin/perl
use strict;
use warnings;
use Cwd qw(realpath);
use File::Basename;
my $BASE_DIR = dirname realpath __FILE__;
my $simplified_merges = do "$BASE_DIR/cache/simplified-merges.pl";
my $svn_id;
my $msg = '';
while (<>) {
if ( /^git-svn-id: (.*)/ ) {
$svn_id = $1;
} else {
$msg .= $_;
}
}
if ( $simplified_merges->{$ENV{GIT_COMMIT}} ) {
$msg = '';
}
$msg =~ s/\A\s*-\s*([^\n]+)\n*\z/$1/ms;
my ( $to, @from ) = ( split /\s+/, `git show -s --pretty='format:%P' $ENV{GIT_COMMIT}` );
# if this is a merge commit, rewrite the message to have a better "subject"
if ( @from ) {
# print the original message
$msg =~ s/^ //mg;
print "Merge ",
join(", ", map { format_branch($_) } @from),
" into ",
format_branch($to),
"\n\n",
$msg;
}
else {
if ( $msg =~ s/^\s*r\d+\@.*:.*$//m ) {
$msg =~ s/^ //mg;
}
print $msg;
}
sub format_branch {
my $commit = shift;
my $body = `git show -s --pretty='format:%s%n%b' $commit`;
if ( $body =~ m{git-svn-id: .*/branches/DBIx-Class/(.*?)\@} ) {
return "'$1'";
}
elsif ( $body =~ m{git-svn-id: .*/DBIx-Class/0.08/tags/(.*?)\@} ) {
return "'$1'";
}
elsif ( $body =~ m{git-svn-id: .*/DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/(.*?)\@} ) {
return "'$1'";
}
elsif ( $body =~ m{git-svn-id: .*/branches/(.*?)\@} ) {
return "'$1'";
}
elsif ( $body =~ m{git-svn-id: .*/trunk} ) {
return "'trunk'";
}
elsif ( $body =~ /\@r(\d+)/ ) {
return $1;
}
else {
die "unknown rev for $commit";
}
}
Jump to Line
Something went wrong with that request. Please try again.