forked from elkuku/EasyCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangelogger.php
56 lines (39 loc) · 1.09 KB
/
changelogger.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @package EasyCreator
* @subpackage Helpers.others
* @author Nikolai Plath (elkuku)
* @author Created on 03-Feb-2012
* @license GNU/GPL, see JROOT/LICENSE.php
*/
$output = shell_exec('git tag');
$tags = explode("\n", trim($output));
$tags = array_reverse($tags);
$lastTag = '';
$contents = array();
foreach($tags as $tag)
{
$output = shell_exec('git log '.$tag.'..'.$lastTag.' --pretty=format:\'%h %ad %an: %s\' --date=short');
$lastTag = $tag;
$lines = explode("\n", $output);
$actDate = '';
foreach($lines as $line)
{
$sha = substr($line, 0, 8);
$date = substr($line, 8, 10);
$message = substr($line, 19);
//-- Remove myself =;)
$message = str_replace('Nikolai Plath: ', '', $message);
if($date != $actDate)
{
$contents[] = '';
$contents[] = $date;
$actDate = $date;
}
$contents[] = $sha.$message;
}
$contents[] = '';
$contents[] = '---------- '.$tag.' ----------';
}
echo implode("\n", $contents);
echo "\n\n".'finished =;)';