Merge lp:~rockstar/launchpad/bug-326592 into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Approved by: Aaron Bentley
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/bug-326592
Merge into: lp:launchpad
Diff against target: 112 lines (+34/-8)
4 files modified
lib/lp/code/model/branch.py (+1/-1)
lib/lp/code/model/tests/test_branch.py (+1/-1)
lib/lp/code/stories/branches/xx-bug-branch-links.txt (+31/-5)
lib/lp/code/templates/branch-delete.pt (+1/-1)
To merge this branch: bzr merge lp:~rockstar/launchpad/bug-326592
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+19919@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

Hi there-

  This branch fixes bug# 326592. Basically, the branch deletion requirements
needed to link to the bug, not the bugbranch (since we're trying to hide the
bugbranch stuff away). The link is now fixed.

  One caveat, however, was that the link formatter for bugs doesn't set the
icon properly. I talked with Deryck about it, and it's a known issue. This
means I had to get the sprite icon from the IBug.default_bugtask. This issue
was pointed out to me by Aaron.

  To test: test -vvtc xx-bug-branch-links.txt

Cheers,
Paul

Revision history for this message
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/model/branch.py'
2--- lib/lp/code/model/branch.py 2010-02-22 01:44:55 +0000
3+++ lib/lp/code/model/branch.py 2010-02-24 17:14:18 +0000
4@@ -609,7 +609,7 @@
5
6 for bugbranch in self.bug_branches:
7 deletion_operations.append(
8- DeletionCallable(bugbranch,
9+ DeletionCallable(bugbranch.bug.default_bugtask,
10 _('This bug is linked to this branch.'),
11 bugbranch.destroySelf))
12 for spec_link in self.spec_links:
13
14=== modified file 'lib/lp/code/model/tests/test_branch.py'
15--- lib/lp/code/model/tests/test_branch.py 2010-02-02 22:26:04 +0000
16+++ lib/lp/code/model/tests/test_branch.py 2010-02-24 17:14:18 +0000
17@@ -867,7 +867,7 @@
18 """Deletion requirements for a branch with a bug are right."""
19 bug = self.factory.makeBug()
20 bug.linkBranch(self.branch, self.branch.owner)
21- self.assertEqual({bug.linked_branches[0]:
22+ self.assertEqual({bug.default_bugtask:
23 ('delete', _('This bug is linked to this branch.'))},
24 self.branch.deletionRequirements())
25
26
27=== modified file 'lib/lp/code/stories/branches/xx-bug-branch-links.txt'
28--- lib/lp/code/stories/branches/xx-bug-branch-links.txt 2009-11-17 09:08:17 +0000
29+++ lib/lp/code/stories/branches/xx-bug-branch-links.txt 2010-02-24 17:14:18 +0000
30@@ -1,10 +1,13 @@
31-= Bug branch links =
32+================
33+Bug branch links
34+================
35
36 It is possible to link bugs and branches from both the bug page and the branch
37 page.
38
39
40-== From the branch page ==
41+From the branch page
42+====================
43
44 There is a "Link to a bug report" item in the actions menu that is visible
45 to everybody but which links to a page restricted with the
46@@ -98,7 +101,8 @@
47 No bug branch links
48
49
50-== From the bug page ==
51+From the bug page
52+=================
53
54 The action link on the bug page is "Link a related branch". Again this
55 links to a page restricted with the launchpad.AnyPerson permission.
56@@ -129,7 +133,8 @@
57 Bug #11: Make Jokosher use autoaudiosink (Undecided – New)
58
59
60-=== Quick branch registration ===
61+Quick branch registration
62+=========================
63
64 You can also register a branch at the same time as registering a bug-branch
65 link. Instead of entering the unique name of a branch, you can enter a URL:
66@@ -182,7 +187,8 @@
67 No bug branch links
68
69
70-== Deleting bug branch links ==
71+Deleting bug branch links
72+=========================
73
74 The edit view for the bug branch also now has a delete button to unlink
75 the bug from the branch.
76@@ -192,3 +198,23 @@
77 >>> browser.getLink(url="+delete").click()
78 >>> printBugBranchLinks(browser)
79 No bug branch links
80+
81+
82+Deleting a branch with linked bugs
83+==================================
84+
85+ >>> login('no-priv@canonical.com')
86+ >>> grub = factory.makeAnyBranch()
87+ >>> new_bug = factory.makeBug()
88+ >>> grub_bug_link = grub.linkBug(new_bug, grub.owner)
89+ >>> grub_url = canonical_url(grub)
90+ >>> logout()
91+
92+ >>> admin_browser.open(grub_url)
93+ >>> admin_browser.getLink('Delete branch').click()
94+
95+ >>> print find_tag_by_id(admin_browser.contents, 'deletion-items')
96+ <ul ...
97+ <a href="http://bugs.launchpad.dev/product-name.../+bug/..."
98+ class="sprite bug-undecided">Bug #...: generic-string...</a>...
99+
100
101=== modified file 'lib/lp/code/templates/branch-delete.pt'
102--- lib/lp/code/templates/branch-delete.pt 2009-08-12 00:47:32 +0000
103+++ lib/lp/code/templates/branch-delete.pt 2010-02-24 17:14:18 +0000
104@@ -24,7 +24,7 @@
105
106 <tal:deletelist condition="view/branch_deletion_actions/delete">
107 The following items must be <em>deleted</em>:
108- <ul>
109+ <ul id="deletion-items">
110 <tal:actions repeat="row view/branch_deletion_actions/delete">
111 <li>
112 <img src="/@@/no" title="Insufficient privileges"