You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/05/27 13:08:12 UTC
svn commit: r948785 - in /subversion/trunk/subversion: include/svn_client.h
libsvn_client/deprecated.c libsvn_client/diff.c svn/cl.h svn/diff-cmd.c
svn/log-cmd.c svn/main.c
Author: stylesen
Date: Thu May 27 11:08:12 2010
New Revision: 948785
URL: http://svn.apache.org/viewvc?rev=948785&view=rev
Log:
Fix issue #3071.
Request enhancement to svn diff to indicate that an external diff-cmd
should NOT be used
* subversion/svn/cl.h
(svn_cl__opt_state_t): Add force internal diff boolean.
* subversion/include/svn_client.h
(svn_client_diff5, svn_client_diff_peg5): Add new parameter to the
function prototype in order to support the new option
--force-internal-diff
* subversion/svn/diff-cmd.c
(svn_cl__diff): Pass new parameter to the diff APIs in order to force
internal diff command.
* subversion/svn/log-cmd.c
(log_entry_receiver): Pass FALSE for force internal diff parameter
to the diff APIs in order preserve old behavior.
* subversion/svn/main.c
(svn_cl__longopt_t): Add new option force internal diff.
(svn_cl__options): Add description for the new diff option.
(svn_cl__cmd_table): Add new option force internal diff to the diff
command.
(main): Enable force internal diff option based on user input and
check for mutually exclusive options '--diff-cmd' and
'--force-internal-diff'
* subversion/libsvn_client/deprecated.c
(svn_client_diff4, svn_client_diff_peg4): Pass FALSE for force
internal diff paramater to get the old behavior.
* subversion/libsvn_client/diff.c
(set_up_diff_cmd_and_options): Check for force internal diff option
and get rid of external diff command if required.
(svn_client_diff5, svn_client_diff_peg5): Add support for the new
option --force-internal-diff
Modified:
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/libsvn_client/deprecated.c
subversion/trunk/subversion/libsvn_client/diff.c
subversion/trunk/subversion/svn/cl.h
subversion/trunk/subversion/svn/diff-cmd.c
subversion/trunk/subversion/svn/log-cmd.c
subversion/trunk/subversion/svn/main.c
Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=948785&r1=948784&r2=948785&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu May 27 11:08:12 2010
@@ -2335,6 +2335,9 @@ svn_client_blame(const char *path_or_url
* If @a no_diff_deleted is TRUE, then no diff output will be
* generated on deleted files.
*
+ * If @a force_internal_diff is TRUE, then diff-cmd specified in config file
+ * will be overriden and subversion internal diff logic is used.
+ *
* If @a show_copies_as_adds is TRUE, then copied files will not be diffed
* against their copyfrom source, and will appear in the diff output
* in their entirety, as if they were newly added.
@@ -2379,6 +2382,7 @@ svn_client_diff5(const apr_array_header_
svn_depth_t depth,
svn_boolean_t ignore_ancestry,
svn_boolean_t no_diff_deleted,
+ svn_boolean_t force_internal_diff,
svn_boolean_t show_copies_as_adds,
svn_boolean_t ignore_content_type,
const char *header_encoding,
@@ -2512,6 +2516,7 @@ svn_client_diff_peg5(const apr_array_hea
svn_depth_t depth,
svn_boolean_t ignore_ancestry,
svn_boolean_t no_diff_deleted,
+ svn_boolean_t force_internal_diff,
svn_boolean_t show_copies_as_adds,
svn_boolean_t ignore_content_type,
const char *header_encoding,
Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=948785&r1=948784&r2=948785&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Thu May 27 11:08:12 2010
@@ -637,7 +637,7 @@ svn_client_diff4(const apr_array_header_
{
return svn_client_diff5(options, path1, revision1, path2,
revision2, relative_to_dir, depth,
- ignore_ancestry, no_diff_deleted, FALSE,
+ ignore_ancestry, no_diff_deleted, FALSE, FALSE,
ignore_content_type, header_encoding,
outfile, errfile, changelists, ctx, pool);
}
@@ -734,6 +734,7 @@ svn_client_diff_peg4(const apr_array_hea
ignore_ancestry,
no_diff_deleted,
FALSE,
+ FALSE,
ignore_content_type,
header_encoding,
outfile,
Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=948785&r1=948784&r2=948785&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Thu May 27 11:08:12 2010
@@ -1594,31 +1594,33 @@ do_diff_summarize(const struct diff_para
/* Initialize DIFF_CMD_BATON.diff_cmd and DIFF_CMD_BATON.options,
* according to OPTIONS and CONFIG. CONFIG may be null.
+ * If FORCE_INTERNAL_DIFF is true then make use of subversion's builtin
+ * diff functionality.
* Allocate the fields in POOL, which should be at least as long-lived
* as the pool DIFF_CMD_BATON itself is allocated in.
*/
static svn_error_t *
set_up_diff_cmd_and_options(struct diff_cmd_baton *diff_cmd_baton,
const apr_array_header_t *options,
- apr_hash_t *config, apr_pool_t *pool)
+ apr_hash_t *config,
+ svn_boolean_t force_internal_diff,
+ apr_pool_t *pool)
{
const char *diff_cmd = NULL;
+ diff_cmd_baton->diff_cmd = NULL;
- /* See if there is a command. */
- if (config)
+ /* See if there is a command only if force_internal_diff is false. */
+ if (! force_internal_diff && config)
{
svn_config_t *cfg = apr_hash_get(config, SVN_CONFIG_CATEGORY_CONFIG,
APR_HASH_KEY_STRING);
svn_config_get(cfg, &diff_cmd, SVN_CONFIG_SECTION_HELPERS,
SVN_CONFIG_OPTION_DIFF_CMD, NULL);
+ if (diff_cmd)
+ SVN_ERR(svn_path_cstring_to_utf8(&diff_cmd_baton->diff_cmd, diff_cmd,
+ pool));
}
- if (diff_cmd)
- SVN_ERR(svn_path_cstring_to_utf8(&diff_cmd_baton->diff_cmd, diff_cmd,
- pool));
- else
- diff_cmd_baton->diff_cmd = NULL;
-
/* If there was a command, arrange options to pass to it. */
if (diff_cmd_baton->diff_cmd)
{
@@ -1692,6 +1694,7 @@ svn_client_diff5(const apr_array_header_
svn_depth_t depth,
svn_boolean_t ignore_ancestry,
svn_boolean_t no_diff_deleted,
+ svn_boolean_t force_internal_diff,
svn_boolean_t show_copies_as_adds,
svn_boolean_t ignore_content_type,
const char *header_encoding,
@@ -1736,8 +1739,8 @@ svn_client_diff5(const apr_array_header_
diff_cmd_baton.orig_path_1 = path1;
diff_cmd_baton.orig_path_2 = path2;
- SVN_ERR(set_up_diff_cmd_and_options(&diff_cmd_baton, options,
- ctx->config, pool));
+ SVN_ERR(set_up_diff_cmd_and_options(&diff_cmd_baton, options, ctx->config,
+ force_internal_diff, pool));
diff_cmd_baton.pool = pool;
diff_cmd_baton.outfile = outfile;
diff_cmd_baton.errfile = errfile;
@@ -1762,6 +1765,7 @@ svn_client_diff_peg5(const apr_array_hea
svn_depth_t depth,
svn_boolean_t ignore_ancestry,
svn_boolean_t no_diff_deleted,
+ svn_boolean_t force_internal_diff,
svn_boolean_t show_copies_as_adds,
svn_boolean_t ignore_content_type,
const char *header_encoding,
@@ -1802,8 +1806,8 @@ svn_client_diff_peg5(const apr_array_hea
diff_cmd_baton.orig_path_1 = path;
diff_cmd_baton.orig_path_2 = path;
- SVN_ERR(set_up_diff_cmd_and_options(&diff_cmd_baton, options,
- ctx->config, pool));
+ SVN_ERR(set_up_diff_cmd_and_options(&diff_cmd_baton, options, ctx->config,
+ force_internal_diff, pool));
diff_cmd_baton.pool = pool;
diff_cmd_baton.outfile = outfile;
diff_cmd_baton.errfile = errfile;
Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=948785&r1=948784&r2=948785&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Thu May 27 11:08:12 2010
@@ -227,6 +227,7 @@ typedef struct svn_cl__opt_state_t
svn_boolean_t ignore_whitespace; /* don't account for whitespace when
patching */
svn_boolean_t show_diff; /* produce diff output */
+ svn_boolean_t force_internal_diff;/* override diff_cmd in config file */
} svn_cl__opt_state_t;
Modified: subversion/trunk/subversion/svn/diff-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/diff-cmd.c?rev=948785&r1=948784&r2=948785&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/diff-cmd.c (original)
+++ subversion/trunk/subversion/svn/diff-cmd.c Thu May 27 11:08:12 2010
@@ -348,6 +348,7 @@ svn_cl__diff(apr_getopt_t *os,
opt_state->depth,
! opt_state->notice_ancestry,
opt_state->no_diff_deleted,
+ opt_state->force_internal_diff,
opt_state->show_copies_as_adds,
opt_state->force,
svn_cmdline_output_encoding(pool),
@@ -392,6 +393,7 @@ svn_cl__diff(apr_getopt_t *os,
opt_state->depth,
! opt_state->notice_ancestry,
opt_state->no_diff_deleted,
+ opt_state->force_internal_diff,
opt_state->show_copies_as_adds,
opt_state->force,
svn_cmdline_output_encoding(pool),
Modified: subversion/trunk/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/log-cmd.c?rev=948785&r1=948784&r2=948785&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/log-cmd.c (original)
+++ subversion/trunk/subversion/svn/log-cmd.c Thu May 27 11:08:12 2010
@@ -302,6 +302,7 @@ log_entry_receiver(void *baton,
svn_depth_infinity,
FALSE, /* ignore ancestry */
TRUE, /* no diff deleted */
+ FALSE, /* override diff-cmd */
FALSE, /* show copies as adds */
FALSE, /* ignore content type */
svn_cmdline_output_encoding(pool),
@@ -334,6 +335,7 @@ log_entry_receiver(void *baton,
svn_depth_infinity,
FALSE, /* ignore ancestry */
TRUE, /* no diff deleted */
+ FALSE, /* override diff-cmd */
FALSE, /* show copies as adds */
FALSE, /* ignore content type */
svn_cmdline_output_encoding(iterpool),
Modified: subversion/trunk/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/main.c?rev=948785&r1=948784&r2=948785&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/main.c (original)
+++ subversion/trunk/subversion/svn/main.c Thu May 27 11:08:12 2010
@@ -120,6 +120,7 @@ typedef enum {
opt_reverse_diff,
opt_ignore_whitespace,
opt_show_diff,
+ opt_force_internal_diff,
} svn_cl__longopt_t;
/* Option codes and descriptions for the command line client.
@@ -362,6 +363,8 @@ const apr_getopt_option_t svn_cl__option
N_("produce diff output\n"
" "
"[alias: --diff]")},
+ {"force-internal-diff", opt_force_internal_diff, 0,
+ N_("override diff-cmd specified in config file")},
/* Long-opt Aliases
*
* These have NULL desriptions, but an option code that matches some
@@ -563,9 +566,9 @@ const svn_opt_subcommand_desc2_t svn_cl_
" 3. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]'\n"
"\n"
" Use just 'svn diff' to display local modifications in a working copy.\n"),
- {'r', 'c', opt_old_cmd, opt_new_cmd, 'N', opt_depth, opt_diff_cmd, 'x',
- opt_no_diff_deleted, opt_show_copies_as_adds, opt_notice_ancestry,
- opt_summarize, opt_changelist, opt_force, opt_xml} },
+ {'r', 'c', opt_old_cmd, opt_new_cmd, 'N', opt_depth, opt_diff_cmd,
+ opt_force_internal_diff, 'x', opt_no_diff_deleted, opt_show_copies_as_adds,
+ opt_notice_ancestry, opt_summarize, opt_changelist, opt_force, opt_xml} },
{ "export", svn_cl__export, {0}, N_
("Create an unversioned copy of a tree.\n"
"usage: 1. export [-r REV] URL[@PEGREV] [PATH]\n"
@@ -1755,6 +1758,9 @@ main(int argc, const char *argv[])
case opt_show_diff:
opt_state.show_diff = TRUE;
break;
+ case opt_force_internal_diff:
+ opt_state.force_internal_diff = TRUE;
+ break;
default:
/* Hmmm. Perhaps this would be a good place to squirrel away
opts that commands like svn diff might need. Hmmm indeed. */
@@ -1924,6 +1930,16 @@ main(int argc, const char *argv[])
return svn_cmdline_handle_exit_error(err, pool, "svn: ");
}
+ /* Disallow simultaneous use of both --diff-cmd and
+ --force-internal-diff. */
+ if (opt_state.diff_cmd && opt_state.force_internal_diff)
+ {
+ err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--diff-cmd and --force-internal-diff "
+ "are mutually exclusive"));
+ return svn_cmdline_handle_exit_error(err, pool, "svn: ");
+ }
+
/* Ensure that 'revision_ranges' has at least one item, and make
'start_revision' and 'end_revision' match that item. */
if (opt_state.revision_ranges->nelts == 0)
Re: svn commit: r948785 - in /subversion/trunk/subversion: include/svn_client.h
libsvn_client/deprecated.c libsvn_client/diff.c svn/cl.h svn/diff-cmd.c svn/log-cmd.c
svn/main.c
Posted by Senthil Kumaran S <se...@collab.net>.
Bert Huijben wrote:
>
>> -----Original Message-----
>> From: stylesen@apache.org [mailto:stylesen@apache.org]
>> Sent: donderdag 27 mei 2010 13:08
>> To: commits@subversion.apache.org
>> Subject: svn commit: r948785 - in /subversion/trunk/subversion:
>> include/svn_client.h libsvn_client/deprecated.c libsvn_client/diff.c svn/cl.h
>> svn/diff-cmd.c svn/log-cmd.c svn/main.c
>>
>> Author: stylesen
>> Date: Thu May 27 11:08:12 2010
>> New Revision: 948785
>>
>> URL: http://svn.apache.org/viewvc?rev=948785&view=rev
>> Log:
>> Fix issue #3071.
>>
>> Request enhancement to svn diff to indicate that an external diff-cmd
>> should NOT be used
>
> Why don't you use the same method as --diff-cmd? (That seems like a much easier way to handle this enhancement)
>
> --diff-cmd is only handled in subversion/svn/main.c:
>
> (line 2095-2099)
> /* XXX: Only diff_cmd for now, overlay rest later and stop passing
> opt_state altogether? */
> if (opt_state.diff_cmd)
> svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
> SVN_CONFIG_OPTION_DIFF_CMD, opt_state.diff_cmd);
Done in r948802. I didn't know such an easy way exists when I started this :)
Thank You.
--
Senthil Kumaran S
http://www.stylesen.org/
RE: svn commit: r948785 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/deprecated.c libsvn_client/diff.c svn/cl.h svn/diff-cmd.c svn/log-cmd.c svn/main.c
Posted by Bert Huijben <be...@qqmail.nl>.
> -----Original Message-----
> From: stylesen@apache.org [mailto:stylesen@apache.org]
> Sent: donderdag 27 mei 2010 13:08
> To: commits@subversion.apache.org
> Subject: svn commit: r948785 - in /subversion/trunk/subversion:
> include/svn_client.h libsvn_client/deprecated.c libsvn_client/diff.c svn/cl.h
> svn/diff-cmd.c svn/log-cmd.c svn/main.c
>
> Author: stylesen
> Date: Thu May 27 11:08:12 2010
> New Revision: 948785
>
> URL: http://svn.apache.org/viewvc?rev=948785&view=rev
> Log:
> Fix issue #3071.
>
> Request enhancement to svn diff to indicate that an external diff-cmd
> should NOT be used
Why don't you use the same method as --diff-cmd? (That seems like a much easier way to handle this enhancement)
--diff-cmd is only handled in subversion/svn/main.c:
(line 2095-2099)
/* XXX: Only diff_cmd for now, overlay rest later and stop passing
opt_state altogether? */
if (opt_state.diff_cmd)
svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
SVN_CONFIG_OPTION_DIFF_CMD, opt_state.diff_cmd);
Bert
RE: svn commit: r948785 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/deprecated.c libsvn_client/diff.c svn/cl.h svn/diff-cmd.c svn/log-cmd.c svn/main.c
Posted by Bert Huijben <be...@qqmail.nl>.
> -----Original Message-----
> From: stylesen@apache.org [mailto:stylesen@apache.org]
> Sent: donderdag 27 mei 2010 13:08
> To: commits@subversion.apache.org
> Subject: svn commit: r948785 - in /subversion/trunk/subversion:
> include/svn_client.h libsvn_client/deprecated.c libsvn_client/diff.c svn/cl.h
> svn/diff-cmd.c svn/log-cmd.c svn/main.c
>
> Author: stylesen
> Date: Thu May 27 11:08:12 2010
> New Revision: 948785
>
> URL: http://svn.apache.org/viewvc?rev=948785&view=rev
> Log:
> Fix issue #3071.
>
> Request enhancement to svn diff to indicate that an external diff-cmd
> should NOT be used
Why don't you use the same method as --diff-cmd? (That seems like a much easier way to handle this enhancement)
--diff-cmd is only handled in subversion/svn/main.c:
(line 2095-2099)
/* XXX: Only diff_cmd for now, overlay rest later and stop passing
opt_state altogether? */
if (opt_state.diff_cmd)
svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
SVN_CONFIG_OPTION_DIFF_CMD, opt_state.diff_cmd);
Bert