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/10 15:06:18 UTC

svn commit: r1444547 - /subversion/trunk/subversion/libsvn_wc/diff_editor.c

Author: rhuijben
Date: Sun Feb 10 14:06:17 2013
New Revision: 1444547

URL: http://svn.apache.org/r1444547
Log:
Start producing copyfrom information for local additions in the repos-wc diff
editor

* subversion/libsvn_wc/diff_editor.c
  (make_edit_baton): Suppress the copy_as_changed filter on git format.
  (file_diff): Produce proper adds for local additions, including all
    copyfrom information.

  (wrap_file_added): Forward copyfrom information.

Modified:
    subversion/trunk/subversion/libsvn_wc/diff_editor.c

Modified: subversion/trunk/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_editor.c?rev=1444547&r1=1444546&r2=1444547&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_editor.c Sun Feb 10 14:06:17 2013
@@ -406,7 +406,7 @@ make_edit_baton(struct edit_baton **edit
   if (reverse_order)
     processor = svn_diff__tree_processor_reverse_create(processor, NULL, pool);
 
-  if (! show_copies_as_adds)
+  if (! show_copies_as_adds && !use_git_diff_format)
     processor = svn_diff__tree_processor_copy_as_changed_create(processor,
                                                                 pool);
 
@@ -689,24 +689,22 @@ file_diff(struct edit_baton *eb,
   * diff, and the file was copied, we need to report the file as added and
   * diff it against the text base, so that a "copied" git diff header, and
   * possibly a diff against the copy source, will be generated for it. */
-  if ((! replaced && status == svn_wc__db_status_added
-                  && !original_repos_relpath)
-      || (replaced && ! eb->ignore_ancestry)
-      || (original_repos_relpath
-          && (eb->show_copies_as_adds || eb->use_git_diff_format)))
+  if (status == svn_wc__db_status_added
+      && !(eb->ignore_ancestry && replaced))
     {
       void *file_baton = NULL;
       svn_boolean_t skip = FALSE;
       const char *translated = NULL;
       svn_diff_source_t *copyfrom_src = NULL;
-      svn_diff_source_t *right_src = svn_diff__source_create(revision,
-                                                             scratch_pool);
+      svn_diff_source_t *right_src = svn_diff__source_create(
+                                                    SVN_INVALID_REVNUM,
+                                                    scratch_pool);
 
-      /* ### Needs reason */
-      if (! eb->show_copies_as_adds && eb->use_git_diff_format
-          && status != svn_wc__db_status_added)
+      if (original_repos_relpath)
         {
-          copyfrom_src = svn_diff__source_create(0, scratch_pool);
+          copyfrom_src = svn_diff__source_create(original_revision,
+                                                 scratch_pool);
+          copyfrom_src->repos_relpath = original_repos_relpath;
         }
 
       SVN_ERR(eb->processor->file_opened(&file_baton, &skip,
@@ -2459,7 +2457,12 @@ wrap_file_added(const char *relpath,
                                      ? svn_prop_get_value(right_props,
                                                           SVN_PROP_MIME_TYPE)
                                      : NULL,
-                                    NULL, SVN_INVALID_REVNUM,
+                                    copyfrom_source
+                                            ? copyfrom_source->repos_relpath
+                                            : NULL,
+                                    copyfrom_source
+                                            ? copyfrom_source->revision
+                                            : SVN_INVALID_REVNUM,
                                     prop_changes, copyfrom_props,
                                     wb->callback_baton,
                                     scratch_pool));