Merge lp:~wgrant/launchpad/product-index-git into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 18201
Proposed branch: lp:~wgrant/launchpad/product-index-git
Merge into: lp:launchpad
Diff against target: 171 lines (+63/-19)
4 files modified
lib/lp/registry/browser/product.py (+10/-0)
lib/lp/registry/browser/tests/test_product.py (+40/-0)
lib/lp/registry/stories/product/xx-product-code-trunk.txt (+3/-7)
lib/lp/registry/templates/product-index.pt (+10/-12)
To merge this branch: bzr merge lp:~wgrant/launchpad/product-index-git
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+306086@code.launchpad.net

Commit message

Link to the default git repository on Product:+index.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
1132 true_text='Approved',1132 true_text='Approved',
1133 header='Does the licence qualifiy the project for free hosting?')1133 header='Does the licence qualifiy the project for free hosting?')
11341134
1135 @property
1136 def code_trunk(self):
1137 if self.context.inferred_vcs == VCSType.GIT:
1138 return getUtility(IGitRepositorySet).getDefaultRepository(
1139 self.context)
1140 elif self.context.inferred_vcs == VCSType.BZR:
1141 return self.context.development_focus.branch
1142 else:
1143 return None
1144
11351145
1136class ProductPackagesView(LaunchpadView):1146class ProductPackagesView(LaunchpadView):
1137 """View for displaying product packaging"""1147 """View for displaying product packaging"""
11381148
=== 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 @@
17 )17 )
18from testtools.matchers import (18from testtools.matchers import (
19 LessThan,19 LessThan,
20 MatchesAll,
20 Not,21 Not,
21 )22 )
22import transaction23import transaction
@@ -297,6 +298,45 @@
297 super(TestProductView, self).setUp()298 super(TestProductView, self).setUp()
298 self.product = self.factory.makeProduct(name='fnord')299 self.product = self.factory.makeProduct(name='fnord')
299300
301 def test_code_link_bzr(self):
302 branch = self.factory.makeBranch(target=self.product)
303 # No browse link unless there are revisions.
304 self.factory.makeRevisionsForBranch(branch)
305 with person_logged_in(self.product.owner):
306 self.product.development_focus.branch = branch
307 self.product.vcs = VCSType.BZR
308 view = create_initialized_view(self.product, "+index")
309 html = view()
310 self.assertThat(
311 html,
312 MatchesAll(
313 HTMLContains(
314 Tag("branch link", "a",
315 text="lp://dev/%s" % self.product.name,
316 attrs={"href": canonical_url(branch)})),
317 HTMLContains(
318 Tag("code browser link", "a", text="Browse the code",
319 attrs={"href": branch.getCodebrowseUrl('files')}))))
320
321 def test_code_link_git(self):
322 repo = self.factory.makeGitRepository(target=self.product)
323 with person_logged_in(repo.target.owner):
324 getUtility(IGitRepositorySet).setDefaultRepository(
325 target=self.product, repository=repo)
326 self.product.vcs = VCSType.GIT
327 view = create_initialized_view(self.product, "+index")
328 html = view()
329 self.assertThat(
330 html,
331 MatchesAll(
332 HTMLContains(
333 Tag("repo link", "a",
334 text="lp:%s" % self.product.name,
335 attrs={"href": canonical_url(repo)})),
336 HTMLContains(
337 Tag("code browser link", "a", text="Browse the code",
338 attrs={"href": repo.getCodebrowseUrl()}))))
339
300 def test_golang_meta_renders_git(self):340 def test_golang_meta_renders_git(self):
301 # ensure golang meta import path is rendered if project has341 # ensure golang meta import path is rendered if project has
302 # git default vcs.342 # git default vcs.
303343
=== 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 @@
34 >>> def print_code_trunk(browser):34 >>> def print_code_trunk(browser):
35 ... """Print out code trunk part of the project info."""35 ... """Print out code trunk part of the project info."""
36 ... project_info = find_tag_by_id(browser.contents, 'code-info')36 ... project_info = find_tag_by_id(browser.contents, 'code-info')
37 ... dev_focus = project_info.find(attrs={'id':'dev-focus'})37 ... code_trunk = project_info.find(attrs={'id':'code-trunk'})
38 ... try:38 ... try:
39 ... print extract_text(dev_focus)39 ... print extract_text(code_trunk)
40 ... except TypeError:40 ... except TypeError:
41 ... return41 ... return
42 ... print "Links:"42 ... print "Links:"
43 ... for a in dev_focus.findAll('a'):43 ... for a in code_trunk.findAll('a'):
44 ... for content in a.contents:44 ... for content in a.contents:
45 ... print content45 ... print content
46 ... title = a.get('title', '')46 ... title = a.get('title', '')
@@ -111,7 +111,6 @@
111 trunk series (/fooix/trunk)111 trunk series (/fooix/trunk)
112 Change details (http://launchpad.dev/fooix/+edit)112 Change details (http://launchpad.dev/fooix/+edit)
113 >>> print_code_trunk(owner_browser)113 >>> print_code_trunk(owner_browser)
114 Development focus:
115 lp://dev/fooix Configure Code114 lp://dev/fooix Configure Code
116 Browse the code115 Browse the code
117 Links:116 Links:
@@ -138,7 +137,6 @@
138 Links:137 Links:
139 trunk series (/fooix/trunk)138 trunk series (/fooix/trunk)
140 >>> print_code_trunk(anon_browser)139 >>> print_code_trunk(anon_browser)
141 Development focus:
142 lp://dev/fooix140 lp://dev/fooix
143 Browse the code141 Browse the code
144 Links:142 Links:
@@ -153,7 +151,6 @@
153 trunk series (/fooix/trunk)151 trunk series (/fooix/trunk)
154 Change details (http://launchpad.dev/fooix/+edit)152 Change details (http://launchpad.dev/fooix/+edit)
155 >>> print_code_trunk(owner_browser)153 >>> print_code_trunk(owner_browser)
156 Development focus:
157 lp://dev/fooix Configure Code154 lp://dev/fooix Configure Code
158 Browse the code155 Browse the code
159 Links:156 Links:
@@ -192,7 +189,6 @@
192 Change details189 Change details
193 (http://launchpad.dev/fooix/+edit)190 (http://launchpad.dev/fooix/+edit)
194 >>> print_code_trunk(owner_browser)191 >>> print_code_trunk(owner_browser)
195 Development focus:
196 lp://dev/fooix Configure Code192 lp://dev/fooix Configure Code
197 Browse the code193 Browse the code
198 Links:194 Links:
199195
=== 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 @@
195 section.195 section.
196 </tal:comment>196 </tal:comment>
197 <div id="code-info" class="portlet"197 <div id="code-info" class="portlet"
198 tal:define="trunk context/development_focus/branch;198 tal:define="trunk view/code_trunk;
199 trunk_visible trunk/required:launchpad.View|nothing"199 trunk_visible trunk/required:launchpad.View|nothing"
200 tal:condition="python: trunk_visible or context.inferred_vcs">200 tal:condition="python: trunk_visible or context.inferred_vcs">
201 <h2>201 <h2>
@@ -205,17 +205,15 @@
205 Code205 Code
206 </h2>206 </h2>
207207
208 <dl id="dev-focus" tal:condition="trunk_visible">208 <div id="code-trunk"
209 <dt>Development focus:</dt>209 tal:condition="trunk_visible">
210 <dd>210 <p tal:condition="trunk_visible">
211 <p>211 <a tal:replace="structure trunk/fmt:link" />&nbsp;
212 <a tal:replace="structure trunk/fmt:link" />&nbsp;212 <a tal:replace="structure context/menu:overview/configure_code/fmt:icon" />
213 <a tal:replace="structure context/menu:overview/configure_code/fmt:icon" />213 <br/>
214 <br/>214 <a tal:replace="structure trunk/menu:context/source/fmt:link"/>
215 <a tal:replace="structure trunk/menu:context/source/fmt:link"/>215 </p>
216 </p>216 </div>
217 </dd>
218 </dl>
219217
220 <div class="two-column-list">218 <div class="two-column-list">
221 <dl id="product-vcs" tal:condition="context/inferred_vcs">219 <dl id="product-vcs" tal:condition="context/inferred_vcs">