Exemplo n.º 1
0
 public function isValid($value)
 {
     $this->_setValue($value);
     $git = new GD_Git($this->_project);
     try {
         if ($git->checkValidRepository()) {
             if ($git->gitCheckout($value)) {
                 return true;
             }
         }
         $this->_error(self::INVALID);
         return false;
     } catch (GD_Exception $ex) {
         $this->_error(self::NO_REPO);
         return false;
     }
 }
Exemplo n.º 2
0
 public function isValid($value)
 {
     $this->_setValue($value);
     $git = GD_Git::FromProject($this->_project);
     try {
         if ($git->checkValidRepository()) {
             if ($git->gitCheckout($value)) {
                 return true;
             }
         }
         $this->_error(self::INVALID);
         return false;
     } catch (GD_Exception $ex) {
         GD_Debug::Log("Repository for {$this->_project->getName()} was not valid [{$ex->getStringCode()}]", GD_Debug::DEBUG_BASIC);
         $this->_error(self::NO_REPO);
         return false;
     }
 }
Exemplo n.º 3
0
 public function getLatestRevisionAction()
 {
     // Get project ID from url
     $projects = new GD_Model_ProjectsMapper();
     $project_slug = $this->_getParam("project");
     if ($project_slug != "") {
         $project = $projects->getProjectBySlug($project_slug);
     }
     // Git pull before anything
     $git = GD_Git::FromProject($project);
     $git->gitPull();
     $data = array();
     $last_commit = $git->getLastCommit();
     if (is_array($last_commit)) {
         $to_revision = $last_commit['HASH'];
         $data['toRevision'] = $to_revision;
     }
     $this->_response->setHeader('Content-type', 'text/plain');
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     $jsonData = Zend_Json::encode($data);
     $this->_response->appendBody($jsonData);
 }
Exemplo n.º 4
0
 public function recloneAction()
 {
     $projects = new GD_Model_ProjectsMapper();
     $project_slug = $this->_getParam("project");
     $project = $projects->getProjectBySlug($project_slug);
     $git = new GD_Git($project);
     $git->deleteRepository();
     $result = $git->gitClone();
     if ($result !== true) {
         throw new GD_Exception("Reclone failed [{$result}].");
     }
     if ($this->_getParam("return")) {
         $this->_redirect(base64_decode($this->_getParam("return")));
     } else {
         $this->_redirect("/project/{$project_slug}/settings");
     }
 }