Some files in a project are special; they may require different handling (such as binary or structured files that should always be manually merged – see File Content Conflict), or they may represent executable scripts or programs.
Monotone allows each file (or directory) in a repository to carry arbitrary File Attributes. Persistent attributes are stored in each revision’s manifest. The hooks in this section allow files to be automatically recognised as having certain attributes at the time they’re added, and for custom triggers to be invoked on each file according to its attributes when the workspace is changed.
attr_functions [attribute] (filename, value)
This is not a hook function, but a table of hook functions,
indexed by attribute. Each entry in the table
attr_functions is a function taking a file name filename
and an attribute value value. The function should “apply” the
attribute to the file in the file system, possibly in a
These hooks are called by any command that modifies workspace files,
mtn clone and
When called to set an attribute, value is a string representing the value of the attribute.
When called to clear an attribute, value is
This facility can be used to extend monotone’s understanding of files with platform-specific attributes, such as permission bits, access control lists, or special file types.
By default, there is only one entry in this table, for the
attribute. It calls platform-specific functions to mark files as
executable or not. See Default hooks.
attr_init_functions [attribute] (filename)
This is not a hook function, but a table of hook
functions. Each entry in the table
table entry attribute, is a function taking a file (or
directory) name filename. Each function returns
the attribute should be set on filename. This table of hook
functions is called once for each file during an add.
By default, there are only two entries in this table, for the
mtn:manual_merge attributes. Their
attr_init_functions["mtn:execute"] = function(filename) if (is_executable(filename)) then return "true" else return nil end end attr_init_functions["mtn:manual_merge"] = function(filename) if (binary_file(filename)) then return "true" -- binary files must be merged manually else return nil end end
binary_file function is also defined as a Lua hook. See