· 8 years ago · Jan 24, 2018, 05:34 AM
1<?php
2
3$authors = `svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq`;
4
5$known = array(
6 '(no author)' => 'nobody <nobody@cebe.cc>',
7 'alexander.makarow' => 'samdark <sam@rmcreative.ru>',
8);
9
10
11$found = array();
12
13$authors = explode("\n", $authors);
14foreach($authors as $author) {
15 $author = trim($author);
16 if (empty($author)) {
17 continue;
18 }
19 $key = $author;
20 if (substr($author, -10, 10) == '@gmail.com') {
21 $author = substr($author, 0, -10);
22 }
23 if (isset($known[$author])) {
24 $found[$key] = $known[$author];
25 } elseif (($pos = strpos($author, '@')) !== false) {
26 $found[$key] = substr($author, 0, $pos) . ' <' . $author . '>';
27 } else {
28 $found[$key] = $author . ' <' . $author . '@gmail.com>';
29 }
30}
31
32foreach($found as $old => $new) {
33 echo $old . ' = ' . $new . "\n";
34}