[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] help setting up Visual Diff

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-06-30 01:50:05 CEST

> cmpilato@collab.net wrote..
>
>>>I wonder why we're passing -u to an anonymous diff program...
>>
>>That's a hard-coded input from when we used Gnu diff all the time. It
>>should be removed and re-added at runtime by users via the -X
>>parameter.

I agree.

>>Doing this will also allow folks to get the other diff
>>types that Gnu diff offers: contextual, side-by-side, etc.

Actually the default "-u" is not added to the diff command if a (non-empty) "-x" argument is given to svn, so we can already request the other diff types that GNU diff offers. (I consider the "non-empty" restriction to be a bug.)

Robert Spier wrote:
> Below find two patches. The first implements the above.

You have removed "-u" and the two "-L label" arguments. I agree that removing "-u" is a good idea if we are to support arbitrary external diff programs; it can easily be passed within "-x" when required. However, the "-L" options cannot so easily be passed by the user, but they are reasonably important in some circumstances. I think we need to devise a better way of invoking an arbitrary diff program.

For example, we could allow the user to specify a diff command with replaceable parameters for FILE1, FILE2, LABEL1 and LABEL2. Examples:

  # To use a simple diff program, not using the human-readable labels:
  --diff-cmd="xxdiff $FILE1 $FILE2"

  # To recreate the existing default behaviour:
  --diff-cmd="diff -u -L $LABEL1 -L $LABEL2 $FILE1 $FILE2"

This is not too bad but quoting and word-splitting can get messy. Actually, the same messiness applies to the present "-x" option - e.g. how can you pass an argument with an embedded space?

Here's another idea: we could specify that the external diff program always takes exactly four arguments: the two file names and the two labels. The user can provide a simple shell script or similar wrapper that accepts those four arguments and invokes the desired diff program with an appropriate combination of those arguments and other options. This is flexible (in Unix; maybe not in Windows) but ugly for the simple cases.

Perhaps we need a combination method that allows simple invocation of programs with simple syntax and flexible invokation of other programs.

It would be useful to list the various diff programs that we have access to now, to see what sort of invocation syntax is required for each. This will indicate how much flexibility we need. Here is a start:

  diff (GNU diffutils) 2.8.1:
    Options such as --line-format may contain arbitrary characters (spaces, quotes, etc.).
    File name arguments may be alone or appended to options like "--from-file=".
    Labels may be given after "-L " or "--label=".

  pdiff 0.4 (GNU a2ps 4.13)
    Some options may be required to come AFTER the file name arguments.
    Labels cannot be used.

  zdiff (gzip 1.3)
    Passes options on to "diff"; generates new temporary file names to pass on to "diff" so the "--label=" option is important.
    Cannot handle options that take an argument as a separate word (e.g. -L label) but can handle single-word options (e.g. --label=label).

And of course we should change "GNU diff" to "diff" in the description of "-x" (in subversion/clients/cmdline/main.c).

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jun 30 01:42:46 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.