[PATCH] send external diff to a file (bug 4047)
James Henstridge
james.henstridge at gmail.com
Thu May 4 07:11:11 BST 2006
This patch is based on a patch I did a while ago to allow redirecting
diff output to a file when using an external diff process. Currently
the external_diff() function contains the following check which
prevents this:
def external_diff(old_filename, oldlines, new_filename, newlines, to_file,
diff_opts):
"""Display a diff by calling out to the external diff program."""
import sys
if to_file != sys.stdout:
raise NotImplementedError("sorry, can't send external diff
other than to stdout yet",
to_file)
...
The patch alters external_diff() to use the subprocess module to
execute the external command rather than os.spawnv() which makes it
possible to direct the output to a file descriptor other than stdout.
I also added a simple test for the external_diff() function as Martin
requested in the bug report.
I haven't added support for directing output to file like objects
without an associated file descriptor (e.g. StringIO), so left a check
for that condition in the code.
The changes are in my bzr branch here (currently at revno 1695):
http://people.ubuntu.com/~jamesh/bzr/bzr.smallfixes
James.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzr-external-diff-to-file.patch
Type: text/x-patch
Size: 2569 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060504/b95055b8/attachment.bin
More information about the bazaar
mailing list