Next: , Previous: Patch Generation, Up: Patch Generation


4.3.1 Diff Command

The diff command used to generate the patch is specified by the :diff-command project option. You can also punctually change this command by calling patcher-mail-diff with a prefix argument. Patcher will then prompt you for a new command and use it exclusively for this particular patch.

By the way, don't use the prefix argument of patcher-mail-diff as a way to specify files (that is work on a subproject). It is not meant for that. It is meant only to modify the diff command for this instance only, not the files to which it applies.

The diff command is in fact a template string that supports dynamic expansion for a set of special constructs. The following ones are currently available.

%n
A ‘%n’ will be replaced with the project's name, that is, either the value of the ‘:name’ option (see Project Naming) or the name of the project descriptor. This may be useful in commands with weird options syntax, like PRCS.
%N
If you want to use the project descriptor's name, regardless of the value of the :name option, use %N instead of %n.
%f
A ‘%f’ will be replaced with explicitly diff'ed files and their accompanying ChangeLog files if any, or will simply be discarded for a global diff.
%?f{STR}
If there are explicitly diff'ed files, this construct will be replaced by ‘STR’. Otherwise, it will simply be discarded.
%!f{STR}
This is the opposite of the previous one: if there are explicitly diff'ed files, this construct will be discarded. Otherwise, it will be replaced by ‘STR’.

Here is an example to clarify this: the default diff command for Git in the ‘git’ built-in theme (see Themes) is the following:

git diff --no-prefix HEAD%?f{ -- }%f

One important note: all diff commands in Patcher must have a ‘%f’ construct somewhere, even if you always perform global diffs only (but in fact, you never really know that for sure). The reason is that there are situations in which Patcher may need to diff specific files, even for a global diff.

See also More On Commands for cases where a diff command would fail.