You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/05/14 19:58:22 UTC

svn commit: r1338314 - /subversion/trunk/subversion/libsvn_client/diff.c

Author: stsp
Date: Mon May 14 17:58:21 2012
New Revision: 1338314

URL: http://svn.apache.org/viewvc?rev=1338314&view=rev
Log:
Rewrite the client-side diff code for showing added/deleted diff targets,
fixing inconsistencies with paths shown in diff output.

For related discussion, see this #svn-dev IRC conversation at
  http://colabti.org/irclogger/irclogger_log/svn-dev?date=2012-05-03#l726
and also this thread on the dev@ list:
  Date: Mon, 19 Mar 2012 21:54:58 +0100
  From: Dmitry Pavlenko
  To: dev@
  Subject: paths in diff output (possible bug)
  Message-Id: <20...@tmatesoft.com>
  http://svn.haxx.se/dev/archive-2012-03/0385.shtml

* subversion/libsvn_client/diff.c
  (diff_prepare_repos_repos): Remove the hack of finding an existing common
    ancestor if one target does not exist. Instead, return node kinds of both
    diff targets to allow the caller to handle the handle this case instead. 
  (make_regular_props_array): New helper that transforms a prop-hash retrieved
   from the RA layer into a changed-props array expected by diff callbacks.
  (diff_repos_repos_added_or_deleted_file,
   diff_repos_repos_added_or_deleted_dir,
   diff_repos_repos_added_or_deleted_target): New functions that handle added
    and deleted diff targets during repos<->repos diffs. Files content is
    retrieved from the RA layer and diffed against the empty file via the
    diff callabacks. File and directory properties are reported as added or
    deleted to the diff callbacks.
  (diff_repos_repos, diff_summarize_repos_repos): If one of the diff targets
    does not exist, invoke the new diff_repos_repos_added_or_deleted_target()
    function instead of using the diff editor.

* subversion/tests/cmdline/log_tests.py
  (log_diff_moved): Adjust expected output and remove XFail for DAV RA layers.
    This test now passes over all RA layers.

Modified:
    subversion/trunk/subversion/libsvn_client/diff.c

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1338314&r1=1338313&r2=1338314&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Mon May 14 17:58:21 2012
@@ -2341,21 +2341,16 @@ diff_repos_repos_added_or_deleted_file(c
                                        svn_ra_session_t *ra_session,
                                        apr_pool_t *scratch_pool)
 {
-  apr_file_t *file;
   const char *file_abspath;
   svn_stream_t *content;
   apr_hash_t *prop_hash;
 
-  /* ### There is no way to flush content to disk without access to the bare
-   * ### file handle so we re-implement svn_stream_open_unique() here.
-   * ### Do we need something like svn_stream_flush()? */
-  SVN_ERR(svn_io_open_unique_file3(&file, &file_abspath, NULL,
-                                   svn_io_file_del_on_close,
-                                   scratch_pool, scratch_pool));
-  content = svn_stream_from_aprfile2(file, FALSE, scratch_pool);
+  SVN_ERR(svn_stream_open_unique(&content, &file_abspath, NULL,
+                                 svn_io_file_del_on_pool_cleanup,
+                                 scratch_pool, scratch_pool));
   SVN_ERR(svn_ra_get_file(ra_session, target, peg_revision, content, NULL,
                           &prop_hash, scratch_pool));
-  SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
+  SVN_ERR(svn_stream_close(content));
 
   if (show_deletion)
     {
@@ -2381,8 +2376,6 @@ diff_repos_repos_added_or_deleted_file(c
                                     NULL, callback_baton, scratch_pool));
     }
     
-  SVN_ERR(svn_stream_close(content));
-
   return SVN_NO_ERROR;
 }