Binary file support

Martin Pool martinpool at gmail.com
Wed Oct 19 04:28:12 BST 2005


On 14/10/05, Alexander Belchenko <bialix at ukr.net> wrote:
> John Arbash Meinel ?8H5B:
> > 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?
>
> I mean that text files may use different line endings on different
> platforms: LF, CRLF, CR, other?

It's definitely an important problem.

I think line-endings are a bit different from binary contents, because
it describes a user's wish as to how the file behave, rather than a
statement of fact about what's in it.

> At now bzr save in the repository actual line endings from edited file.
> I often faced with problem, when after patching some of bzrlib/* python
> files on Windows all line endings was changed to CRLF by patch utility
> and following diff show me that all file content is deleted and then
> added with patch changes. So I need convert patched files to LF line
> endigns manually. It's not difficult, but sometimes I forget about this.
>
> I think it will be useful if inventory will save for each text file
> additional metadata about used line endings:

I think that'd be good too.

> * Actual (the same as in file on disk, used in current bzr implementation)
> * LF
> * CRLF
> * CR
> * other?

So "actual" is like "binary": don't make any conversions, even if the
file contains a mix of different line-endings.

The other option is "convert to the target platform's default".  This
is what you'd probably want for most source files.

> May be this idea is too stupid, but I every day face with different line
> endings during multiplatform development.

No, it's a good idea.  There may be some fiddly bits in making sure
everything that deals with files ahandles different settings correctly
but it can be done.

http://bazaar.canonical.com/LineEndings

--
Martin




More information about the bazaar mailing list