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 2012/05/09 13:45:15 UTC

svn commit: r1336110 - 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: stsp
Date: Wed May  9 11:45:15 2012
New Revision: 1336110

URL: http://svn.apache.org/viewvc?rev=1336110&view=rev
Log:
Add a new --properties-only option to 'svn diff' to show only property changes.
This is the inverse of --ignore-properties. The two options are mutually
exclusive.

* subversion/svn/diff-cmd.c
  (svn_cl__diff): Pass the properties_only option to the client layer.

* subversion/svn/main.c
  (svn_cl__longopt_t, svn_cl__options, svn_cl__cmd_table): Add a new
   --properties-only option. The internal flag is called opt_properties_only".

* subversion/svn/log-cmd.c
  (log_entry_receiver): When showing diffs, set properties_only to FALSE.

* subversion/svn/cl.h
  (svn_cl__opt_state_t): New properties_only option.

* subversion/libsvn_client/diff.c
  (diff_cmd_baton): Add properties_only flag.
  (diff_content_changed): Do nothing if properties_only is set.
  (svn_client_diff6, svn_client_diff_peg6): New properties_only parameter.
   Raise an error if both ignore_properties and properties_only are set.

* subversion/libsvn_client/deprecated.c
  (svn_client_diff5, svn_client_diff_peg5): Pass FALSE for properties_only.

* subversion/include/svn_client.h
  (svn_client_diff6, svn_client_diff_peg6): Update declarations and docstring.

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=1336110&r1=1336109&r2=1336110&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed May  9 11:45:15 2012
@@ -2884,6 +2884,9 @@ svn_client_blame(const char *path_or_url
  * ### Do we need to say more about the format? A reference perhaps?
  *
  * If @a ignore_properties is TRUE, do not show property differences.
+ * If @a properties_only is TRUE, show only property changes.
+ * The above two options are mutually exclusive. It is an error to set
+ * both to TRUE.
  *
  * Generated headers are encoded using @a header_encoding.
  *
@@ -2930,6 +2933,7 @@ svn_client_diff6(const apr_array_header_
                  svn_boolean_t show_copies_as_adds,
                  svn_boolean_t ignore_content_type,
                  svn_boolean_t ignore_properties,
+                 svn_boolean_t properties_only,
                  svn_boolean_t use_git_diff_format,
                  const char *header_encoding,
                  svn_stream_t *outstream,
@@ -3090,6 +3094,7 @@ svn_client_diff_peg6(const apr_array_hea
                      svn_boolean_t show_copies_as_adds,
                      svn_boolean_t ignore_content_type,
                      svn_boolean_t ignore_properties,
+                     svn_boolean_t properties_only,
                      svn_boolean_t use_git_diff_format,
                      const char *header_encoding,
                      svn_stream_t *outstream,

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1336110&r1=1336109&r2=1336110&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Wed May  9 11:45:15 2012
@@ -886,7 +886,7 @@ svn_client_diff5(const apr_array_header_
                           revision2, relative_to_dir, depth,
                           ignore_ancestry, no_diff_deleted,
                           show_copies_as_adds, ignore_content_type, FALSE,
-                          use_git_diff_format, header_encoding,
+                          FALSE, use_git_diff_format, header_encoding,
                           outstream, errstream, changelists, ctx, pool);
 }
 
@@ -1014,6 +1014,7 @@ svn_client_diff_peg5(const apr_array_hea
                               show_copies_as_adds,
                               ignore_content_type,
                               FALSE,
+                              FALSE,
                               use_git_diff_format,
                               header_encoding,
                               outstream,

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1336110&r1=1336109&r2=1336110&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Wed May  9 11:45:15 2012
@@ -779,6 +779,9 @@ struct diff_cmd_baton {
   /* Whether property differences are ignored. */
   svn_boolean_t ignore_properties;
 
+  /* Whether to show only property changes. */
+  svn_boolean_t properties_only;
+
   /* Whether we're producing a git-style diff. */
   svn_boolean_t use_git_diff_format;
 
@@ -929,6 +932,10 @@ diff_content_changed(const char *path,
   const char *path1 = diff_cmd_baton->orig_path_1;
   const char *path2 = diff_cmd_baton->orig_path_2;
 
+  /* If only property differences are shown, there's nothing to do. */
+  if (diff_cmd_baton->properties_only)
+    return SVN_NO_ERROR;
+
   /* Generate the diff headers. */
   SVN_ERR(adjust_paths_for_diff_labels(&path, &path1, &path2,
                                        rel_to_dir, subpool));
@@ -2938,6 +2945,7 @@ svn_client_diff6(const apr_array_header_
                  svn_boolean_t show_copies_as_adds,
                  svn_boolean_t ignore_content_type,
                  svn_boolean_t ignore_properties,
+                 svn_boolean_t properties_only,
                  svn_boolean_t use_git_diff_format,
                  const char *header_encoding,
                  svn_stream_t *outstream,
@@ -2947,9 +2955,14 @@ svn_client_diff6(const apr_array_header_
                  apr_pool_t *pool)
 {
   struct diff_cmd_baton diff_cmd_baton = { 0 };
+  svn_opt_revision_t peg_revision;
+
+  if (ignore_properties && properties_only)
+    return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+                            _("Cannot ignore properties and show only "
+                              "properties at the same time"));
 
   /* We will never do a pegged diff from here. */
-  svn_opt_revision_t peg_revision;
   peg_revision.kind = svn_opt_revision_unspecified;
 
   /* setup callback and baton */
@@ -2968,6 +2981,7 @@ svn_client_diff6(const apr_array_header_
   diff_cmd_baton.force_empty = FALSE;
   diff_cmd_baton.force_binary = ignore_content_type;
   diff_cmd_baton.ignore_properties = ignore_properties;
+  diff_cmd_baton.properties_only = properties_only;
   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;
@@ -2997,6 +3011,7 @@ svn_client_diff_peg6(const apr_array_hea
                      svn_boolean_t show_copies_as_adds,
                      svn_boolean_t ignore_content_type,
                      svn_boolean_t ignore_properties,
+                     svn_boolean_t properties_only,
                      svn_boolean_t use_git_diff_format,
                      const char *header_encoding,
                      svn_stream_t *outstream,
@@ -3007,6 +3022,11 @@ svn_client_diff_peg6(const apr_array_hea
 {
   struct diff_cmd_baton diff_cmd_baton = { 0 };
 
+  if (ignore_properties && properties_only)
+    return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+                            _("Cannot ignore properties and show only "
+                              "properties at the same time"));
+
   /* setup callback and baton */
   diff_cmd_baton.orig_path_1 = path_or_url;
   diff_cmd_baton.orig_path_2 = path_or_url;
@@ -3023,6 +3043,7 @@ svn_client_diff_peg6(const apr_array_hea
   diff_cmd_baton.force_empty = FALSE;
   diff_cmd_baton.force_binary = ignore_content_type;
   diff_cmd_baton.ignore_properties = ignore_properties;
+  diff_cmd_baton.properties_only = properties_only;
   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;

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1336110&r1=1336109&r2=1336110&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Wed May  9 11:45:15 2012
@@ -234,6 +234,7 @@ typedef struct svn_cl__opt_state_t
   svn_boolean_t patch_compatible; /* 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_boolean_t properties_only;   /* Show properties only */
 } 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=1336110&r1=1336109&r2=1336110&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/diff-cmd.c (original)
+++ subversion/trunk/subversion/svn/diff-cmd.c Wed May  9 11:45:15 2012
@@ -374,6 +374,7 @@ svn_cl__diff(apr_getopt_t *os,
                      show_copies_as_adds,
                      opt_state->force,
                      ignore_properties,
+                     opt_state->properties_only,
                      opt_state->use_git_diff_format,
                      svn_cmdline_output_encoding(pool),
                      outstream,
@@ -420,6 +421,7 @@ svn_cl__diff(apr_getopt_t *os,
                      show_copies_as_adds,
                      opt_state->force,
                      ignore_properties,
+                     opt_state->properties_only,
                      opt_state->use_git_diff_format,
                      svn_cmdline_output_encoding(pool),
                      outstream,

Modified: subversion/trunk/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/log-cmd.c?rev=1336110&r1=1336109&r2=1336110&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/log-cmd.c (original)
+++ subversion/trunk/subversion/svn/log-cmd.c Wed May  9 11:45:15 2012
@@ -313,6 +313,7 @@ log_entry_receiver(void *baton,
                                    FALSE, /* show copies as adds */
                                    FALSE, /* ignore content type */
                                    FALSE, /* ignore prop diff */
+                                   FALSE, /* properties only */
                                    FALSE, /* use git diff format */
                                    svn_cmdline_output_encoding(pool),
                                    outstream,

Modified: subversion/trunk/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/main.c?rev=1336110&r1=1336109&r2=1336110&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/main.c (original)
+++ subversion/trunk/subversion/svn/main.c Wed May  9 11:45:15 2012
@@ -128,6 +128,7 @@ typedef enum svn_cl__longopt_t {
   opt_allow_mixed_revisions,
   opt_include_externals,
   opt_symmetric,
+  opt_properties_only,
 } svn_cl__longopt_t;
 
 
@@ -369,6 +370,8 @@ const apr_getopt_option_t svn_cl__option
                        "fixed revision. (See the svn:externals property)")},
   {"symmetric", opt_symmetric, 0,
                        N_("Symmetric merge")},
+  {"properties-only", opt_properties_only, 0,
+                       N_("show only properties during the operation")},
 
   /* Long-opt Aliases
    *
@@ -553,6 +556,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "  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_ignore_properties,
+     opt_properties_only,
      opt_show_copies_as_adds, opt_notice_ancestry, opt_summarize, opt_changelist,
      opt_force, opt_xml, opt_use_git_diff_format, opt_patch_compatible} },
   { "export", svn_cl__export, {0}, N_
@@ -2126,6 +2130,9 @@ main(int argc, const char *argv[])
       case opt_include_externals:
         opt_state.include_externals = TRUE;
         break;
+      case opt_properties_only:
+        opt_state.properties_only = TRUE;
+        break;
       default:
         /* Hmmm. Perhaps this would be a good place to squirrel away
            opts that commands like svn diff might need. Hmmm indeed. */