monotone-users
[Top][All Lists]
Advanced

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

Re: [Monotone-users] Reading *other* attrs from an attr_functions[] func


From: Timothy Brownawell
Subject: Re: [Monotone-users] Reading *other* attrs from an attr_functions[] function?
Date: Sat, 28 Mar 2015 10:11:59 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:34.0) Gecko/20100101 Icedove/34.0

On 03/23/2015 03:36 PM, Douglas Dickinson wrote:
Is there a monotone lua function like GET_ATTR(filename, attrname) ??
Sorry, we don't have that.

You might try taking the mtn:execute entry out of the attr_init_functions table (and clearing the attr on existing files), so you don't have both attrs populated on the same files. This wouldn't work if you're collaborating with people using the standard attr hooks, but it's probably the cleanest solution.

My own unix permissions handling attribute "ds:chmod" works,
BUT the execute bit is then overwritten by the "mtn:execute" handler,
So I want to override the default handler for "mtn:execute" to respect
both attributes,
Ideally something like:

attr_functions["mtn:execute"] =
    function(filename, value)
       if (GET_ATTR(filename, "ds:chmod") ~=nil) then  -- ????
          return execute(string.format("chmod %s %s", value, filename))
       end
       -- Continue like normal "mtn:execute"...
       if (value == "true") then
          set_executable(filename)
       else
          clear_executable(filename)
       end
    end

Many thanks in advance,
./ddd



-- Simple `chmod` handler
attr_functions["ds:chmod"] =
   function(filename, value)
     if value == nil then
       return nil
     end
     return execute(string.format("chmod %s %s", value, filename))
   end





reply via email to

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