www-infrastructure-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: [1/2] git commit: f92a685 -
Date Wed, 06 Jun 2012 13:45:31 GMT
Hi,

On Wed, Jun 6, 2012 at 2:57 PM, Joe Schaefer <joe_schaefer@yahoo.com> wrote:
> Sounds interesting Jukka- especially if we could keep it well
> correlated with the data in our "push logs".  Do share more
> details.

Yep, basically the idea is that each entry in the push log (i.e.
branch B advanced from revision X to revision Y) results in a push
notification message.

For example, your push updated the master branch from revision
bee695d44c to f92a6853be. That update covers two commits (one normal
and one merge, see "git log bee695d44c..f92a6853be") and changes just
a single line (see "git diff bee695d44c..f92a6853be"). That
information, a log of the commits and the diff of all changes, should
be included in the push notification message.

See below for a relevant snippet from the script I have in place at
work. It has some Adobe-specific bits (HTML diffs, etc.), but I should
be able to adapt it for Apache with not much effort.

BR,

Jukka Zitting

----

$payload->{ref} =~ /^(refs\/heads\/)?(.*)/;
my $ref = $2;
my $ref_html = html($ref);

my $before = $payload->{before};
my $after = $payload->{after};
"$before..$after" =~ /^([a-f0-9]+\.\.[a-f0-9]+)$/ or die;
my $range = $1;

my $sbefore = substr($before, 0, 8);
my $safter = substr($after, 0, 8);
"$sbefore..$safter" =~ /^([a-f0-9]+\.\.[a-f0-9]+)$/ or die;
my $srange =  $1;

my $log_text  = `git log $range` or die;
my $log_html  = log_to_html($log_text);
my $stat_text = `git diff --stat $range -- . ` or die;
my $stat_html = stat_to_html($stat_text);
my $diff_text = `git diff $range -- . ` or die;
my $diff_html = diff_to_html($diff_text);

my ($subject_text, $is_rtc, $has_rtc, $has_bug) =
  review_commits(@{$payload->{commits}});
my $subject_html = html($subject_text);

Mime
View raw message