Merge lp:~jml/launchpad/browse-source-code into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~jml/launchpad/browse-source-code
Merge into: lp:launchpad
Diff against target: 97 lines
7 files modified
lib/lp/code/browser/branch.py (+1/-0)
lib/lp/code/browser/tests/test_product.py (+1/-2)
lib/lp/code/configure.zcml (+1/-0)
lib/lp/code/interfaces/branch.py (+3/-0)
lib/lp/code/model/branch.py (+4/-0)
lib/lp/code/model/tests/test_branch.py (+7/-0)
lib/lp/code/templates/product-branch-summary.pt (+1/-1)
To merge this branch: bzr merge lp:~jml/launchpad/browse-source-code
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Martin Albisetti (community) ui Approve
Review via email: mp+12933@code.launchpad.net

Commit message

Change the browse source code link on product branch pages so that it links to the actual source code rather than a revision log.

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

Go to https://code.edge.launchpad.net/launchpad. There's a link to "browse the source code". Click this link, and you'll be taken to a list of revisions. What you want is to be taken to a list of files.

This branch gives you what you want.

The patch adds a new property to give the right URL, a test for that property, and changes the template to use the new property.

Revision history for this message
Martin Albisetti (beuno) wrote :

This is the right change, although this text should probably be under the development focus, making it look more special than it does today, and less like "just another item on the list".

review: Approve (ui)
Revision history for this message
Brad Crittenden (bac) wrote :

Nice, simple branch. Thanks for making the change, Jonathan.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/branch.py'
2--- lib/lp/code/browser/branch.py 2009-09-28 22:19:22 +0000
3+++ lib/lp/code/browser/branch.py 2009-10-07 22:06:12 +0000
4@@ -305,6 +305,7 @@
5 """
6 return self.branch.target.getBugTask(self.context)
7
8+
9 class BranchView(LaunchpadView, FeedsMixin):
10
11 __used_for__ = IBranch
12
13=== modified file 'lib/lp/code/browser/tests/test_product.py'
14--- lib/lp/code/browser/tests/test_product.py 2009-07-17 00:26:05 +0000
15+++ lib/lp/code/browser/tests/test_product.py 2009-10-07 22:06:12 +0000
16@@ -66,8 +66,7 @@
17
18 link = self.getBranchSummaryBrowseLinkForProduct(product)
19 login(ANONYMOUS)
20- self.assertEqual(
21- link.url, branch.codebrowse_url())
22+ self.assertEqual(link.url, branch.browse_source_url)
23
24 def test_unbrowseable_branch_does_not_have_link(self):
25 # If the product's development focus branch is not browseable, there
26
27=== modified file 'lib/lp/code/configure.zcml'
28--- lib/lp/code/configure.zcml 2009-10-05 14:17:48 +0000
29+++ lib/lp/code/configure.zcml 2009-10-07 22:06:12 +0000
30@@ -431,6 +431,7 @@
31 getMergeQueue
32 revisions_since
33 code_is_browseable
34+ browse_source_url
35 code_import
36 bzr_identity
37 canBeDeleted
38
39=== modified file 'lib/lp/code/interfaces/branch.py'
40--- lib/lp/code/interfaces/branch.py 2009-10-05 14:17:48 +0000
41+++ lib/lp/code/interfaces/branch.py 2009-10-07 22:06:12 +0000
42@@ -787,6 +787,9 @@
43 end of the URL (with `bzrlib.urlutils.join`).
44 """
45
46+ browse_source_url = Attribute(
47+ "The URL of the source browser for this branch.")
48+
49 # Don't use Object -- that would cause an import loop with ICodeImport.
50 code_import = Attribute("The associated CodeImport, if any.")
51
52
53=== modified file 'lib/lp/code/model/branch.py'
54--- lib/lp/code/model/branch.py 2009-10-05 14:17:48 +0000
55+++ lib/lp/code/model/branch.py 2009-10-07 22:06:12 +0000
56@@ -435,6 +435,10 @@
57 return urlutils.join(root, self.unique_name, *extras)
58
59 @property
60+ def browse_source_url(self):
61+ return self.codebrowse_url('files')
62+
63+ @property
64 def bzr_identity(self):
65 """See `IBranch`."""
66 # XXX: JonathanLange 2009-03-19 spec=package-branches bug=345740: This
67
68=== modified file 'lib/lp/code/model/tests/test_branch.py'
69--- lib/lp/code/model/tests/test_branch.py 2009-10-01 13:25:12 +0000
70+++ lib/lp/code/model/tests/test_branch.py 2009-10-07 22:06:12 +0000
71@@ -1333,6 +1333,13 @@
72 'http://bazaar.launchpad.dev/' + branch.unique_name + '/a/b',
73 branch.codebrowse_url('a', 'b'))
74
75+ def test_source_code_url(self):
76+ # The source code URL points to the codebrowse URL where you can
77+ # actually browse the source code.
78+ branch = self.factory.makeAnyBranch()
79+ self.assertEqual(
80+ branch.browse_source_url, branch.codebrowse_url('files'))
81+
82
83 class TestBranchNamespace(TestCaseWithFactory):
84 """Tests for `IBranch.namespace`."""
85
86=== modified file 'lib/lp/code/templates/product-branch-summary.pt'
87--- lib/lp/code/templates/product-branch-summary.pt 2009-09-08 08:48:35 +0000
88+++ lib/lp/code/templates/product-branch-summary.pt 2009-10-07 22:06:12 +0000
89@@ -50,7 +50,7 @@
90 dev_focus context/development_focus/branch">
91 You can
92 <tal:browseable condition="dev_focus/code_is_browseable">
93- <a tal:attributes="href dev_focus/codebrowse_url"
94+ <a tal:attributes="href dev_focus/browse_source_url"
95 >browse the source code</a> for the development focus branch or get a
96 copy of the branch</tal:browseable>
97 <tal:not-browseable condition="not: dev_focus/code_is_browseable">