monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Joel Crisp
Subject: Re: [Monotone-devel] [PATCH] and RFC: binary files merging and hook
Date: Wed, 01 Jun 2005 20:07:19 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

I just don't think that it is fair to expect everyone to program what should be 
standard functionality in hooks.

Hooks should be there for functionality which is non-standard, e.g. integration with "my" software process rather than yours...mailing when checkins are done, or enforcing lifecycle constraints.

Choosing how to handle common file types hardly fits into that category, and I think the average user would prefer that to be supported via a less obscure mechanism.

To give you some comparason: in a recent government job I worked in we weren't allowed to use triggers _at all_ (in clearcase, which uses perl) on the grounds that no-one else would be able to maintain them....let alone in a language with the limited uptake of lua (note, I personally think it is ok as a language, but the perception in the industry as a whole is that it is a game programmers language not a 'commercial' one)

Joel

rghetta wrote:
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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]