subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1569320 - in /subversion/trunk/subversion: libsvn_client/diff.c tests/cmdline/diff_tests.py
Date Tue, 18 Feb 2014 13:46:27 GMT
Author: rhuijben
Date: Tue Feb 18 13:46:26 2014
New Revision: 1569320

URL: http://svn.apache.org/r1569320
Log:
Diff consistency fix: Report the properties on deleted files, like how
we report the deleted file content. Without this we don't create clean
'svn patch' files.

This doesn't fix the same problem for directories as the diff output still
uses the old diff callbacks api which doesn't carry the necessary information.

* subversion/libsvn_client/diff.c
  (diff_file_deleted): Calculate property changes.

* subversion/tests/cmdline/diff_tests.py
  (diff_repo_repo_added_file_mime_type): Make test actually verify output.
    Resolve comment about missing information.

Modified:
    subversion/trunk/subversion/libsvn_client/diff.c
    subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1569320&r1=1569319&r2=1569320&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Tue Feb 18 13:46:26 2014
@@ -1118,6 +1118,7 @@ diff_file_deleted(svn_wc_notify_state_t 
   else
     {
       svn_boolean_t wrote_header = FALSE;
+
       if (tmpfile1)
         SVN_ERR(diff_content_changed(&wrote_header, diff_relpath,
                                      tmpfile1, tmpfile2,
@@ -1129,10 +1130,21 @@ diff_file_deleted(svn_wc_notify_state_t 
                                      diff_cmd_baton,
                                      scratch_pool));
 
-      /* Should we also report the properties as deleted? */
-    }
+      if (original_props && apr_hash_count(original_props))
+        {
+          apr_array_header_t *prop_changes;
 
-  /* We don't list all the deleted properties. */
+          SVN_ERR(svn_prop_diffs(&prop_changes, apr_hash_make(scratch_pool),
+                                 original_props, scratch_pool));
+
+          SVN_ERR(diff_props_changed(diff_relpath,
+                                     diff_cmd_baton->revnum1,
+                                     diff_cmd_baton->revnum2,
+                                     wrote_header, prop_changes,
+                                     original_props, ! wrote_header,
+                                     diff_cmd_baton, scratch_pool));
+        }
+    }
 
   return SVN_NO_ERROR;
 }
@@ -1163,7 +1175,6 @@ diff_dir_deleted(svn_wc_notify_state_t *
                  void *diff_baton,
                  apr_pool_t *scratch_pool)
 {
-  /* Do nothing. */
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=1569320&r1=1569319&r2=1569320&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Tue Feb 18 13:46:26 2014
@@ -4801,11 +4801,18 @@ def diff_repo_repo_added_file_mime_type(
                                        '-r1:2', newfile)
 
     # reverse the diff to diff across a deletion
-    # Note no property delete is printed when whole file is deleted
     expected_output = make_diff_header(newfile, 'revision 2', 'revision 1') + \
-                      [ '@@ -1, +0,0 @@\n',
-                        "-This is the file 'newfile'.\n" ]
-    svntest.actions.run_and_verify_svn(None, None, [], 'diff',
+                      [ '@@ -1 +0,0 @@\n',
+                        "-This is the file 'newfile'.\n",
+                        '\n',
+                        'Property changes on: %s\n' % sbox.path('newfile'),
+                        '__________________________________________________' +
+                              '_________________\n',
+                        'Deleted: svn:mime-type\n',
+                        '## -1 +0,0 ##\n',
+                        '-text/plain\n',
+                        '\ No newline at end of property\n']
+    svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff',
                                        '-r2:1', newfile)
 
 ########################################################################



Mime
View raw message