/** * 数据提交完毕后 * @param Hook $hook * @param $commits */ static function postReceive(Hook $hook, $commits) { $reposite = new Reposite($hook->group, $hook->name); // 检查每个分支是否已经创建过 $merges = array(); $branches = array(); foreach ($commits as $commit) { $branch = $commit['branch']; if (strpos($branch, Util::TAG_PREFIX) !== 0) { $_ms = $reposite->listMergeCommits($commit['start'], $commit['end']); if ($_ms) { $merges = array_merge($merges, $_ms); } $branches[substr($branch, strlen(Util::BRANCH_PREFIX))] = $commit['end']; } } $merge = new \firegit\app\mod\git\Merge(); if ($merges) { $merge->handleMerges($hook->group, $hook->name, $merges); } if ($branches) { $merge->updateBranches($hook->group, $hook->name, $branches); } }
/** * 代码历史 */ function history_action() { list($branch, $path) = $this->handleBranchAndPath(func_get_args()); $history = $this->repo->getHistory($path); $this->response->set(array('show_menu' => 'show', 'model' => 'history', 'path' => $path, 'blob' => 'blob', 'commits' => $this->packCommits($history['commits'])))->setView('git/commits.phtml'); }