示例#1
0
 public function getContent()
 {
     switch ($this->project_creator_status->getStatus($this->repository)) {
         case Git_Driver_Gerrit_ProjectCreatorStatus::QUEUE:
             return $this->getRemoteRepositoryInfoOnGoing();
         case Git_Driver_Gerrit_ProjectCreatorStatus::DONE:
             return $this->getRemoteRepositoryInfoDone();
         case Git_Driver_Gerrit_ProjectCreatorStatus::ERROR:
             return $this->getRemoteRepositoryInfoError();
         default:
             if ($this->repository->isMigratedToGerrit()) {
                 return $this->getRemoteRepositoryInfoDone();
             }
             return '';
     }
 }
 /**
  * Display access control management for gitolite backend
  *
  * @param Integer $project_id Project Id, to manage permissions when performing a cross project fork
  *
  * @return String
  */
 public function displayAccessControl($project_id = null)
 {
     $project = $project_id ? ProjectManager::instance()->getProject($project_id) : $this->repository->getProject();
     $renderer = TemplateRendererFactory::build()->getRenderer(dirname(GIT_BASE_DIR) . '/templates');
     $presenter = new GitPresenters_AccessControlPresenter($this->repository->isMigratedToGerrit() ? true : false, 'repo_access[' . Git::PERM_READ . ']', 'repo_access[' . Git::PERM_WRITE . ']', 'repo_access[' . Git::PERM_WPLUS . ']', $this->getOptions($project, Git::PERM_READ), $this->getOptions($project, Git::PERM_WRITE), $this->getOptions($project, Git::PERM_WPLUS));
     return $renderer->renderToString('access-control', $presenter);
 }
示例#3
0
 private function getAccessURLs()
 {
     $urls = $this->repository->getAccessURL();
     if ($this->repository->isMigratedToGerrit()) {
         $gerrit_user = $this->gerrit_usermanager->getGerritUser($this->current_user);
         $gerrit_server = $this->gerrit_servers[$this->repository->getRemoteServerId()];
         $driver = $this->driver_factory->getDriver($gerrit_server);
         $gerrit_project = $driver->getGerritProjectName($this->repository);
         $clone_url = $gerrit_server->getEndUserCloneUrl($gerrit_project, $gerrit_user);
         $this->prependGerritCloneURL($urls, $clone_url);
     }
     return $urls;
 }
示例#4
0
 /**
  *
  * @param GitRepository $git_repo
  * @param Project $project
  * @throws Git_ProjectNotFoundException
  * @throws GitRepoNotFoundException
  * @throws GitRepoNotInProjectException
  * @throws GitRepoNotOnGerritException
  */
 private function checkRepoValidity($git_repo, $project)
 {
     if ($project->isError()) {
         throw new Git_ProjectNotFoundException('unable to get config', 404);
     }
     if (!$git_repo) {
         throw new GitRepoNotFoundException('unable to get config', 404);
     }
     if (!$git_repo->belongsToProject($project)) {
         throw new GitRepoNotInProjectException('unable to get config', 403);
     }
     if (!$git_repo->isMigratedToGerrit()) {
         throw new GitRepoNotOnGerritException('unable to get config', 500);
     }
 }
示例#5
0
 public function itIsNotMigratedIfItWasDisconnected()
 {
     $repository = new GitRepository();
     $repository->setDeletionDate(null);
     $repository->setRemoteServerDisconnectDate(12345677890);
     $repository->setRemoteServerId(1);
     $this->assertFalse($repository->isMigratedToGerrit());
 }
 private function isMigrationToGerritCompletedWithSuccess(GitRepository $repository)
 {
     return $repository->isMigratedToGerrit() && $this->gerrit_status->getStatus($repository) === Git_Driver_Gerrit_ProjectCreatorStatus::DONE;
 }