Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-06-10 Thread rghetta
Joel Crisp wrote: I'm not against programming, just against making everyone do it. If you can provide a framework which allows a registry of common file types against the way of handling them and a library of shipped code fragments which can be incorporated without the end user having to do

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-06-10 Thread rghetta
Hi Riccardo This sounds much better. The criteria which I'm concerned about are: 1) ease of use - end users should not have to (knowingly) use LUA to configure 'pre-defined' file types 2) flexibility - the type of each file should be able to be set independently and new file types defined

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-06-01 Thread rghetta
Glen Ditchfield wrote: Why can't there be one function that examines the files and decides to run the internal merge algorithm on some kinds of files, and to exec external tools on other kinds of files? Sorry if I'm stating the obvious, but perhaps not everyone is aware that monotone

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-06-01 Thread Joel Crisp
I'm not against programming, just against making everyone do it. If you can provide a framework which allows a registry of common file types against the way of handling them and a library of shipped code fragments which can be incorporated without the end user having to do any coding, then that

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-30 Thread rghetta
On Sun, 2005-05-29 at 12:20 +0100, Joel Crisp wrote: Hi My concern about this approach is that if you have lots of different types of files to handle, XML, Word, Rational XMI (which is XML but has a specific merge tool), etc then you would end up having to do lots of jiggering in the

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-29 Thread rghetta
On Fri, 2005-05-27 at 20:13 -0700, Nathaniel Smith wrote: On Fri, May 27, 2005 at 09:44:23PM +0200, rghetta wrote: Ok, I'll try to summarize the requests (and possible answers) so far: Both Nathaniel Smith and Emile Snyder advocated the use of .mt-attrs, perhaps coupled with the

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-29 Thread rghetta
From the feedback to this patch, it appears that in naming the hook binary_file() I made big a mistake. Since the hook only effect is to disable the internal merging algorithm of monotone, perhaps a better name would be manual_merge, and that could also be used for the .mt-attr property. Riccardo

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-29 Thread rghetta
On Sat, 2005-05-28 at 09:44 -0500, Glen Ditchfield wrote: I worry that, when monotone checks for control characters, it is not always good enough, and too late for a hook to fix things. I would like to have a hook that sees that the first six bytes of the file are \320\317\021\340\241\261

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-29 Thread Nathaniel Smith
On Sun, May 29, 2005 at 09:29:45AM +0200, rghetta wrote: On Fri, 2005-05-27 at 20:13 -0700, Nathaniel Smith wrote: But, the file is sitting right there on the filesystem, and the hook can run arbitrary code. For instance, it could peek at the file to see whether it looks like it's binary.

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-29 Thread Joel Crisp
Hi My concern about this approach is that if you have lots of different types of files to handle, XML, Word, Rational XMI (which is XML but has a specific merge tool), etc then you would end up having to do lots of jiggering in the merge hooks. Also, the order in which you tried to identify

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-28 Thread Glen Ditchfield
Glen Ditchfield wrote: You base the text/binary decision on the name of the file. How hard would it be to base it on the contents of the file instead, the way the Unix 'file' command does? On Friday 27 May 2005 14:44, rghetta replied: The hook uses only the filespec, true, but if it returns

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-27 Thread rghetta
Ok, I'll try to summarize the requests (and possible answers) so far: Both Nathaniel Smith and Emile Snyder advocated the use of .mt-attrs, perhaps coupled with the attr_init hook to automagically mark the files at add time. Howewer, the attr_init hooks receive only the filename, while the hook

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-26 Thread Emile Snyder
I like the idea of an .mt-attrs approach because the binary'ness of a file is a property of the file, not something that different people should have different ideas about (a'la hooks). I don't have particularly strong feelings about the right way to help monotone automatically figure it out for

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-25 Thread Glen Ditchfield
On Tuesday 24 May 2005 17:33, rghetta wrote: function binary_file(name) lowname=string.lower(name) -- some known binaries, return true if (string.find(lowname, %.gif$)) then return true end You base the text/binary decision on the name of the file. How hard would it be to base it on

Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook

2005-05-25 Thread Nathaniel Smith
On Wed, May 25, 2005 at 12:33:04AM +0200, rghetta wrote: If the hook returns nil, the file will be treated as binary if the monotone function guess_binary() returns true, i.e. if the files contains NUL bytes or a selection of other ASCII control chars (for example, STX and ETX). Another