subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1569697 - in /subversion/trunk/subversion: include/private/svn_client_private.h include/private/svn_wc_private.h libsvn_client/diff.c libsvn_client/diff_local.c libsvn_wc/deprecated.c libsvn_wc/diff_editor.c libsvn_wc/diff_local.c
Date Wed, 19 Feb 2014 11:49:53 GMT
Author: rhuijben
Date: Wed Feb 19 11:49:53 2014
New Revision: 1569697

URL: http://svn.apache.org/r1569697
Log:
Following up on r1569551, update the libsvn_client 'svn diff' code to create a
diff processor in one place and directly pass that to all the different diff
implementations.

Move handling of all arguments that are only used for tree transformations
to libsvn_client (and the deprecated apis).

* subversion/include/private/svn_client_private.h
  (includes): Add private/svn_diff_tree.h.

* subversion/include/private/svn_wc_private.h
  (svn_wc__get_diff_editor): Update argument type.

* subversion/libsvn_client/diff.c
  (diff_wc_wc): Update caller. Use anchor output argument.
  (diff_repos_repos): Update argument type. Switch argument order.
  (diff_repos_wc): Update caller.
  (do_diff): Create diff processor. Update caller.

  (diff_summarize_repos_wc,
   diff_summarize_wc_wc,
   do_diff_summarize): Update caller.

* subversion/libsvn_client/diff_local.c
  (svn_client__arbitrary_nodes_diff): Use diff processor argument. Pass anchor
    to interested callers.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_get_diff_editor6): Update caller.

* subversion/libsvn_wc/diff_editor.c
  (make_edit_baton,
   svn_wc__get_diff_editor): Update argument type. Remove now unused arguments.

* subversion/libsvn_wc/diff_local.c
  (diff_baton): Remove unused variable.
  (svn_wc_diff6): Rename to...
  (svn_wc__diff7): ... this. Update argument type. Remove now unused arguments.
    Allow providing anchor as output argument.
  (svn_wc_diff6): Reimplement as new function wrapping svn_wc__diff7.

Modified:
    subversion/trunk/subversion/include/private/svn_client_private.h
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/diff.c
    subversion/trunk/subversion/libsvn_client/diff_local.c
    subversion/trunk/subversion/libsvn_wc/deprecated.c
    subversion/trunk/subversion/libsvn_wc/diff_editor.c
    subversion/trunk/subversion/libsvn_wc/diff_local.c

Modified: subversion/trunk/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_client_private.h?rev=1569697&r1=1569696&r2=1569697&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Wed Feb 19 11:49:53 2014
@@ -33,6 +33,8 @@
 #include "svn_client.h"
 #include "svn_types.h"
 
+#include "private/svn_diff_tree.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -235,17 +237,22 @@ svn_client__wc_node_get_origin(svn_clien
                                apr_pool_t *scratch_pool);
 
 /* Produce a diff with depth DEPTH between two files or two directories at
- * LOCAL_ABSPATH1 and LOCAL_ABSPATH2, using the provided diff callbacks to
+ * LEFT_ABSPATH1 and RIGHT_ABSPATH, using the provided diff callbacks to
  * show changes in files. The files and directories involved may be part of
  * a working copy or they may be unversioned. For versioned files, show
- * property changes, too. */
+ * property changes, too.
+ *
+ * If ANCHOR_ABSPATH is not null, set it to the anchor of the diff before
+ * the first processor call. (The anchor is LEFT_ABSPATH or an ancestor of it)
+ */
 svn_error_t *
-svn_client__arbitrary_nodes_diff(const char *local_abspath1,
-                                 const char *local_abspath2,
+svn_client__arbitrary_nodes_diff(const char **anchor_abspath,
+                                 const char *left_abspath,
+                                 const char *right_abspath,
                                  svn_depth_t depth,
-                                 const svn_wc_diff_callbacks4_t *callbacks,
-                                 void *callback_baton,
+                                 const svn_diff_tree_processor_t *diff_processor,
                                  svn_client_ctx_t *ctx,
+                                 apr_pool_t *result_pool,
                                  apr_pool_t *scratch_pool);
 
 /* Copy the file or directory on URL in some repository to DST_ABSPATH,

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1569697&r1=1569696&r2=1569697&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Feb 19 11:49:53 2014
@@ -1559,7 +1559,7 @@ svn_wc__get_switch_editor(const svn_delt
  * Diffs will be reported as valid relpaths, with @a anchor_abspath being
  * the root ("").
  *
- * @a callbacks/@a callback_baton is the callback table to use.
+ * @a diff_processor will retrieve the diff report.
  *
  * If @a depth is #svn_depth_empty, just diff exactly @a target or
  * @a anchor_path if @a target is empty.  If #svn_depth_files then do the same
@@ -1630,14 +1630,11 @@ svn_wc__get_diff_editor(const svn_delta_
                         const char *target,
                         svn_depth_t depth,
                         svn_boolean_t ignore_ancestry,
-                        svn_boolean_t show_copies_as_adds,
-                        svn_boolean_t use_git_diff_format,
                         svn_boolean_t use_text_base,
                         svn_boolean_t reverse_order,
                         svn_boolean_t server_performs_filtering,
                         const apr_array_header_t *changelist_filter,
-                        const svn_wc_diff_callbacks4_t *callbacks,
-                        void *callback_baton,
+                        const svn_diff_tree_processor_t *diff_processor,
                         svn_cancel_func_t cancel_func,
                         void *cancel_baton,
                         apr_pool_t *result_pool,
@@ -1842,6 +1839,25 @@ svn_wc__acquire_write_lock_for_resolve(c
                                        const char *local_abspath,
                                        apr_pool_t *result_pool,
                                        apr_pool_t *scratch_pool);
+
+/* The implemementation of svn_wc_diff6(), but reporting to a diff processor
+ *
+ * If ANCHOR_ABSPATH is not null, set it to the anchor of the diff before
+ * the first processor call. (The anchor is LOCAL_ABSPATH or an ancestor of it)
+ */
+svn_error_t *
+svn_wc__diff7(const char **anchor_abspath,
+              svn_wc_context_t *wc_ctx,
+              const char *local_abspath,
+              svn_depth_t depth,
+              svn_boolean_t ignore_ancestry,
+              const apr_array_header_t *changelist_filter,
+              const svn_diff_tree_processor_t *diff_processor,
+              svn_cancel_func_t cancel_func,
+              void *cancel_baton,
+              apr_pool_t *result_pool,
+              apr_pool_t *scratch_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1569697&r1=1569696&r2=1569697&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Wed Feb 19 11:49:53 2014
@@ -1620,7 +1620,8 @@ unsupported_diff_error(svn_error_t *chil
 
    All other options are the same as those passed to svn_client_diff6(). */
 static svn_error_t *
-diff_wc_wc(const char *path1,
+diff_wc_wc(const char **anchor_path,
+           const char *path1,
            const svn_opt_revision_t *revision1,
            const char *path2,
            const svn_opt_revision_t *revision2,
@@ -1629,14 +1630,13 @@ diff_wc_wc(const char *path1,
            svn_boolean_t show_copies_as_adds,
            svn_boolean_t use_git_diff_format,
            const apr_array_header_t *changelists,
-           const svn_wc_diff_callbacks4_t *callbacks,
            struct diff_cmd_baton *callback_baton,
+           const svn_diff_tree_processor_t *diff_processor,
            svn_client_ctx_t *ctx,
            apr_pool_t *pool)
 {
   const char *abspath1;
   svn_error_t *err;
-  svn_node_kind_t kind;
 
   SVN_ERR_ASSERT(! svn_path_is_url(path1));
   SVN_ERR_ASSERT(! svn_path_is_url(path2));
@@ -1674,22 +1674,37 @@ diff_wc_wc(const char *path1,
 
   callback_baton->revnum2 = SVN_INVALID_REVNUM;  /* WC */
 
-  SVN_ERR(svn_wc_read_kind2(&kind, ctx->wc_ctx, abspath1,
+  if (! show_copies_as_adds && !use_git_diff_format)
+    {
+      /* ### Eventually we want to get rid of this wrapping as it loses
+             information that we might need for some cases */
+      diff_processor = svn_diff__tree_processor_copy_as_changed_create(
+                                  diff_processor, pool);
+    }
+
+  {
+    svn_node_kind_t kind;
+
+    SVN_ERR(svn_wc_read_kind2(&kind, ctx->wc_ctx, abspath1,
                             TRUE, FALSE, pool));
 
-  if (kind != svn_node_dir)
-    callback_baton->anchor = svn_dirent_dirname(path1, pool);
-  else
-    callback_baton->anchor = path1;
+    if (kind != svn_node_dir)
+      callback_baton->anchor = svn_dirent_dirname(path1, pool);
+    else
+      callback_baton->anchor = path1;
+  }
 
-  SVN_ERR(svn_wc_diff6(ctx->wc_ctx,
-                       abspath1,
-                       callbacks, callback_baton,
-                       depth,
-                       ignore_ancestry, show_copies_as_adds,
-                       use_git_diff_format, changelists,
-                       ctx->cancel_func, ctx->cancel_baton,
-                       pool));
+  /* --git and --show-copies-as-adds imply --notice-ancestry */
+  if (use_git_diff_format || show_copies_as_adds)
+    ignore_ancestry = FALSE;
+
+  SVN_ERR(svn_wc__diff7(anchor_path, ctx->wc_ctx,
+                        abspath1,
+                        depth,
+                        ignore_ancestry, changelists,
+                        diff_processor,
+                        ctx->cancel_func, ctx->cancel_baton,
+                        pool, pool));
   return SVN_NO_ERROR;
 }
 
@@ -1703,9 +1718,7 @@ diff_wc_wc(const char *path1,
 
    All other options are the same as those passed to svn_client_diff6(). */
 static svn_error_t *
-diff_repos_repos(const svn_wc_diff_callbacks4_t *callbacks,
-                 struct diff_cmd_baton *callback_baton,
-                 svn_client_ctx_t *ctx,
+diff_repos_repos(struct diff_cmd_baton *callback_baton,
                  const char *path_or_url1,
                  const char *path_or_url2,
                  const svn_opt_revision_t *revision1,
@@ -1713,6 +1726,8 @@ diff_repos_repos(const svn_wc_diff_callb
                  const svn_opt_revision_t *peg_revision,
                  svn_depth_t depth,
                  svn_boolean_t ignore_ancestry,
+                 const svn_diff_tree_processor_t *diff_processor,
+                 svn_client_ctx_t *ctx,
                  apr_pool_t *pool)
 {
   svn_ra_session_t *extra_ra_session;
@@ -1723,8 +1738,6 @@ diff_repos_repos(const svn_wc_diff_callb
   const svn_delta_editor_t *diff_editor;
   void *diff_edit_baton;
 
-  const svn_diff_tree_processor_t *diff_processor;
-
   const char *url1;
   const char *url2;
   const char *base_path;
@@ -1756,11 +1769,6 @@ diff_repos_repos(const svn_wc_diff_callb
   /* Set up the repos_diff editor on BASE_PATH, if available.
      Otherwise, we just use "". */
 
-  SVN_ERR(svn_wc__wrap_diff_callbacks(&diff_processor,
-                                      callbacks, callback_baton,
-                                      TRUE /* walk_deleted_dirs */,
-                                      pool, pool));
-
   /* Get actual URLs. */
   callback_baton->orig_path_1 = url1;
   callback_baton->orig_path_2 = url2;
@@ -1859,9 +1867,8 @@ diff_repos_wc(const char *path_or_url1,
               svn_boolean_t show_copies_as_adds,
               svn_boolean_t use_git_diff_format,
               const apr_array_header_t *changelists,
-              const svn_wc_diff_callbacks4_t *callbacks,
-              void *callback_baton,
               struct diff_cmd_baton *cmd_baton,
+              const svn_diff_tree_processor_t *diff_processor,
               svn_client_ctx_t *ctx,
               apr_pool_t *scratch_pool)
 {
@@ -1969,6 +1976,21 @@ diff_repos_wc(const char *path_or_url1,
                                   ctx->wc_ctx, abspath2,
                                   FALSE, pool, pool));
 
+  if (reverse)
+    diff_processor = svn_diff__tree_processor_reverse_create(
+                              diff_processor, NULL, pool);
+
+  if (! show_copies_as_adds)
+    diff_processor = svn_diff__tree_processor_copy_as_changed_create(
+                              diff_processor, pool);
+
+  if (is_copy)
+    ignore_ancestry = TRUE;
+
+  /* --show-copies-as-adds and --git imply --notice-ancestry */
+  if (show_copies_as_adds || use_git_diff_format)
+    ignore_ancestry = FALSE;
+
   /* Use the diff editor to generate the diff. */
   SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
                                 SVN_RA_CAPABILITY_DEPTH, pool));
@@ -1977,14 +1999,12 @@ diff_repos_wc(const char *path_or_url1,
                                   anchor_abspath,
                                   target,
                                   depth,
-                                  ignore_ancestry || is_copy,
-                                  show_copies_as_adds,
-                                  use_git_diff_format,
+                                  ignore_ancestry,
                                   rev2_is_base,
                                   reverse,
                                   server_supports_depth,
                                   changelists,
-                                  callbacks, callback_baton,
+                                  diff_processor,
                                   ctx->cancel_func, ctx->cancel_baton,
                                   pool, pool));
   SVN_ERR(svn_ra_reparent(ra_session, anchor_url, pool));
@@ -2103,21 +2123,27 @@ do_diff(const svn_wc_diff_callbacks4_t *
 {
   svn_boolean_t is_repos1;
   svn_boolean_t is_repos2;
+  svn_diff_tree_processor_t *diff_processor;
 
   /* Check if paths/revisions are urls/local. */
   SVN_ERR(check_paths(&is_repos1, &is_repos2, path_or_url1, path_or_url2,
                       revision1, revision2, peg_revision));
 
+  SVN_ERR(svn_wc__wrap_diff_callbacks(&diff_processor,
+                                      callbacks, callback_baton,
+                                      TRUE /* walk_deleted_dirs */,
+                                      pool, pool));
+
   if (is_repos1)
     {
       if (is_repos2)
         {
           /* ### Ignores 'show_copies_as_adds'. */
-          SVN_ERR(diff_repos_repos(callbacks, callback_baton, ctx,
+          SVN_ERR(diff_repos_repos(callback_baton,
                                    path_or_url1, path_or_url2,
                                    revision1, revision2,
                                    peg_revision, depth, ignore_ancestry,
-                                   pool));
+                                   diff_processor, ctx, pool));
         }
       else /* path_or_url2 is a working copy path */
         {
@@ -2125,8 +2151,8 @@ do_diff(const svn_wc_diff_callbacks4_t *
                                 path_or_url2, revision2, FALSE, depth,
                                 ignore_ancestry, show_copies_as_adds,
                                 use_git_diff_format, changelists,
-                                callbacks, callback_baton, callback_baton,
-                                ctx, pool));
+                                callback_baton,
+                                diff_processor, ctx, pool));
         }
     }
   else /* path_or_url1 is a working copy path */
@@ -2137,8 +2163,8 @@ do_diff(const svn_wc_diff_callbacks4_t *
                                 path_or_url1, revision1, TRUE, depth,
                                 ignore_ancestry, show_copies_as_adds,
                                 use_git_diff_format, changelists,
-                                callbacks, callback_baton, callback_baton,
-                                ctx, pool));
+                                callback_baton,
+                                diff_processor, ctx, pool));
         }
       else /* path_or_url2 is a working copy path */
         {
@@ -2151,18 +2177,18 @@ do_diff(const svn_wc_diff_callbacks4_t *
               SVN_ERR(svn_dirent_get_absolute(&abspath1, path_or_url1, pool));
               SVN_ERR(svn_dirent_get_absolute(&abspath2, path_or_url2, pool));
 
-              SVN_ERR(svn_client__arbitrary_nodes_diff(abspath1, abspath2,
+              SVN_ERR(svn_client__arbitrary_nodes_diff(NULL, abspath1, abspath2,
                                                        depth,
-                                                       callbacks,
-                                                       callback_baton,
-                                                       ctx, pool));
+                                                       diff_processor,
+                                                       ctx, pool, pool));
             }
           else
-            SVN_ERR(diff_wc_wc(path_or_url1, revision1,
+            SVN_ERR(diff_wc_wc(NULL,
+                               path_or_url1, revision1,
                                path_or_url2, revision2,
                                depth, ignore_ancestry, show_copies_as_adds,
                                use_git_diff_format, changelists,
-                               callbacks, callback_baton, ctx, pool));
+                               callback_baton, diff_processor, ctx, pool));
         }
     }
 
@@ -2198,6 +2224,7 @@ diff_summarize_repos_wc(svn_client_diff_
   svn_wc_diff_callbacks4_t *callbacks;
   void *callback_baton;
   struct diff_cmd_baton cmd_baton;
+  const svn_diff_tree_processor_t *diff_processor;
 
   SVN_ERR_ASSERT(! svn_path_is_url(path2));
 
@@ -2209,11 +2236,15 @@ diff_summarize_repos_wc(svn_client_diff_
             &callbacks, &callback_baton, target, reverse,
             summarize_func, summarize_baton, pool));
 
+  SVN_ERR(svn_wc__wrap_diff_callbacks(&diff_processor,
+                                      callbacks, callback_baton, TRUE,
+                                      pool, pool));
+
   SVN_ERR(diff_repos_wc(path_or_url1, revision1, peg_revision,
                         path2, revision2, reverse,
                         depth, FALSE, TRUE, FALSE, changelists,
-                        callbacks, callback_baton, &cmd_baton,
-                        ctx, pool));
+                        &cmd_baton,
+                        diff_processor, ctx, pool));
   return SVN_NO_ERROR;
 }
 
@@ -2240,6 +2271,7 @@ diff_summarize_wc_wc(svn_client_diff_sum
   void *callback_baton;
   const char *abspath1, *target1;
   svn_node_kind_t kind;
+  const svn_diff_tree_processor_t *diff_processor;
 
   SVN_ERR_ASSERT(! svn_path_is_url(path1));
   SVN_ERR_ASSERT(! svn_path_is_url(path2));
@@ -2265,14 +2297,17 @@ diff_summarize_wc_wc(svn_client_diff_sum
             &callbacks, &callback_baton, target1, FALSE,
             summarize_func, summarize_baton, pool));
 
-  SVN_ERR(svn_wc_diff6(ctx->wc_ctx,
-                       abspath1,
-                       callbacks, callback_baton,
-                       depth,
-                       ignore_ancestry, FALSE /* show_copies_as_adds */,
-                       FALSE /* use_git_diff_format */, changelists,
-                       ctx->cancel_func, ctx->cancel_baton,
-                       pool));
+  SVN_ERR(svn_wc__wrap_diff_callbacks(&diff_processor,
+                                      callbacks, callback_baton, TRUE,
+                                      pool, pool));
+
+  SVN_ERR(svn_wc__diff7(NULL,
+                        ctx->wc_ctx,
+                        abspath1,
+                        depth, ignore_ancestry, changelists,
+                        diff_processor,
+                        ctx->cancel_func, ctx->cancel_baton,
+                        pool, pool));
   return SVN_NO_ERROR;
 }
 
@@ -2404,6 +2439,7 @@ do_diff_summarize(svn_client_diff_summar
                   const apr_array_header_t *changelists,
                   apr_pool_t *pool)
 {
+  const svn_diff_tree_processor_t *diff_processor;
   svn_boolean_t is_repos1;
   svn_boolean_t is_repos2;
 
@@ -2466,11 +2502,15 @@ do_diff_summarize(svn_client_diff_summar
                      &callbacks, &callback_baton, target, FALSE,
                      summarize_func, summarize_baton, pool));
 
-             SVN_ERR(svn_client__arbitrary_nodes_diff(abspath1, abspath2,
+             SVN_ERR(svn_wc__wrap_diff_callbacks(&diff_processor,
+                                                 callbacks, callback_baton,
+                                                 TRUE /* walk_deleted*/,
+                                                 pool, pool));
+
+             SVN_ERR(svn_client__arbitrary_nodes_diff(NULL, abspath1, abspath2,
                                                       depth,
-                                                      callbacks,
-                                                      callback_baton,
-                                                      ctx, pool));
+                                                      diff_processor,
+                                                      ctx, pool, pool));
            }
           else
             SVN_ERR(diff_summarize_wc_wc(summarize_func, summarize_baton,

Modified: subversion/trunk/subversion/libsvn_client/diff_local.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff_local.c?rev=1569697&r1=1569696&r2=1569697&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff_local.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff_local.c Wed Feb 19 11:49:53 2014
@@ -575,12 +575,13 @@ do_dir_diff(const char *left_abspath,
 }
 
 svn_error_t *
-svn_client__arbitrary_nodes_diff(const char *left_abspath,
+svn_client__arbitrary_nodes_diff(const char **anchor_abspath,
+                                 const char *left_abspath,
                                  const char *right_abspath,
                                  svn_depth_t depth,
-                                 const svn_wc_diff_callbacks4_t *callbacks,
-                                 void *diff_baton,
+                                 const svn_diff_tree_processor_t *diff_processor,
                                  svn_client_ctx_t *ctx,
+                                 apr_pool_t *result_pool,
                                  apr_pool_t *scratch_pool)
 {
   svn_node_kind_t left_kind;
@@ -588,12 +589,6 @@ svn_client__arbitrary_nodes_diff(const c
   const char *left_root_abspath;
   const char *right_root_abspath;
   svn_boolean_t left_before_right = FALSE; /* Future argument */
-  const svn_diff_tree_processor_t *diff_processor;
-
-  SVN_ERR(svn_wc__wrap_diff_callbacks(&diff_processor,
-                                      callbacks, diff_baton,
-                                      TRUE /* walk_deleted_dirs */,
-                                      scratch_pool, scratch_pool));
 
   if (depth == svn_depth_unknown)
     depth = svn_depth_infinity;
@@ -615,6 +610,9 @@ svn_client__arbitrary_nodes_diff(const c
       right_root_abspath = svn_dirent_dirname(right_abspath, scratch_pool);
     }
 
+  if (anchor_abspath)
+    *anchor_abspath = apr_pstrdup(result_pool, left_root_abspath);
+
   if (left_kind == svn_node_dir && right_kind == svn_node_dir)
     {
       SVN_ERR(do_dir_diff(left_abspath, right_abspath,

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1569697&r1=1569696&r2=1569697&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Wed Feb 19 11:49:53 2014
@@ -2001,16 +2001,37 @@ svn_wc_get_diff_editor6(const svn_delta_
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
+  const svn_diff_tree_processor_t *diff_processor;
+
+  /* --git implies --show-copies-as-adds */
+  if (use_git_diff_format)
+    show_copies_as_adds = TRUE;
+
+  /* --show-copies-as-adds implies --notice-ancestry */
+  if (show_copies_as_adds)
+    ignore_ancestry = FALSE;
+
+  SVN_ERR(svn_wc__wrap_diff_callbacks(&diff_processor,
+                                      callbacks, callback_baton, TRUE,
+                                      result_pool, scratch_pool));
+
+  if (reverse_order)
+    diff_processor = svn_diff__tree_processor_reverse_create(
+                              diff_processor, NULL, result_pool);
+
+  if (! show_copies_as_adds)
+    diff_processor = svn_diff__tree_processor_copy_as_changed_create(
+                              diff_processor, result_pool);
+
   return svn_error_trace(
     svn_wc__get_diff_editor(editor, edit_baton,
                             wc_ctx,
                             anchor_abspath, target,
                             depth,
-                            ignore_ancestry, show_copies_as_adds,
                             use_git_diff_format, use_text_base,
                             reverse_order, server_performs_filtering,
                             changelist_filter,
-                            callbacks, callback_baton,
+                            diff_processor,
                             cancel_func, cancel_baton,
                             result_pool, scratch_pool));
 }

Modified: subversion/trunk/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_editor.c?rev=1569697&r1=1569696&r2=1569697&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_editor.c Wed Feb 19 11:49:53 2014
@@ -249,11 +249,9 @@ make_edit_baton(struct edit_baton_t **ed
                 svn_wc__db_t *db,
                 const char *anchor_abspath,
                 const char *target,
-                const svn_wc_diff_callbacks4_t *callbacks,
-                void *callback_baton,
+                const svn_diff_tree_processor_t *diff_processor,
                 svn_depth_t depth,
                 svn_boolean_t ignore_ancestry,
-                svn_boolean_t show_copies_as_adds,
                 svn_boolean_t use_text_base,
                 svn_boolean_t reverse_order,
                 const apr_array_header_t *changelist_filter,
@@ -263,7 +261,6 @@ make_edit_baton(struct edit_baton_t **ed
 {
   apr_hash_t *changelist_hash = NULL;
   struct edit_baton_t *eb;
-  const svn_diff_tree_processor_t *processor;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(anchor_abspath));
 
@@ -271,26 +268,11 @@ make_edit_baton(struct edit_baton_t **ed
     SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelist_filter,
                                        pool));
 
-  SVN_ERR(svn_wc__wrap_diff_callbacks(&processor,
-                                      callbacks, callback_baton, TRUE,
-                                      pool, pool));
-
-  if (reverse_order)
-    processor = svn_diff__tree_processor_reverse_create(processor, NULL, pool);
-
-  /* --show-copies-as-adds implies --notice-ancestry */
-  if (show_copies_as_adds)
-    ignore_ancestry = FALSE;
-
-  if (! show_copies_as_adds)
-    processor = svn_diff__tree_processor_copy_as_changed_create(processor,
-                                                                pool);
-
   eb = apr_pcalloc(pool, sizeof(*eb));
   eb->db = db;
   eb->anchor_abspath = apr_pstrdup(pool, anchor_abspath);
   eb->target = apr_pstrdup(pool, target);
-  eb->processor = processor;
+  eb->processor = diff_processor;
   eb->depth = depth;
   eb->ignore_ancestry = ignore_ancestry;
   eb->local_before_remote = reverse_order;
@@ -2251,14 +2233,11 @@ svn_wc__get_diff_editor(const svn_delta_
                         const char *target,
                         svn_depth_t depth,
                         svn_boolean_t ignore_ancestry,
-                        svn_boolean_t show_copies_as_adds,
-                        svn_boolean_t use_git_diff_format,
                         svn_boolean_t use_text_base,
                         svn_boolean_t reverse_order,
                         svn_boolean_t server_performs_filtering,
                         const apr_array_header_t *changelist_filter,
-                        const svn_wc_diff_callbacks4_t *callbacks,
-                        void *callback_baton,
+                        const svn_diff_tree_processor_t *diff_processor,
                         svn_cancel_func_t cancel_func,
                         void *cancel_baton,
                         apr_pool_t *result_pool,
@@ -2274,15 +2253,11 @@ svn_wc__get_diff_editor(const svn_delta_
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(anchor_abspath));
 
-  /* --git implies --show-copies-as-adds */
-  if (use_git_diff_format)
-    show_copies_as_adds = TRUE;
-
   SVN_ERR(make_edit_baton(&eb,
                           wc_ctx->db,
                           anchor_abspath, target,
-                          callbacks, callback_baton,
-                          depth, ignore_ancestry, show_copies_as_adds,
+                          diff_processor,
+                          depth, ignore_ancestry,
                           use_text_base, reverse_order, changelist_filter,
                           cancel_func, cancel_baton,
                           result_pool));

Modified: subversion/trunk/subversion/libsvn_wc/diff_local.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_local.c?rev=1569697&r1=1569696&r2=1569697&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff_local.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_local.c Wed Feb 19 11:49:53 2014
@@ -88,9 +88,6 @@ struct diff_baton
   /* Should this diff ignore node ancestry? */
   svn_boolean_t ignore_ancestry;
 
-  /* Should this diff not compare copied files with their source? */
-  svn_boolean_t show_copies_as_adds;
-
   /* Hash whose keys are const char * changelist names. */
   apr_hash_t *changelist_hash;
 
@@ -431,23 +428,21 @@ diff_status_callback(void *baton,
 
 /* Public Interface */
 svn_error_t *
-svn_wc_diff6(svn_wc_context_t *wc_ctx,
-             const char *local_abspath,
-             const svn_wc_diff_callbacks4_t *callbacks,
-             void *callback_baton,
-             svn_depth_t depth,
-             svn_boolean_t ignore_ancestry,
-             svn_boolean_t show_copies_as_adds,
-             svn_boolean_t use_git_diff_format,
-             const apr_array_header_t *changelist_filter,
-             svn_cancel_func_t cancel_func,
-             void *cancel_baton,
-             apr_pool_t *scratch_pool)
+svn_wc__diff7(const char **anchor_abspath,
+              svn_wc_context_t *wc_ctx,
+              const char *local_abspath,
+              svn_depth_t depth,
+              svn_boolean_t ignore_ancestry,
+              const apr_array_header_t *changelist_filter,
+              const svn_diff_tree_processor_t *diff_processor,
+              svn_cancel_func_t cancel_func,
+              void *cancel_baton,
+              apr_pool_t *result_pool,
+              apr_pool_t *scratch_pool)
 {
   struct diff_baton eb = { 0 };
   svn_node_kind_t kind;
   svn_boolean_t get_all;
-  const svn_diff_tree_processor_t *processor;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, local_abspath,
@@ -461,37 +456,19 @@ svn_wc_diff6(svn_wc_context_t *wc_ctx,
   else
     eb.anchor_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
 
-  SVN_ERR(svn_wc__wrap_diff_callbacks(&processor,
-                                      callbacks, callback_baton, TRUE,
-                                      scratch_pool, scratch_pool));
-
-  if (use_git_diff_format)
-    show_copies_as_adds = TRUE;
-  if (show_copies_as_adds)
-    ignore_ancestry = FALSE;
-
-
-
-  /*
-  if (reverse_order)
-    processor = svn_diff__tree_processor_reverse_create(processor, NULL, pool);
-   */
-
-  if (! show_copies_as_adds && !use_git_diff_format)
-    processor = svn_diff__tree_processor_copy_as_changed_create(processor,
-                                                                scratch_pool);
+  if (anchor_abspath)
+    *anchor_abspath = apr_pstrdup(result_pool, eb.anchor_abspath);
 
   eb.db = wc_ctx->db;
-  eb.processor = processor;
+  eb.processor = diff_processor;
   eb.ignore_ancestry = ignore_ancestry;
-  eb.show_copies_as_adds = show_copies_as_adds;
   eb.pool = scratch_pool;
 
   if (changelist_filter && changelist_filter->nelts)
     SVN_ERR(svn_hash_from_cstring_keys(&eb.changelist_hash, changelist_filter,
                                        scratch_pool));
 
-  if (show_copies_as_adds || use_git_diff_format || !ignore_ancestry)
+  if (ignore_ancestry)
     get_all = TRUE; /* We need unmodified descendants of copies */
   else
     get_all = FALSE;
@@ -514,22 +491,22 @@ svn_wc_diff6(svn_wc_context_t *wc_ctx,
       if (!ns->skip)
         {
           if (ns->propchanges)
-            SVN_ERR(processor->dir_changed(ns->relpath,
-                                           ns->left_src,
-                                           ns->right_src,
-                                           ns->left_props,
-                                           ns->right_props,
-                                           ns->propchanges,
-                                           ns->baton,
-                                           processor,
-                                           ns->pool));
+            SVN_ERR(diff_processor->dir_changed(ns->relpath,
+                                                ns->left_src,
+                                                ns->right_src,
+                                                ns->left_props,
+                                                ns->right_props,
+                                                ns->propchanges,
+                                                ns->baton,
+                                                diff_processor,
+                                                ns->pool));
           else
-            SVN_ERR(processor->dir_closed(ns->relpath,
-                                          ns->left_src,
-                                          ns->right_src,
-                                          ns->baton,
-                                          processor,
-                                          ns->pool));
+            SVN_ERR(diff_processor->dir_closed(ns->relpath,
+                                               ns->left_src,
+                                               ns->right_src,
+                                               ns->baton,
+                                               diff_processor,
+                                               ns->pool));
         }
       eb.cur = ns->parent;
       svn_pool_clear(ns->pool);
@@ -537,3 +514,43 @@ svn_wc_diff6(svn_wc_context_t *wc_ctx,
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_wc_diff6(svn_wc_context_t *wc_ctx,
+             const char *local_abspath,
+             const svn_wc_diff_callbacks4_t *callbacks,
+             void *callback_baton,
+             svn_depth_t depth,
+             svn_boolean_t ignore_ancestry,
+             svn_boolean_t show_copies_as_adds,
+             svn_boolean_t use_git_diff_format,
+             const apr_array_header_t *changelist_filter,
+             svn_cancel_func_t cancel_func,
+             void *cancel_baton,
+             apr_pool_t *scratch_pool)
+{
+  const svn_diff_tree_processor_t *processor;
+
+  SVN_ERR(svn_wc__wrap_diff_callbacks(&processor,
+                                      callbacks, callback_baton, TRUE,
+                                      scratch_pool, scratch_pool));
+
+  if (use_git_diff_format)
+    show_copies_as_adds = TRUE;
+  if (show_copies_as_adds)
+    ignore_ancestry = FALSE;
+
+  if (! show_copies_as_adds && !use_git_diff_format)
+    processor = svn_diff__tree_processor_copy_as_changed_create(processor,
+                                                                scratch_pool);
+
+  return svn_error_trace(svn_wc__diff7(NULL,
+                                       wc_ctx, local_abspath,
+                                       depth,
+                                       ignore_ancestry,
+                                       changelist_filter,
+                                       processor,
+                                       cancel_func, cancel_baton,
+                                       scratch_pool, scratch_pool));
+}
+



Mime
View raw message