When Patcher generates a diff, it needs to associate every hunk with the corresponding source file (and possibly with the corresponding ChangeLog file as well). Unfortunately, different revision control systems might generate different diff outputs, making this association difficult to establish.
Patcher provides a :diff-header
project option to help. Its value
is of the form (REGEXP NUMBER1 NUMBER2)
. REGEXP
is used to
match the beginning of a diff output while NUMBER1 and NUMBER2 are the
parenthesized levels in which to find the corresponding old and new file
names.
When the change involves modifying a file's contents, the old and new
file names will be the same. However, they can be different in several
situations, like when a file is renamed, created or deleted. In case of
creation or deletion, some revision control systems use
“/dev/null
” to denote a virtual old or new file.
If you want to see some examples, have a look at the built-in themes in
patcher-built-in-themes
(see Themes). They contain presets
for different revision control systems, along with suitable
:diff-header
options.
Also, you should pay attention to the fact that the values of the
:diff-header
and :diff-command
options may depend on one
another to work properly. For instance, the diff output of Mercurial
looks different when you use the --git
option.