monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] lua changes, attributes


From: graydon hoare
Subject: [Monotone-devel] lua changes, attributes
Date: 10 Oct 2003 03:09:53 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

hi,

I've just rewritten the lua interface, upgraded all the lua code to
5.0, and incorporated the lua interpreter source into monotone's tree
directly. this might break a bit of existing code, but probably not
much. the only major change you ought to notice is that lua 5.0 has a
boolean datatype, so in old places where you return "nil" or 0 / 1
from a hook function to indicate boolean-ness, just switch to
returning "true" or "false".

in the process I think I fixed up the use of temporary files; now it
uses mkstemp and $TMPDIR and all that. I also had to rewrite the
merge2 and merge3 hooks to shift with lua's standard library
modularization, which means they *might* currently be broken. I don't
have testcases for those hooks or anything.. let me know if they
break.

otherwise, the interesting part of this is that I added support for an
explicit .mt-attrs file in the root of your working copy. if it's
there, commands which modify the working copy (update, checkout, etc.)
will invoke a corresponding lua hook from a table of hooks. it works
like this: a line containing a triple like

   path  key   value

in the .mt-attrs file, causes:

   attr_functions[key](path, value)

to be called in lua. so you can just add things to the attr_functions
table, to implement your own attrs. I've implemented "execute" this
way, so now monotone can manage files which need to be executable on
checkout. just add a line like "configure execute true" to .mt-attrs.

I'm sure this needs to be polished up a bit, it's just a first draft.
comments / fixes appreciated.

-graydon





reply via email to

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