hasChanges() public method

Returns true if there are changes to commit.
public hasChanges ( ) : boolean
return boolean
Esempio n. 1
0
 /**
  * @return bool
  * @throws GitException
  */
 public function precheck()
 {
     if ($this->git->hasChanges()) {
         throw new GitException('Working Copy is not clean, please commit or stash changes first.');
     }
     return true;
 }
Esempio n. 2
0
 /**
  * Deploy the current contents of our working copy.
  *
  * @param GitWorkingCopy $workingCopy
  */
 protected function deployWithGit(GitWorkingCopy $workingCopy)
 {
     if (!$workingCopy->hasChanges()) {
         return $this->output->writeln('<comment>No changes to deploy!</comment>');
     }
     $this->output->writeln('<info>Ready to deploy changes:</info>');
     $this->output->write($workingCopy->getStatus());
     if (!$this->input->getOption('force')) {
         if (!$this->askForChangesConfirmation($workingCopy)) {
             return $this->output->writeln('<error>Aborted!</error>');
         }
     }
     $this->output->writeln('<info>Deploying...</info>');
     $this->output->write($workingCopy->add('.')->commit($this->getCommitMessage())->push()->getOutput(), OutputInterface::VERBOSITY_VERBOSE);
 }