Skip to content

Commit 18571d8

Browse files
committed
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 #20010.
1 parent 3b21e9b commit 18571d8

File tree

6 files changed

+387
-43
lines changed

6 files changed

+387
-43
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: 87 additions & 5 deletions
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
@@ -30,10 +33,12 @@ package App::Porting::updateAUTHORS;
3033
sub main {
3134
local $Data::Dumper::Sortkeys= 1;
3235
my %opts= (
33-
authors_file => "AUTHORS",
34-
mailmap_file => ".mailmap",
35-
from => "",
36-
to => "",
36+
authors_file => "AUTHORS",
37+
mailmap_file => ".mailmap",
38+
exclude_file => "Porting/exclude_contrib.txt",
39+
from => "",
40+
to => "",
41+
exclude_contrib => [],
3742
);
3843

3944
## Parse options and print usage if there is a syntax error,
@@ -58,6 +63,20 @@ 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)=
68+
Porting::updateAUTHORS->current_author_name_email("full");
69+
my ($committer_full)=
70+
Porting::updateAUTHORS->current_committer_name_email("full");
71+
72+
push @{ $opts{exclude_contrib} }, $author_full
73+
if $author_full;
74+
push @{ $opts{exclude_contrib} }, $committer_full
75+
if $committer_full
76+
and (!$author_full
77+
or $committer_full ne $author_full);
78+
}
79+
6180
my $self= Porting::updateAUTHORS->new(%opts);
6281

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

0 commit comments

Comments
 (0)