diff --git includes/interfaces.inc includes/interfaces.inc index 2db2854..1bf31c2 100644 --- includes/interfaces.inc +++ includes/interfaces.inc @@ -326,6 +326,15 @@ interface VersioncontrolAuthHandlerInterface { interface VersioncontrolWebviewerUrlHandlerInterface { /** + * Retrieve the URL of the repository viewer that displays the main + * view of the repository. + * + * @return + * The repository view URL of the associated repository. + */ + public function getRepositoryViewUrl(); + + /** * Retrieve the URL of the repository viewer that displays the given commit * in the corresponding repository. * diff --git includes/plugins/webviewer_url_handlers/VersioncontrolRepositoryUrlHandler.inc includes/plugins/webviewer_url_handlers/VersioncontrolRepositoryUrlHandler.inc index 87cc4f2..e7f7bf6 100644 --- includes/plugins/webviewer_url_handlers/VersioncontrolRepositoryUrlHandler.inc +++ includes/plugins/webviewer_url_handlers/VersioncontrolRepositoryUrlHandler.inc @@ -46,6 +46,19 @@ class VersioncontrolRepositoryUrlHandler implements VersioncontrolWebviewerUrlHa } /** + * Retrieve the URL of the repository viewer that displays the main + * view of the repository. + * + * @return + * The repository view URL of the associated repository. + */ + public function getRepositoryViewUrl() { + return strtr($this->getTemplateUrl('repository_view'), array( + '%repo_name' => $this->repository->name, + )); + } + + /** * Retrieve the URL of the repository viewer that displays the given commit * in the corresponding repository. * diff --git includes/plugins/webviewer_url_handlers/gitweb.inc includes/plugins/webviewer_url_handlers/gitweb.inc deleted file mode 100644 index 6b57378..0000000 --- includes/plugins/webviewer_url_handlers/gitweb.inc +++ /dev/null @@ -1,32 +0,0 @@ - 'git', - 'title' => t('Gitweb URL autogenerator'), - 'url_templates' => array( - 'commit_view' => '%base_url/?p=%repo_name;a=commit;h=%revision', - 'file_log_view' => '%base_url/?p=%repo_name;a=history;f=%path;h=%revision;hb=%branch', - 'directory_log_view' => '%base_url/?p=%repo_name;a=history;f=%path;h=%revision;hb=%branch', - 'file_view' => '%base_url/?p=%repo_name;a=blob;f=%path;h=%revision;hb=%branch', - 'directory_view' => '%base_url/?p=%repo_name;a=tree;f=%path;h=%revision;hb=%branch', - /** - * FIXME gitweb need blob hashes in order to do this, but - * versioncontrol_git is not storing blobs, so stop supporting this - * until we can do this. - * Template should be like this: - * '%base_url/?p=%repo_name;a=blobdiff;f=%path;h=%new_blob_hash;hp=%old_blob_hash;hb=%new_revision;hpb=%old_revision', - */ - 'diff' => '', - ), - 'handler' => array( - 'class' => 'VersioncontrolRepositoryUrlHandler', - 'file' => 'VersioncontrolRepositoryUrlHandler.inc', - 'path' => drupal_get_path('module', 'versioncontrol') . '/includes/plugins/webviewer_url_handlers', - ), -); diff --git includes/plugins/webviewer_url_handlers/none.inc includes/plugins/webviewer_url_handlers/none.inc index 307fac4..242de9e 100644 --- includes/plugins/webviewer_url_handlers/none.inc +++ includes/plugins/webviewer_url_handlers/none.inc @@ -20,12 +20,21 @@ $plugin = array( 'url_templates' => array( /** + * Template URL for the main page for this repository. + * + * It contains the following placeholders: + * - "%base_url" the URL to the repository viewer. + * - "%repo_name" the name of the repository on the filesystem. + */ + 'repository_view' => '', + + /** * Template url for the commit view. * * The URL of the repository viewer that displays a given commit in the * repository. * It contains the following placeholders: - * - "%base_url" the path to gitweb. + * - "%base_url" the URL to the repository viewer. * - "%repo_name" the name of the repository on the filesystem. * - "%revision" for the revision/commit/changeset identifier. */ @@ -37,7 +46,7 @@ $plugin = array( * The URL of the repository viewer that displays the commit log of * a given file in the repository. * It contains the following placeholders: - * - "%base_url" the path to gitweb. + * - "%base_url" the URL to the repository viewer. * - "%repo_name" the name of the repository on the filesystem. * - "%path" for the file path * - "%revision" will be replaced by the file-level revision (the one @@ -52,7 +61,7 @@ $plugin = array( * The URL of the repository viewer that displays the commit log of * a given directoryin the repository. * It contains the following placeholders: - * - "%base_url" the path to gitweb. + * - "%base_url" the URL to the repository viewer. * - "%repo_name" the name of the repository on the filesystem. * - "%path" for the file path * - "%revision" will be replaced by the file-level revision (the one @@ -67,7 +76,7 @@ $plugin = array( * The URL of the repository viewer that displays the contents of a * given file in the repository. * It contains the following placeholders: - * - "%base_url" the path to gitweb. + * - "%base_url" the URL to the repository viewer. * - "%repo_name" the name of the repository on the filesystem. * - "%path" for the file path * - "%revision" will be replaced by the file-level revision (the @@ -82,7 +91,7 @@ $plugin = array( * The URL of the repository viewer that displays the contents of a given * directory in the repository. * It contains the following placeholders: - * - "%base_url" the path to gitweb. + * - "%base_url" the URL to the repository viewer. * - "%repo_name" the name of the repository on the filesystem. * - "%path" for the directory path * - "%revision" will be replaced by the file-level revision (the @@ -99,7 +108,7 @@ $plugin = array( * The URL of the repository viewer that displays the diff between two * given files in the repository. * It contains the following placeholders: - * - "%base_url" the path to gitweb. + * - "%base_url" the URL to the repository viewer. * - "%repo_name" the name of the repository on the filesystem. * - "%path" and "%old_path" for the new and old paths (for some * version control systems, like CVS, those paths will always be diff --git versioncontrol.info versioncontrol.info index bf6db51..660c3d6 100644 --- versioncontrol.info +++ versioncontrol.info @@ -10,7 +10,6 @@ files[] = includes/VersioncontrolBranch.php files[] = includes/VersioncontrolItem.php files[] = includes/VersioncontrolOperation.php files[] = includes/VersioncontrolRepository.php -files[] = includes/VersioncontrolRepositoryUrlHandler.php files[] = includes/VersioncontrolTag.php files[] = includes/interfaces.inc files[] = includes/controllers.inc