Merge lp:~abentley/launchpad/ignore-md-diff into lp:launchpad

Proposed by Aaron Bentley
Status: Merged
Merged at revision: not available
Proposed branch: lp:~abentley/launchpad/ignore-md-diff
Merge into: lp:launchpad
Diff against target: 51 lines
2 files modified
lib/lp/code/mail/codehandler.py (+1/-17)
lib/lp/code/mail/tests/test_codehandler.py (+1/-1)
To merge this branch: bzr merge lp:~abentley/launchpad/ignore-md-diff
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) release-critical Approve
Abel Deuring (community) code Approve
Review via email: mp+13491@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

= Summary =
This patch stops launchpad from storing the diffs in merge directives,
fixing bug #453010.

== Proposed fix ==
bzr has a bug in its patch parsing, but we are only exposed to it when
we process diffs that we don't get directly from bzrlib. When we
receive diffs via email, there's a chance that the mail client will
munge the newlines, which exposes us to this bug.

We are no longer using this type of diff at all, so there's no need to
be retrieving it from the merge directive.

So this patch simply stops attempting to store the diff from the merge
directive. For the time being, this means that it will be generated by
the MergeProposalCreationJob, but eventually, we can shut that off too.

== Pre-implementation notes ==
This patch has no pre-implementation call.

== Implementation details ==
Nothing to add

== Tests ==
bin/test -v test_codehandler

== Demo and Q/A ==
Generate a merge directive. Convert its line endings to CRLF. Send it
as an attachment to <email address hidden>. Launchpad should not
report an OOPS (via email).

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/code/mail/codehandler.py
  lib/lp/code/mail/tests/test_codehandler.py
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrYqkkACgkQ0F+nu1YWqI360gCdGSh7GtIj/OjKgm1f76PkOZkk
piYAn1pfPDnOPUgeA7HJ4izjFyD+9pJ/
=xtLB
-----END PGP SIGNATURE-----

Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)
Revision history for this message
Francis J. Lacoste (flacoste) :
review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/mail/codehandler.py'
2--- lib/lp/code/mail/codehandler.py 2009-07-17 00:26:05 +0000
3+++ lib/lp/code/mail/codehandler.py 2009-10-16 17:20:28 +0000
4@@ -21,7 +21,6 @@
5
6 from lp.codehosting.bzrutils import is_branch_stackable
7 from lp.codehosting.vfs import get_lp_server
8-from lp.code.interfaces.diff import IStaticDiffSource
9 from canonical.launchpad.interfaces.mail import (
10 IMailHandler, EmailProcessingError)
11 from canonical.launchpad.interfaces.message import IMessageSet
12@@ -582,25 +581,10 @@
13 'Error Creating Merge Proposal', body)
14 return
15
16- if md.patch is not None:
17- diff_source = getUtility(IStaticDiffSource)
18- # XXX: Tim Penhey, 2009-02-12, bug 328271
19- # If the branch is private we should probably use the restricted
20- # librarian.
21- # Using the .txt suffix to allow users to view the file in
22- # firefox without firefox trying to get them to download it.
23- filename = '%s.diff.txt' % source.name
24- review_diff = diff_source.acquireFromText(
25- md.base_revision_id, md.revision_id, md.patch,
26- filename=filename)
27- transaction.commit()
28- else:
29- review_diff = None
30
31 try:
32 bmp = source.addLandingTarget(submitter, target,
33- needs_review=True,
34- review_diff=review_diff)
35+ needs_review=True)
36
37 context = CodeReviewEmailCommandExecutionContext(
38 bmp, submitter, notify_event_listeners=False)
39
40=== modified file 'lib/lp/code/mail/tests/test_codehandler.py'
41--- lib/lp/code/mail/tests/test_codehandler.py 2009-09-24 05:41:53 +0000
42+++ lib/lp/code/mail/tests/test_codehandler.py 2009-10-16 17:20:28 +0000
43@@ -468,7 +468,7 @@
44 bmp, comment = code_handler.processMergeProposal(message)
45 self.assertEqual(source, bmp.source_branch)
46 self.assertEqual(target, bmp.target_branch)
47- self.assertEqual('', bmp.review_diff.diff.text)
48+ self.assertIs(None, bmp.review_diff)
49 self.assertEqual('Hi!\n', comment.message.text_contents)
50 self.assertEqual('My subject', comment.message.subject)
51 # No emails are sent.