diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -189,6 +189,28 @@ list($commit, $tree, $parents, $time, $author, $author_email, $title, $message) = explode("\1", trim($line), 8); $message = rtrim($message); + $co_authors = array(); + + foreach (explode("\n", $message) as $message_line) { + if (strncasecmp($message_line, 'Co-authored-by:', 15) !== 0) { + continue; + } + + $matches = array(); + $status = preg_match( + '/^co-authored-by:\s*(.*)<(.*)>/i', + $message_line, + $matches); + + if ($status !== 1) { + continue; + } + + $co_authors[] = array( + 'name' => trim($matches[1]), + 'email' => trim($matches[2]), + ); + } $commits[$commit] = array( 'commit' => $commit, @@ -199,6 +221,7 @@ 'summary' => $title, 'message' => $message, 'authorEmail' => $author_email, + 'coAuthors' => $co_authors, ); } diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -202,6 +202,7 @@ $parents, $desc) = explode("\1", $log, 9); list($author, $author_email) = $this->parseFullAuthor($full_author); + $co_authors = array(); // NOTE: If a commit has only one parent, {parents} returns empty. // If it has two parents, {parents} returns revs and short hashes, not @@ -223,6 +224,28 @@ $node); } + + foreach (explode("\n", $desc) as $line) { + if (strncasecmp($line, 'Co-authored-by:', 15) !== 0) { + continue; + } + + $matches = array(); + $status = preg_match( + '/^co-authored-by:\s*(.*)<(.*)>/i', + $line, + $matches); + + if ($status !== 1) { + continue; + } + + $co_authors[] = array( + 'name' => $matches[1], + 'email' => $matches[2], + ); + } + $commits[$node] = array( 'author' => $author, 'time' => strtotime($date), @@ -235,6 +258,7 @@ 'summary' => head(explode("\n", $desc)), 'message' => $desc, 'authorEmail' => $author_email, + 'coAuthors' => $co_authors, ); $last_node = $node; diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php --- a/src/workflow/ArcanistWorkflow.php +++ b/src/workflow/ArcanistWorkflow.php @@ -968,6 +968,11 @@ return $working_copy; } + /** + * @param ArcanistRepositoryAPI $api + * + * @return self + */ final public function setRepositoryAPI($api) { $this->repositoryAPI = $api; return $this; @@ -981,6 +986,9 @@ } } + /** + * @return ArcanistRepositoryAPI + */ final public function getRepositoryAPI() { $configuration_engine = $this->getConfigurationEngine(); if ($configuration_engine) {