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
=== modified file 'lib/lp/code/browser/branch.py'
--- lib/lp/code/browser/branch.py 2009-09-28 22:19:22 +0000
+++ lib/lp/code/browser/branch.py 2009-10-07 22:06:12 +0000
@@ -305,6 +305,7 @@
305 """305 """
306 return self.branch.target.getBugTask(self.context)306 return self.branch.target.getBugTask(self.context)
307307
308
308class BranchView(LaunchpadView, FeedsMixin):309class BranchView(LaunchpadView, FeedsMixin):
309310
310 __used_for__ = IBranch311 __used_for__ = IBranch
311312
=== modified file 'lib/lp/code/browser/tests/test_product.py'
--- lib/lp/code/browser/tests/test_product.py 2009-07-17 00:26:05 +0000
+++ lib/lp/code/browser/tests/test_product.py 2009-10-07 22:06:12 +0000
@@ -66,8 +66,7 @@
6666
67 link = self.getBranchSummaryBrowseLinkForProduct(product)67 link = self.getBranchSummaryBrowseLinkForProduct(product)
68 login(ANONYMOUS)68 login(ANONYMOUS)
69 self.assertEqual(69 self.assertEqual(link.url, branch.browse_source_url)
70 link.url, branch.codebrowse_url())
7170
72 def test_unbrowseable_branch_does_not_have_link(self):71 def test_unbrowseable_branch_does_not_have_link(self):
73 # If the product's development focus branch is not browseable, there72 # If the product's development focus branch is not browseable, there
7473
=== modified file 'lib/lp/code/configure.zcml'
--- lib/lp/code/configure.zcml 2009-10-05 14:17:48 +0000
+++ lib/lp/code/configure.zcml 2009-10-07 22:06:12 +0000
@@ -431,6 +431,7 @@
431 getMergeQueue431 getMergeQueue
432 revisions_since432 revisions_since
433 code_is_browseable433 code_is_browseable
434 browse_source_url
434 code_import435 code_import
435 bzr_identity436 bzr_identity
436 canBeDeleted437 canBeDeleted
437438
=== modified file 'lib/lp/code/interfaces/branch.py'
--- lib/lp/code/interfaces/branch.py 2009-10-05 14:17:48 +0000
+++ lib/lp/code/interfaces/branch.py 2009-10-07 22:06:12 +0000
@@ -787,6 +787,9 @@
787 end of the URL (with `bzrlib.urlutils.join`).787 end of the URL (with `bzrlib.urlutils.join`).
788 """788 """
789789
790 browse_source_url = Attribute(
791 "The URL of the source browser for this branch.")
792
790 # Don't use Object -- that would cause an import loop with ICodeImport.793 # Don't use Object -- that would cause an import loop with ICodeImport.
791 code_import = Attribute("The associated CodeImport, if any.")794 code_import = Attribute("The associated CodeImport, if any.")
792795
793796
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py 2009-10-05 14:17:48 +0000
+++ lib/lp/code/model/branch.py 2009-10-07 22:06:12 +0000
@@ -435,6 +435,10 @@
435 return urlutils.join(root, self.unique_name, *extras)435 return urlutils.join(root, self.unique_name, *extras)
436436
437 @property437 @property
438 def browse_source_url(self):
439 return self.codebrowse_url('files')
440
441 @property
438 def bzr_identity(self):442 def bzr_identity(self):
439 """See `IBranch`."""443 """See `IBranch`."""
440 # XXX: JonathanLange 2009-03-19 spec=package-branches bug=345740: This444 # XXX: JonathanLange 2009-03-19 spec=package-branches bug=345740: This
441445
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2009-10-01 13:25:12 +0000
+++ lib/lp/code/model/tests/test_branch.py 2009-10-07 22:06:12 +0000
@@ -1333,6 +1333,13 @@
1333 'http://bazaar.launchpad.dev/' + branch.unique_name + '/a/b',1333 'http://bazaar.launchpad.dev/' + branch.unique_name + '/a/b',
1334 branch.codebrowse_url('a', 'b'))1334 branch.codebrowse_url('a', 'b'))
13351335
1336 def test_source_code_url(self):
1337 # The source code URL points to the codebrowse URL where you can
1338 # actually browse the source code.
1339 branch = self.factory.makeAnyBranch()
1340 self.assertEqual(
1341 branch.browse_source_url, branch.codebrowse_url('files'))
1342
13361343
1337class TestBranchNamespace(TestCaseWithFactory):1344class TestBranchNamespace(TestCaseWithFactory):
1338 """Tests for `IBranch.namespace`."""1345 """Tests for `IBranch.namespace`."""
13391346
=== modified file 'lib/lp/code/templates/product-branch-summary.pt'
--- lib/lp/code/templates/product-branch-summary.pt 2009-09-08 08:48:35 +0000
+++ lib/lp/code/templates/product-branch-summary.pt 2009-10-07 22:06:12 +0000
@@ -50,7 +50,7 @@
50 dev_focus context/development_focus/branch">50 dev_focus context/development_focus/branch">
51 You can51 You can
52 <tal:browseable condition="dev_focus/code_is_browseable">52 <tal:browseable condition="dev_focus/code_is_browseable">
53 <a tal:attributes="href dev_focus/codebrowse_url"53 <a tal:attributes="href dev_focus/browse_source_url"
54 >browse the source code</a> for the development focus branch or get a54 >browse the source code</a> for the development focus branch or get a
55 copy of the branch</tal:browseable>55 copy of the branch</tal:browseable>
56 <tal:not-browseable condition="not: dev_focus/code_is_browseable">56 <tal:not-browseable condition="not: dev_focus/code_is_browseable">