[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook
From: |
rghetta |
Subject: |
Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook |
Date: |
Wed, 01 Jun 2005 20:10:53 +0200 |
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 embeds a complete lua interpreter, and you aren't limited to
just reimplement the predefined hooks in your monotonerc files.
You can also add other functions, tables, etc.
For example, you could create a single function to categorize your
files, and use it both on the add-time and merge hooks.
Something like that:
function choose_merge(filename)
filedata=read_contents_of_file(name)
if filedata ~= nil then
if is_word(filedata)
return "msword"
else
* other categorizing code *
end
end
return nil -- filetype unknown
end
attr_init_functions["manual_merge"] =
function(filename)
if choose_merge(filename) ~= nil then
return "true" -- files with associate tool merge manually
else
return nil
end
end
function merge3(anc_path, left_path, right_path, merged_path, ancestor,
left, right)
* common code to setup files (see std_hooks.lua) *
ftype = choose_merge(filename)
if ftype=="msword" then
* call word *
else
* other tools *
end
...
end
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook, Glen Ditchfield, 2005/06/01
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook, rghetta, 2005/06/01
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook,
rghetta <=
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook, Joel Crisp, 2005/06/01
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook, rghetta, 2005/06/01
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook, Joel Crisp, 2005/06/01
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook, rghetta, 2005/06/10
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook, rghetta, 2005/06/10
- Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook, Glen Ditchfield, 2005/06/10