Skip to content

Instantly share code, notes, and snippets.

@co3k
Created February 25, 2010 10:11
Show Gist options
  • Save co3k/314434 to your computer and use it in GitHub Desktop.
Save co3k/314434 to your computer and use it in GitHub Desktop.
<?php
set_include_path(get_include_path().PATH_SEPARATOR.'/home/co3k/develop/VersionControl_Git/');
require_once 'VersionControl/Git.php';
$svnToGit = array(
'ebihara <ebihara@8bbc783d-d51a-0410-adab-8fa69d43f207>' => 'Kousuke Ebihara <[email protected]>',
'nagasawa <nagasawa@8bbc783d-d51a-0410-adab-8fa69d43f207>' => 'Masato Nagasawa <[email protected]>',
'shingo <shingo@8bbc783d-d51a-0410-adab-8fa69d43f207>' => 'Shingo Yamada <[email protected]>',
'fukamachi <fukamachi@8bbc783d-d51a-0410-adab-8fa69d43f207>' => 'fukamachi <[email protected]>',
'kawahara <kawahara@8bbc783d-d51a-0410-adab-8fa69d43f207>' => 'Shogo Kawahara <[email protected]>',
'urabe <urabe@8bbc783d-d51a-0410-adab-8fa69d43f207>' => 'Shinichi Urabe <[email protected]>',
'urabe <[email protected]>' => 'Shinichi Urabe <[email protected]>',
'nothan <[email protected]>' => 'Masato Nagasawa <[email protected]>',
'ogawa <ogawa@8bbc783d-d51a-0410-adab-8fa69d43f207>' => 'Rimpei Ogawa <[email protected]>',
);
$repopath = './OpenPNE3';
$repo = new VersionControl_Git($repopath);
$revlist = $repo->getRevListFetcher();
$commits = $revlist->fetch();
$authors = array();
foreach ($commits as $commit)
{
$authors[] = $commit->getAuthor();
}
$authors = array_unique($authors);
$ranking = array();
foreach ($authors as $author)
{
$revlist->setOption('author', $author);
$count = count($revlist->fetch());
$_author = $author;
if (isset($svnToGit[$_author]))
{
$_author = $svnToGit[$_author];
}
if (empty($ranking[$_author]))
{
$ranking[$_author] = 0;
}
$ranking[$_author] += $count;
}
arsort($ranking);
$i = 1;
foreach ($ranking as $author => $rank)
{
echo $i.'位 ('.$rank.'回)'."\t".$author.PHP_EOL;
$i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment