parse commit coments actions on log level and save

This commit is contained in:
aaronchen2k
2020-02-01 15:58:57 +08:00
parent 575d7ce549
commit a565b96d88
2 changed files with 17 additions and 29 deletions
+17 -28
View File
@@ -82,6 +82,7 @@ class scm
* @param string $comment
* @param array $allCommands
* @access public
* @return array
*/
public function parseComment($comment, &$allCommands)
{
@@ -89,6 +90,10 @@ class scm
$matches = array();
preg_match_all($pattern, $comment,$matches);
$stories = array();
$tasks = array();
$bugs = array();
if(count($matches) > 1 && count($matches[1]) > 0)
{
$i = 0;
@@ -103,12 +108,23 @@ class scm
$currArr = [];
}
$newArr = explode(",", $entityIds);
$allCommands[$entityType][$action] = array_keys(array_flip($currArr) + array_flip($newArr));
if ($action === 'story') {
$stories = array_merge($stories, $newArr);
}
if ($action === 'task') {
$tasks = array_merge($tasks, $newArr);
}
if ($action === 'bug') {
$bugs = array_merge($bugs, $newArr);
}
$i++;
}
}
return array('stories' => join(',', $stories), 'tasks' => join(',', $tasks), 'bugs' => join(',', $bugs));
}
/**
@@ -135,33 +151,6 @@ class scm
$jobToBuild = array_keys(array_flip($taskToBuild) + array_flip($newArr));
}
}
/**
* Parse the actions from comment.
*
* @param array $allCommands
* @access public
*
* @return array
*/
public function parseAction($allCommands)
{
$stories = array();
$tasks = array();
$bugs = array();
foreach ($allCommands['story'] as $action => $idArr) {
$stories = array_merge($stories, $idArr);
}
foreach ($allCommands['task'] as $action => $idArr) {
$tasks = array_merge($tasks, $idArr);
}
foreach ($allCommands['bug'] as $action => $idArr) {
$bugs = array_merge($bugs, $idArr);
}
return array('stories' => join(',', $stories), 'tasks' => join(',', $tasks), 'bugs' => join(',', $bugs));
}
}
function escapeCmd($cmd)
-1
View File
@@ -112,7 +112,6 @@ class svnModel extends model
$scm = $this->app->loadClass('scm');
$objects = $scm->parseComment($log->msg, $allCommands);
$objects = $this->parseComment($log->msg);
if($objects)
{
$this->printLog('extract' .