You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2014/06/19 14:02:44 UTC

svn commit: r1603847 - in /subversion/trunk/subversion: include/svn_diff.h libsvn_diff/diff_file.c

Author: rhuijben
Date: Thu Jun 19 12:02:44 2014
New Revision: 1603847

URL: http://svn.apache.org/r1603847
Log:
Add commandline support for configuring the context size of our
unified diff output. This allows
$ svn diff -x -U9 WC

Note: this patch doesn't update the help output for -x, which
will need a separate patch.

* subversion/include/svn_diff.h
  (svn_diff_file_options_parse): Document -U and --context.

* subversion/libsvn_diff/diff_file.c
  (diff_options): Add context.
  (svn_diff_file_options_parse): Handle context option.

Modified:
    subversion/trunk/subversion/include/svn_diff.h
    subversion/trunk/subversion/libsvn_diff/diff_file.c

Modified: subversion/trunk/subversion/include/svn_diff.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_diff.h?rev=1603847&r1=1603846&r2=1603847&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_diff.h (original)
+++ subversion/trunk/subversion/include/svn_diff.h Thu Jun 19 12:02:44 2014
@@ -505,6 +505,7 @@ svn_diff_file_options_create(apr_pool_t 
  * - --ignore-all-space, -w
  * - --ignore-eol-style
  * - --show-c-function, -p @since New in 1.5.
+ * - --context, -U ARG @since New in 1.9.
  * - --unified, -u (for compatibility, does nothing).
  */
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_file.c?rev=1603847&r1=1603846&r2=1603847&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/trunk/subversion/libsvn_diff/diff_file.c Thu Jun 19 12:02:44 2014
@@ -1198,6 +1198,7 @@ static const apr_getopt_option_t diff_op
   /* ### For compatibility; we don't support the argument to -u, because
    * ### we don't have optional argument support. */
   { "unified", 'u', 0, NULL },
+  { "context", 'U', 1, NULL },
   { NULL, 0, 0, NULL }
 };
 
@@ -1297,6 +1298,11 @@ svn_diff_file_options_parse(svn_diff_fil
         case 'p':
           options->show_c_function = TRUE;
           break;
+        case 'U':
+          SVN_ERR(svn_cstring_atoi(&options->context_size, opt_arg));
+          if (options->context_size < 1)
+            options->context_size = 1;
+          break;
         default:
           break;
         }