From: Jeff Garzik <jgarzik@pobox.com>
To: Git Mailing List <git@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: git-shortlog script
Date: Sat, 04 Jun 2005 18:33:04 -0400 [thread overview]
Message-ID: <42A22C20.10002@pobox.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 785 bytes --]
Attached is the 'git-shortlog' script I whipped up, to mimic the
shortlog script that was used back in the BitKeeper days.
shortlog reads a changelog in the 'git-whatchanged' format, such as
git-whatchanged | git-shortlog
or
git-shortlog changes.txt
and outputs the changes sorted by author:
author1:
cset 1-line desc
cset 1-line desc
...
author2:
cset 1-line desc
...
...
Since git distinguishes 'author' from 'committer', I ran
git-whatchanged | git-shortlog > changes.txt
to look at the kernel authors throughout the entire history [of which is
in git].
It's fun to browse, since this is the first time we've been able to get
a better picture who is actually writing the patches, versus committing
them. See changes.txt.bz2, attached.
Jeff
[-- Attachment #2: git-shortlog --]
[-- Type: text/plain, Size: 1125 bytes --]
#!/usr/bin/perl -w
use strict;
my ($author, $desc, %map);
my $pstate = 1;
while (<>) {
# get author
if ($pstate == 1) {
next unless /^Author: (.*)$/;
$author = $1;
$pstate++;
}
# skip to blank line
elsif ($pstate == 2) {
next unless /^\s*$/;
$pstate++;
}
# skip to non-blank line
elsif ($pstate == 3) {
next if /^\s*$/;
chomp;
$desc = $_;
&shortlog_entry($author, $desc);
$pstate = 1;
}
else {
die "invalid parse state $pstate";
}
}
&shortlog_output;
exit(0);
sub shortlog_entry($$) {
my ($tmp_author, $tmp_desc) = @_;
$tmp_desc =~ s#/pub/scm/linux/kernel/git/#/.../#g;
$tmp_desc =~ s#\[PATCH\] ##g;
$tmp_desc =~ s#^\s+##g;
if (exists $map{$tmp_author}) {
# grab ref
my $obj = $map{$tmp_author};
# add desc to array
push(@$obj, $tmp_desc);
} else {
# create new array, containing 1 item
my @arr = ($tmp_desc);
# store ref to array
$map{$tmp_author} = \@arr;
}
}
sub shortlog_output {
my ($obj);
foreach $author (sort keys %map) {
print "$author:\n";
$obj = $map{$author};
foreach $desc (@$obj) {
print " $desc\n";
}
print "\n";
}
}
[-- Attachment #3: changes.txt.bz2 --]
[-- Type: application/x-bzip2, Size: 31825 bytes --]
next reply other threads:[~2005-06-04 22:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-04 22:33 Jeff Garzik [this message]
2005-06-04 23:45 ` git-shortlog script Linus Torvalds
2005-06-04 23:47 ` Linus Torvalds
2005-06-05 0:08 ` Jeff Garzik
2005-06-05 0:16 ` Linus Torvalds
2005-06-05 0:19 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42A22C20.10002@pobox.com \
--to=jgarzik@pobox.com \
--cc=git@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.