monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] [PATCH]automatically add executable files to .mt-at


From: Nathaniel Smith
Subject: Re: [Monotone-devel] [PATCH]automatically add executable files to .mt-attr on add
Date: Thu, 14 Apr 2005 21:33:27 -0700
User-agent: Mutt/1.5.8i

On Thu, Apr 14, 2005 at 09:43:10PM -0400, Joel Reed wrote:
> The attached patch automatically adds executable files to .mt-attr on 
> the "monotone add" command.
> 
> Other than the formatting of the braces (could someone tell me 
> the gnu ident command to match monotone's style?) is the patch ok?

"indent", I assume you mean :-) Just the default should be correct for
brace placement at least...

> If applied, I'll hack out a matching automatically delete "execute"
> entries in .mt-attr on "monotone drop" if people think that its a
> reasonable counterpart to the add functionality.

Almost -- instead of making it specific to "execute", we should
automatically delete all entries in .mt-attr on "monotone drop", and
should move entries in .mt-attr on "monotone rename".  Right?

> diff -up -ur monotone-0.18-orig/platform.hh monotone-0.18/platform.hh
[...]

I like this patch's functionality, but would suggest a slightly
different implementation: define is_executable as now, but instead of
hard-coding a call to it into add, expose is_executable to LUA (just
as we expose make_executable now). Then, add a new LUA hook, called by
add, that is given the path of a file being added, and gets to return
a table of attributes that should be set on the newly defined file.
Then make the default implementation of this hook be something like

  function initial_attrs(filename)
    if (is_executable(filename)) then
      return {execute = "true"}
    end
    return {}
  end

Actually, perhaps it would be better to have a table, like the current
attr_functions table, but each entry containing an initializer for the
given attribute.  So one would have:

  function attr_initializers["execute"] =
    function(filename)
      if (is_executable(filename)) then
        return "true"
      else
        return nil
      end
    end
  end

This would make it easier for people to add their own without
interfering with the pre-defined one(s), plus just be more consistent
with attr_functions...

This is a bit more code/docs/testing, but I think it's worth it?
Obviously #monotone is a good place to check if any parts of what
would be required are unclear...

-- Nathaniel

-- 
"...All of this suggests that if we wished to find a modern-day model
for British and American speech of the late eighteenth century, we could
probably do no better than Yosemite Sam."

This email may be read aloud.




reply via email to

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