Binary file handling discussion

Nicholas Allen allen at ableton.com
Mon Nov 6 11:23:31 GMT 2006


> Let's assume there is only a central configuration file and no 
> individual file properties
> like CVS or SVN have.
>
> What happens to a file that is moved or renamed? What if i configured to
> handle xml files in 'configuration' directories different than other 
> xml files, and
> then rename the 'configuration' directory to 'config', forgetting to 
> also change the
> central .bzrtypes file. Not a good idea at all!
>
> So that seems to be the reason why CVS is using special file 
> attributes, but
> has also a central file describing the default attributes for new files.
I agree that one wants to store properties and meta data with the file 
itself and not separately so that it survives a rename or move.

There needs to be a file that determines the default set of meta data 
for a file that is *newly added* but this would only be used for new 
files. This is basically the way svn does it but svn only has one config 
file per user and it is not possible to store the file in the 
repository. This means that every user has to be setup separately as 
this information cannot be stored in the project.

Even so, I think svn's property mechanism has shown itself to be a 
successful one and so I would recommend that bzr also use such a system 
but also allows the user to put the "auto props for new files" 
configuration file in the repository too. This would be a slight 
improvement over svn as it would allow per project default properties 
for new files (e.g one project may have .doc as binary because it 
represents a word doc and another as text because in that project that 
extension implies docbook).

I can also imagine that the properties system could be used by the user 
for many different purposes and would be a useful thing to have anyway. 
So it would make sense to have the line ending conversions that should 
be applied to a file as a property of that file (as that is exactly what 
it is).

But I would also like that bzr would warn about a file that was added 
and matched an auto properties entry implying line ending conversion but 
appeared to contain binary characters. In this case I think a warning is 
useful as the config file is only a general hint as to what properties 
should be set and may not be correct for all newly added files. In this 
case it should not set the line ending conversion property to avoid data 
loss.

Nick




More information about the bazaar mailing list