bzr diff --filter= or equivalent?

Martin Pool mbp at canonical.com
Thu Feb 3 21:27:22 UTC 2011


On 4 February 2011 05:34, Doug Lee <dgl at dlee.org> wrote:
> I see that bzr diff allows --using for an external differ, but I want
> a filter applied to files before the internal differ is used.  Sample
> usage:
>
>        bzr diff --filter=docstream figures.xlsx
>
> where docstream is a program that converts a Microsoft Office
> Word/Excel file into a more diff-friendly format.  I have written a
> quick example of such a filter.  Bzr would send each version of the
> file through docstream and compare the output instead of the original
> content.
>
> Since I don't know if attachments are allowed here and it's a short
> program, I'll just drop its 49-line self right here; pardon any
> presumptuousness this demonstrates. :)  This currently requires the
> name of the source file on the command line, but of course it would be
> easy enough to allow default-to-stdin or add support of filename "-".
> No license restrictions.
>
> Is this planned, currently possible somewhere I missed, ... or should
> I file it as a bug/feature request?

I think it's a nice idea and I don't know of any existing bug.  Please
file one.  It should not be too hard to add as a feature, and if
you're interested we will help you work out how to fit it in.

One way would be to put it into DiffFromTool in diff.py.

More generally we could look at this as a kind of tree transform that
changes the text of the files on the way to being seen by diff.  That
could let you use it in other places like cat or export, but it might
be a bit more complicated to insert.

Martin



More information about the bazaar mailing list