launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18985
[Merge] lp:~cjwatson/launchpad/git-shorten-codebrowse-url into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/git-shorten-codebrowse-url into lp:launchpad.
Commit message:
Use the shortened path for Git codebrowse URLs.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-shorten-codebrowse-url/+merge/264461
Use the shortened path for Git codebrowse URLs, rather than the repository's unique name. This matches the git+ssh:// and https:// URLs shown on GitRepository:+index.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/git-shorten-codebrowse-url into lp:launchpad.
=== modified file 'lib/lp/code/model/gitrepository.py'
--- lib/lp/code/model/gitrepository.py 2015-07-08 16:05:11 +0000
+++ lib/lp/code/model/gitrepository.py 2015-07-10 22:38:21 +0000
@@ -348,7 +348,7 @@
def getCodebrowseUrl(self):
"""See `IGitRepository`."""
return urlutils.join(
- config.codehosting.git_browse_root, self.unique_name)
+ config.codehosting.git_browse_root, self.shortened_path)
@property
def git_https_url(self):
=== modified file 'lib/lp/code/model/tests/test_gitrepository.py'
--- lib/lp/code/model/tests/test_gitrepository.py 2015-06-25 04:42:48 +0000
+++ lib/lp/code/model/tests/test_gitrepository.py 2015-07-10 22:38:21 +0000
@@ -736,7 +736,18 @@
# The basic codebrowse URL for a repository is an 'https' URL.
repository = self.factory.makeGitRepository()
expected_url = urlutils.join(
- config.codehosting.git_browse_root, repository.unique_name)
+ config.codehosting.git_browse_root, repository.shortened_path)
+ self.assertEqual(expected_url, repository.getCodebrowseUrl())
+
+ def test_codebrowse_url_for_default(self):
+ # The codebrowse URL for the default repository for a target is an
+ # 'https' URL based on the repository's shortened path.
+ repository = self.factory.makeGitRepository()
+ with person_logged_in(repository.target.owner):
+ getUtility(IGitRepositorySet).setDefaultRepository(
+ repository.target, repository)
+ expected_url = urlutils.join(
+ config.codehosting.git_browse_root, repository.shortened_path)
self.assertEqual(expected_url, repository.getCodebrowseUrl())
def test_git_https_url_for_public(self):
Follow ups