@@ -22,6 +22,9 @@ package App::Porting::updateAUTHORS;
22
22
mailmap_file=s
23
23
24
24
verbose+
25
+ exclude_missing|exclude
26
+ exclude_contrib=s@
27
+ exclude_me
25
28
26
29
from_commit|from=s
27
30
to_commit|to=s
@@ -30,10 +33,12 @@ package App::Porting::updateAUTHORS;
30
33
sub main {
31
34
local $Data::Dumper::Sortkeys = 1;
32
35
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 => [],
37
42
);
38
43
39
44
# # Parse options and print usage if there is a syntax error,
@@ -58,6 +63,20 @@ sub main {
58
63
pod2usage(1) if $opts {help };
59
64
pod2usage(-verbose => 2) if $opts {man };
60
65
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
+
61
80
my $self = Porting::updateAUTHORS-> new(%opts );
62
81
63
82
my $changed = $self -> read_and_update();
@@ -73,7 +92,7 @@ sub main {
73
92
=head1 NAME
74
93
75
94
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.
77
96
78
97
=head1 SYNOPSIS
79
98
@@ -96,6 +115,15 @@ =head1 SYNOPSIS
96
115
--authors-file=FILE override default of 'AUTHORS'
97
116
--mailmap-file=FILE override default of '.mailmap'
98
117
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
+
99
127
=head1 OPTIONS
100
128
101
129
=over 4
@@ -126,6 +154,60 @@ =head1 OPTIONS
126
154
Override the default location of the mailmap file, which is by default
127
155
the F<.mailmap> file in the current directory.
128
156
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
+
129
211
=back
130
212
131
213
=head1 DESCRIPTION
0 commit comments