Esempio n. 1
0
 /**
  * This will push the branch to the specified alias/branch, and add to the loaded branches
  * 
  * @param Sadekbaroudi\Gitorade\Branches\BranchLocal $branchLocal branch object to push
  * @throws GitException
  */
 public function push(BranchLocal $branchLocal)
 {
     if (!$branchLocal->hasRemote()) {
         throw new GitException(__METHOD__ . ": The BranchLocal object must have a remote branch!");
     }
     $this->getGit()->clearOutput();
     $this->getGit()->push($branchLocal->getRemote()->getAlias(), $branchLocal->getRemote()->getBranch());
     $pushOutput = $this->getGit()->getOutput();
     if (!empty($pushOutput)) {
         throw new GitException("Could not push to " . $branchLocal->getRemote()->getAlias() . ". Output: " . PHP_EOL . $pushResults);
     } else {
         // TODO: log this
         $pushed = "remotes/" . $branchLocal->getRemote()->getAlias() . "/" . $branchLocal->getRemote()->getBranch();
         $this->getBm()->add($pushed);
         $logMe = "Successfully pushed {$pushed}!";
         echo $logMe . PHP_EOL;
     }
 }