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
_______________________________________________
Monotone-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/monotone-devel