You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ross Boylan <ro...@biostat.ucsf.edu> on 2004/10/07 20:29:11 UTC

Feature request: default diff for svn diff

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?

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.
-- 
Ross Boylan                                      wk:  (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4          ross@biostat.ucsf.edu
Dept of Epidemiology and Biostatistics           fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840                     hm:  (415) 550-1062


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Feature request: default diff for svn diff

Posted by kf...@collab.net.
Ross Boylan <ro...@biostat.ucsf.edu> writes:
> Oops; I got so hung up on -x I wasn't thinking about the normal case.
> 
> What I should have said was that if someone uses -x, an external diff is
> invoked.  If none is specified (via --diff-cmd), it defaults to 'diff'. 
> 
> Wording that thought in terms of a default argument to --diff-cmd was a
> goof on my part.
> 
> Do you feel any differently about that possibility?

No, I knew that was what you meant, and it's the behavior I was
(mildly) objecting to.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Feature request: default diff for svn diff

Posted by Ross Boylan <ro...@biostat.ucsf.edu>.
On Tue, 2004-10-12 at 11:24, kfogel@collab.net wrote:
> Ross Boylan <ro...@biostat.ucsf.edu> writes:
> > 1) should --diff-cmd have an implicit default argument of 'diff'?
> 
> I think not.  If you don't say '--diff-cmd', then it should use the
> internal diff.
Oops; I got so hung up on -x I wasn't thinking about the normal case.

What I should have said was that if someone uses -x, an external diff is
invoked.  If none is specified (via --diff-cmd), it defaults to 'diff'. 

Wording that thought in terms of a default argument to --diff-cmd was a
goof on my part.

Do you feel any differently about that possibility?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Feature request: default diff for svn diff

Posted by kf...@collab.net.
Ross Boylan <ro...@biostat.ucsf.edu> writes:
> 1) should --diff-cmd have an implicit default argument of 'diff'?

I think not.  If you don't say '--diff-cmd', then it should use the
internal diff.

> 2) should -x -u continue to magically work with the internal diff?  (I
> assume that if --diff-cmd is specified explicitly, -u is passed to it).

Right.

/me shrugs

Other threads are discussing fixing the wording of the help output for
-x, so that may be an 80% fix for this confusion.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Feature request: default diff for svn diff

Posted by Ross Boylan <ro...@biostat.ucsf.edu>.
On Sat, 2004-10-09 at 14:31, kfogel@collab.net wrote:
> Ross Boylan <ro...@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.
> 
I'd say that if someone specifies a diff option, they should expect
their default diff--except that which diff is being called is apparently
non-obvious to Windows users, judging from the list traffic.

On the other hand, the present approach just forces the user to say
--diff-cmd diff
which still has the same ambiguity.

So, on balance, I think it might be useful to default to -diff-cmd
diff.  Alternately, the help text needs to be changed.
> 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:
[snip elaboration of preceding point]

A further way this could get very weird is if someone thinks -x -u is
going to their external diff program, and that program behaves
differently from svn's internal logic.  Admittedly this is a fairly
unlikely case, but, in time, all errors are possible :)

> > 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?)

Well, the wording above,
  -x [--extensions] arg    : pass ARG as option to the command specified
in --diff-cmd
is one possibility.

This is a tough one to do well, as a completely correct statement is
much too verbose to be useful (e.g., in general --diff-cmd specifies an
arbitrary command; svn passes certain arguments to it; and some of those
arguments in certain positions are the  ones given to -x).

The manual/book can be a bit more expansive.  However, I've noticed that
the reference material in the svn book often says very little about
options, other than documenting their existence.  Personally, I'd
appreciate it if the docs covered the options more fully in the
reference section.  I realize that would take work...

I think the first thing is to decide the desired behavior.  There seem
to be at least two issues:
1) should --diff-cmd have an implicit default argument of 'diff'?
2) should -x -u continue to magically work with the internal diff?  (I
assume that if --diff-cmd is specified explicitly, -u is passed to it).
> 
> -Karl
-- 
Ross Boylan                                      wk:  (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4          ross@biostat.ucsf.edu
Dept of Epidemiology and Biostatistics           fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840                     hm:  (415) 550-1062


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Feature request: default diff for svn diff

Posted by kf...@collab.net.
Ross Boylan <ro...@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