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/15 00:19:03 UTC

svn commit: r1446390 - in /subversion/trunk/subversion: libsvn_wc/diff_editor.c tests/cmdline/diff_tests.py tests/cmdline/merge_tests.py

Author: rhuijben
Date: Thu Feb 14 23:19:02 2013
New Revision: 1446390

URL: http://svn.apache.org/r1446390
Log:
Restore the behavior of reporting the src-right version of added nodes to
what we did with the old diff engine: always 0 for adds/copies.

* subversion/libsvn_wc/diff_editor.c
  (svn_wc__diff_local_only_file): Don't overwrite the BASE revision with the
    original revision in diff headers.
  (wrap_file_added): Always pass 0 as right revision.

* subversion/tests/cmdline/diff_tests.py
  (diff_git_format_wc_wc): Restore an asumption changed in r1446339.
  (diff_dir_replaced_by_file): New test, verifying the current behavior.
  (test_list): Add test.

* subversion/tests/cmdline/merge_tests.py
  (merge_in_new_file_and_diff): Expect directory changes after the changes to
    files in the directory as that is the only valid way to drive the new (and
    old) diff. The revision numbers are fixed by the rest of this patch.

Modified:
    subversion/trunk/subversion/libsvn_wc/diff_editor.c
    subversion/trunk/subversion/tests/cmdline/diff_tests.py
    subversion/trunk/subversion/tests/cmdline/merge_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_editor.c?rev=1446390&r1=1446389&r2=1446390&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_editor.c Thu Feb 14 23:19:02 2013
@@ -981,7 +981,6 @@ svn_wc__diff_local_only_file(svn_wc__db_
     {
       copyfrom_src = svn_diff__source_create(original_revision, scratch_pool);
       copyfrom_src->repos_relpath = original_repos_relpath;
-      revision = original_revision;
     }
 
   if (props_mod || !SVN_IS_VALID_REVNUM(revision))
@@ -2614,9 +2613,7 @@ wrap_file_added(const char *relpath,
                                         ? copyfrom_file
                                         : wb->empty_file,
                                     right_file,
-                                    copyfrom_source
-                                       ? copyfrom_source->revision
-                                       : 0 /* For legacy reasons */,
+                                    0,
                                     right_source->revision,
                                     copyfrom_props
                                      ? svn_prop_get_value(copyfrom_props,

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=1446390&r1=1446389&r2=1446390&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Thu Feb 14 23:19:02 2013
@@ -3387,7 +3387,7 @@ def diff_git_format_wc_wc(sbox):
 
   expected_output = make_git_diff_header(
                          alpha_copied_path, "A/B/E/alpha_copied",
-                         "revision 1", "working copy",
+                         "revision 0", "working copy",
                          copyfrom_path="A/B/E/alpha", 
                          copyfrom_rev='1', cp=True,
                          text_changes=True) + [
@@ -4387,6 +4387,39 @@ def local_tree_replace(sbox):
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                      'patch', patch, wc_dir)
 
+def diff_dir_replaced_by_file(sbox):
+  "diff a directory replaced by a file"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  sbox.simple_rm('A/B/E')
+  sbox.simple_add_text('text', 'A/B/E')
+
+  expected_output = [
+    'Index: %s\n' % sbox.path('A/B/E/alpha'),
+    '===================================================================\n',
+    '--- %s\t(revision 1)\n' % sbox.path('A/B/E/alpha'),
+    '+++ %s\t(working copy)\n' % sbox.path('A/B/E/alpha'),
+    '@@ -1 +0,0 @@\n',
+    '-This is the file \'alpha\'.\n',
+    'Index: %s\n' % sbox.path('A/B/E/beta'),
+    '===================================================================\n',
+    '--- %s\t(revision 1)\n' % sbox.path('A/B/E/beta'),
+    '+++ %s\t(working copy)\n' % sbox.path('A/B/E/beta'),
+    '@@ -1 +0,0 @@\n',
+    '-This is the file \'beta\'.\n',
+    'Index: %s\n' % sbox.path('A/B/E'),
+    '===================================================================\n',
+    '--- %s\t(revision 0)\n' % sbox.path('A/B/E'),
+    '+++ %s\t(working copy)\n' % sbox.path('A/B/E'),
+    '@@ -0,0 +1 @@\n',
+    '+text\n',
+    '\ No newline at end of file\n',
+  ]
+
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+                                     'diff', wc_dir)
 
 ########################################################################
 #Run the tests
@@ -4464,6 +4497,7 @@ test_list = [ None,
               diff_git_format_wc_wc_dir_mv,
               simple_ancestry,
               local_tree_replace,
+              diff_dir_replaced_by_file,
               ]
 
 if __name__ == '__main__':

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1446390&r1=1446389&r2=1446390&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Thu Feb 14 23:19:02 2013
@@ -1390,6 +1390,13 @@ def merge_in_new_file_and_diff(sbox):
 
   # Finally, run diff.
   expected_output = [
+    "Index: " + url_branch_path + "/newfile\n",
+    "===================================================================\n",
+    "--- "+ url_branch_path + "/newfile	(revision 0)\n",
+    "+++ "+ url_branch_path + "/newfile	(working copy)\n",
+    "@@ -0,0 +1 @@\n",
+    "+newfile\n",
+
     "Index: " + url_branch_path + "\n",
     "===================================================================\n",
     "--- "+ url_branch_path + "\t(revision 2)\n",
@@ -1399,12 +1406,7 @@ def merge_in_new_file_and_diff(sbox):
     "___________________________________________________________________\n",
     "Added: " + SVN_PROP_MERGEINFO + "\n",
     "   Merged /A/B/E:r2-3\n",
-    "Index: " + url_branch_path + "/newfile\n",
-    "===================================================================\n",
-    "--- "+ url_branch_path + "/newfile	(revision 0)\n",
-    "+++ "+ url_branch_path + "/newfile	(working copy)\n",
-    "@@ -0,0 +1 @@\n",
-    "+newfile\n"]
+  ]
   svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff',
                                      '--show-copies-as-adds', branch_path)