Merge lp:~abentley/launchpad/parse-binary into lp:launchpad

Proposed by Aaron Bentley
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~abentley/launchpad/parse-binary
Merge into: lp:launchpad
Diff against target: 55 lines
3 files modified
lib/lp/code/model/diff.py (+3/-1)
lib/lp/code/model/tests/test_diff.py (+5/-0)
versions.cfg (+3/-3)
To merge this branch: bzr merge lp:~abentley/launchpad/parse-binary
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) release-critical Approve
Brad Crittenden (community) code Approve
Review via email: mp+13600@code.launchpad.net

Commit message

Diffstat generation handles binaries

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

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

= Summary =
Fix bugs 436325 and 436794 by updating bzr and diffstat generation

== Proposed fix ==
Skip binary files when generating diffstats

== Pre-implementation notes ==
No pre-implementation was done, but the bzr changes were approved by vila.

== Implementation details ==
bzr was updated to 2.0-lp-2, which correctly parses binary sections, and
 permits unicode filenames.

The diffstat generation was updated to skip binary patch sections.

== Tests ==
bin/test -v test_fromFileAcceptsBinary

== Demo and Q/A ==
Create a branch containing a binary file with a unicode filename.
Branch it, and modify the file.
Propose the second branch for merging into the first.
A diff should be generated, with no OOPs.

= Launchpad lint =

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

Linting changed files:
  versions.cfg
  lib/lp/code/model/diff.py
  lib/lp/code/model/tests/test_diff.py

== Pylint notices ==

lib/lp/code/model/diff.py
    17: [F0401] Unable to import 'lazr.delegates' (No module named
delegates)
    166: [W0703, Diff.fromFile] Catch "Exception"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEUEARECAAYFAkrc3IkACgkQ0F+nu1YWqI2O4QCfW8sxKPICQKsX64QwD/Z47KPk
zbAAljW1R0JwgNqz/qEj5hou0DXo7g4=
=5cev
-----END PGP SIGNATURE-----

Revision history for this message
Brad Crittenden (bac) :
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/model/diff.py'
2--- lib/lp/code/model/diff.py 2009-10-05 14:17:48 +0000
3+++ lib/lp/code/model/diff.py 2009-10-19 21:45:23 +0000
4@@ -12,7 +12,7 @@
5
6 from bzrlib.branch import Branch
7 from bzrlib.diff import show_diff_trees
8-from bzrlib.patches import parse_patches
9+from bzrlib.patches import parse_patches, Patch
10 from bzrlib.merge import Merge3Merger
11 from lazr.delegates import delegates
12 import simplejson
13@@ -188,6 +188,8 @@
14 """
15 file_stats = {}
16 for patch in parse_patches(diff_bytes.splitlines(True)):
17+ if not isinstance(patch, Patch):
18+ continue
19 path = patch.newname.split('\t')[0]
20 file_stats[path] = tuple(patch.stats_values()[:2])
21 return file_stats
22
23=== modified file 'lib/lp/code/model/tests/test_diff.py'
24--- lib/lp/code/model/tests/test_diff.py 2009-10-14 03:01:42 +0000
25+++ lib/lp/code/model/tests/test_diff.py 2009-10-19 21:45:23 +0000
26@@ -177,6 +177,11 @@
27 self.assertEqual({'bar': (0, 3), 'baz': (2, 0), 'foo': (2, 1)},
28 diff.diffstat)
29
30+ def test_fromFileAcceptsBinary(self):
31+ diff_bytes = "Binary files a\t and b\t differ\n"
32+ diff = Diff.fromFile(StringIO(diff_bytes), len(diff_bytes))
33+ self.assertEqual({}, diff.diffstat)
34+
35 def test_fromFileSets_added_removed(self):
36 """fromFile sets added_lines_count, removed_lines_count."""
37 diff = Diff.fromFile(
38
39=== modified file 'versions.cfg'
40--- versions.cfg 2009-10-16 01:54:41 +0000
41+++ versions.cfg 2009-10-19 21:45:23 +0000
42@@ -4,10 +4,10 @@
43 [versions]
44 # Alphabetical, case-insensitive, please! :-)
45 #
46-# 4671:lp:~launchpad/bzr/2.0.0-lp
47-# This dramatically speeds up preview diffs involving large numbers of files.
48+# 4674:lp:~launchpad/bzr/2.0.0-lp
49+# This fixes various oopses.
50 # To generate tarball: "make dist" and rename to taste.
51-bzr = 2.0.0-lp-1
52+bzr = 2.0.0-lp-2
53 chameleon.core = 1.0b35
54 chameleon.zpt = 1.0b17
55 ClientForm = 0.2.10