Merge lp:~deryck/launchpad/no-linky-abandoned-branches-559325 into lp:launchpad

Proposed by Deryck Hodge
Status: Rejected
Rejected by: Deryck Hodge
Proposed branch: lp:~deryck/launchpad/no-linky-abandoned-branches-559325
Merge into: lp:launchpad
Diff against target: 61 lines (+32/-1)
2 files modified
lib/lp/bugs/browser/bugtask.py (+4/-1)
lib/lp/bugs/stories/bugs/xx-link-bug-to-branch.txt (+28/-0)
To merge this branch: bzr merge lp:~deryck/launchpad/no-linky-abandoned-branches-559325
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Disapprove
Review via email: mp+23135@code.launchpad.net

Commit message

Do not list abandon branches as linked branches on a bug page.

Description of the change

This branch makes sure that branches marked as abandoned are not listed on a bug page. The page test has been extended to demonstrate that this actually happens as it should.

./bin/test -cvvt xx-link-bug-to-branch.txt

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

I think that hiding the branch is not the right approach. The fact that the original developer stopped working on it does not imply that the branch is useless, and we should err on the side of showing things that may be useful.

However, we should prominently display the abandoned status. We might also want to reduce the visibility of the merge proposal, or hide it entirely. It implies that the branch is in development, which is at odds with the branch's status. (We should still allow traversal to the merge proposal from the branch page itself.)

If there were no merge proposal, the Abandoned status would be prominent, so as a first cut, I suggest that we ignore the merge proposals of abandoned branches in this display.

review: Disapprove

Unmerged revisions

10649. By Deryck Hodge

Test that abandon branches don't appear on a bug page.

10648. By Deryck Hodge

Do not include abandoned branches in linked_branches.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-04-05 21:10:31 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-04-09 18:45:35 +0000
@@ -117,6 +117,7 @@
117from lp.bugs.interfaces.bugtracker import BugTrackerType117from lp.bugs.interfaces.bugtracker import BugTrackerType
118from lp.bugs.interfaces.cve import ICveSet118from lp.bugs.interfaces.cve import ICveSet
119from lp.bugs.interfaces.malone import IMaloneApplication119from lp.bugs.interfaces.malone import IMaloneApplication
120from lp.code.enums import BranchLifecycleStatus
120from lp.registry.interfaces.distribution import IDistribution121from lp.registry.interfaces.distribution import IDistribution
121from lp.registry.interfaces.distributionsourcepackage import (122from lp.registry.interfaces.distributionsourcepackage import (
122 IDistributionSourcePackage)123 IDistributionSourcePackage)
@@ -996,7 +997,9 @@
996 """Filter out the bug_branch links to non-visible private branches."""997 """Filter out the bug_branch links to non-visible private branches."""
997 linked_branches = []998 linked_branches = []
998 for linked_branch in self.context.bug.linked_branches:999 for linked_branch in self.context.bug.linked_branches:
999 if check_permission('launchpad.View', linked_branch.branch):1000 status = linked_branch.branch.lifecycle_status
1001 if (check_permission('launchpad.View', linked_branch.branch) and
1002 status != BranchLifecycleStatus.ABANDONED):
1000 linked_branches.append(linked_branch)1003 linked_branches.append(linked_branch)
1001 return linked_branches1004 return linked_branches
10021005
10031006
=== modified file 'lib/lp/bugs/stories/bugs/xx-link-bug-to-branch.txt'
--- lib/lp/bugs/stories/bugs/xx-link-bug-to-branch.txt 2009-11-17 09:08:17 +0000
+++ lib/lp/bugs/stories/bugs/xx-link-bug-to-branch.txt 2010-04-09 18:45:35 +0000
@@ -36,6 +36,34 @@
36 lp://dev/~name12/firefox/main36 lp://dev/~name12/firefox/main
37 ...37 ...
3838
39Branches marked abandoned are no longer visible as linked branches on
40a bug page. To demonstrate this, the branch used here will need to be
41edited and set to abandoned.
42
43 >>> from zope.component import getUtility
44 >>> from zope.security.proxy import removeSecurityProxy
45 >>> from lp.code.interfaces.branch import IBranchSet
46 >>> from lp.code.enums import BranchLifecycleStatus
47 >>> login(ANONYMOUS)
48 >>> branch = getUtility(IBranchSet).getByUniqueName(
49 ... '~name12/firefox/main')
50 >>> editable_branch = removeSecurityProxy(branch)
51 >>> logout()
52
53Once abandoned the branch doesn't appear when the page is reloaded.
54
55 >>> editable_branch.lifecycle_status = BranchLifecycleStatus.ABANDONED
56 >>> user_browser.reload()
57 >>> 'lp://dev/~name12/firefox/main' in extract_text(user_browser.contents)
58 False
59
60If the status changes, the branch will reappear on the page after a reload.
61
62 >>> editable_branch.lifecycle_status = BranchLifecycleStatus.DEVELOPMENT
63 >>> user_browser.reload()
64 >>> 'lp://dev/~name12/firefox/main' in extract_text(user_browser.contents)
65 True
66
39We can delete existing links between a bug and a branch.67We can delete existing links between a bug and a branch.
4068
41 >>> delete_branch_link_url = (69 >>> delete_branch_link_url = (