public function getBranchesActivity(Project $project, $branch = null) { $repository = $project->getRepository(); $references = $repository->getReferences(); $branchName = null === $branch ? $project->getDefaultBranch() : $branch; $against = $references->getBranch($branchName); foreach ($references->getBranches() as $branch) { $logBehind = $repository->getLog($repository->getRevision($branch->getFullname() . '..' . $against->getFullname())); $logAbove = $repository->getLog($repository->getRevision($against->getFullname() . '..' . $branch->getFullname())); $rows[] = array('branch' => $branch, 'above' => $logAbove->count(), 'behind' => $logBehind->count(), 'lastModification' => $branch->getLastModification()); } usort($rows, function ($left, $right) { return $left['lastModification']->getAuthorDate() < $right['lastModification']->getAuthorDate(); }); return $rows; }
/** * Handles the git pack. */ public function handle(Project $project, $command, array $env = array()) { $project->getRepository()->shell($command, $env); }