binary_file hook

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

binary_file hook

Daniel Carosone
On Sun, Oct 23, 2005 at 04:18:19PM -0700, Nathaniel Smith wrote:
> As a side note, there's a simple trick you can use for this sort of
> thing, in lack of anything better ATM...:
>
> default_ignore_file = ignore_file

I tried applying this to the binary_file hook, to deal with the
example I had in mind when I posed the original question about
appending to internal hooks without copying the default
implementation:

default_binary_file = binary_file
function binary_file(name)
  if (string.find(name, "%-confg$")) then return false end
  return default_binary_file(name)
end

These files are Cisco router/switch configs. They're text, but they
contain some ^C characters, such as used for banner delimiters, so the
guess routine evidently decides they're binary.

No joy. Nothing I could do would make the hook match the files as
text. After some fussing around trying to figure out what kinds of lua
newbie syntax errors I had made, I eventually wound up with:

function binary_file(name)
  return false
end

(and no function renaming trick).  

monotone --debug says the lua file is being loaded, and I get lua
errors from loading it when I introduce syntax errors, but it seems
the hook isn't being called - no matter what I do, I still get
monotone diff telling me that some of the files are binary.  The files
aren't listed with any special attributes in .mt-attrs.

I've been working around this for quite some time using external diff,
which happily shows me the diffs.  I thought the tip given above would
be a better solution.

A more careful examination of TFM reveals that although a default
implementation of binary_file() is given, there's no documentation of
the hook itself -- suggesting that in fact it isn't likely to be
called.

So, how do I tell monotone these files are text?  

--
Dan.
_______________________________________________
Monotone-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/monotone-devel

attachment0 (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: binary_file hook

rghetta
On Tue, 2005-10-25 at 14:57 +1000, Daniel Carosone wrote:
> A more careful examination of TFM reveals that although a default
> implementation of binary_file() is given, there's no documentation of
> the hook itself -- suggesting that in fact it isn't likely to be
> called.
The binary_file hook is called to set the manual_merge attribute when you
add a file.

> So, how do I tell monotone these files are text?  
Currently, the manual_merge attribute is used only for merges.
Not using it also for diffs was a mistake, I guess.

Riccardo




_______________________________________________
Monotone-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/monotone-devel