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/05/28 14:03:27 UTC
svn commit: r1597983 - in /subversion/trunk/subversion: include/svn_diff.h
libsvn_client/diff.c libsvn_diff/deprecated.c libsvn_diff/diff_file.c
svn/conflict-callbacks.c svnlook/svnlook.c
Author: rhuijben
Date: Wed May 28 12:03:27 2014
New Revision: 1597983
URL: http://svn.apache.org/r1597983
Log:
Extend svn_diff_file_options_t and svn_diff_file_output_unified4() to allow
configuring the context size for file diffs.
* subversion/include/svn_diff.h
(svn_diff_file_options_t): Add variable.
(svn_diff_file_output_unified4): Add argument.
(svn_diff_file_output_unified3): Document legacy behavior.
* subversion/libsvn_client/diff.c
(diff_content_changed): Update caller.
* subversion/libsvn_diff/deprecated.c
(svn_diff_file_output_unified3): Update caller.
* subversion/libsvn_diff/diff_file.c
(svn_diff_file_options_create): Initialize with original default.
(svn_diff_file_output_unified4): Add argument. Update initialization.
* subversion/svn/conflict-callbacks.c
(show_diff): Update caller. Use options to document defaults.
* subversion/svnlook/svnlook.c
(print_diff_tree): Update caller.
Modified:
subversion/trunk/subversion/include/svn_diff.h
subversion/trunk/subversion/libsvn_client/diff.c
subversion/trunk/subversion/libsvn_diff/deprecated.c
subversion/trunk/subversion/libsvn_diff/diff_file.c
subversion/trunk/subversion/svn/conflict-callbacks.c
subversion/trunk/subversion/svnlook/svnlook.c
Modified: subversion/trunk/subversion/include/svn_diff.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_diff.h?rev=1597983&r1=1597982&r2=1597983&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_diff.h (original)
+++ subversion/trunk/subversion/include/svn_diff.h Wed May 28 12:03:27 2014
@@ -476,6 +476,12 @@ typedef struct svn_diff_file_options_t
* @c FALSE.
*/
svn_boolean_t show_c_function;
+
+ /** The number of context lines produced above and below modifications, if
+ * available. The number of context lines must be >= 1.
+ *
+ * @since New in 1.9 */
+ int context_size;
} svn_diff_file_options_t;
/** Allocate a @c svn_diff_file_options_t structure in @a pool, initializing
@@ -615,6 +621,10 @@ svn_diff_file_diff4(svn_diff_t **diff,
* path of the target, an error is returned. Finally, if @a relative_to_dir
* is a URL, an error will be returned.
*
+ * If @a context_size is greater than 0, then this number of context lines
+ * will be used in the generated diff output. Otherwise the legacy compile
+ * time default will be used.
+ *
* @since New in 1.9.
*/
svn_error_t *
@@ -627,12 +637,13 @@ svn_diff_file_output_unified4(svn_stream
const char *header_encoding,
const char *relative_to_dir,
svn_boolean_t show_c_function,
+ int context_size,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *scratch_pool);
/** Similar to svn_diff_file_output_unified3(), but without cancel
- * support.
+ * support and with @a context_size -1.
*
* @since New in 1.5.
* @deprecated Provided for backwards compatibility with the 1.8 API.
Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1597983&r1=1597982&r2=1597983&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Wed May 28 12:03:27 2014
@@ -861,6 +861,7 @@ diff_content_changed(svn_boolean_t *wrot
tmpfile1, tmpfile2, label1, label2,
dwi->header_encoding, rel_to_dir,
dwi->options.for_internal->show_c_function,
+ dwi->options.for_internal->context_size,
dwi->cancel_func, dwi->cancel_baton,
scratch_pool));
Modified: subversion/trunk/subversion/libsvn_diff/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/deprecated.c?rev=1597983&r1=1597982&r2=1597983&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_diff/deprecated.c Wed May 28 12:03:27 2014
@@ -166,6 +166,7 @@ svn_diff_file_output_unified3(svn_stream
header_encoding,
relative_to_dir,
show_c_function,
+ -1 /* context_size */,
NULL, NULL, /* cancel */
pool));
}
Modified: subversion/trunk/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_file.c?rev=1597983&r1=1597982&r2=1597983&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/trunk/subversion/libsvn_diff/diff_file.c Wed May 28 12:03:27 2014
@@ -1204,7 +1204,11 @@ static const apr_getopt_option_t diff_op
svn_diff_file_options_t *
svn_diff_file_options_create(apr_pool_t *pool)
{
- return apr_pcalloc(pool, sizeof(svn_diff_file_options_t));
+ svn_diff_file_options_t * opts = apr_pcalloc(pool, sizeof(*opts));
+
+ opts->context_size = SVN_DIFF__UNIFIED_CONTEXT_SIZE;
+
+ return opts;
}
/* A baton for use with opt_parsing_error_func(). */
@@ -1828,6 +1832,7 @@ svn_diff_file_output_unified4(svn_stream
const char *header_encoding,
const char *relative_to_dir,
svn_boolean_t show_c_function,
+ int context_size,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool)
@@ -1846,7 +1851,8 @@ svn_diff_file_output_unified4(svn_stream
baton.hunk = svn_stringbuf_create_empty(pool);
baton.show_c_function = show_c_function;
baton.extra_context = svn_stringbuf_create_empty(pool);
- baton.context_size = SVN_DIFF__UNIFIED_CONTEXT_SIZE;
+ baton.context_size = (context_size > 0) ? context_size
+ : SVN_DIFF__UNIFIED_CONTEXT_SIZE;
if (show_c_function)
{
Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1597983&r1=1597982&r2=1597983&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Wed May 28 12:03:27 2014
@@ -192,7 +192,9 @@ show_diff(const svn_wc_conflict_descript
path1, path2,
label1, label2,
APR_LOCALE_CHARSET,
- NULL, FALSE,
+ NULL,
+ options->show_c_function,
+ options->context_size,
cancel_func, cancel_baton,
pool);
}
Modified: subversion/trunk/subversion/svnlook/svnlook.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/svnlook.c?rev=1597983&r1=1597982&r2=1597983&view=diff
==============================================================================
--- subversion/trunk/subversion/svnlook/svnlook.c (original)
+++ subversion/trunk/subversion/svnlook/svnlook.c Wed May 28 12:03:27 2014
@@ -1062,7 +1062,7 @@ print_diff_tree(svn_stream_t *out_stream
out_stream, diff, orig_path, new_path,
orig_label, new_label,
svn_cmdline_output_encoding(pool), NULL,
- opts->show_c_function,
+ opts->show_c_function, opts->context_size,
check_cancel, NULL, pool));
SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
"\n"));