diff --git a/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php b/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php index 0422d1bcc8..828af226e8 100644 --- a/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php +++ b/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php @@ -227,7 +227,7 @@ final class DifferentialChangesetListView extends AphrontView { $repository = $this->repository; if ($repository) { - $meta['diffusionURI'] = $repository->getDiffusionBrowseURIForPath( + $meta['diffusionURI'] = (string)$repository->getDiffusionBrowseURIForPath( $changeset->getAbsoluteRepositoryPath($this->diff, $repository)); } diff --git a/src/applications/repository/storage/repository/PhabricatorRepository.php b/src/applications/repository/storage/repository/PhabricatorRepository.php index 447f979508..5ecbdce3a1 100644 --- a/src/applications/repository/storage/repository/PhabricatorRepository.php +++ b/src/applications/repository/storage/repository/PhabricatorRepository.php @@ -58,19 +58,16 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO { } public function getDiffusionBrowseURIForPath($path) { - switch ($this->getVersionControlSystem()) { - case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: - case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: - $branch = '/'.$this->getDetail('default-branch'); - break; - case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: - $branch = null; - break; - default: - throw new Exception("Unknown VCS."); - } + $drequest = DiffusionRequest::newFromDictionary( + array( + 'repository' => $this, + 'path' => $path, + )); - return '/diffusion/'.$this->getCallsign().'/browse'.$branch.$path; + return $drequest->generateURI( + array( + 'action' => 'browse', + )); } public static function newPhutilURIFromGitURI($raw_uri) { diff --git a/src/applications/repository/storage/repository/__init__.php b/src/applications/repository/storage/repository/__init__.php index e08a467030..88b89adada 100644 --- a/src/applications/repository/storage/repository/__init__.php +++ b/src/applications/repository/storage/repository/__init__.php @@ -6,6 +6,7 @@ +phutil_require_module('phabricator', 'applications/diffusion/request/base'); phutil_require_module('phabricator', 'applications/phid/constants'); phutil_require_module('phabricator', 'applications/phid/storage/phid'); phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');