Merge lp:~brian-murray/launchpad/text-interface-patch into lp:launchpad

Proposed by Brian Murray
Status: Merged
Approved by: Deryck Hodge
Approved revision: no longer in the source branch.
Merged at revision: 10948
Proposed branch: lp:~brian-murray/launchpad/text-interface-patch
Merge into: lp:launchpad
Diff against target: 50 lines (+14/-1)
2 files modified
lib/lp/bugs/browser/bug.py (+7/-1)
lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt (+7/-0)
To merge this branch: bzr merge lp:~brian-murray/launchpad/text-interface-patch
Reviewer Review Type Date Requested Status
Deryck Hodge (community) code Approve
Canonical Launchpad Engineering Pending
Review via email: mp+26258@code.launchpad.net

Description of the change

The +text interface of a bug report currently displays all attachments to a bug report and makes no distinction between those attachments that are patches and those that are not. This branch separates attachments that are patches out into their own section.

Some discussion relating to this appears in bug 344054.

The test modified is:
lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

Looks good. Feel free to land this once PQM reopens.

Cheers,
deryck

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bug.py'
2--- lib/lp/bugs/browser/bug.py 2010-05-16 23:56:51 +0000
3+++ lib/lp/bugs/browser/bug.py 2010-06-03 22:07:26 +0000
4@@ -791,7 +791,13 @@
5
6 text.append('attachments: ')
7 for attachment in bug.attachments:
8- text.append(' %s' % self.attachment_text(attachment))
9+ if attachment.type != BugAttachmentType.PATCH:
10+ text.append(' %s' % self.attachment_text(attachment))
11+
12+ text.append('patches: ')
13+ for attachment in bug.attachments:
14+ if attachment.type == BugAttachmentType.PATCH:
15+ text.append(' %s' % self.attachment_text(attachment))
16
17 text.append('tags: %s' % ' '.join(bug.tags))
18
19
20=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt'
21--- lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt 2010-05-21 12:57:42 +0000
22+++ lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt 2010-06-03 22:07:26 +0000
23@@ -23,6 +23,10 @@
24 >>> a2 = bug.addAttachment(mark, content, "comment for file with space",
25 ... "file with space.txt",
26 ... content_type='text/plain;\n name="file with space.txt"')
27+ >>> content = StringIO.StringIO("Yes we can!")
28+ >>> a3 = bug.addAttachment(mark, content, "comment for patch",
29+ ... "bug-patch.diff", is_patch=True, content_type='text/plain',
30+ ... description="a patch")
31
32 Next, we'll cycle through all statuses so the dates are present:
33
34@@ -68,6 +72,8 @@
35 attachments:
36 http://.../file_a.txt text/html
37 http://.../file%20with%20space.txt text/plain; name="file with space.txt"
38+ patches:
39+ http://.../bug-patch.diff text/plain
40 tags:
41 subscribers:
42 Steve Alexander (stevea)
43@@ -292,6 +298,7 @@
44 private: yes
45 security: yes
46 attachments:
47+ patches:
48 tags: lunch-money
49 subscribers:
50 Karl Tilbury (karl)