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
1=== modified file 'lib/lp/bugs/browser/bugtask.py'
2--- lib/lp/bugs/browser/bugtask.py 2010-04-05 21:10:31 +0000
3+++ lib/lp/bugs/browser/bugtask.py 2010-04-09 18:45:35 +0000
4@@ -117,6 +117,7 @@
5 from lp.bugs.interfaces.bugtracker import BugTrackerType
6 from lp.bugs.interfaces.cve import ICveSet
7 from lp.bugs.interfaces.malone import IMaloneApplication
8+from lp.code.enums import BranchLifecycleStatus
9 from lp.registry.interfaces.distribution import IDistribution
10 from lp.registry.interfaces.distributionsourcepackage import (
11 IDistributionSourcePackage)
12@@ -996,7 +997,9 @@
13 """Filter out the bug_branch links to non-visible private branches."""
14 linked_branches = []
15 for linked_branch in self.context.bug.linked_branches:
16- if check_permission('launchpad.View', linked_branch.branch):
17+ status = linked_branch.branch.lifecycle_status
18+ if (check_permission('launchpad.View', linked_branch.branch) and
19+ status != BranchLifecycleStatus.ABANDONED):
20 linked_branches.append(linked_branch)
21 return linked_branches
22
23
24=== modified file 'lib/lp/bugs/stories/bugs/xx-link-bug-to-branch.txt'
25--- lib/lp/bugs/stories/bugs/xx-link-bug-to-branch.txt 2009-11-17 09:08:17 +0000
26+++ lib/lp/bugs/stories/bugs/xx-link-bug-to-branch.txt 2010-04-09 18:45:35 +0000
27@@ -36,6 +36,34 @@
28 lp://dev/~name12/firefox/main
29 ...
30
31+Branches marked abandoned are no longer visible as linked branches on
32+a bug page. To demonstrate this, the branch used here will need to be
33+edited and set to abandoned.
34+
35+ >>> from zope.component import getUtility
36+ >>> from zope.security.proxy import removeSecurityProxy
37+ >>> from lp.code.interfaces.branch import IBranchSet
38+ >>> from lp.code.enums import BranchLifecycleStatus
39+ >>> login(ANONYMOUS)
40+ >>> branch = getUtility(IBranchSet).getByUniqueName(
41+ ... '~name12/firefox/main')
42+ >>> editable_branch = removeSecurityProxy(branch)
43+ >>> logout()
44+
45+Once abandoned the branch doesn't appear when the page is reloaded.
46+
47+ >>> editable_branch.lifecycle_status = BranchLifecycleStatus.ABANDONED
48+ >>> user_browser.reload()
49+ >>> 'lp://dev/~name12/firefox/main' in extract_text(user_browser.contents)
50+ False
51+
52+If the status changes, the branch will reappear on the page after a reload.
53+
54+ >>> editable_branch.lifecycle_status = BranchLifecycleStatus.DEVELOPMENT
55+ >>> user_browser.reload()
56+ >>> 'lp://dev/~name12/firefox/main' in extract_text(user_browser.contents)
57+ True
58+
59 We can delete existing links between a bug and a branch.
60
61 >>> delete_branch_link_url = (