[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: Robert Spier <rspier_at_pobox.com>
Date: 2003-06-29 10:28:10 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. Doing this will also allow folks to get the other diff
> types that Gnu diff offers: contextual, side-by-side, etc.

Below find two patches. The first implements the above. The second
makes --diff-cmd "usable".

-R

Patch One:

Log Message:

    * io.c: (svn_io_run_diff) remove the obsolete hard coded
      arguments passed to the external diff program. The user should
      specify any arguments they want with the -x parameter instead.

Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 6369)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -1154,14 +1154,7 @@
 
   if (user_args != NULL)
     nargs += num_user_args;
- else
- nargs += 1; /* -u */
 
- if (label1 != NULL)
- nargs += 2; /* the -L and the label itself */
- if (label2 != NULL)
- nargs += 2; /* the -L and the label itself */
-
   args = apr_palloc (subpool, nargs * sizeof(char *));
 
   i = 0;
@@ -1173,20 +1166,7 @@
       for (j = 0; j < num_user_args; ++j)
         args[i++] = user_args[j];
     }
- else
- args[i++] = "-u"; /* assume -u if the user didn't give us any args */
 
- if (label1 != NULL)
- {
- args[i++] = "-L";
- args[i++] = label1;
- }
- if (label2 != NULL)
- {
- args[i++] = "-L";
- args[i++] = label2;
- }
-
   args[i++] = from;
   args[i++] = to;
   args[i++] = NULL;

Patch Two:

This is a usability patch. Without this patch using diff-cmd is a
royal pain because of everything that would need to be specified in
-x.

    1- search for --diff-cmd programs in the user's path (because this
    is a common expectation.)

    2- preserve the environment so GUI diff programs (like xxdiff) can
    access the ever-important DISPLAY variable, and other things like
    HOME. (Currently a completely empty environment is passed. That
    can't be right.)

Log Message:

    * io.c: (svn_io_run_diff) pass the inherit flag to svn_io_run_cmd
      so that external diff commands do not need to be specified with
      the full path. (i.e. svn diff configure.in --diff-cmd diff
      instead of svn diff configure.in --diff-cmd `which diff`). At a
      lower level, this means that the diff command is run with
      APR_PROGRAM_PATH instead of APR_PROGRAM, so it is searched for
      in the path and the environment is inherited.

Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 6369)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -1193,7 +1193,7 @@
 
   assert (i == nargs);
 
- SVN_ERR (svn_io_run_cmd (dir, diff_utf8, args, pexitcode, NULL, FALSE,
+ SVN_ERR (svn_io_run_cmd (dir, diff_utf8, args, pexitcode, NULL, TRUE,
                            NULL, outfile, errfile, subpool));
 
   /* The man page for (GNU) diff describes the return value as:

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jun 29 10:29:17 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.