/**
  * Verify git version
  *
  * Verify hat the version of the installed GIT binary is at least 1.6. Will
  * throw an exception, if the binary is not available or too old.
  * 
  * @return void
  */
 protected static function checkVersion()
 {
     if (self::$checked === true) {
         return true;
     }
     $process = new pbsSystemProcess('git');
     $process->nonZeroExitCodeException = true;
     $process->argument('--version')->execute();
     if (!preg_match('(\\d+(?:\\.\\d+)+)', $process->stdoutOutput, $match)) {
         throw new vcsRuntimeException('Could not determine GIT version.');
     }
     if (version_compare($match[0], '1.6', '>=')) {
         return self::$checked = true;
     }
     throw new vcsRuntimeException('Git is required in a minimum version of 1.6.');
 }
 /**
  * Get diff
  *
  * Get the diff between the current version and the given version.
  * Optionally you may specify another version then the current one as the
  * diff base as the second parameter.
  *
  * @param string $version 
  * @param string $current 
  * @return vcsResource
  */
 public function getDiff($version, $current = null)
 {
     if (!in_array($version, $this->getVersions(), true)) {
         throw new vcsNoSuchVersionException($this->path, $version);
     }
     $current = $current === null ? $this->getVersionString() : $current;
     if (($diff = vcsCache::get($this->path, $version, 'diff')) === false) {
         // Refetch the basic content information, and cache it.
         $process = new vcsGitCliProcess();
         $process->workingDirectory($this->root);
         $process->argument('diff')->argument('--no-ext-diff');
         $process->argument($version . '..' . $current)->argument(new pbsPathArgument('.' . $this->path))->execute();
         // Parse resulting unified diff
         $parser = new vcsUnifiedDiffParser();
         $diff = $parser->parseString($process->stdoutOutput);
         vcsCache::cache($this->path, $version, 'diff', $diff);
     }
     return $diff;
 }
 /**
  * Update repository
  *
  * Update the repository to the most current state. Method will return
  * true, if an update happened, and false if no update was available.
  *
  * Optionally a version can be specified, in which case the repository
  * won't be updated to the latest version, but to the specified one.
  * 
  * @param string $version
  * @return bool
  */
 public function update($version = null)
 {
     // Remember version before update try
     $oldVersion = $this->getVersionString();
     $process = new vcsGitCliProcess();
     $process->workingDirectory($this->root);
     $process->argument('pull')->argument('origin');
     $process->execute();
     // Check if an update has happened
     $this->currentVersion = null;
     return $oldVersion !== $this->getVersionString();
 }