Differences between files can be shown in a number of ways, varying according to user preference and file type. These hooks allow customization of the way file differences are shown in diff and log commands.
get_encloser_pattern (
file_path)
file_path is the pathname of the file that is being diffed.
The hook should return a string constant containing a regular expression; this regular expression will be used to find lines in the file that name the “top-level” constructs enclosing each “hunk” of changes.
If a null string is returned, no enclosers are shown.
See Regexps, for the regular expression syntax used by monotone.
The default hook treats looks at the file extension, as follows:
^[[:alnum:]$_]
, which is correct for
many programming languages.
external_diff (
file_path,
old_data,
new_data,
is_binary,
diff_args,
old_rev,
new_rev)
The hook should run a program that displays the differences between two versions of a file. The return value of the hook is not used.
file_path is the pathname of the file that is being diffed.
old_data and new_data are the contents of the old and the new file (old_data is nil if the file is new). If the content is binary, is_binary will be true, otherwise false. old_rev and new_rev are the revision IDs of the old and new data.
If an extra arguments are given via --diff-args, the string will be passed in as diff_args. Otherwise diff_args will be nil.
The default implementation of this hook calls the program diff,
and if --diff-args were not passed, takes default arguments
from the Lua variable external_diff_default_args
. You can
override this variable in your configuration file, without overriding
the whole hook.