#!/usr/bin/perl
=pod
update-authors.pl is part of Atril.
Atril is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Atril is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Atril. If not, see .
=cut
use strict;
use warnings;
sub ReplaceAuthors {
my @authors = @_;
$_ eq 'Alexander ' and $_ = 'Alexander Ovchinnikov ' for @authors;
$_ eq 'bl0ckeduser ' and $_ = 'Gabriel Cormier-Affleck ' for @authors;
$_ eq 'Glorf ' and $_ = 'Michał Bień ' for @authors;
$_ eq 'hekel ' and $_ = 'Adam Erdman ' for @authors;
$_ eq 'infirit ' and $_ = 'Sander Sweers ' for @authors;
$_ eq 'Jason Crain ' and $_ = 'Jason Crain ' for @authors;
$_ eq 'José Aliste ' and $_ = 'José Aliste ' for @authors;
$_ eq 'leigh123linux ' and $_ = 'Leigh Scott ' for @authors;
$_ eq 'lyokha ' and $_ = 'Alexey Radkov ' for @authors;
$_ eq 'Martin Wimpress ' and $_ = 'Martin Wimpress ' for @authors;
$_ eq 'monsta ' and $_ = 'Vlad Orlov ' for @authors;
$_ eq 'Monsta ' and $_ = 'Vlad Orlov ' for @authors;
$_ eq 'oz123 ' and $_ = 'Oz N Tiram ' for @authors;
$_ eq 'Piiit ' and $_ = 'Peter Moser ' for @authors;
$_ eq 'rootavish ' and $_ = 'Avishkar Gupta ' for @authors;
$_ eq 'rootavish ' and $_ = 'Avishkar Gupta ' for @authors;
$_ eq 'raveit ' and $_ = 'Wolfgang Ulbrich ' for @authors;
$_ eq 'raveit65 ' and $_ = 'Wolfgang Ulbrich ' for @authors;
$_ eq 'raveit65 ' and $_ = 'Wolfgang Ulbrich ' for @authors;
$_ eq 'rbuj ' and $_ = 'Robert Buj ' for @authors;
$_ eq 'Scott Balneaves ' and $_ = 'Scott Balneaves ' for @authors;
$_ eq 'Wolfgang Ulbrich ' and $_ = 'Wolfgang Ulbrich ' for @authors;
$_ eq 'Wu Xiaotian ' and $_ = 'Wu Xiaotian ' for @authors;
$_ eq 'ZenWalker ' and $_ = 'Pablo Barciela ' for @authors;
return @authors;
}
sub GetCurrentAuthors {
my @authors;
open(FILE,"shell/atril.about") or die "Can't open shell/atril.about";
while () {
if (/^Authors=*(.+)$/) {
@authors=split(";",$1);
}
}
close FILE;
return ReplaceAuthors(@authors);
}
sub GetNewAuthors {
my @authors = `git log --pretty="%an <%ae>" --since "2012-01-01" -- . "_.h" "_.c" | sort | uniq | sed 's/@/%/g' | sed '/^mate-i18n.*/d'`;
chomp @authors;
return ReplaceAuthors(@authors);
}
my @A = GetCurrentAuthors;
my @B = GetNewAuthors;
for (@B) {
s/<\d+\+(.+?)%users\.noreply\.github\.com>/<$1%users\.noreply\.github\.com>/;
s/<(.+?)%users\.noreply\.github\.com>/https:\/\/github.com\/$1/;
}
my @merged = sort { $a cmp $b } keys %{{map {($_ => 1)} (@A, @B)}};
print join(';',@merged) . ';';