Binary file support

Jan Hudec bulb at ucw.cz
Fri Oct 14 11:44:40 BST 2005


On Fri, Oct 14, 2005 at 12:54:07 +0300, Alexander Belchenko wrote:
> John Arbash Meinel ??????????:
> >I know Aaron mentioned a patch in the past, to add a binary flag to
> >files, so that we can more properly handle diff and merge.
> 
> What about different text files?

That's mostly orthogonal.

The way mercurial recently implemented this seems like a good idea. They
have a configurable filter for converting the file between on-disk and
canonical format. The file is converted to canonical form for diffing
and patching (though third filter converting the diff to on-disk form
might do better).

Mercurial matches the filters by filenames and the filters can only be
external commands so far. IIRC the file is not versioned there.

I think that plugin-provided classes would be slightly better and that
there should be both versioed and unversioned configuration source. Or
maybe better there should be default and than the selection for
particular files would be recorded in manifest.

> I mean that text files may use different line endings on different 
> platforms: LF, CRLF, CR, other?

Well, next thing someone will request is charset conversion, then
keyword expansion and whatnot else. Plugable filters are a reasonable
way to go.

Actually, I'd suggest plugable diff for the text/binary stuff to. So the
configuration would not say whether it's binary, but rather a diffing
algorithm for it. So the manifest would end up containing something
like:

<filters>
	<filter class="NativeLineEnding" />
	<filter class="LocaleCharset" />
	<filter class="Keywords" />
</filters>
<diff class="TextDiff" />

And binary files would simply have:

<filters />
<diff class="BinaryDiff" />

That would leave the space for adding eg.

<diff class="OpenDocumentDiff" />

without changing the format, except that the repository that actually
uses the new diff would not be readable by bzr without that diff method.
Adding filters would not even have this problem, because filters can be
skipped if they are not available.

--
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051014/25b26731/attachment.pgp 


More information about the bazaar mailing list