subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1428426 - in /subversion/trunk/subversion: libsvn_client/diff.c tests/cmdline/diff_tests.py
Date Thu, 03 Jan 2013 16:05:38 GMT
Author: rhuijben
Date: Thu Jan  3 16:05:38 2013
New Revision: 1428426

URL: http://svn.apache.org/viewvc?rev=1428426&view=rev
Log:
Enable the arbritrary file diff support for 'svn diff --summarize'.

* subversion/libsvn_client/diff.c
  (do_diff_summarize): Handle working-working diffs using the new diff_local
    handling.

* subversion/tests/cmdline/diff_tests.py
  (diff_arbitrary_same): New test.
  (test_list): Add test.

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=1428426&r1=1428425&r2=1428426&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Thu Jan  3 16:05:38 2013
@@ -2710,11 +2710,36 @@ do_diff_summarize(svn_client_diff_summar
                                       peg_revision, depth, ignore_ancestry,
                                       pool);
   else if (! is_repos1 && ! is_repos2)
-    return diff_summarize_wc_wc(summarize_func, summarize_baton,
-                                path_or_url1, revision1,
-                                path_or_url2, revision2,
-                                depth, ignore_ancestry,
-                                changelists, ctx, pool);
+    {
+      if (revision1->kind == svn_opt_revision_working
+          && revision2->kind == svn_opt_revision_working)
+        {
+          const char *abspath1;
+          const char *abspath2;
+          svn_wc_diff_callbacks4_t *callbacks;
+          void *callback_baton;
+
+          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__get_diff_summarize_callbacks(
+                  &callbacks, &callback_baton, path_or_url1,
+                  summarize_func, summarize_baton, pool));
+
+          SVN_ERR(svn_client__arbitrary_nodes_diff(abspath1, abspath2,
+                                                   callbacks,
+                                                   callback_baton,
+                                                   ctx, pool));
+        }
+      else
+        SVN_ERR(diff_summarize_wc_wc(summarize_func, summarize_baton,
+                                     path_or_url1, revision1,
+                                     path_or_url2, revision2,
+                                     depth, ignore_ancestry,
+                                     changelists, ctx, pool));
+
+      return SVN_NO_ERROR;
+    }
   else
    return unsupported_diff_error(
             svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=1428426&r1=1428425&r2=1428426&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Thu Jan  3 16:05:38 2013
@@ -4123,6 +4123,28 @@ def diff_properties_no_newline(sbox):
 
   os.chdir(old_cwd)
 
+def diff_arbitrary_same(sbox):
+  "diff arbitrary files and dirs but same"
+
+  sbox.build(read_only = True)
+
+  sbox.simple_propset('k', 'v', 'A', 'A/mu', 'A/D/G/pi')
+
+  svntest.main.file_write(sbox.ospath('A/mu'), "new mu")
+
+  sbox.simple_copy('A', 'A2')
+
+  svntest.actions.run_and_verify_svn(None, [], [],
+                                     'diff',
+                                     '--old', sbox.ospath('A'),
+                                     '--new', sbox.ospath('A2'))
+
+  svntest.actions.run_and_verify_svn(None, [], [],
+                                     'diff', '--summarize',
+                                     '--old', sbox.ospath('A'),
+                                     '--new', sbox.ospath('A2'))
+
+
 ########################################################################
 #Run the tests
 
@@ -4195,6 +4217,7 @@ test_list = [ None,
               diff_arbitrary_files_and_dirs,
               diff_properties_only,
               diff_properties_no_newline,
+              diff_arbitrary_same,
               ]
 
 if __name__ == '__main__':



Mime
View raw message