Skip to content

Commit

Permalink
Updated 'phing changelog' to work with new commit tags
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu authored and Sam Minnee committed Jun 26, 2012
1 parent 17303c6 commit 1ca61a5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tools/CreateChangelog.php
Expand Up @@ -18,11 +18,10 @@ class CreateChangelog extends SilverStripeBuildTask {
* Order of the array keys determines order of the lists.
*/
public $types = array(
'API Changes' => array('/^API CHANGE:?/i','/^APICHANGE?:?/i'),
'Features and Enhancements' => array('/^(ENHANCEMENT|ENHNACEMENT):?/i', '/^FEATURE:?/i'),
'Bugfixes' => array('/^(BUGFIX|BUGFUX):?/i','/^BUG FIX:?/i'),
'Minor changes' => array('/^MINOR:?/i'),
'Other' => array('/^[^A-Z][^A-Z][^A-Z]/') // dirty trick: check for uppercase characters
'API Changes' => array('/^(APICHANGE|API-CHANGE|API CHANGE|API)\s?:?/i'),
'Features and Enhancements' => array('/^(ENHANCEMENT|ENHNACEMENT|FEATURE|NEW)\s?:?/i'),
'Bugfixes' => array('/^(BUGFIX|BUGFUX|BUG)\s?:?/i','/^(BUG FIX)\s?:?/i'),
'Other' => array('/^(MINOR)\s?:?/i')
);

public $commitUrls = array(
Expand Down Expand Up @@ -144,9 +143,9 @@ function sortByType($commits) {
foreach($this->types as $name => $rules) {
if(!isset($groupedByType[$name])) $groupedByType[$name] = array();
foreach($rules as $rule) {
if(!$matched && preg_match($rule, $commit['message'])) {
if(!$matched && preg_match($rule, $commit['message'], $matches)) {
// @todo The fallback rule on other can't be replaced, as it doesn't match a full prefix
$commit['message'] = ($name != 'Other') ? trim(preg_replace($rule, '', $commit['message'])) : $commit['message'];
$commit['message'] = trim(preg_replace($rule, '', $commit['message']));
$groupedByType[$name][] = $commit;
$matched = true;
}
Expand Down

0 comments on commit 1ca61a5

Please sign in to comment.