Hi,

I meant to send the patch tonight and then, I realised I forgot to add
a feature that Julian Foad suggested.

However, I have a cunning plan to address the issue that Alan raised,
he has a good point that for plain usage, uniformity and conformity is
desirable.

I hope this idea will fix the issues danielsh raised too -- might need
some polishing, then again, it might not be as useful as I hope it is.

Here is the current svn_io_create_custom_diff_cmd: (the guts will
change tomorrow, but it will do the same thing will stuff like +---f1
working added on.)

Current svn help diff output (for unix) is: (adjusted for email fit)

--invoke-diff-cmd ARG    : 

use ARG as format string for external diff command  invocation.

 Substitutions: %f1 %f2  files to compare
                %l1 %l2  user defined labels
 Examples: --invoke-diff-cmd="diff -y %f1 %f2
    --invoke-diff-cmd="kdiff3 -auto -o /home/u/log \
      %f1 %f2 --L1 %l1 --L2 "Custom Label"
 The switch symbol '%' can be modified by defining an
 alternative symbol string, starting with a non-alpha
 numeric character.  Example:
   --invoke-diff-cmd="--- diff -y ---f1 ---f2

[[[
const char **
svn_io_create_custom_diff_cmd(const char *label1,
                              const char *label2,
                              const char *label3,
                              const char *tmpfile1,
                              const char *tmpfile2,
                              const char *base,
                              const char *cmd,
                              apr_pool_t *pool)
{
 
  apr_array_header_t * external_diff_cmd, *delimiters;
  const char ** ret;
  char * delimiter_prefix;
  char * default_delimiter_prefix;
  int  has_custom_delimiter, len, i, j;
  apr_pool_t *subpool;

  subpool = svn_pool_create(pool);

#ifdef WIN32
  default_delimiter_prefix = apr_pstrdup(subpool, "---");
else
  default_delimiter_prefix = apr_pstrdup(subpool, "%");  
#endif

  external_diff_cmd = svn_cstring_split(cmd, " ", FALSE, subpool);

  if (cmd[0] > 33 && cmd[0] < 43) /* user requests custom delimter prefix */
   {
     delimiter_prefix =  APR_ARRAY_IDX(external_diff_cmd,0, char *);
     has_custom_delimiter = 1;
   }
  else 
   {
     delimiter_prefix = apr_pstrdup(subpool, default_delimiter_prefix);
     has_custom_delimiter = 0;
   }

  delimiters = svn_cstring_split("f1 f2 f3 l1 l2 l3", " ", TRUE, subpool);

  { /* add the selected prefix to the delimiters */
    char *s;
    s = apr_pcalloc(subpool, (1+
                              strlen(delimiter_prefix)+
                              delimiters->nelts)*sizeof(char *));
    
    for (i = 0; i < delimiters->nelts; i++)
     {
      strcat(s, delimiter_prefix);
      strcat(s, APR_ARRAY_IDX(delimiters, i, char *));
      strcat(s," ");
     
     }
    delimiters = svn_cstring_split(s, " ", FALSE, subpool);
  }

  ret = apr_pcalloc(subpool, 
                    external_diff_cmd->nelts * 
                    external_diff_cmd->elt_size*sizeof(char *));  

  len = strlen(delimiter_prefix)+2;  /* f1 f2 ...  is always size 2*/

  /* skip first entry of external_diff_cmd if the delimiter is customised */
  for (j = 0,  i = has_custom_delimiter; i < external_diff_cmd->nelts; i++, j++)
   {
     const char * atom;
     char *c;
     int p = 1;
     apr_array_header_t pick;

     atom = APR_ARRAY_IDX(external_diff_cmd, i, char *);
     c  = apr_pcalloc(subpool, strlen(atom)*sizeof(char*));

     if (0 == (p = strncmp(atom, APR_ARRAY_IDX(delimiters, 0, char *), len)))
       strcat(c,svn_dirent_local_style(tmpfile1, subpool));
     else if(0 == (p = strncmp(atom, APR_ARRAY_IDX(delimiters, 1, char *), len))) 
       strcat(c,svn_dirent_local_style(tmpfile2, subpool));
     else if(0 == (p = strncmp(atom, APR_ARRAY_IDX(delimiters, 2, char *), len))) 
       strcat(c,svn_dirent_local_style(base, subpool));
     else if(0 == (p = strncmp(atom, APR_ARRAY_IDX(delimiters, 3, char *), len))) 
       strcat(c, label1);
     else if(0 == (p = strncmp(atom, APR_ARRAY_IDX(delimiters, 4, char *), len))) 
       strcat(c, label2);
     else if(0 == (p = strncmp(atom, APR_ARRAY_IDX(delimiters, 5, char *), len))) 
       strcat(c, label3);
     if (0 == p) 
       ret[j] = strdup(c);
     else
       ret[j] = atom;
   }
  ret[j] = NULL;
  svn_pool_destroy(subpool);
  return ret;
}
]]]

