monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] New commands (for mtn, in lua)


From: William Uther
Subject: Re: [Monotone-devel] New commands (for mtn, in lua)
Date: Fri, 6 Jul 2007 10:17:22 -0700


On 06/07/2007, at 9:00 AM, address@hidden wrote:


On Friday 06 July 2007, William Uther wrote:
   mtn_automate(...) : This allows any of the automate commands to be
called from lua.  The result is returned as a string.

Seems like something one really wants to have.

However, there is potential for deadlocks, when some command calls a Lua hook
that calls an automate command that calls a Lua hook...

I didn't want lua hooks calling automate commands because I wasn't sure what that would do, and I didn't think it was necessary. So there is a flag in the code that only turns mtn_automate on when it is being called from a user command. It also turns the flag off inside mtn_automate itself so you can't get
recursion (you'll get an error if you try).

Speaking of errors... Lua seems to be blocking the I() style macros. The output gets into the debug log, but no further. I'm guessing this is the C/C++ interface. Haven't looked into it too much yet.

   alias_command( new_command, old_command) : Add a new command alias
to an existing command.

Likely to confuse people. Experienced users will have aliases and talk
about 'blame' and 'praise', but the newcomers wonder what's going on.

Heh.  I think people can handle it.  I do want to add an explicit check
that you're not overloading a current command though.  At the moment
I just add the alias to the current command structure and let it sort
things out.  I haven't checked what happens when things are overloaded.

   register_command(command, abstract, description, lua_function) :
Adds a new command to the "user" group of commands.  When the command
is called, the associated lua function is executed.  That lua will
normally use mtn_automate() calls to do its work.

Same problem as above.

Which "problem"? I don't think deadlocks are an issue. Otherwise, this is no different to shell scripting (except it is cross platform). Perhaps we should ban the use of monotone in scripts? :) Scrap the automate interface entirely I say! :)

I also added automate versions of the following normal commands:
push, pull, sync, merge, update and commit.

Good!

These are currently not
very 'automate' friendly in that they still output everything to
standard out.  They work for this purpose though.

You mean they don't work with automate stdio? If so, that would be bad.

Decidedly non-optimal, yes.

I hope to fix this, but I think it'll take some thought to do right.

Be well,

Will          :-}







reply via email to

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