You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ne...@apache.org on 2010/04/23 19:38:49 UTC
svn commit: r937442 - /subversion/trunk/subversion/libsvn_wc/diff.c
Author: neels
Date: Fri Apr 23 17:38:49 2010
New Revision: 937442
URL: http://svn.apache.org/viewvc?rev=937442&view=rev
Log:
Fix the revision number shown for wc-wc diff on replaced files.
The diff output is against the revert-base, so show the revert-base's
revision number, like with simply deleted files.
But only do that for nodes that are not copied/moved-here, because wc-wc diff
then actually just shows the changes against the copy-source, not against
revert-base.
Note that --show-copies-as-adds shows even replacing copies as adds, currently
using revnum 0 and diffing against the empty file. So that's not applicable to
this patch. We should fix diff entirely :P
* subversion/libsvn_wc/diff.c (file_diff):
Get the revision from revert-base in the cases described above.
Modified:
subversion/trunk/subversion/libsvn_wc/diff.c
Modified: subversion/trunk/subversion/libsvn_wc/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff.c?rev=937442&r1=937441&r2=937442&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff.c Fri Apr 23 17:38:49 2010
@@ -549,6 +549,7 @@ file_diff(struct dir_baton *db,
svn_boolean_t replaced;
svn_wc__db_status_t status;
svn_revnum_t revision;
+ svn_revnum_t revert_base_revnum;
svn_boolean_t base_shadowed;
svn_wc__db_status_t base_status;
const char *local_abspath;
@@ -571,7 +572,7 @@ file_diff(struct dir_baton *db,
&base_shadowed, NULL, NULL,
eb->db, local_abspath, pool, pool));
if (base_shadowed)
- SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, NULL,
+ SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, &revert_base_revnum,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
eb->db, local_abspath, pool, pool));
@@ -588,6 +589,17 @@ file_diff(struct dir_baton *db,
NULL, NULL, NULL, eb->db, local_abspath,
pool, pool));
+ /* A wc-wc diff of replaced files actually shows a diff against the
+ * revert-base, showing all previous lines as removed and adding all new
+ * lines. This does not happen for copied/moved-here files, not even with
+ * show_copies_as_adds == TRUE (in which case copy/move is really shown as
+ * an add, diffing against the empty file).
+ * So show the revert-base revision for plain replaces. */
+ if (replaced
+ && ! (status == svn_wc__db_status_copied
+ || status == svn_wc__db_status_moved_here))
+ revision = revert_base_revnum;
+
/* Prep these two paths early. */
SVN_ERR(svn_wc__text_base_path(&textbase, eb->db, local_abspath, FALSE,
pool));