mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2026-08-26 22:23:12 -04:00
get_maintainer: add ability to report Git Lab handle
With the GitLab mapping files from the previous commit, the get_manitainer.pl script is now able to report the gitlab handle for each maintainer/reviewer when displaying output. For example: $ ./scripts/get_maintainer.pl -f hw/scsi/lsi53c895a.c Paolo Bonzini <pbonzini@redhat.com> (supporter:SCSI, gitlab:@bonzini) Fam Zheng <fam@euphon.net> (reviewer:SCSI, gitlab:@famzheng) qemu-devel@nongnu.org (open list:All patches CC here) Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
4f7615789b
commit
84a6c5f94b
1 changed files with 49 additions and 4 deletions
|
|
@ -365,6 +365,31 @@ sub read_mailmap {
|
|||
close($mailmap_file);
|
||||
}
|
||||
|
||||
my %gitlabmap;
|
||||
|
||||
read_gitlabmap(".gitlab-map-auto");
|
||||
read_gitlabmap(".gitlab-map-manual");
|
||||
|
||||
sub read_gitlabmap {
|
||||
my $mapfile = shift;
|
||||
open MAP, "<$mapfile"
|
||||
or die "cannot open $mapfile: $!";
|
||||
|
||||
while (<MAP>) {
|
||||
next if /^#/;
|
||||
next if /^\s*$/;
|
||||
|
||||
if (/^(\S+)\t(.*)$/) {
|
||||
my $handle = $1;
|
||||
my $realname = $2;
|
||||
|
||||
$gitlabmap{$realname} = $handle;
|
||||
}
|
||||
}
|
||||
|
||||
close MAP;
|
||||
}
|
||||
|
||||
## use the filenames on the command line or find the filenames in the patchfiles
|
||||
|
||||
my @files = ();
|
||||
|
|
@ -1068,6 +1093,18 @@ sub email_inuse {
|
|||
return 0;
|
||||
}
|
||||
|
||||
sub gitlab_handle {
|
||||
my $name = shift;
|
||||
|
||||
$name =~ s/"//g;
|
||||
|
||||
my $gitlab_handle;
|
||||
if (exists $gitlabmap{$name}) {
|
||||
return $gitlabmap{$name};
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub push_email_address {
|
||||
my ($line, $role) = @_;
|
||||
|
||||
|
|
@ -1077,10 +1114,14 @@ sub push_email_address {
|
|||
return 0;
|
||||
}
|
||||
|
||||
my $gitlab_handle = gitlab_handle($name);
|
||||
|
||||
if (!$email_remove_duplicates) {
|
||||
push(@email_to, [format_email($name, $address, $email_usename), $role]);
|
||||
push(@email_to, [format_email($name, $address, $email_usename),
|
||||
$role, $gitlab_handle]);
|
||||
} elsif (!email_inuse($name, $address)) {
|
||||
push(@email_to, [format_email($name, $address, $email_usename), $role]);
|
||||
push(@email_to, [format_email($name, $address, $email_usename),
|
||||
$role, $gitlab_handle]);
|
||||
$email_hash_name{lc($name)}++ if ($name ne "");
|
||||
$email_hash_address{lc($address)}++;
|
||||
}
|
||||
|
|
@ -2026,10 +2067,14 @@ sub merge_email {
|
|||
my %saw;
|
||||
|
||||
for (@_) {
|
||||
my ($address, $role) = @$_;
|
||||
my ($address, $role, $gitlab_handle) = @$_;
|
||||
if (!$saw{$address}) {
|
||||
if ($output_roles) {
|
||||
push(@lines, "$address ($role)");
|
||||
if (defined $gitlab_handle) {
|
||||
push(@lines, "$address ($role, gitlab:\@$gitlab_handle)");
|
||||
} else {
|
||||
push(@lines, "$address ($role)");
|
||||
}
|
||||
} else {
|
||||
push(@lines, $address);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue