[MERGE] fix bugs with external_diff
John Arbash Meinel
john at arbash-meinel.com
Mon Jul 31 20:24:59 BST 2006
The attached patch fixes a couple bugs in how bzr handles calling out to
an external diff.
It handles these 2 reported bugs:
https://launchpad.net/products/bzr/+bug/52930
https://launchpad.net/products/bzr/+bug/54651
54651 is actually because of a bug in python's subprocess.py module. If
you call Popen(cmd, stdout=sys.stdout), the stdout is actually closed in
the child, and you get 'Bad File Descriptor'.
52930 is because 'diff' as a standalone program is very unclear about
why it returns retcode = 2. It can do so because you supply invalid
arguments, or because files are missing, or because binary files differ.
The easy fix is to just swallow retcode = 2. Instead I fixed it so that
we buffer the first line of diff's output. Which lets us check if
retcode == 2 because of Binary files.
The unreported bugs are:
the exception NoDiff() used super() which is not valid for Exception
classes
and
'bzr diff --diff-options -u' has a slightly different output than the
output of a plain 'bzr diff'. internal_diff() always adds a trailing
newline, while external_diff does not.
The fix is pretty small and well tested. So I'd like to merge this for
0.9. (bzr.dev cannot run an external diff at all because of bug 54651,
so it is fairly critical)
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: external-diff.patch
Type: text/x-patch
Size: 28174 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060731/3aa458f7/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060731/3aa458f7/attachment.pgp
More information about the bazaar
mailing list