示例#1
0
 public function testGetReferenceName()
 {
     $fileInfo = new VcsFileInfo('path/to/conveyor', array('master', VcsFileInfo::BRANCH), VcsFileInfo::DIR);
     $this->assertEquals('master', $fileInfo->getReferenceName());
 }
示例#2
0
 /**
  * Returns url for a specific path
  *
  * @param  string|VcsFileInfo $path
  * @return string
  */
 public function getSvnUrl($path)
 {
     $head = $this->head;
     if ($path instanceof Reference) {
         $head = $path;
         $path = '/';
     }
     if (null === $path) {
         $path = '/';
     }
     if (is_string($path)) {
         $path = new VcsFileInfo($path, array($head->getName(), $head->getType()));
     }
     if ($path->inBranch()) {
         $branchName = $path->getReferenceName();
         if ('trunk' === $branchName) {
             $basePath = $this->basePaths['trunk'];
         } else {
             $basePath = $this->basePaths['branches'] . '/' . $branchName;
         }
     } elseif ($path->inTag()) {
         $tagName = $path->getReferenceName();
         $basePath = $this->basePaths['tags'] . '/' . $tagName;
     }
     $retval = $this->url;
     if (isset($basePath)) {
         $retval .= '/' . $basePath;
     }
     $retval .= '/' . ltrim($path->getPathname(), '/');
     $retval = rtrim($retval, '/');
     return $retval;
 }