Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 11 additions & 30 deletions review-tools/gitaddrev
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ my $authorcount = 0;
# $min_authors is special in so far that 0 denotes that authors MUST NOT
# be counted as reviewers. For all other values, it works as a minimum.
my $min_authors = 0; # Main source default
my $otccount = 0;
my $min_otc = 0; # Main source default
my $omccount = 0;
my $min_omc = 0; # Main source default
my $author = $ENV{GIT_AUTHOR_EMAIL};
my $authorrev = $query->find_person_tag($author, 'rev');

Expand All @@ -65,8 +61,6 @@ sub try_add_reviewer {
}
if ($rc && !(grep {$_ eq $rc} @reviewers)) {
$authorcount++ if is_author($rc);
$otccount++ if $query->is_member_of($id2, 'otc');
$omccount++ if $query->is_member_of($id2, 'omc');
# Authors don't get Reviewed-by trailers
push @reviewers, $rc unless is_author($rc);
}
Expand All @@ -93,27 +87,31 @@ foreach (@ARGV) {
my $email_id = (grep { ref($_) eq "" && $_ =~ m|\@| } @$_)[0];
my $rev = $query->find_person_tag($email_id, 'rev');
next unless defined $rev;
my $otc = $query->is_member_of($email_id, 'otc');
next unless $query->has_cla(lc $rev);
next unless $query->is_member_of($email_id, 'commit') || $otc;
next unless $query->is_member_of($email_id, 'commit');
my @ids =
sort grep { $_ =~ /^[a-z]+$/ || $_ =~ /^\@(?:\w|\w-\w)+$/ }
sort grep { $_ =~ /^[A-Za-z]+$/ || $_ =~ /^\@(?:\w|\w-\w)+$/ }
map {
if (ref($_) eq "HASH") {
my %h = %$_;
map { $_ eq "github" ? '@'.$h{$_} : $h{$_} } keys %h;
map {
if ($_ eq "github" || $_ eq "ghe") {
'@'.$h{$_};
} else {
$h{$_};
}
} keys %h;
} else {
$_;
}
} @$_;
foreach (@ids) {
$list{$_} = { tag => $rev, otc => $otc };
$list{$_} = { tag => $rev };
}
}
foreach (sort { my $res = $list{$a}->{tag} cmp $list{$b}->{tag};
$res != 0 ? $res : ($a cmp $b) } keys %list) {
printf "%-15s %-6s (%s)\n",
$_, $list{$_}->{otc} ? "[OTC]" : "", $list{$_}->{tag};
printf "%-15s (%s)\n", $_, $list{$_}->{tag};
}
exit 0;
} elsif (/^--reviewer=(.+)$/) {
Expand All @@ -132,27 +130,16 @@ foreach (@ARGV) {
} elsif (/--tools$/) {
$WHAT = 'tools';
$min_authors = 1;
# openssl/tools is governed by OTC
$min_otc = 0;
$min_omc = 0;
} elsif (/--fuzz-corpora$/) {
$WHAT = 'fuzz-corpora';
$min_authors = 1;
$min_reviewers = 1;
# openssl/fuzz-corpora is governed by OTC
$min_otc = 0;
$min_omc = 0;
} elsif (/--perftools$/) {
$WHAT = 'perftools';
$min_authors = 1;
$min_otc = 0;
$min_omc = 0;
} elsif (/--installer$/) {
$WHAT = 'installer';
$min_authors = 1;
# openssl/installer is governed by OTC
$min_otc = 0;
$min_omc = 0;
} elsif (/^--release$/) {
$release = 1;
}
Expand Down Expand Up @@ -188,12 +175,6 @@ if (scalar @reviewers < $min_reviewers - $authorcount) {
die "Too few reviewers (total must be at least ",
$min_reviewers - $authorcount, ")\n";
}
if ($otccount < $min_otc) {
die "At least one of the reviewers must be an OTC member\n";
}
if ($omccount < $min_omc) {
die "At least one of the reviewers must be an OMC member\n";
}

print STDERR "Going with these reviewers:\n ", join("\n ", @reviewers), "\n"
if $verbose;
Expand Down