Skip to content

Commit f8efc99

Browse files
demerphqBram
authored andcommitted
updateAUTHORS.p[lm] - add exclusion support
This add a new file Porting/exclude_contrib.txt to hold a list of base64 SHA-256 digests of the user name and email who should be excluded. This adds the options --exclude-me --exclude-contrib=NAME_AND_EMAIL --exclude-missing to add exclusions in different ways. --exclude-me uses the git credentials for the current user, --exclude-contrib expects a name and email, and --exclude-missing excludes someone who is missing from the change log. When excluding someone their name will be removed from AUTHORS if it is already listed, and the relevant entries to .mailmap will be removed, and if necessary additional exclusion entries will be added for any of their old identities which were mentioned in .mailmap. This feature will be used in a later patch to resolve GH issue Perl#20010.
1 parent ff1a581 commit f8efc99

File tree

6 files changed

+379
-39
lines changed

6 files changed

+379
-39
lines changed

.mailmap

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
# Each line specifies the canonical name and email for a developer
77
# and mapping data from other names and email addresses.
88
#
9-
# Every developer who has worked on the project should have at least
10-
# one entry in this file, and should have one entry per every distinct
11-
# name/email combination they have used while working on the project.
12-
#
139
# The mapping works from *right* to *left*, that is the definition
1410
# on the left specifies the "preferred email", the definition on the
1511
# right specifies the "other email". The "preferred email" is what
@@ -53,8 +49,7 @@
5349
# Please do NOT add comments after the header block.
5450
#
5551
# See also: https://git-scm.com/docs/gitmailmap
56-
# However be aware, we do not support all the forms that git does. We
57-
# want to have one entry per actually use author/commit data.
52+
# However be aware, we do not support all the forms that git does.
5853
#
5954
########################################################################
6055
A. C. Yardley <[email protected]> A. C. Yardley <[email protected]>

MANIFEST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5412,6 +5412,7 @@ Porting/corelist-perldelta.pl Generates data perldelta from Module::CoreList
54125412
Porting/deparse-skips.txt List of test files to ignore/skip for deparse tests.
54135413
Porting/docs-team-charter.pod Perl Documentation Team charter
54145414
Porting/epigraphs.pod the release epigraphs used over the years
5415+
Porting/exclude_contrib.txt Data about contributors that do not want to be listed in AUTHORS
54155416
Porting/exec-bit.txt List of files that get +x in release tarball
54165417
Porting/exercise_makedef.pl Brute force testing for makedef.pl
54175418
Porting/expand-macro.pl A tool to expand C macro definitions in the Perl source

Porting/README.pod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ The charter of the Perl Documentation Team
146146

147147
List of Perl release epigraphs.
148148

149+
=head2 F<exclude_contrib.txt>
150+
151+
List of base 64 encoded SHA256 digests of C<< "name <email>" >> data
152+
which should be ignored by F<updateAUTHORS.pl>.
153+
149154
=head2 F<exec-bit.txt>
150155

151156
This file contains a list of files that F<makerel> will ensure get an
@@ -403,4 +408,3 @@ leaks.
403408
Guide for Vote Administrators for running Steering Council elections.
404409

405410
=cut
406-

Porting/exclude_contrib.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
##########################################################################
2+
# This file is managed by `Porting/updateAUTHORS.pl`
3+
#
4+
# It contains the base 64 SHA-256 of the name and email details of the
5+
# contributors who have requested that their gracious contributions go
6+
# unnoted in our AUTHORS file, and who choose not to be listed in our
7+
# .mailmap files either.
8+
#
9+
# For example the user details
10+
#
11+
12+
#
13+
# would be excluded via entry
14+
#
15+
# UkM6tKuf79Ra0HH7wQj6YUXumpjWy6Qd3aB5+HoNoGM
16+
#
17+
# To update this file you should use one of the --exclude options to
18+
# `Porting/updateAUTHORS.pl`, but if you *must* manually edit it then make
19+
# sure you run the tool afterwards to ensure it is correctly formatted and
20+
# sorted.
21+
##########################################################################

Porting/updateAUTHORS.pl

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ package App::Porting::updateAUTHORS;
2222
mailmap_file=s
2323
2424
verbose+
25+
exclude_missing|exclude
26+
exclude_contrib=s@
27+
exclude_me
2528
2629
from_commit|from=s
2730
to_commit|to=s
@@ -32,8 +35,10 @@ sub main {
3235
my %opts= (
3336
authors_file => "AUTHORS",
3437
mailmap_file => ".mailmap",
38+
exclude_file => "Porting/exclude_contrib.txt",
3539
from => "",
3640
to => "",
41+
exclude_contrib => [],
3742
);
3843

3944
## Parse options and print usage if there is a syntax error,
@@ -58,6 +63,17 @@ sub main {
5863
pod2usage(1) if $opts{help};
5964
pod2usage(-verbose => 2) if $opts{man};
6065

66+
if (delete $opts{exclude_me}) {
67+
my ($author_full)= Porting::updateAUTHORS->current_author_name_email("full");
68+
my ($committer_full)= Porting::updateAUTHORS->current_committer_name_email("full");
69+
70+
push @{$opts{exclude_contrib}}, $author_full
71+
if $author_full;
72+
push @{$opts{exclude_contrib}}, $committer_full
73+
if $committer_full and (!$author_full or
74+
$committer_full ne $author_full);
75+
}
76+
6177
my $self= Porting::updateAUTHORS->new(%opts);
6278

6379
my $changed= $self->read_and_update();
@@ -73,7 +89,7 @@ sub main {
7389
=head1 NAME
7490
7591
F<Porting/updateAUTHORS.pl> - Automatically update F<AUTHORS> and F<.mailmap>
76-
based on commit data.
92+
and F<Porting/exclude_contrib.txt> based on commit data.
7793
7894
=head1 SYNOPSIS
7995
@@ -96,6 +112,15 @@ =head1 SYNOPSIS
96112
--authors-file=FILE override default of 'AUTHORS'
97113
--mailmap-file=FILE override default of '.mailmap'
98114
115+
Action Modifiers
116+
--exclude-missing Add new names to the exclude file so they never
117+
appear in AUTHORS or .mailmap.
118+
119+
Details Changes
120+
Update canonical name or email in AUTHORS and .mailmap properly.
121+
--exclude-contrib NAME_AND_EMAIL
122+
--exclude-me
123+
99124
=head1 OPTIONS
100125
101126
=over 4
@@ -126,6 +151,60 @@ =head1 OPTIONS
126151
Override the default location of the mailmap file, which is by default
127152
the F<.mailmap> file in the current directory.
128153
154+
=item C<--exclude-file=FILE>
155+
156+
=item C<--exclude_file=FILE>
157+
158+
Override the default location of the exclude file, which is by default
159+
the F<Porting/exclude_contrib.txt> file reachable from the current
160+
directory.
161+
162+
=item C<--exclude-contrib=NAME_AND_EMAIL>
163+
164+
=item C<--exclude_contrib=NAME_AND_EMAIL>
165+
166+
Exclude a specific name/email combination from our contributor datasets.
167+
Can be repeated multiple times on the command line to remove multiple
168+
items at once. If the contributor details correspond to a canonical
169+
identity of a contributor (one that is in the AUTHORS file or on the
170+
left in the .mailmap file) then ALL records, including those linked to
171+
that identity in .mailmap will be marked for exclusion. This is similar
172+
to C<--exclude-missing> but it only affects the specifically named
173+
users. Note that the format for NAME_AND_EMAIL is similar to that of the
174+
.mailmap file, email addresses and C< @github > style identifiers should
175+
be wrapped in angle brackets like this: C<< <@github> >>, users with no
176+
email in the AUTHORS file should use C<< <unknown> >>.
177+
178+
For example:
179+
180+
Porting/updateAUTHORS.pl --exclude-contrib="Joe B <[email protected]>"
181+
182+
Would remove all references to "Joe B" from F<AUTHORS> and F<.mailmap>
183+
and add the required entires to F<Porting/exclude_contrib.txt> such that
184+
the contributor would never be automatically added back, and would be
185+
automatically removed should someone read them manually.
186+
187+
=item C<--exclude-missing>
188+
189+
=item C<--exclude_missing>
190+
191+
=item C<--exclude>
192+
193+
Normally when the tool is run it *adds* missing data only. If this
194+
option is set then the reverse will happen, any author data missing will
195+
be marked as intentionally missing in such a way that future "normal"
196+
runs of the script ignore the author(s) that were excluded.
197+
198+
The exclude data is stored in F<Porting/exclude_contrib.txt> as a SHA256
199+
digest (in base 64) of the user name and email being excluded so that
200+
the list itself doesnt contain the contributor details in plain text.
201+
202+
The general idea is that if you want to remove someone from F<AUTHORS>
203+
and F<.mailmap> you delete their details manually, and then run this
204+
tool with the C<--exclude> option. It is probably a good idea to run it
205+
first without any arguments to make sure you dont exclude something or
206+
someone you did not intend to.
207+
129208
=back
130209
131210
=head1 DESCRIPTION

0 commit comments

Comments
 (0)