Merge lp:~cjwatson/launchpad/package-git-link into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 17842
Proposed branch: lp:~cjwatson/launchpad/package-git-link
Merge into: lp:launchpad
Diff against target: 66 lines (+22/-1)
3 files modified
lib/lp/code/browser/branchlisting.py (+7/-0)
lib/lp/code/browser/tests/test_branchlisting.py (+11/-1)
lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt (+4/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/package-git-link
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+276419@code.launchpad.net

Commit message

Add git links to DistributionSourcePackage:+branches and DistributionSourcePackage:+all-branches.

Description of the change

Add git links to DistributionSourcePackage:+branches and DistributionSourcePackage:+all-branches.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
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/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py 2015-09-23 17:51:12 +0000
+++ lib/lp/code/browser/branchlisting.py 2015-11-02 16:38:03 +0000
@@ -1361,6 +1361,8 @@
1361class DistributionSourcePackageBranchesView(BaseSourcePackageBranchesView):1361class DistributionSourcePackageBranchesView(BaseSourcePackageBranchesView):
1362 """A general listing of all branches in the distro source package."""1362 """A general listing of all branches in the distro source package."""
13631363
1364 can_have_git_link = True
1365
1364 def _getCollection(self):1366 def _getCollection(self):
1365 return getUtility(IAllBranches).inDistributionSourcePackage(1367 return getUtility(IAllBranches).inDistributionSourcePackage(
1366 self.context)1368 self.context)
@@ -1540,6 +1542,11 @@
1540 })1542 })
1541 return result1543 return result
15421544
1545 @property
1546 def show_git_link(self):
1547 c = IGitCollection(self.context)
1548 return not c.visibleByUser(self.user).is_empty()
1549
15431550
1544class SourcePackageBranchesView(BranchListingView):1551class SourcePackageBranchesView(BranchListingView):
15451552
15461553
=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
--- lib/lp/code/browser/tests/test_branchlisting.py 2015-09-28 17:38:45 +0000
+++ lib/lp/code/browser/tests/test_branchlisting.py 2015-11-02 16:38:03 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2012 Canonical Ltd. This software is licensed under the1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for branch listing."""4"""Tests for branch listing."""
@@ -618,6 +618,16 @@
618 series_branches_last_row.text_content(),618 series_branches_last_row.text_content(),
619 DocTestMatches("%s ... ago" % branch.displayname))619 DocTestMatches("%s ... ago" % branch.displayname))
620620
621 def test_git_link(self):
622 page = create_initialized_view(
623 self.distro_source_package, name='+branches', rootsite='code')()
624 self.assertNotIn('View Git repositories', page)
625
626 self.factory.makeGitRepository(target=self.distro_source_package)
627 page = create_initialized_view(
628 self.distro_source_package, name='+branches', rootsite='code')()
629 self.assertIn('View Git repositories', page)
630
621631
622class TestDevelopmentFocusPackageBranches(TestCaseWithFactory):632class TestDevelopmentFocusPackageBranches(TestCaseWithFactory):
623 """Make sure that the bzr_identity of the branches are correct."""633 """Make sure that the bzr_identity of the branches are correct."""
624634
=== modified file 'lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt'
--- lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt 2014-02-25 06:38:58 +0000
+++ lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt 2015-11-02 16:38:03 +0000
@@ -10,6 +10,10 @@
1010
11<div metal:fill-slot="main">11<div metal:fill-slot="main">
1212
13 <span class="see-all" tal:condition="view/show_git_link">
14 <a tal:attributes="href context/fmt:url:code/+git">View Git repositories</a>
15 </span>
16
13 <p id="distro-branch-warning">17 <p id="distro-branch-warning">
14 <strong>This page is for a packaging branch for a program in18 <strong>This page is for a packaging branch for a program in
15 <tal:name replace="context/distribution/displayname"/>.</strong> Changes19 <tal:name replace="context/distribution/displayname"/>.</strong> Changes