launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20987
[Merge] lp:~wgrant/launchpad/product-index-git into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/product-index-git into lp:launchpad.
Commit message:
Link to the default git repository on Product:+index.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1576494 in Launchpad itself: "Product:+index doesn't link to Git repository"
https://bugs.launchpad.net/launchpad/+bug/1576494
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/product-index-git/+merge/306086
Link to the default git repository on Product:+index.
Also drop the "development focus" terminology from code. The phrase now
exclusively refers to the development focus series, which implies the
code trunk in the Bazaar case.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/product-index-git into lp:launchpad.
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2016-07-12 21:15:27 +0000
+++ lib/lp/registry/browser/product.py 2016-09-19 11:57:07 +0000
@@ -1132,6 +1132,16 @@
true_text='Approved',
header='Does the licence qualifiy the project for free hosting?')
+ @property
+ def code_trunk(self):
+ if self.context.inferred_vcs == VCSType.GIT:
+ return getUtility(IGitRepositorySet).getDefaultRepository(
+ self.context)
+ elif self.context.inferred_vcs == VCSType.BZR:
+ return self.context.development_focus.branch
+ else:
+ return None
+
class ProductPackagesView(LaunchpadView):
"""View for displaying product packaging"""
=== modified file 'lib/lp/registry/browser/tests/test_product.py'
--- lib/lp/registry/browser/tests/test_product.py 2016-07-25 04:45:51 +0000
+++ lib/lp/registry/browser/tests/test_product.py 2016-09-19 11:57:07 +0000
@@ -17,6 +17,7 @@
)
from testtools.matchers import (
LessThan,
+ MatchesAll,
Not,
)
import transaction
@@ -297,6 +298,45 @@
super(TestProductView, self).setUp()
self.product = self.factory.makeProduct(name='fnord')
+ def test_code_link_bzr(self):
+ branch = self.factory.makeBranch(target=self.product)
+ # No browse link unless there are revisions.
+ self.factory.makeRevisionsForBranch(branch)
+ with person_logged_in(self.product.owner):
+ self.product.development_focus.branch = branch
+ self.product.vcs = VCSType.BZR
+ view = create_initialized_view(self.product, "+index")
+ html = view()
+ self.assertThat(
+ html,
+ MatchesAll(
+ HTMLContains(
+ Tag("branch link", "a",
+ text="lp://dev/%s" % self.product.name,
+ attrs={"href": canonical_url(branch)})),
+ HTMLContains(
+ Tag("code browser link", "a", text="Browse the code",
+ attrs={"href": branch.getCodebrowseUrl('files')}))))
+
+ def test_code_link_git(self):
+ repo = self.factory.makeGitRepository(target=self.product)
+ with person_logged_in(repo.target.owner):
+ getUtility(IGitRepositorySet).setDefaultRepository(
+ target=self.product, repository=repo)
+ self.product.vcs = VCSType.GIT
+ view = create_initialized_view(self.product, "+index")
+ html = view()
+ self.assertThat(
+ html,
+ MatchesAll(
+ HTMLContains(
+ Tag("repo link", "a",
+ text="lp:%s" % self.product.name,
+ attrs={"href": canonical_url(repo)})),
+ HTMLContains(
+ Tag("code browser link", "a", text="Browse the code",
+ attrs={"href": repo.getCodebrowseUrl()}))))
+
def test_golang_meta_renders_git(self):
# ensure golang meta import path is rendered if project has
# git default vcs.
=== renamed file 'lib/lp/registry/stories/product/xx-product-development-focus.txt' => 'lib/lp/registry/stories/product/xx-product-code-trunk.txt'
--- lib/lp/registry/stories/product/xx-product-development-focus.txt 2016-03-23 12:16:54 +0000
+++ lib/lp/registry/stories/product/xx-product-code-trunk.txt 2016-09-19 11:57:07 +0000
@@ -34,13 +34,13 @@
>>> def print_code_trunk(browser):
... """Print out code trunk part of the project info."""
... project_info = find_tag_by_id(browser.contents, 'code-info')
- ... dev_focus = project_info.find(attrs={'id':'dev-focus'})
+ ... code_trunk = project_info.find(attrs={'id':'code-trunk'})
... try:
- ... print extract_text(dev_focus)
+ ... print extract_text(code_trunk)
... except TypeError:
... return
... print "Links:"
- ... for a in dev_focus.findAll('a'):
+ ... for a in code_trunk.findAll('a'):
... for content in a.contents:
... print content
... title = a.get('title', '')
@@ -111,7 +111,6 @@
trunk series (/fooix/trunk)
Change details (http://launchpad.dev/fooix/+edit)
>>> print_code_trunk(owner_browser)
- Development focus:
lp://dev/fooix Configure Code
Browse the code
Links:
@@ -138,7 +137,6 @@
Links:
trunk series (/fooix/trunk)
>>> print_code_trunk(anon_browser)
- Development focus:
lp://dev/fooix
Browse the code
Links:
@@ -153,7 +151,6 @@
trunk series (/fooix/trunk)
Change details (http://launchpad.dev/fooix/+edit)
>>> print_code_trunk(owner_browser)
- Development focus:
lp://dev/fooix Configure Code
Browse the code
Links:
@@ -192,7 +189,6 @@
Change details
(http://launchpad.dev/fooix/+edit)
>>> print_code_trunk(owner_browser)
- Development focus:
lp://dev/fooix Configure Code
Browse the code
Links:
=== modified file 'lib/lp/registry/templates/product-index.pt'
--- lib/lp/registry/templates/product-index.pt 2016-03-24 11:15:09 +0000
+++ lib/lp/registry/templates/product-index.pt 2016-09-19 11:57:07 +0000
@@ -195,7 +195,7 @@
section.
</tal:comment>
<div id="code-info" class="portlet"
- tal:define="trunk context/development_focus/branch;
+ tal:define="trunk view/code_trunk;
trunk_visible trunk/required:launchpad.View|nothing"
tal:condition="python: trunk_visible or context.inferred_vcs">
<h2>
@@ -205,17 +205,15 @@
Code
</h2>
- <dl id="dev-focus" tal:condition="trunk_visible">
- <dt>Development focus:</dt>
- <dd>
- <p>
- <a tal:replace="structure trunk/fmt:link" />
- <a tal:replace="structure context/menu:overview/configure_code/fmt:icon" />
- <br/>
- <a tal:replace="structure trunk/menu:context/source/fmt:link"/>
- </p>
- </dd>
- </dl>
+ <div id="code-trunk"
+ tal:condition="trunk_visible">
+ <p tal:condition="trunk_visible">
+ <a tal:replace="structure trunk/fmt:link" />
+ <a tal:replace="structure context/menu:overview/configure_code/fmt:icon" />
+ <br/>
+ <a tal:replace="structure trunk/menu:context/source/fmt:link"/>
+ </p>
+ </div>
<div class="two-column-list">
<dl id="product-vcs" tal:condition="context/inferred_vcs">
Follow ups