Hi Stefan,
Oops, I forgot to send it out after applying the feedback comments. Nothing to
be sorry about. Here it is, updated to apply to r1239239.
[[[
* subversion/svn/cl.h
* subversion/svn/main.c
New options, --no-diff-properties and --patch for svn diff.
* subversion/include/svn_client.h
(svn_client_diff6,svn_client_diff_peg6): New argument, ignore_prop_diff.
(svn_client_diff5,svn_client_diff_peg5): Update comments.
* subversion/libsvn_client/deprecated.c
(svn_client_diff5,svn_client_diff_peg5): Pass FALSE as ignore_prop_diff.
* subversion/libsvn_client/diff.c
(diff_cmd_baton): New field, ignore_prop_diff.
(diff_props_changed): Do nothing if diff_cmd_baton->ignore_prop_diff is set.
(svn_client_diff6,svn_client_diff_peg6): Pass ignore_prop_diff downstream
via diff_cmd_baton.
* subversion/svn/diff-cmd.c
(svn_cl__diff): Handle --patch and --no-diff-properties.
* subversion/svn/log-cmd.c
(log_entry_receiver): Request property changes from svn_client_diff6.
]]]
Regards,
Alexey.
On Wednesday, February 01, 2012 09:53:00 am Stefan Sperling wrote:
> Alexey,
>
> are you still working on this patch?
>
> Since your last submission there has been some feedback and I think
> we've reached consensus. I am sorry that our discussion flip-flopped
> a little and mislead you.
>
> I would very much like to see a version of your patch which
> incorporates the feedback you've received since your last submission.
>
> If you don't have time or interested to work on this patch anymore
> I'd like to pick it up and finish it. Else I will wait for an updated
> patch from you.
>
> Thanks!
>
> On Thu, Dec 22, 2011 at 11:18:18AM +0000, Julian Foad wrote:
> > Stefan Sperling wrote:
> > > Alexey Neyman wrote:
> > >> Stefan Sperling wrote:
> > >>> I'd prefer keeping --no-diff-properties and add a --patch option
> > >>> later which implies --no-diff-properties and maybe other options.
> > >>>
> > >> I was explicitly asked by Julian Foad to avoid adding more
> > >>
> > >> low-level options (such as --no-diff-properties) and add
> > >> "interface-level" options instead. I am fine with either approach.
> >
> > Actually, my contribution to this design discussion was only to say that
> > having a high-level option was "potentially a good direction to go
> > [...]": <http://svn.haxx.se/dev/archive-2011-11/0081.shtml>.
> >
> > > I'd prefer having both low-level and high-level options available.
> > >
> > > That way it is easier to tell what each individual option does.
> > > Higher-level options can simply explain themselves as being
> > > equivalent to some set of lower-level options.
> >
> > That sounds good to me.
> >
> > > But feel free to let us argue about it instead of getting involved
> > > in the bikeshedding. We can apply your patch as-is and change the
> > > option name later. It's no big deal. Before doing so I'll wait a bit
> > > to see what the others have to say.
> >
> > Agreed.
> >
> > - Julian
Index: subversion/svn/cl.h
===================================================================
--- subversion/svn/cl.h (revision 1239239)
+++ subversion/svn/cl.h (working copy)
@@ -184,6 +184,7 @@
svn_boolean_t no_ignore; /* disregard default ignores & svn:ignore's */
svn_boolean_t no_auth_cache; /* do not cache authentication information */
svn_boolean_t no_diff_deleted; /* do not show diffs for deleted files */
+ svn_boolean_t no_diff_props; /* do not show diffs for properties */
svn_boolean_t show_copies_as_adds; /* do not diff copies with their source */
svn_boolean_t notice_ancestry; /* notice ancestry for diff-y operations */
svn_boolean_t ignore_ancestry; /* ignore ancestry for merge-y operations */
@@ -229,6 +230,7 @@
svn_boolean_t show_diff; /* produce diff output (maps to --diff) */
svn_boolean_t internal_diff; /* override diff_cmd in config file */
svn_boolean_t use_git_diff_format; /* Use git's extended diff format */
+ svn_boolean_t use_patch_diff_format; /* Output compatible with GNU patch */
svn_boolean_t allow_mixed_rev; /* Allow operation on mixed-revision WC */
svn_boolean_t include_externals; /* Recurses (in)to file & dir externals */
} svn_cl__opt_state_t;
Index: subversion/svn/diff-cmd.c
===================================================================
--- subversion/svn/diff-cmd.c (revision 1239239)
+++ subversion/svn/diff-cmd.c (working copy)
@@ -171,6 +171,10 @@
const char *old_target, *new_target;
apr_pool_t *iterpool;
svn_boolean_t pegged_diff = FALSE;
+ svn_boolean_t show_copies_as_adds =
+ opt_state->use_patch_diff_format ? TRUE : opt_state->show_copies_as_adds;
+ svn_boolean_t ignore_prop_diff =
+ opt_state->use_patch_diff_format ? TRUE : opt_state->no_diff_props;
int i;
const svn_client_diff_summarize_func_t summarize_func =
(opt_state->xml ? summarize_xml : summarize_regular);
@@ -361,8 +365,9 @@
opt_state->depth,
! opt_state->notice_ancestry,
opt_state->no_diff_deleted,
- opt_state->show_copies_as_adds,
+ show_copies_as_adds,
opt_state->force,
+ ignore_prop_diff,
opt_state->use_git_diff_format,
svn_cmdline_output_encoding(pool),
outstream,
@@ -406,8 +411,9 @@
opt_state->depth,
! opt_state->notice_ancestry,
opt_state->no_diff_deleted,
- opt_state->show_copies_as_adds,
+ show_copies_as_adds,
opt_state->force,
+ ignore_prop_diff,
opt_state->use_git_diff_format,
svn_cmdline_output_encoding(pool),
outstream,
Index: subversion/svn/log-cmd.c
===================================================================
--- subversion/svn/log-cmd.c (revision 1239239)
+++ subversion/svn/log-cmd.c (working copy)
@@ -312,6 +312,7 @@
TRUE, /* no diff deleted */
FALSE, /* show copies as adds */
FALSE, /* ignore content type */
+ FALSE, /* ignore prop diff */
FALSE, /* use git diff format */
svn_cmdline_output_encoding(pool),
outstream,
Index: subversion/svn/main.c
===================================================================
--- subversion/svn/main.c (revision 1239239)
+++ subversion/svn/main.c (working copy)
@@ -89,6 +89,7 @@
opt_no_auth_cache,
opt_no_autoprops,
opt_no_diff_deleted,
+ opt_no_diff_props,
opt_no_ignore,
opt_no_unlock,
opt_non_interactive,
@@ -123,6 +124,7 @@
opt_diff,
opt_internal_diff,
opt_use_git_diff_format,
+ opt_use_patch_diff_format,
opt_allow_mixed_revisions,
opt_include_externals,
} svn_cl__longopt_t;
@@ -239,6 +241,8 @@
N_("try operation but make no changes")},
{"no-diff-deleted", opt_no_diff_deleted, 0,
N_("do not print differences for deleted files")},
+ {"no-diff-properties", opt_no_diff_props, 0,
+ N_("do not print differences for properties")},
{"notice-ancestry", opt_notice_ancestry, 0,
N_("notice ancestry when calculating differences")},
{"ignore-ancestry", opt_ignore_ancestry, 0,
@@ -343,6 +347,12 @@
N_("override diff-cmd specified in config file")},
{"git", opt_use_git_diff_format, 0,
N_("use git's extended diff format")},
+ {"patch", opt_use_patch_diff_format, 0,
+ N_("generate diff suitable for GNU patch;\n"
+ " "
+ "implies show-copies-as-adds and ignores property\n"
+ " "
+ "differences")},
{"allow-mixed-revisions", opt_allow_mixed_revisions, 0,
N_("Allow merge into mixed-revision working copy.\n"
" "
@@ -538,9 +548,9 @@
"\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,
- opt_internal_diff, 'x', opt_no_diff_deleted, opt_show_copies_as_adds,
- opt_notice_ancestry, opt_summarize, opt_changelist, opt_force, opt_xml,
- opt_use_git_diff_format} },
+ opt_internal_diff, 'x', opt_no_diff_deleted, opt_no_diff_props,
+ opt_show_copies_as_adds, opt_notice_ancestry, opt_summarize, opt_changelist,
+ opt_force, opt_xml, opt_use_git_diff_format, opt_use_patch_diff_format} },
{ "export", svn_cl__export, {0}, N_
("Create an unversioned copy of a tree.\n"
"usage: 1. export [-r REV] URL[@PEGREV] [PATH]\n"
@@ -1908,6 +1918,9 @@
case opt_no_diff_deleted:
opt_state.no_diff_deleted = TRUE;
break;
+ case opt_no_diff_props:
+ opt_state.no_diff_props = TRUE;
+ break;
case opt_show_copies_as_adds:
opt_state.show_copies_as_adds = TRUE;
break;
@@ -2088,6 +2101,9 @@
case opt_internal_diff:
opt_state.internal_diff = TRUE;
break;
+ case opt_use_patch_diff_format:
+ opt_state.use_patch_diff_format = TRUE;
+ break;
case opt_use_git_diff_format:
opt_state.use_git_diff_format = TRUE;
break;
Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h (revision 1239239)
+++ subversion/include/svn_client.h (working copy)
@@ -2877,6 +2877,7 @@
svn_boolean_t no_diff_deleted,
svn_boolean_t show_copies_as_adds,
svn_boolean_t ignore_content_type,
+ svn_boolean_t ignore_prop_diff,
svn_boolean_t use_git_diff_format,
const char *header_encoding,
svn_stream_t *outstream,
@@ -2886,7 +2887,8 @@
apr_pool_t *pool);
/** Similar to svn_client_diff6(), but with @a outfile and @a errfile,
- * instead of @a outstream and @a errstream.
+ * instead of @a outstream and @a errstream, and always showing property
+ * changes.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* @since New in 1.7.
@@ -3035,6 +3037,7 @@
svn_boolean_t no_diff_deleted,
svn_boolean_t show_copies_as_adds,
svn_boolean_t ignore_content_type,
+ svn_boolean_t ignore_prop_diff,
svn_boolean_t use_git_diff_format,
const char *header_encoding,
svn_stream_t *outstream,
@@ -3044,7 +3047,8 @@
apr_pool_t *pool);
/** Similar to svn_client_diff_peg6(), but with @a outfile and @a errfile,
- * instead of @a outstream and @a errstream.
+ * instead of @a outstream and @a errstream, and always showing property
+ * changes.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* @since New in 1.7.
Index: subversion/libsvn_client/deprecated.c
===================================================================
--- subversion/libsvn_client/deprecated.c (revision 1239239)
+++ subversion/libsvn_client/deprecated.c (working copy)
@@ -864,7 +864,7 @@
return svn_client_diff6(diff_options, path1, revision1, path2,
revision2, relative_to_dir, depth,
ignore_ancestry, no_diff_deleted,
- show_copies_as_adds, ignore_content_type,
+ show_copies_as_adds, ignore_content_type, FALSE,
use_git_diff_format, header_encoding,
outstream, errstream, changelists, ctx, pool);
}
@@ -992,6 +992,7 @@
no_diff_deleted,
show_copies_as_adds,
ignore_content_type,
+ FALSE,
use_git_diff_format,
header_encoding,
outstream,
Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 1239239)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -777,6 +777,9 @@
relative to for output generation (see issue #2723). */
const char *relative_to_dir;
+ /* Whether property differences are ignored. */
+ svn_boolean_t ignore_prop_diff;
+
/* Whether we're producing a git-style diff. */
svn_boolean_t use_git_diff_format;
@@ -817,6 +820,10 @@
apr_array_header_t *props;
svn_boolean_t show_diff_header;
+ /* If property differences are ignored, there's nothing to do. */
+ if (diff_cmd_baton->ignore_prop_diff)
+ return SVN_NO_ERROR;
+
SVN_ERR(svn_categorize_props(propchanges, NULL, NULL, &props,
scratch_pool));
@@ -2413,6 +2420,7 @@
svn_boolean_t no_diff_deleted,
svn_boolean_t show_copies_as_adds,
svn_boolean_t ignore_content_type,
+ svn_boolean_t ignore_prop_diff,
svn_boolean_t use_git_diff_format,
const char *header_encoding,
svn_stream_t *outstream,
@@ -2442,6 +2450,7 @@
diff_cmd_baton.force_empty = FALSE;
diff_cmd_baton.force_binary = ignore_content_type;
+ diff_cmd_baton.ignore_prop_diff = ignore_prop_diff;
diff_cmd_baton.relative_to_dir = relative_to_dir;
diff_cmd_baton.use_git_diff_format = use_git_diff_format;
diff_cmd_baton.no_diff_deleted = no_diff_deleted;
@@ -2470,6 +2479,7 @@
svn_boolean_t no_diff_deleted,
svn_boolean_t show_copies_as_adds,
svn_boolean_t ignore_content_type,
+ svn_boolean_t ignore_prop_diff,
svn_boolean_t use_git_diff_format,
const char *header_encoding,
svn_stream_t *outstream,
@@ -2495,6 +2505,7 @@
diff_cmd_baton.force_empty = FALSE;
diff_cmd_baton.force_binary = ignore_content_type;
+ diff_cmd_baton.ignore_prop_diff = ignore_prop_diff;
diff_cmd_baton.relative_to_dir = relative_to_dir;
diff_cmd_baton.use_git_diff_format = use_git_diff_format;
diff_cmd_baton.no_diff_deleted = no_diff_deleted;