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

Re: Feature request: default diff for svn diff

From: <kfogel_at_collab.net>
Date: 2004-10-09 23:31:41 CEST

Ross Boylan <ross@biostat.ucsf.edu> writes:
> I discovered that specifying the -x (for extended args to diff) alone is
> not adequate; one must specify --diff-cmd as well. Couldn't it default
> to diff? Or have I missed something?

I wonder about the wisdom of defaulting to whatever 'diff' command
happens to be available, instead of relying on the user to specify it.

But, the behavior right now is inconsistent. If you run

   $ svn diff -r11217:11218 -x -u

it shows a unified diff (!). But if you do, say...

   $ svn diff -r11217:11218 -x -B
   $ svn diff -r11217:11218 -x -w
   $ svn diff -r11217:11218 -x -c

...it errors, claiming:

   svn: '-B' is not supported

(Substitute '-w' or '-c', as the case may be.)

I find the success of -u somewhat bizarre, as no --diff-cmd was
passed. However, we clearly coded this in, in libsvn_client/diff.c:

    /* We don't currently support any options (well, other than -u, since we
       default to unified diff output anyway), so if we received anything
       other than that it's an error. */
    if (diff_cmd_baton->options)
      {
        for (i = 0; i < diff_cmd_baton->options->nelts; ++i)
          {
            const char *arg
              = ((const char **)(diff_cmd_baton->options->elts))[i];

             if (strcmp(arg, "-u") == 0)
              continue;
            else
              return svn_error_createf(SVN_ERR_INVALID_DIFF_OPTION, NULL,
                                       _("'%s' is not supported"), arg);
          }
      }

All of that happens in the "use our internal diff" case, of course.

> Further, svn help diff says
> -x [--extensions] arg : pass ARG as bundled options to GNU diff
> which implies you get GNU diff automatically. I believe that should
> read "pass ARG as option to the command specified in --diff-cmd", at
> least at the moment.
>
> Using subversion 1.0.6-2 on Debian GNU/Linux.

In r11213 Julian Foad changed it to just "diff", which while it
doesn't go as far as you suggest, does solve the worst of the problem.
(Although the new usage message becomes problematic if we use -x for
something other than diff... which we already do, namely, diff3.)

In sum, this question is rather complex. I think a new option help
string might be appropriate, one that indicates that -x is not just
for diff. (Care to try a patch?)

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Oct 10 01:20:43 2004

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

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