monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] user-defined external mergers...


From: Zbigniew Zagórski
Subject: Re: [Monotone-devel] user-defined external mergers...
Date: Thu, 23 Jun 2005 00:10:06 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Vladimir Vukicevic wrote:
On 6/16/05, Richard Levitte - VMS Whacker <address@hidden> wrote:
The current idea is that the user can specify commands in the
environment variables MONOTONE_MERGE2 and MONOTONE_MERGE3.  They can
contain the following printf-like items:

Hmm, why do things via an environment variable when it's already
possible to set up arbitrary hooks using ~/.monotone/monotonerc or
MT/monotonerc?  I think exposing these bits as environment variables
by default really makes it such that you have to expose a lot of other
config via environment variables as well..

I don't agree, i think that it would be very convenient. Just look how
different is to write:
  export MONOTONE_MERGE2=something
vs.
          function merge3(ancestor, left, right)
             local afile = nil
             local lfile = nil
             local rfile = nil
             local outfile = nil
             local data = nil

             lfile = write_to_temporary_file(left)
... and about 20-30 lines more (yep i know copy and paste), and you must know
Lua at least a little, and if for some magic reason specification of callbacks 
would change
then all carefully crafted callback code will become unusable.

Otoh, i don't know Lua and Lua in monotone internals, but maybe following would
good idea.

If Lua supports kind of global variables, then variables such as those
proposed by Richard and many more could be set in rc file as global variables, 
so
config would look like this:
 merge2_command = "something %x %y %z"
 ...
and default merge2 callback will use 'merge2_command' variable.

Also, another idea very different to callbacks, but maybe useful for things like
'ignore_file (filename)' callback. How Lua/Monotone. Instead of updating 
ignore_file
callback we can modify it to use some internal table of rules, and modify those
rules like this:

 add_ignored_files( "/core$" )
 add_ignored_files( { "%.a$", "%.o$" } )

or even:

 some_global_list_of_ignore_patterns.append( "/core$" )
 some_global_list_of_ignore_patterns.append( { "%.a$", "%.o$" } )

Default 'ignore_file' callback would look like this (pseudo code) :

          function ignore_file(name)
                for each pattern in some_global_list_of_ignore_patterns
                   if string.find(name, pattern) return true
                end
                return false
          end

And ignore_file(name) would look like that:

Finally going far further "future" configurations would look like those
Workspace:

passphrases.append( "address@hidden", "agent would be better idea" )
merge2_command = "mybestmerge2tool %z %y"
merge3_command = "mybestmerge3tool %z %y %z"

Server:

accepted_netsync_write.append( "mycollection", "address@hidden" )
passphrases.append( "address@hidden", "apart from anything it rulez!" )

Whole issue is how LUA embedded in monotone plays with global variables.

My 2 cents as satisfied, happy monotone user.

DISCLAIMER: i don't know LUA (for now).

--
::: zbigg ::::::::::::: Zbigniew Zagórski ::
:: zzbigg (at) o2 (dot) pl ::: GG:5280474 ::





reply via email to

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