Stefan Sperling <stsp_at_elego.de> writes:
> I agree. I like the idea of allowing users to specify a template in the
> configuration file to control the way a diff tool is invoked.
> I also like the format you proposed. Do you think it would be reasonable
> to add this new template support to the existing diff-cmd option in the
> ~/.subversion/config file?
> diff-cmd='kdiff3 --L1=<label1> <file1> --L2=<label2> <file2>'
> Currently, diff-cmd takes just a path to a binary which is then invoked
> with a fixed set of parameters. It seems very unlikely that people are
> already using diff commands which contain strings like "<label1>" etc.
> So such a change could be considered a backward-compatible extension
> of the diff-cmd option.
That's neat. However we have to consider whitespace/quoting issues in
the filenames and the command and that can be tricky. Consider the
On Unix we currently invoke diff without a shell passing an array of
arguments directly to exec. I think your example would work even when
<file1> or <label1> gets expanded to something containing spaces.
On Windows I believe APR concatenates the array of arguments and passes
the resulting string to Windows. Windows quoting is a bit of a mystery
to me but perhaps something like this would work:
diff-cmd='kdiff3 --L1="<label1>" "<file1>" --L2="<label2>" "<file2>"'
The tricky bit is that that will not work on Unix. The extra quotes
would end up getting passed directly to the command which would see them
as part of the filename. Perhaps on Windows we make <file1> expand to
a name surrounded by quotes?
Turning to the command itself, Subversion would have to parse the string
and split it into arguments. That gets compilcated if the user wants to
be able to use quotes to pass whitespace:
diff-cmd='prog --arg "foo bar" <file1> <file2>'
A unix user probably wants prog to see one argument "foo bar", without
quotes, rather than two arguments foo and bar.
Certified & Supported Apache Subversion Downloads:
Received on 2013-03-20 13:22:59 CET