[MERGE REVIEW] Binary file handling

Aaron Bentley aaron.bentley at utoronto.ca
Sun Apr 16 18:51:32 BST 2006


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

Hi all,

This patch adds support for binary file handling in diff and merge.
That is, diffing a binary file will produce 'Binary files differ'.

Text merges won't be performed on binary files-- if a scalar merge can't
be performed, foo.BASE, foo.THIS and foo.OTHER will be emitted, with no
foo.  (foo.OTHER will be versioned).

Binary files are defined as files containing the NUL character (\x00) in
their first 1024 bytes.  Reportedly, this is the heuristic used by diff.
~ This does, unfortunately, mean that UTF-16 files will be treated as
binary.

It is tempting to test for ESC as well, since that would prevent bzr
diff from messing up the user's terminal.  Text files containing ESC are
relatively rare, but they do exist, e.g. shell scripts that set terminal
colors.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEQoQk0F+nu1YWqI0RAj2MAJ4zmPhz9olh4S0ju+OOOsfmYIeG4ACeIo5n
D6Km4dRZz63hyurPWSLAzZQ=
=2uHw
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binary-handling.patch
Type: text/x-patch
Size: 18029 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060416/9e2d272b/attachment.bin 


More information about the bazaar mailing list