#!/usr/bin/env perl # SPDX-License-Identifier: GPL-2.0 # # (c) 2007, Joe Perches <joe@perches.com> # created from checkpatch.pl # # Print selected MAINTAINERS information for # the files modified in a patch or for a file # # usage: perl scripts/get_maintainer.pl [OPTIONS] <patch> # perl scripts/get_maintainer.pl [OPTIONS] -f <file>
use warnings;
use strict;
my $P = $0;
my $V = '0.26';
use Getopt::Long qw(:config no_auto_abbrev);
use Cwd;
use File::Find;
use File::Spec::Functions;
use open qw(:std :encoding(UTF-8));
my $cur_path = fastgetcwd() . '/';
my $lk_path = "./";
my $email = 1;
my $email_usename = 1;
my $email_maintainer = 1;
my $email_reviewer = 1;
my $email_fixes = 1;
my $email_list = 1;
my $email_moderated_list = 1;
my $email_subscriber_list = 0;
my $email_git_penguin_chiefs = 0;
my $email_git = 0;
my $email_git_all_signature_types = 0;
my $email_git_blame = 0;
my $email_git_blame_signatures = 1;
my $email_git_fallback = 1;
my $email_git_min_signatures = 1;
my $email_git_max_maintainers = 5;
my $email_git_min_percent = 5;
my $email_git_since = "1-year-ago";
my $email_hg_since = "-365";
my $interactive = 0;
my $email_remove_duplicates = 1;
my $email_use_mailmap = 1;
my $output_multiline = 1;
my $output_separator = ", ";
my $output_roles = 0;
my $output_rolestats = 1;
my $output_substatus = undef;
my $output_section_maxlen = 50;
my $scm = 0;
my $tree = 1;
my $web = 0;
my $bug = 0;
my $subsystem = 0;
my $status = 0;
my $letters = "";
my $keywords = 1;
my $keywords_in_file = 0;
my $sections = 0;
my $email_file_emails = 0;
my $from_filename = 0;
my $pattern_depth = 0;
my $self_test = undef;
my $version = 0;
my $help = 0;
my $find_maintainer_files = 0;
my $maintainer_path;
my $vcs_used = 0;
my $exit = 0;
my @files = ();
my @fixes = (); # If a patch description includes Fixes: lines
my @range = ();
my @keyword_tvi = ();
my @file_emails = ();
my %commit_author_hash;
my %commit_signer_hash;
my @penguin_chief = ();
push(@penguin_chief, "Linus Torvalds:torvalds\@linux-foundation.org"); #Andrew wants in on most everything - 2009/01/14 #push(@penguin_chief, "Andrew Morton:akpm\@linux-foundation.org");
my @penguin_chief_names = (); foreach my $chief (@penguin_chief) { if ($chief =~ m/^(.*):(.*)/) {
my $chief_name = $1;
my $chief_addr = $2;
push(@penguin_chief_names, $chief_name);
}
}
my $penguin_chiefs = "\(" . join("|", @penguin_chief_names) . "\)";
# Signature types of people who are either # a) responsible for the code in question, or # b) familiar enough with it to give relevant feedback
my @signature_tags = ();
push(@signature_tags, "Signed-off-by:");
push(@signature_tags, "Reviewed-by:");
push(@signature_tags, "Acked-by:");
my $signature_pattern = "\(" . join("|", @signature_tags) . "\)";
# rfc822 email address - preloaded methods go here.
my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])";
my $rfc822_char = '[\\000-\\377]';
# VCS command support: class-like functions and strings
my $conf = which_conf(".get_maintainer.conf"); if (-f $conf) {
my @conf_args;
open(my $conffile, '<', "$conf")
or warn "$P: Can't find a readable .get_maintainer.conf file $!\n";
next if ($line =~ m/^\s*#/);
next if ($line =~ m/^\s*$/);
my @words = split(" ", $line); foreach my $word (@words) {
last if ($word =~ m/^#/);
push (@conf_args, $word);
}
}
close($conffile);
unshift(@ARGV, @conf_args) if @conf_args;
}
my @ignore_emails = ();
my $ignore_file = which_conf(".get_maintainer.ignore"); if (-f $ignore_file) {
open(my $ignore, '<', "$ignore_file")
or warn "$P: Can't find a readable .get_maintainer.ignore file $!\n"; while (<$ignore>) {
my $line = $_;
next if ($line =~ m/^\s*$/); if (rfc822_valid($line)) {
push(@ignore_emails, $line);
}
}
close($ignore);
}
if ($#ARGV > 0) { foreach (@ARGV) { if ($_ =~ /^-{1,2}self-test(?:=|$)/) {
die "$P: using --self-test does not allow any other option or argument\n";
}
}
}
if ($version != 0) {
print("${P} ${V}\n");
exit 0;
}
if (defined $self_test) {
read_all_maintainer_files();
self_test();
exit 0;
}
if (-t STDIN && !@ARGV) { # We're talking to a terminal, but have no command line arguments.
die "$P: missing patchfile or -f file - use --help if necessary\n";
}
$output_multiline = 0 if ($output_separator ne ", ");
$output_rolestats = 1 if ($interactive);
$output_roles = 1 if ($output_rolestats);
return if (!$email_use_mailmap || !(-f "${lk_path}.mailmap"));
open(my $mailmap_file, '<', "${lk_path}.mailmap")
or warn "$P: Can't open .mailmap: $!\n";
while (<$mailmap_file>) {
s/#.*$//; #strip comments
s/^\s+|\s+$//g; #trim
next if (/^\s*$/); #skip empty lines #entries have one of the following formats: # name1 <mail1> # <mail1> <mail2> # name1 <mail1> <mail2> # name1 <mail1> name2 <mail2> # (see man git-shortlog)
if (/^([^<]+)<([^>]+)>$/) {
my $real_name = $1;
my $address = $2;
## use the filenames on the command line or find the filenames in the patchfiles
if (!@ARGV) {
push(@ARGV, "&STDIN");
}
foreach my $file (@ARGV) { if ($file ne "&STDIN") {
$file = canonpath($file); ##if $file is a directory and it lacks a trailing slash, add one if ((-d $file)) {
$file =~ s@([^/])$@$1/@;
} elsif (!(-f $file)) {
die "$P: file '${file}' not found\n";
}
} if ($from_filename && (vcs_exists() && !vcs_file_exists($file))) {
warn "$P: file '$file' not found in version control $!\n";
} if ($from_filename || ($file ne "&STDIN" && vcs_file_exists($file))) {
$file =~ s/^\Q${cur_path}\E//; #strip any absolute path
$file =~ s/^\Q${lk_path}\E//; #or the path to the lk tree
push(@files, $file); if ($file ne "MAINTAINERS" && -f $file && $keywords && $keywords_in_file) {
open(my $f, '<', $file)
or die "$P: Can't open $file: $!\n";
my $text = do { local($/) ; <$f> };
close($f); foreach my $line (keys %keyword_hash) { if ($text =~ m/$keyword_hash{$line}/x) {
push(@keyword_tvi, $line);
}
}
}
} else {
my $file_cnt = @files;
my $lastfile;
open(my $patch, "< $file")
or die "$P: Can't open $file: $!\n";
# We can check arbitrary information before the patch # like the commit message, mail headers, etc... # This allows us to match arbitrary keywords against any part # of a git format-patch generated file (subject tags, etc...)
my $patch_prefix = ""; #Parsing the intro
while (<$patch>) {
my $patch_line = $_; if (m/^ mode change [0-7]+ => [0-7]+ (\S+)\s*$/) {
my $filename = $1;
push(@files, $filename);
} elsif (m/^rename (?:from|to) (\S+)\s*$/) {
my $filename = $1;
push(@files, $filename);
} elsif (m/^diff --git a\/(\S+) b\/(\S+)\s*$/) {
my $filename1 = $1;
my $filename2 = $2;
push(@files, $filename1);
push(@files, $filename2);
} elsif (m/^Fixes:\s+([0-9a-fA-F]{6,40})/) {
push(@fixes, $1) if ($email_fixes);
} elsif (m/^\+\+\+\s+(\S+)/ or m/^---\s+(\S+)/) {
my $filename = $1;
$filename =~ s@^[^/]*/@@;
$filename =~ s@\n@@;
$lastfile = $filename;
push(@files, $filename);
$patch_prefix = "^[+-].*"; #Now parsing the actual patch
} elsif (m/^\@\@ -(\d+),(\d+)/) { if ($email_git_blame) {
push(@range, "$lastfile:$1:$2");
}
} elsif ($keywords) { foreach my $line (keys %keyword_hash) { if ($patch_line =~ m/${patch_prefix}$keyword_hash{$line}/x) {
push(@keyword_tvi, $line);
}
}
}
}
close($patch);
if ($file_cnt == @files) {
warn "$P: file '${file}' doesn't appear to be a patch. "
. "Add -f to options?\n";
}
@files = sort_and_uniq(@files);
}
}
my %email_hash_name;
my %email_hash_address;
my @email_to = ();
my %hash_list_to;
my @list_to = ();
my @scm = ();
my @web = ();
my @bug = ();
my @subsystem = ();
my @status = ();
my @substatus = ();
my %deduplicate_name_hash = ();
my %deduplicate_address_hash = ();
my @maintainers = get_maintainers(); if (@maintainers) {
@maintainers = merge_email(@maintainers);
output(@maintainers);
}
if ($scm) {
@scm = uniq(@scm);
output(@scm);
}
if ($output_substatus) {
@substatus = uniq(@substatus);
output(@substatus);
}
if ($status) {
@status = uniq(@status);
output(@status);
}
if ($subsystem) {
@subsystem = uniq(@subsystem);
output(@subsystem);
}
if ($web) {
@web = uniq(@web);
output(@web);
}
if ($bug) {
@bug = uniq(@bug);
output(@bug);
}
exit($exit);
sub self_test {
my @lsfiles = ();
my @good_links = ();
my @bad_links = ();
my @section_headers = ();
my $index = 0;
@lsfiles = vcs_list_files($lk_path);
for my $x (@self_test_info) {
$index++;
## Section header duplication and missing section content if (($self_test eq "" || $self_test =~ /\bsections\b/) &&
$x->{line} =~ /^\S[^:]/ &&
defined $self_test_info[$index] &&
$self_test_info[$index]->{line} =~ /^([A-Z]):\s*\S/) {
my $has_S = 0;
my $has_F = 0;
my $has_ML = 0;
my $status = ""; if (grep(m@^\Q$x->{line}\E@, @section_headers)) {
print("$x->{file}:$x->{linenr}: warning: duplicate section header\t$x->{line}\n");
} else {
push(@section_headers, $x->{line});
}
my $nextline = $index; while (defined $self_test_info[$nextline] &&
$self_test_info[$nextline]->{line} =~ /^([A-Z]):\s*(\S.*)/) {
my $type = $1;
my $value = $2; if ($type eq "S") {
$has_S = 1;
$status = $value;
} elsif ($type eq "F" || $type eq "N") {
$has_F = 1;
} elsif ($type eq "M" || $type eq "R" || $type eq "L") {
$has_ML = 1;
}
$nextline++;
} if (!$has_ML && $status !~ /orphan|obsolete/i) {
print("$x->{file}:$x->{linenr}: warning: section without email address\t$x->{line}\n");
} if (!$has_S) {
print("$x->{file}:$x->{linenr}: warning: section without status \t$x->{line}\n");
} if (!$has_F) {
print("$x->{file}:$x->{linenr}: warning: section without file pattern\t$x->{line}\n");
}
}
next if ($x->{line} !~ /^([A-Z]):\s*(.*)/);
my $type = $1;
my $value = $2;
## Filename pattern matching if (($type eq "F" || $type eq "X") &&
($self_test eq "" || $self_test =~ /\bpatterns\b/)) {
$value =~ s@\.@\\\.@g; ##Convert . to \.
$value =~ s/\*/\.\*/g; ##Convert * to .*
$value =~ s/\?/\./g; ##Convert ? to . ##if pattern is a directory and it lacks a trailing slash, add one if ((-d $value)) {
$value =~ s@([^/])$@$1/@;
} if (!grep(m@^$value@, @lsfiles)) {
print("$x->{file}:$x->{linenr}: warning: no file matches\t$x->{line}\n");
}
## Link reachability
} elsif (($type eq "W" || $type eq "Q" || $type eq "B") &&
$value =~ /^https?:/ &&
($self_test eq "" || $self_test =~ /\blinks\b/)) {
next if (grep(m@^\Q$value\E$@, @good_links));
my $isbad = 0; if (grep(m@^\Q$value\E$@, @bad_links)) {
$isbad = 1;
} else {
my $output = `wget --spider -q --no-check-certificate --timeout 10 --tries 1 $value`; if ($? == 0) {
push(@good_links, $value);
} else {
push(@bad_links, $value);
$isbad = 1;
}
} if ($isbad) {
print("$x->{file}:$x->{linenr}: warning: possible bad link\t$x->{line}\n");
}
## SCM reachability
} elsif ($type eq "T" &&
($self_test eq "" || $self_test =~ /\bscm\b/)) {
next if (grep(m@^\Q$value\E$@, @good_links));
my $isbad = 0; if (grep(m@^\Q$value\E$@, @bad_links)) {
$isbad = 1;
} elsif ($value !~ /^(?:git|quilt|hg)\s+\S/) {
print("$x->{file}:$x->{linenr}: warning: malformed entry\t$x->{line}\n");
} elsif ($value =~ /^git\s+(\S+)(\s+([^\(]+\S+))?/) {
my $url = $1;
my $branch = "";
$branch = $3 if $3;
my $output = `git ls-remote --exit-code -h "$url" $branch > /dev/null 2>&1`; if ($? == 0) {
push(@good_links, $value);
} else {
push(@bad_links, $value);
$isbad = 1;
}
} elsif ($value =~ /^(?:quilt|hg)\s+(https?:\S+)/) {
my $url = $1;
my $output = `wget --spider -q --no-check-certificate --timeout 10 --tries 1 $url`; if ($? == 0) {
push(@good_links, $value);
} else {
push(@bad_links, $value);
$isbad = 1;
}
} if ($isbad) {
print("$x->{file}:$x->{linenr}: warning: possible bad link\t$x->{line}\n");
}
}
}
}
sub ignore_email_address {
my ($address) = @_;
foreach my $ignore (@ignore_emails) {
return 1 if ($ignore eq $address);
}
return 0;
}
sub range_is_maintained {
my ($start, $end) = @_;
for (my $i = $start; $i < $end; $i++) {
my $line = $typevalue[$i]; if ($line =~ m/^([A-Z]):\s*(.*)/) {
my $type = $1;
my $value = $2; if ($type eq 'S') { if ($value =~ /(maintain|support)/i) {
return 1;
}
}
}
}
return 0;
}
sub range_has_maintainer {
my ($start, $end) = @_;
for (my $i = $start; $i < $end; $i++) {
my $line = $typevalue[$i]; if ($line =~ m/^([A-Z]):\s*(.*)/) {
my $type = $1;
my $value = $2; if ($type eq 'M') {
return 1;
}
}
}
return 0;
}
my %hash;
my $tvi = find_first_section(); while ($tvi < @typevalue) {
my $start = find_starting_index($tvi);
my $end = find_ending_index($tvi);
my $exclude = 0;
my $i;
#Do not match excluded file patterns
for ($i = $start; $i < $end; $i++) {
my $line = $typevalue[$i]; if ($line =~ m/^([A-Z]):\s*(.*)/) {
my $type = $1;
my $value = $2; if ($type eq 'X') { if (file_match_pattern($file, $value)) {
$exclude = 1;
last;
}
}
}
}
if (!$exclude) { for ($i = $start; $i < $end; $i++) {
my $line = $typevalue[$i]; if ($line =~ m/^([A-Z]):\s*(.*)/) {
my $type = $1;
my $value = $2; if ($type eq 'F') { if (file_match_pattern($file, $value)) {
my $value_pd = ($value =~ tr@/@@);
my $file_pd = ($file =~ tr@/@@);
$value_pd++ if (substr($value,-1,1) ne "/");
$value_pd = -1 if ($value =~ /^\.\*/); if ($value_pd >= $file_pd &&
range_is_maintained($start, $end) &&
range_has_maintainer($start, $end)) {
$exact_pattern_match_hash{$file} = 1;
} if ($pattern_depth == 0 ||
(($file_pd - $value_pd) < $pattern_depth)) {
$hash{$tvi} = $value_pd;
}
}
} elsif ($type eq 'N') { if ($file =~ m/$value/x) {
$hash{$tvi} = 0;
}
}
}
}
}
$tvi = $end + 1;
}
foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
add_categories($line, ""); if ($sections) {
my $i;
my $start = find_starting_index($line);
my $end = find_ending_index($line); for ($i = $start; $i < $end; $i++) {
my $line = $typevalue[$i]; if ($line =~ /^[FX]:/) { ##Restore file patterns
$line =~ s/([^\\])\.([^\*])/$1\?$2/g;
$line =~ s/([^\\])\.$/$1\?/g; ##Convert . back to ?
$line =~ s/\\\./\./g; ##Convert \. to .
$line =~ s/\.\*/\*/g; ##Convert .* to *
}
my $count = $line =~ s/^([A-Z]):/$1:\t/g; if ($letters eq "" || (!$count || $letters =~ /$1/i)) {
print("$line\n");
}
}
print("\n");
}
}
maintainers_in_file($file);
}
if ($keywords) {
@keyword_tvi = sort_and_uniq(@keyword_tvi); foreach my $line (@keyword_tvi) {
add_categories($line, ":Keyword:$keyword_hash{$line}");
}
}
foreach my $email (@email_to, @list_to) {
$email->[0] = deduplicate_email($email->[0]);
}
foreach my $file (@files) { if ($email &&
($email_git ||
($email_git_fallback &&
$file !~ /MAINTAINERS$/ &&
!$exact_pattern_match_hash{$file}))) {
vcs_file_signoffs($file);
} if ($email && $email_git_blame) {
vcs_file_blame($file);
}
}
if ($email) { foreach my $chief (@penguin_chief) { if ($chief =~ m/^(.*):(.*)/) {
my $email_address;
MAINTAINER field selection options:
--email => print email address(es) if any
--git => include recent git \*-by: signers
--git-all-signature-types => include signers regardless of signature type
or use only ${signature_pattern} signers (default: $email_git_all_signature_types)
--git-fallback => use git when no exact MAINTAINERS pattern (default: $email_git_fallback)
--git-chief-penguins => include ${penguin_chiefs}
--git-min-signatures => number of signatures required (default: $email_git_min_signatures)
--git-max-maintainers => maximum maintainers to add (default: $email_git_max_maintainers)
--git-min-percent => minimum percentage of commits required (default: $email_git_min_percent)
--git-blame => use git blame to find modified commits for patch or file
--git-blame-signatures => when used with --git-blame, also includeall commit signers
--git-since => git history to use (default: $email_git_since)
--hg-since => hg history to use (default: $email_hg_since)
--interactive => display a menu (mostly useful if used with the --git option)
--m => include maintainer(s) if any
--r => include reviewer(s) if any
--n => include name 'Full Name '
--l => include list(s) if any
--moderated => include moderated lists(s) if any (default: true)
--s => include subscriber only list(s) if any (default: false)
--remove-duplicates => minimize duplicate email names/addresses
--roles => show roles (role:subsystem, git-signer, list, etc...)
--rolestats => show roles and statistics (commits/total_commits, %)
--substatus => show subsystem status if not Maintained (default: match --roles when output is tty)"
--file-emails => add email addresses found in -f file (default: 0 (off))
--fixes => for patches, add signatures of commits with 'Fixes: ' (default: 1 (on))
--scm => print SCM tree(s) if any
--status => print status if any
--subsystem => print subsystem name if any
--web => print website(s) if any
--bug => print bug reporting info if any
Output type options:
--separator [, ] => separator for multiple entries on 1 line
using --separator also sets --nomultiline if --separator is not [, ]
--multiline => print 1 entry per line
Other options:
--pattern-depth => Number of pattern directory traversals (default: 0 (all))
--keywords => scan patch for keywords (default: $keywords)
--keywords-in-file => scan file for keywords (default: $keywords_in_file)
--sections => print all of the subsystem sections with pattern matches
--letters => print all matching 'letter' types from all matching sections
--mailmap => use .mailmap file (default: $email_use_mailmap)
--no-tree => run without a kernel tree
--self-test => show potential issues with MAINTAINERS file content
--version => show version
--help => show this help information
Notes:
Using "-f directory" may give unexpected results:
Used with "--git", git signators for _all_ files in and below
directory are examined as git recurses directories.
Any specified X: (exclude) pattern matches are _not_ ignored.
Used with "--nogit", directory is used as a pattern match,
no individual file within the directory or subdirectory
is matched.
Used with "--git-blame", does not iterate all files in directory
Using "--git-blame" is slow and may add old committers and authors
that are no longer active maintainers to the output.
Using "--roles" or "--rolestats" with git send-email --cc-cmd or any
other automated tools that expect only ["name"] <email address>
may not work because of additional output after <email address>.
Using "--rolestats" and "--git-blame" shows the #/total=% commits,
not the percentage of the entire file authored. # of commits is
not a good measure of amount of code authored. 1 major commit may
contain a thousand lines, 5 trivial commits may modify a single line. If git is not installed, but mercurial (hg) is installed and an .hg
repository exists, the following options apply to mercurial:
--git,
--git-min-signatures, --git-max-maintainers, --git-min-percent, and
--git-blame
Use --hg-since not --git-since to control date selection
File ".get_maintainer.conf", if it exists in the linux kernel source root
directory, can change whatever get_maintainer defaults are desired.
Entries in this file can be any command line argument.
This file is prepended to any additional command line arguments.
Multiple lines and # comments are allowed.
Most options have both positive and negative forms.
The negative forms for --<foo> are --no<foo> and --no-<foo>.
my $i;
my $start = find_starting_index($index);
my $end = find_ending_index($index);
my $role = "maintainer";
my $subsystem = get_subsystem_name($index);
my $status = "unknown";
for ($i = $start + 1; $i < $end; $i++) {
my $tv = $typevalue[$i]; if ($tv =~ m/^([A-Z]):\s*(.*)/) {
my $ptype = $1;
my $pvalue = $2; if ($ptype eq "S") {
$status = $pvalue;
}
}
}
$status = lc($status); if ($status eq "buried alive in reporters") {
$role = "chief penguin";
}
return $role . ":" . $subsystem;
}
sub get_list_role {
my ($index) = @_;
my $subsystem = get_subsystem_name($index);
if ($subsystem eq "THE REST") {
$subsystem = "";
}
return $subsystem;
}
sub add_categories {
my ($index, $suffix) = @_;
my $i;
my $start = find_starting_index($index);
my $end = find_ending_index($index);
my $subsystem = $typevalue[$start];
push(@subsystem, $subsystem);
my $status = "Unknown";
for ($i = $start + 1; $i < $end; $i++) {
my $tv = $typevalue[$i]; if ($tv =~ m/^([A-Z]):\s*(.*)/) {
my $ptype = $1;
my $pvalue = $2; if ($ptype eq "L") {
my $list_address = $pvalue;
my $list_additional = "";
my $list_role = get_list_role($i);
sub vcs_is_git {
vcs_exists();
return $vcs_used == 1;
}
sub vcs_is_hg {
return $vcs_used == 2;
}
sub vcs_add_commit_signers {
return if (!vcs_exists());
my ($commit, $desc) = @_;
my $commit_count = 0;
my $commit_authors_ref;
my $commit_signers_ref;
my $stats_ref;
my @commit_authors = ();
my @commit_signers = ();
my $cmd;
$cmd = $VCS_cmds{"find_commit_signers_cmd"};
$cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, "");
@commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref;
@commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref;
foreach my $signer (@commit_signers) {
$signer = deduplicate_email($signer);
}
vcs_assign($desc, 1, @commit_signers);
}
sub interactive_get_maintainers {
my ($list_ref) = @_;
my @list = @$list_ref;
vcs_exists();
my %selected;
my %authored;
my %signed;
my $count = 0;
my $maintained = 0; foreach my $entry (@list) {
$maintained = 1 if ($entry->[1] =~ /^(maintainer|supporter)/i);
$selected{$count} = 1;
$authored{$count} = 0;
$signed{$count} = 0;
$count++;
}
#menu loop
my $done = 0;
my $print_options = 0;
my $redraw = 1; while (!$done) {
$count = 0; if ($redraw) {
printf STDERR "\n%1s %2s %-65s", "*", "#", "email/list and role:stats"; if ($email_git ||
($email_git_fallback && !$maintained) ||
$email_git_blame) {
print STDERR "auth sign";
}
print STDERR "\n"; foreach my $entry (@list) {
my $email = $entry->[0];
my $role = $entry->[1];
my $sel = "";
$sel = "*"if ($selected{$count});
my $commit_author = $commit_author_hash{$email};
my $commit_signer = $commit_signer_hash{$email};
my $authored = 0;
my $signed = 0;
$authored++ for (@{$commit_author});
$signed++ for (@{$commit_signer});
printf STDERR "%1s %2d %-65s", $sel, $count + 1, $email;
printf STDERR "%4d %4d", $authored, $signed if ($authored > 0 || $signed > 0);
printf STDERR "\n %s\n", $role; if ($authored{$count}) {
my $commit_author = $commit_author_hash{$email}; foreach my $ref (@{$commit_author}) {
print STDERR " Author: @{$ref}[1]\n";
}
} if ($signed{$count}) {
my $commit_signer = $commit_signer_hash{$email}; foreach my $ref (@{$commit_signer}) {
print STDERR " @{$ref}[2]: @{$ref}[1]\n";
}
}
$count++;
}
}
my $date_ref = \$email_git_since;
$date_ref = \$email_hg_since if (vcs_is_hg()); if ($print_options) {
$print_options = 0; if (vcs_exists()) {
print STDERR <<EOT
Version Control options:
g use git history [$email_git]
gf use git-fallback [$email_git_fallback]
b use git blame [$email_git_blame]
bs use blame signatures [$email_git_blame_signatures]
c# minimum commits [$email_git_min_signatures]
%# min percent [$email_git_min_percent]
d# history to use [$$date_ref]
x# max maintainers [$email_git_max_maintainers]
t all signature types [$email_git_all_signature_types]
m use .mailmap [$email_use_mailmap]
EOT
}
print STDERR <<EOT
Additional options:
0 toggle all
tm toggle maintainers
tg toggle git entries
tl toggle open list entries
ts toggle subscriber list entries
f emails in file [$email_file_emails]
k keywords in file [$keywords]
r remove duplicates [$email_remove_duplicates]
p# pattern match depth [$pattern_depth]
EOT
}
print STDERR "\n#(toggle), A#(author), S#(signed) *(all), ^(none), O(options), Y(approve): ";
my $input = <STDIN>;
chomp($input);
$redraw = 1;
my $rerun = 0;
my @wish = split(/[, ]+/, $input); foreach my $nr (@wish) {
$nr = lc($nr);
my $sel = substr($nr, 0, 1);
my $str = substr($nr, 1);
my $val = 0;
$val = $1 if $str =~ /^(\d+)$/;
Interactive mode allows you to select the various maintainers, submitters,
commit signers and mailing lists that could be CC'd on a patch.
Any *'d entry is selected.
If you have git or hg installed, you can choose to summarize the commit
history of files in the patch. Also, each line of the current file can
be matched to its commit author and that commits signers with blame.
Various knobs exist to control the length of time for active commit
tracking, the maximum number of commit authors and signers to add,
and such.
Enter selections at the prompt until you are satisfied that the selected
maintainers are appropriate. You may enter multiple selections separated
by either commas or spaces.
EOT
} else {
print STDERR "invalid option: '$nr'\n";
$redraw = 0;
}
} if ($rerun) {
print STDERR "git-blame can be very slow, please have patience..." if ($email_git_blame);
goto &get_maintainers;
}
}
#drop not selected entries
$count = 0;
my @new_emailto = (); foreach my $entry (@list) { if ($selected{$count}) {
push(@new_emailto, $list[$count]);
}
$count++;
}
return @new_emailto;
}
if ($email_git_blame_signatures) { if (vcs_is_hg()) {
my $commit_count;
my $commit_authors_ref;
my $commit_signers_ref;
my $stats_ref;
my @commit_authors = ();
my @commit_signers = ();
my $commit = join(" -r ", @commits);
my $cmd;
$cmd = $VCS_cmds{"find_commit_signers_cmd"};
$cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, $file);
@commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref;
@commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref;
push(@signers, @commit_signers);
} else { foreach my $commit (@commits) {
my $commit_count;
my $commit_authors_ref;
my $commit_signers_ref;
my $stats_ref;
my @commit_authors = ();
my @commit_signers = ();
my $cmd;
$cmd = $VCS_cmds{"find_commit_signers_cmd"};
$cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
($commit_count, $commit_signers_ref, $commit_authors_ref, $stats_ref) = vcs_find_signers($cmd, $file);
@commit_authors = @{$commit_authors_ref} if defined $commit_authors_ref;
@commit_signers = @{$commit_signers_ref} if defined $commit_signers_ref;
push(@signers, @commit_signers);
}
}
}
if ($from_filename) { if ($output_rolestats) {
my @blame_signers; if (vcs_is_hg()) {{ # Double brace for last exit
my $commit_count;
my @commit_signers = ();
@commits = uniq(@commits);
@commits = sort(@commits);
my $commit = join(" -r ", @commits);
my $cmd;
$cmd = $VCS_cmds{"find_commit_author_cmd"};
$cmd =~ s/(\$\w+)/$1/eeg; #substitute variables in $cmd
my @lines = ();
@lines = &{$VCS_cmds{"execute_cmd"}}($cmd);
if (!$email_git_penguin_chiefs) {
@lines = grep(!/${penguin_chiefs}/i, @lines);
}
last if !@lines;
my @authors = (); foreach my $line (@lines) { if ($line =~ m/$VCS_cmds{"author_pattern"}/) {
my $author = $1;
$author = deduplicate_email($author);
push(@authors, $author);
}
}
save_commits_by_author(@lines) if ($interactive);
save_commits_by_signer(@lines) if ($interactive);
push(@signers, @authors);
}} else { foreach my $commit (@commits) {
my $i;
my $cmd = $VCS_cmds{"find_commit_author_cmd"};
$cmd =~ s/(\$\w+)/$1/eeg; #interpolate $cmd
my @author = vcs_find_author($cmd);
next if !@author;
my $formatted_author = deduplicate_email($author[0]);
sub clean_file_emails {
my (@file_emails) = @_;
my @fmt_emails = ();
foreach my $email (@file_emails) {
$email =~ s/[\(\<\{]{0,1}([A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+)[\)\>\}]{0,1}/\<$1\>/g;
my ($name, $address) = parse_email($email);
# Strip quotes for easier processing, format_email will add them back
$name =~ s/^"(.*)"$/$1/;
# Split into name-like parts and remove stray punctuation particles
my @nw = split(/[^\p{L}\'\,\.\+-]/, $name);
@nw = grep(!/^[\'\,\.\+-]$/, @nw);
# Make a best effort to extract the name, and only the name, by taking # only the last two names, or in the case of obvious initials, the last # three names. if (@nw > 2) {
my $first = $nw[@nw - 3];
my $middle = $nw[@nw - 2];
--> --------------------
--> maximum size reached
--> --------------------
¤ Dauer der Verarbeitung: 0.31 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.