/** * @param sfWebRequest $request * @return void */ public function execute($request) { $repository = RepositoryPeer::retrieveByPK($request->getParameter('repository')); $this->forward404Unless($repository, "Repository Not Found"); $branches = BranchQuery::create()->filterByRepositoryId($repository->getId())->filterByIsBlacklisted(0)->find(); foreach ($branches as $branch) { BranchPeer::synchronize($this->gitCommand, $repository, $branch, true); } $this->redirect('default/branchList?repository=' . $repository->getId()); }
/** * @param sfWebRequest $request * @return void */ public function execute($request) { $this->file = FilePeer::retrieveByPK($request->getParameter('file')); $this->forward404Unless($this->file, "File not found"); $this->branch = BranchPeer::retrieveByPK($this->file->getBranchId()); $this->forward404Unless($this->branch, "Branch not found"); $this->repository = RepositoryPeer::retrieveByPK($this->branch->getRepositoryId()); $this->forward404Unless($this->repository, "Repository not found"); $this->fileContent = $this->gitCommand->getShowFile($this->repository->getGitDir(), $this->file->getLastChangeCommit(), $this->file->getFilename()); $this->fileExtension = pathinfo($this->file->getFilename(), PATHINFO_EXTENSION); }
/** * @param sfWebRequest $request * @return void */ public function execute($request) { $this->branch = null; if ($request->hasParameter('name') && $request->hasParameter('repository')) { $repository = RepositoryQuery::create()->filterByName($request->getParameter('repository'))->findOne(); $this->forward404Unless($repository, "Repository not found"); $this->branch = BranchQuery::create()->filterByName($request->getParameter('name'))->filterByRepository($repository)->findOne(); // Dirty hack to make the breadcrumb work /!\ if ($this->branch) { $this->redirect('default/fileList?branch=' . $this->branch->getId()); } } elseif ($request->hasParameter('branch')) { $this->branch = BranchPeer::retrieveByPK($request->getParameter('branch')); } $this->forward404Unless($this->branch, "Branch not found"); $this->getResponse()->setTitle($this->branch->getName()); $this->repository = RepositoryPeer::retrieveByPK($this->branch->getRepositoryId()); $this->forward404Unless($this->repository, "Repository not found"); $files = FileQuery::create()->filterByBranchId($this->branch->getId())->find(); $this->files = array(); foreach ($files as $file) { $fileCommentsCount = CommentQuery::create()->filterByFileId($file->getId())->filterByType(CommentPeer::TYPE_FILE)->count(); $fileCommentsCountNotChecked = CommentQuery::create()->filterByFileId($file->getId())->filterByType(CommentPeer::TYPE_FILE)->filterByCheckUserId(null)->count(); $lineCommentsCount = CommentQuery::create()->filterByFileId($file->getId())->filterByCommit($file->getLastChangeCommit())->filterByType(CommentPeer::TYPE_LINE)->count(); $lineCommentsCountNotChecked = CommentQuery::create()->filterByFileId($file->getId())->filterByCommit($file->getLastChangeCommit())->filterByType(CommentPeer::TYPE_LINE)->filterByCheckUserId(null)->count(); $lastCommentId = 0; if ($fileCommentsCount || $lineCommentsCount) { $lastComment = CommentQuery::create()->filterByFileId($file->getId())->filterByCommit($file->getLastChangeCommit())->_or()->filterByType(CommentPeer::TYPE_FILE)->orderById(Criteria::DESC)->findOne(); if ($lastComment) { $lastCommentId = $lastComment->getId(); } } $this->files[] = array_merge($file->toArray(), array('NbFileComments' => $fileCommentsCount + $lineCommentsCount, 'NbFileCommentsNotChecked' => $fileCommentsCountNotChecked + $lineCommentsCountNotChecked, 'LastCommentId' => $lastCommentId)); } usort($this->files, array('self', 'sortPath')); $this->statusActions = StatusActionPeer::getStatusActionsForBoard(null, $this->repository->getId(), $this->branch->getId()); $this->commentBoards = CommentPeer::getCommentsForBoard(null, $this->repository->getId(), $this->branch->getId()); }
/** * @param sfWebRequest $request * @return void */ public function execute($request) { $this->file = FilePeer::retrieveByPK($request->getParameter('file')); $this->forward404Unless($this->file, "File not found"); $this->getResponse()->setTitle(basename($this->file->getFilename())); $this->previousFileId = FileQuery::create()->select('Id')->filterByBranchId($this->file->getBranchId())->filterByFilename($this->file->getFilename(), Criteria::LESS_THAN)->filterByIsBinary(false)->orderByFilename(Criteria::DESC)->findOne(); $this->nextFileId = FileQuery::create()->select('Id')->filterByBranchId($this->file->getBranchId())->filterByFilename($this->file->getFilename(), Criteria::GREATER_THAN)->filterByIsBinary(false)->orderByFilename(Criteria::ASC)->findOne(); $this->branch = BranchPeer::retrieveByPK($this->file->getBranchId()); $this->forward404Unless($this->branch, "Branch not found"); $this->repository = RepositoryPeer::retrieveByPK($this->branch->getRepositoryId()); $this->forward404Unless($this->repository, "Repository not found"); $options = array(); if ($request->getParameter('s', false)) { $options['ignore-all-space'] = true; } $this->fileContentLines = $this->gitCommand->getShowFileFromBranch($this->repository->getGitDir(), $this->branch->getCommitReference(), $this->file->getLastChangeCommit(), $this->file->getFilename(), $options); $fileLineCommentsModel = CommentQuery::create()->filterByFileId($this->file->getId())->filterByCommit($this->file->getLastChangeCommit())->filterByType(CommentPeer::TYPE_LINE)->find(); $this->userId = $this->getUser()->getId(); $this->fileLineComments = array(); foreach ($fileLineCommentsModel as $fileLineCommentModel) { $this->fileLineComments[$fileLineCommentModel->getPosition()][] = $fileLineCommentModel; } }