launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18920
[Merge] lp:~blr/launchpad/golang-meta-import-buggy-productseries into lp:launchpad
Bayard 'kit' Randel has proposed merging lp:~blr/launchpad/golang-meta-import-buggy-productseries into lp:launchpad.
Commit message:
Render golang import only if series has default branch, not the series product's default.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~blr/launchpad/golang-meta-import-buggy-productseries/+merge/263994
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~blr/launchpad/golang-meta-import-buggy-productseries into lp:launchpad.
=== modified file 'lib/lp/registry/browser/productseries.py'
--- lib/lp/registry/browser/productseries.py 2015-07-06 00:00:55 +0000
+++ lib/lp/registry/browser/productseries.py 2015-07-07 04:28:52 +0000
@@ -386,8 +386,7 @@
"""Meta string for golang remote import path.
See: https://golang.org/cmd/go/#hdr-Remote_import_paths
"""
- if (self.context.product.vcs == VCSType.BZR and
- self.context.product.development_focus.branch):
+ if (self.context.product.vcs == VCSType.BZR and self.context.branch):
return (
"{hostname}/{product}/{series} bzr {root_url}{branch}").format(
hostname=config.vhost.mainsite.hostname,
=== modified file 'lib/lp/registry/browser/tests/test_productseries_views.py'
--- lib/lp/registry/browser/tests/test_productseries_views.py 2015-07-06 00:00:55 +0000
+++ lib/lp/registry/browser/tests/test_productseries_views.py 2015-07-07 04:28:52 +0000
@@ -35,20 +35,21 @@
def test_golang_meta_renders(self):
# ensure golang meta import path is rendered if project has
- # bzr default vcs.
+ # bzr default vcs and default branch set.
# See: https://golang.org/cmd/go/#hdr-Remote_import_paths
owner = self.factory.makePerson(name='zardoz')
product = self.factory.makeProduct(name='wapcaplet')
+ series = self.factory.makeProductSeries(owner=owner, product=product,
+ name='a-series')
branch = self.factory.makeBranch(product=product, name='a-branch',
owner=owner)
- view = create_initialized_view(branch.product.development_focus,
- '+index')
- with person_logged_in(branch.product.owner):
- branch.product.development_focus.branch = branch
- branch.product.vcs = VCSType.BZR
+ view = create_initialized_view(series, '+index')
+ with person_logged_in(series.product.owner):
+ series.branch = branch
+ series.product.vcs = VCSType.BZR
golang_import = (
- "{hostname}/wapcaplet/trunk bzr "
+ "{hostname}/wapcaplet/a-series bzr "
"{root_url}~zardoz/wapcaplet/a-branch").format(
hostname=config.vhost.mainsite.hostname,
root_url=allvhosts.configs['mainsite'].rooturl,
@@ -57,10 +58,20 @@
meta_tag = soupmatchers.Tag('go-import-meta', 'meta',
attrs={'name': 'go-import',
'content': golang_import})
- browser = self.getViewBrowser(branch.product.development_focus,
- '+index', user=branch.owner)
+ browser = self.getViewBrowser(series, '+index',
+ user=series.branch.owner)
self.assertThat(browser.contents, soupmatchers.HTMLContains(meta_tag))
+ def test_golang_meta_no_default_branch(self):
+ # ensure golang meta import path is not rendered if series has
+ # no default branch.
+ series = self.factory.makeProductSeries()
+ view = create_initialized_view(series, '+index')
+ with person_logged_in(series.product.owner):
+ series.product.vcs = VCSType.BZR
+
+ self.assertEqual(None, view.golang_import_spec)
+
def test_information_type_public(self):
# A ProductSeries view should include its information_type,
# which defaults to Public for new projects.
Follow ups