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 2013/02/14 18:28:43 UTC

svn commit: r1446279 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/diff_editor.c

Author: rhuijben
Date: Thu Feb 14 17:28:42 2013
New Revision: 1446279

URL: http://svn.apache.org/r1446279
Log:
After a short irc discussion with stsp, made the repos-wc diff assume
that for 'svn diff'
--git implies --show-copies-as-adds
and
--show-copies-as-adds implies --notice-ancestry

This just removes the difference in handling copies differently than adds
and makes the implementation much easier to understand and explain. And
probably resolves many problems for users that would have been bitten
by this special handling on replacements.

* subversion/include/svn_wc.h
  (svn_wc_get_diff_editor6): Update documentation.

* subversion/libsvn_wc/diff_editor.c
  (edit_baton_t): Remove copies_as_adds boolean.
  (make_edit_baton): Implement new specification.

  (walk_local_nodes_diff,
   add_directory,
   open_directory,
   add_file,
   open_file): Remove ugly special case.

  (svn_wc__get_diff_editor): Set show_copies_as_adds for git handling.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/diff_editor.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1446279&r1=1446278&r2=1446279&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Feb 14 17:28:42 2013
@@ -6336,10 +6336,13 @@ svn_wc_canonicalize_svn_prop(const svn_s
  * @a show_copies_as_adds determines whether paths added with history will
  * appear as a diff against their copy source, or whether such paths will
  * appear as if they were newly added in their entirety.
+ * @a show_copies_as_adds implies not @a ignore_ancestry.
  *
  * If @a use_git_diff_format is TRUE, copied paths will be treated as added
  * if they weren't modified after being copied. This allows the callbacks
  * to generate appropriate --git diff headers for such files.
+ * @a use_git_diff_format implies @a show_copies_as_adds, and as such implies
+ * not @a ignore_ancestry.
  *
  * Normally, the difference from repository->working_copy is shown.
  * If @a reverse_order is TRUE, then show working_copy->repository diffs.

Modified: subversion/trunk/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_editor.c?rev=1446279&r1=1446278&r2=1446279&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_editor.c Thu Feb 14 17:28:42 2013
@@ -110,9 +110,6 @@ struct edit_baton_t 
   /* 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;
-
   /* Possibly diff repos against text-bases instead of working files. */
   svn_boolean_t diff_pristine;
 
@@ -256,7 +253,6 @@ make_edit_baton(struct edit_baton_t **ed
                 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,
                 const apr_array_header_t *changelist_filter,
@@ -281,7 +277,11 @@ make_edit_baton(struct edit_baton_t **ed
   if (reverse_order)
     processor = svn_diff__tree_processor_reverse_create(processor, NULL, pool);
 
-  if (! show_copies_as_adds && !use_git_diff_format)
+  /* --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);
 
@@ -292,7 +292,6 @@ make_edit_baton(struct edit_baton_t **ed
   eb->processor = processor;
   eb->depth = depth;
   eb->ignore_ancestry = ignore_ancestry;
-  eb->show_copies_as_adds = show_copies_as_adds;
   eb->local_before_remote = reverse_order;
   eb->diff_pristine = use_text_base;
   eb->changelist_hash = changelist_hash;
@@ -756,9 +755,7 @@ walk_local_nodes_diff(struct edit_baton_
 
               if (NOT_PRESENT(base_status))
                 local_only = TRUE;
-              else if (base_kind != info->kind 
-                       || !eb->ignore_ancestry
-                       || (info->copied && eb->show_copies_as_adds))
+              else if (base_kind != info->kind || !eb->ignore_ancestry)
                 {
                   repos_only = TRUE;
                   local_only = TRUE;
@@ -1531,15 +1528,6 @@ add_directory(const char *path,
       if (!db->repos_only && info->status != svn_wc__db_status_added)
         db->repos_only = TRUE;
 
-      /* ### Yuck,... but we love legacy compatibility */
-      if (!db->repos_only
-          && eb->ignore_ancestry
-          && eb->show_copies_as_adds
-          && info->copied)
-        {
-          db->repos_only = TRUE;
-        }
-
       if (!db->repos_only)
         {
           db->right_src = svn_diff__source_create(SVN_INVALID_REVNUM, db->pool);
@@ -1619,16 +1607,6 @@ open_directory(const char *path,
               SVN_ERR_MALFUNCTION();
         }
 
-      /* ### Yuck,... but we love legacy compatibility */
-      if (!db->repos_only
-          && eb->ignore_ancestry
-          && eb->show_copies_as_adds
-          && info->copied)
-        {
-          db->repos_only = TRUE;
-          db->ignoring_ancestry = FALSE;
-        }
-
       if (!db->repos_only)
         {
           db->right_src = svn_diff__source_create(SVN_INVALID_REVNUM, db->pool);
@@ -1829,15 +1807,6 @@ add_file(const char *path,
       if (!fb->repos_only && info->status != svn_wc__db_status_added)
         fb->repos_only = TRUE;
 
-      /* ### Yuck,... but we love legacy compatibility */
-      if (!fb->repos_only
-          && eb->ignore_ancestry
-          && eb->show_copies_as_adds
-          && info->copied)
-        {
-          fb->repos_only = TRUE;
-        }
-
       if (!fb->repos_only)
         {
           /* Add this path to the parent directory's list of elements that
@@ -1913,16 +1882,6 @@ open_file(const char *path,
               SVN_ERR_MALFUNCTION();
         }
 
-      /* ### Yuck,... but we love legacy compatibility */
-      if (!fb->repos_only
-          && eb->ignore_ancestry
-          && eb->show_copies_as_adds
-          && info->copied)
-        {
-          fb->repos_only = TRUE;
-          fb->ignoring_ancestry = FALSE;
-        }
-
       if (!fb->repos_only)
         {
           /* Add this path to the parent directory's list of elements that
@@ -2295,12 +2254,15 @@ 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,
-                          use_git_diff_format,
                           use_text_base, reverse_order, changelist_filter,
                           cancel_func, cancel_baton,
                           result_pool));