Ejemplo n.º 1
0
 /**
  * @param string $basePath Base path for all repositories
  */
 public function __construct($basePath)
 {
     $rel_path = str_replace($basePath, '', \Git::getRepositoryPath());
     if (preg_match('@/(.*\\.git)$@', $rel_path, $matches)) {
         $this->repositoryName = $matches[1];
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns an array of commit messages between revision $old and $new.
  *
  * @param string $old The old revison number.
  * @parma string $new The new revison umber.
  *
  * @return array
  */
 private function getReceivedMessagesForRange($old, $new)
 {
     $repourl = \Git::getRepositoryPath();
     $output = [];
     if ($old == \Git::NULLREV) {
         $cmd = sprintf("%s --git-dir=%s for-each-ref --format='%%(refname)' 'refs/heads/*'", \Git::GIT_EXECUTABLE, $repourl);
         exec($cmd, $heads);
         $not = count($heads) > 0 ? ' --not ' . implode(' ', $this->escapeArrayShellArgs($heads)) : '';
         $cmd = sprintf('%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s %s', \Git::GIT_EXECUTABLE, $repourl, escapeshellarg($new), $not);
         exec($cmd, $output);
     } elseif ($new != \Git::NULLREV) {
         $cmd = sprintf('%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s..%s', \Git::GIT_EXECUTABLE, $repourl, escapeshellarg($old), escapeshellarg($new));
         exec($cmd, $output);
     }
     return $output;
 }