contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
# List people who might be interested in a patch. Useful as the argument to
|
|
|
|
# git-send-email --cc-cmd option, and in other situations.
|
|
|
|
#
|
2013-07-21 14:52:39 +04:00
|
|
|
# Usage: git contacts <file | rev-list option> ...
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use IPC::Open2;
|
|
|
|
|
|
|
|
my $since = '5-years-ago';
|
|
|
|
my $min_percent = 10;
|
2017-07-21 17:15:30 +03:00
|
|
|
my $labels_rx = qr/Signed-off-by|Reviewed-by|Acked-by|Cc|Reported-by/i;
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
my %seen;
|
|
|
|
|
|
|
|
sub format_contact {
|
|
|
|
my ($name, $email) = @_;
|
|
|
|
return "$name <$email>";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub parse_commit {
|
|
|
|
my ($commit, $data) = @_;
|
|
|
|
my $contacts = $commit->{contacts};
|
|
|
|
my $inbody = 0;
|
|
|
|
for (split(/^/m, $data)) {
|
|
|
|
if (not $inbody) {
|
|
|
|
if (/^author ([^<>]+) <(\S+)> .+$/) {
|
|
|
|
$contacts->{format_contact($1, $2)} = 1;
|
|
|
|
} elsif (/^$/) {
|
|
|
|
$inbody = 1;
|
|
|
|
}
|
|
|
|
} elsif (/^$labels_rx:\s+([^<>]+)\s+<(\S+?)>$/o) {
|
|
|
|
$contacts->{format_contact($1, $2)} = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub import_commits {
|
|
|
|
my ($commits) = @_;
|
|
|
|
return unless %$commits;
|
|
|
|
my $pid = open2 my $reader, my $writer, qw(git cat-file --batch);
|
|
|
|
for my $id (keys(%$commits)) {
|
|
|
|
print $writer "$id\n";
|
|
|
|
my $line = <$reader>;
|
|
|
|
if ($line =~ /^([0-9a-f]{40}) commit (\d+)/) {
|
|
|
|
my ($cid, $len) = ($1, $2);
|
|
|
|
die "expected $id but got $cid\n" unless $id eq $cid;
|
|
|
|
my $data;
|
|
|
|
# cat-file emits newline after data, so read len+1
|
|
|
|
read $reader, $data, $len + 1;
|
|
|
|
parse_commit($commits->{$id}, $data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close $reader;
|
|
|
|
close $writer;
|
|
|
|
waitpid($pid, 0);
|
|
|
|
die "git-cat-file error: $?\n" if $?;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub get_blame {
|
2013-08-10 01:39:56 +04:00
|
|
|
my ($commits, $source, $from, $ranges) = @_;
|
|
|
|
return unless @$ranges;
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
open my $f, '-|',
|
2013-08-10 01:39:56 +04:00
|
|
|
qw(git blame --porcelain -C),
|
|
|
|
map({"-L$_->[0],+$_->[1]"} @$ranges),
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
'--since', $since, "$from^", '--', $source or die;
|
|
|
|
while (<$f>) {
|
|
|
|
if (/^([0-9a-f]{40}) \d+ \d+ \d+$/) {
|
|
|
|
my $id = $1;
|
|
|
|
$commits->{$id} = { id => $id, contacts => {} }
|
|
|
|
unless $seen{$id};
|
|
|
|
$seen{$id} = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close $f;
|
|
|
|
}
|
|
|
|
|
2013-08-10 01:39:55 +04:00
|
|
|
sub blame_sources {
|
|
|
|
my ($sources, $commits) = @_;
|
|
|
|
for my $s (keys %$sources) {
|
|
|
|
for my $id (keys %{$sources->{$s}}) {
|
2013-08-10 01:39:56 +04:00
|
|
|
get_blame($commits, $s, $id, $sources->{$s}{$id});
|
2013-08-10 01:39:55 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
sub scan_patches {
|
2013-08-10 01:39:55 +04:00
|
|
|
my ($sources, $id, $f) = @_;
|
2013-07-21 14:52:39 +04:00
|
|
|
my $source;
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
while (<$f>) {
|
|
|
|
if (/^From ([0-9a-f]{40}) Mon Sep 17 00:00:00 2001$/) {
|
|
|
|
$id = $1;
|
|
|
|
$seen{$id} = 1;
|
|
|
|
}
|
|
|
|
next unless $id;
|
|
|
|
if (m{^--- (?:a/(.+)|/dev/null)$}) {
|
|
|
|
$source = $1;
|
|
|
|
} elsif (/^@@ -(\d+)(?:,(\d+))?/ && $source) {
|
2013-08-10 01:39:54 +04:00
|
|
|
my $len = defined($2) ? $2 : 1;
|
2013-08-10 01:39:55 +04:00
|
|
|
push @{$sources->{$source}{$id}}, [$1, $len] if $len;
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub scan_patch_file {
|
|
|
|
my ($commits, $file) = @_;
|
|
|
|
open my $f, '<', $file or die "read failure: $file: $!\n";
|
2013-07-21 14:52:39 +04:00
|
|
|
scan_patches($commits, undef, $f);
|
|
|
|
close $f;
|
|
|
|
}
|
|
|
|
|
2013-07-21 14:52:40 +04:00
|
|
|
sub parse_rev_args {
|
|
|
|
my @args = @_;
|
|
|
|
open my $f, '-|',
|
|
|
|
qw(git rev-parse --revs-only --default HEAD --symbolic), @args
|
|
|
|
or die;
|
|
|
|
my @revs;
|
|
|
|
while (<$f>) {
|
|
|
|
chomp;
|
|
|
|
push @revs, $_;
|
|
|
|
}
|
|
|
|
close $f;
|
|
|
|
return @revs if scalar(@revs) != 1;
|
|
|
|
return "^$revs[0]", 'HEAD' unless $revs[0] =~ /^-/;
|
|
|
|
return $revs[0], 'HEAD';
|
|
|
|
}
|
|
|
|
|
2013-07-21 14:52:39 +04:00
|
|
|
sub scan_rev_args {
|
|
|
|
my ($commits, $args) = @_;
|
2013-07-21 14:52:40 +04:00
|
|
|
my @revs = parse_rev_args(@$args);
|
|
|
|
open my $f, '-|', qw(git rev-list --reverse), @revs or die;
|
2013-07-21 14:52:39 +04:00
|
|
|
while (<$f>) {
|
|
|
|
chomp;
|
|
|
|
my $id = $_;
|
|
|
|
$seen{$id} = 1;
|
|
|
|
open my $g, '-|', qw(git show -C --oneline), $id or die;
|
|
|
|
scan_patches($commits, $id, $g);
|
|
|
|
close $g;
|
|
|
|
}
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
close $f;
|
|
|
|
}
|
|
|
|
|
2013-07-21 14:52:41 +04:00
|
|
|
sub mailmap_contacts {
|
|
|
|
my ($contacts) = @_;
|
|
|
|
my %mapped;
|
|
|
|
my $pid = open2 my $reader, my $writer, qw(git check-mailmap --stdin);
|
|
|
|
for my $contact (keys(%$contacts)) {
|
|
|
|
print $writer "$contact\n";
|
|
|
|
my $canonical = <$reader>;
|
|
|
|
chomp $canonical;
|
|
|
|
$mapped{$canonical} += $contacts->{$contact};
|
|
|
|
}
|
|
|
|
close $reader;
|
|
|
|
close $writer;
|
|
|
|
waitpid($pid, 0);
|
|
|
|
die "git-check-mailmap error: $?\n" if $?;
|
|
|
|
return \%mapped;
|
|
|
|
}
|
|
|
|
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
if (!@ARGV) {
|
2013-07-21 14:52:39 +04:00
|
|
|
die "No input revisions or patch files\n";
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
}
|
|
|
|
|
2013-07-21 14:52:39 +04:00
|
|
|
my (@files, @rev_args);
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
for (@ARGV) {
|
2013-07-21 14:52:39 +04:00
|
|
|
if (-e) {
|
|
|
|
push @files, $_;
|
|
|
|
} else {
|
|
|
|
push @rev_args, $_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-10 01:39:55 +04:00
|
|
|
my %sources;
|
2013-07-21 14:52:39 +04:00
|
|
|
for (@files) {
|
2013-08-10 01:39:55 +04:00
|
|
|
scan_patch_file(\%sources, $_);
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
}
|
2013-07-21 14:52:39 +04:00
|
|
|
if (@rev_args) {
|
2013-08-10 01:39:55 +04:00
|
|
|
scan_rev_args(\%sources, \@rev_args)
|
2013-07-21 14:52:39 +04:00
|
|
|
}
|
2013-08-10 01:39:55 +04:00
|
|
|
|
2013-09-18 06:52:05 +04:00
|
|
|
my $toplevel = `git rev-parse --show-toplevel`;
|
|
|
|
chomp $toplevel;
|
|
|
|
chdir($toplevel) or die "chdir failure: $toplevel: $!\n";
|
|
|
|
|
2013-08-10 01:39:55 +04:00
|
|
|
my %commits;
|
|
|
|
blame_sources(\%sources, \%commits);
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
import_commits(\%commits);
|
|
|
|
|
|
|
|
my $contacts = {};
|
|
|
|
for my $commit (values %commits) {
|
|
|
|
for my $contact (keys %{$commit->{contacts}}) {
|
|
|
|
$contacts->{$contact}++;
|
|
|
|
}
|
|
|
|
}
|
2013-07-21 14:52:41 +04:00
|
|
|
$contacts = mailmap_contacts($contacts);
|
contrib: add git-contacts helper
This script lists people that might be interested in a patch by going
back through the history for each patch hunk, and finding people that
reviewed, acknowledged, signed, authored, or were Cc:'d on the code the
patch is modifying.
It does this by running git-blame incrementally on each hunk and then
parsing the commit message. After gathering all participants, it
determines each person's relevance by considering how many commits
mentioned that person compared with the total number of commits under
consideration. The final output consists only of participants who pass a
minimum threshold of participation.
Several conditions controlling a person's significance are currently
hard-coded, such as minimum participation level, blame date-limiting,
and -C level for detecting moved and copied lines. In the future, these
conditions may become configurable.
For example:
% git contacts 0001-remote-hg-trivial-cleanups.patch
Felipe Contreras <felipe.contreras@gmail.com>
Jeff King <peff@peff.net>
Max Horn <max@quendi.de>
Junio C Hamano <gitster@pobox.com>
Thus, it can be invoked as git-send-email's --cc-cmd option, among other
possible uses.
This is a Perl rewrite of Felipe Contreras' git-related patch series[1]
written in Ruby.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/226065/
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21 14:52:38 +04:00
|
|
|
|
|
|
|
my $ncommits = scalar(keys %commits);
|
|
|
|
for my $contact (keys %$contacts) {
|
|
|
|
my $percent = $contacts->{$contact} * 100 / $ncommits;
|
|
|
|
next if $percent < $min_percent;
|
|
|
|
print "$contact\n";
|
|
|
|
}
|