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
=== modified file 'lib/lp/code/model/diff.py'
--- lib/lp/code/model/diff.py 2009-10-05 14:17:48 +0000
+++ lib/lp/code/model/diff.py 2009-10-19 21:45:23 +0000
@@ -12,7 +12,7 @@
1212
13from bzrlib.branch import Branch13from bzrlib.branch import Branch
14from bzrlib.diff import show_diff_trees14from bzrlib.diff import show_diff_trees
15from bzrlib.patches import parse_patches15from bzrlib.patches import parse_patches, Patch
16from bzrlib.merge import Merge3Merger16from bzrlib.merge import Merge3Merger
17from lazr.delegates import delegates17from lazr.delegates import delegates
18import simplejson18import simplejson
@@ -188,6 +188,8 @@
188 """188 """
189 file_stats = {}189 file_stats = {}
190 for patch in parse_patches(diff_bytes.splitlines(True)):190 for patch in parse_patches(diff_bytes.splitlines(True)):
191 if not isinstance(patch, Patch):
192 continue
191 path = patch.newname.split('\t')[0]193 path = patch.newname.split('\t')[0]
192 file_stats[path] = tuple(patch.stats_values()[:2])194 file_stats[path] = tuple(patch.stats_values()[:2])
193 return file_stats195 return file_stats
194196
=== modified file 'lib/lp/code/model/tests/test_diff.py'
--- lib/lp/code/model/tests/test_diff.py 2009-10-14 03:01:42 +0000
+++ lib/lp/code/model/tests/test_diff.py 2009-10-19 21:45:23 +0000
@@ -177,6 +177,11 @@
177 self.assertEqual({'bar': (0, 3), 'baz': (2, 0), 'foo': (2, 1)},177 self.assertEqual({'bar': (0, 3), 'baz': (2, 0), 'foo': (2, 1)},
178 diff.diffstat)178 diff.diffstat)
179179
180 def test_fromFileAcceptsBinary(self):
181 diff_bytes = "Binary files a\t and b\t differ\n"
182 diff = Diff.fromFile(StringIO(diff_bytes), len(diff_bytes))
183 self.assertEqual({}, diff.diffstat)
184
180 def test_fromFileSets_added_removed(self):185 def test_fromFileSets_added_removed(self):
181 """fromFile sets added_lines_count, removed_lines_count."""186 """fromFile sets added_lines_count, removed_lines_count."""
182 diff = Diff.fromFile(187 diff = Diff.fromFile(
183188
=== modified file 'versions.cfg'
--- versions.cfg 2009-10-16 01:54:41 +0000
+++ versions.cfg 2009-10-19 21:45:23 +0000
@@ -4,10 +4,10 @@
4[versions]4[versions]
5# Alphabetical, case-insensitive, please! :-)5# Alphabetical, case-insensitive, please! :-)
6#6#
7# 4671:lp:~launchpad/bzr/2.0.0-lp7# 4674:lp:~launchpad/bzr/2.0.0-lp
8# This dramatically speeds up preview diffs involving large numbers of files.8# This fixes various oopses.
9# To generate tarball: "make dist" and rename to taste.9# To generate tarball: "make dist" and rename to taste.
10bzr = 2.0.0-lp-110bzr = 2.0.0-lp-2
11chameleon.core = 1.0b3511chameleon.core = 1.0b35
12chameleon.zpt = 1.0b1712chameleon.zpt = 1.0b17
13ClientForm = 0.2.1013ClientForm = 0.2.10