Author: kotkov
Date: Fri Oct 30 16:58:45 2015
New Revision: 1711507

URL: http://svn.apache.org/viewvc?rev=1711507&view=rev
Log:
Following up on r1709388, undo the behavior change of the calling sites of
svn_fs_contents_different() and svn_fs_props_different() that is not required
nor justified in the context of fixing issue #4598, "No-op changes no longer
dumped by 'svnadmin dump' in 1.9".

This commit also restores the hack required for blame -g for old clients
(see r1686478, r1686888) in rev_hunt.c:send_path_revision().  Perhaps there
is a better replacement for it, since we now have the original behavior of
svn_fs_contents_changed() available, but this can be handled separately.

* subversion/libsvn_fs_fs/dag.c
  (svn_fs_fs__dag_things_different): Tweak the related comment within this
   function.

* subversion/libsvn_fs_fs/tree.c
  (merge): Compare the property lists based on their contents.

* subversion/libsvn_repos/delta.c
  (delta_proplists): Use svn_fs_props_different() when comparing property
   lists.
  (svn_repos__compare_files): Call svn_fs_contents_different() instead of
   reimplementing the content comparison in this function.
  (delta_files): Call svn_fs_contents_different(), as we were doing prior
   to r1709388.

* subversion/libsvn_repos/reporter.c
  (delta_proplists): Use svn_fs_props_different() when comparing property
   lists.

* subversion/libsvn_repos/rev_hunt.c
  (send_path_revision): Call svn_fs_contents_different().  Restore the
   blame -g compatibility hack.

* subversion/include/svn_ra.h
  (svn_ra_get_file_revs2): Restore the original @note in the docstring.

* subversion/include/svn_repos.h
  (svn_repos_get_file_revs2): Restore the original @note in the docstring.

Modified:
    subversion/trunk/subversion/include/svn_ra.h
    subversion/trunk/subversion/include/svn_repos.h
    subversion/trunk/subversion/libsvn_fs_fs/dag.c
    subversion/trunk/subversion/libsvn_fs_fs/tree.c
    subversion/trunk/subversion/libsvn_repos/delta.c
    subversion/trunk/subversion/libsvn_repos/reporter.c
    subversion/trunk/subversion/libsvn_repos/rev_hunt.c

Modified: subversion/trunk/subversion/include/svn_ra.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=1711507&r1=1711506&r2=1711507&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Fri Oct 30 16:58:45 2015
@@ -1797,10 +1797,11 @@ svn_ra_get_location_segments(svn_ra_sess
  * to support reversion of the revision range for @a include_merged_revision
  * @c FALSE reporting by switching  @a end with @a start.
  *
- * @note In Subversion 1.9.0-1.9.2, the delta handler / baton return
- * arguments passed to @a handler were set to #NULL in case of an empty
- * text delta.  All other versions may request delta handlers from
- * @a handler even for empty text deltas.
+ * @note Prior to Subversion 1.9, this function may request delta handlers
+ * from @a handler even for empty text deltas.  Starting with 1.9, the
+ * delta handler / baton return arguments passed to @a handler will be
+ * #NULL unless there is an actual difference in the file contents between
+ * the current and the previous call.
  *
  * @since New in 1.5.
  */

Modified: subversion/trunk/subversion/include/svn_repos.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1711507&r1=1711506&r2=1711507&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_repos.h (original)
+++ subversion/trunk/subversion/include/svn_repos.h Fri Oct 30 16:58:45 2015
@@ -2093,10 +2093,11 @@ svn_repos_fs_get_mergeinfo(svn_mergeinfo
  * the revision range for @a include_merged_revision @c FALSE reporting by
  * switching @a start with @a end.
  *
- * @note In Subversion 1.9.0-1.9.2, the delta handler / baton return
- * arguments passed to @a handler were set to #NULL in case of an empty
- * text delta.  All other versions may request delta handlers from
- * @a handler even for empty text deltas.
+ * @note Prior to Subversion 1.9, this function may request delta handlers
+ * from @a handler even for empty text deltas.  Starting with 1.9, the
+ * delta handler / baton return arguments passed to @a handler will be
+ * #NULL unless there is an actual difference in the file contents between
+ * the current and the previous call.
  *
  * @since New in 1.5.
  */

Modified: subversion/trunk/subversion/libsvn_fs_fs/dag.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/dag.c?rev=1711507&r1=1711506&r2=1711507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/dag.c Fri Oct 30 16:58:45 2015
@@ -1319,9 +1319,6 @@ svn_fs_fs__dag_things_different(svn_bool
     {
       /* In strict mode, compare text and property representations in the
          svn_fs_contents_different() / svn_fs_props_different() manner.
-         These functions are currently not being used in our codebase, but
-         we released them as a part of 1.9, and keep them for compatibility
-         reasons.
 
          See the "No-op changes no longer dumped by 'svnadmin dump' in 1.9"
          discussion (http://svn.haxx.se/dev/archive-2015-09/0269.shtml) and

Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1711507&r1=1711506&r2=1711507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Fri Oct 30 16:58:45 2015
@@ -1929,6 +1929,7 @@ merge(svn_stringbuf_t *conflict_p,
   */
   {
     node_revision_t *tgt_nr, *anc_nr, *src_nr;
+    svn_boolean_t same;
     apr_pool_t *scratch_pool;
 
     /* Get node revisions for our id's. */
@@ -1945,16 +1946,15 @@ merge(svn_stringbuf_t *conflict_p,
 
     /* Now compare the prop-keys of the skels.  Note that just because
        the keys are different -doesn't- mean the proplists have
-       different contents.  But merge() isn't concerned with contents;
-       it doesn't do a brute-force comparison on textual contents, so
-       it won't do that here either.  Checking to see if the propkey
-       atoms are `equal' is enough. */
-    if (! svn_fs_fs__noderev_same_rep_key(src_nr->prop_rep, anc_nr->prop_rep))
+       different contents. */
+    SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, src_nr, anc_nr, pool));
+    if (! same)
       return conflict_err(conflict_p, target_path);
 
     /* The directory entries got changed in the repository but the directory
        properties did not. */
-    if (! svn_fs_fs__noderev_same_rep_key(tgt_nr->prop_rep, anc_nr->prop_rep))
+    SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, tgt_nr, anc_nr, pool));
+    if (! same)
       {
         /* There is an incoming prop change for this directory.
            We will accept it only if the directory changes were mere updates

Modified: subversion/trunk/subversion/libsvn_repos/delta.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/delta.c?rev=1711507&r1=1711506&r2=1711507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/delta.c (original)
+++ subversion/trunk/subversion/libsvn_repos/delta.c Fri Oct 30 16:58:45 2015
@@ -530,8 +530,8 @@ delta_proplists(struct context *c,
       svn_boolean_t changed;
 
       /* Is this deltification worth our time? */
-      SVN_ERR(svn_fs_props_changed(&changed, c->target_root, target_path,
-                                   c->source_root, source_path, subpool));
+      SVN_ERR(svn_fs_props_different(&changed, c->target_root, target_path,
+                                     c->source_root, source_path, subpool));
       if (! changed)
         goto cleanup;
 
@@ -611,62 +611,8 @@ svn_repos__compare_files(svn_boolean_t *
                          const char *path2,
                          apr_pool_t *pool)
 {
-  svn_filesize_t size1, size2;
-  svn_checksum_t *checksum1, *checksum2;
-  svn_stream_t *stream1, *stream2;
-  svn_boolean_t same;
-
-  /* If the filesystem claims the things haven't changed, then they
-     haven't changed. */
-  SVN_ERR(svn_fs_contents_changed(changed_p, root1, path1,
-                                  root2, path2, pool));
-  if (!*changed_p)
-    return SVN_NO_ERROR;
-
-  /* If the SHA1 checksums match for these things, we'll claim they
-     have the same contents.  (We don't give quite as much weight to
-     MD5 checksums.)  */
-  SVN_ERR(svn_fs_file_checksum(&checksum1, svn_checksum_sha1,
-                               root1, path1, FALSE, pool));
-  SVN_ERR(svn_fs_file_checksum(&checksum2, svn_checksum_sha1,
-                               root2, path2, FALSE, pool));
-  if (checksum1 && checksum2)
-    {
-      *changed_p = !svn_checksum_match(checksum1, checksum2);
-      return SVN_NO_ERROR;
-    }
-
-  /* From this point on, our default answer is "Nothing's changed". */
-  *changed_p = FALSE;
-
-  /* Different filesizes means the contents are different. */
-  SVN_ERR(svn_fs_file_length(&size1, root1, path1, pool));
-  SVN_ERR(svn_fs_file_length(&size2, root2, path2, pool));
-  if (size1 != size2)
-    {
-      *changed_p = TRUE;
-      return SVN_NO_ERROR;
-    }
-
-  /* Different MD5 checksums means the contents are different. */
-  SVN_ERR(svn_fs_file_checksum(&checksum1, svn_checksum_md5, root1, path1,
-                               FALSE, pool));
-  SVN_ERR(svn_fs_file_checksum(&checksum2, svn_checksum_md5, root2, path2,
-                               FALSE, pool));
-  if (!svn_checksum_match(checksum1, checksum2))
-    {
-      *changed_p = TRUE;
-      return SVN_NO_ERROR;
-    }
-
-  /* And finally, different contents means the ... uh ... contents are
-     different. */
-  SVN_ERR(svn_fs_file_contents(&stream1, root1, path1, pool));
-  SVN_ERR(svn_fs_file_contents(&stream2, root2, path2, pool));
-  SVN_ERR(svn_stream_contents_same2(&same, stream1, stream2, pool));
-  *changed_p = !same;
-
-  return SVN_NO_ERROR;
+  return svn_error_trace(svn_fs_contents_different(changed_p, root1, path1,
+                                                   root2, path2, pool));
 }
 
 
@@ -693,19 +639,7 @@ delta_files(struct context *c,
 
   if (source_path)
     {
-      /* Is this delta calculation worth our time?  If we are ignoring
-         ancestry, then our editor implementor isn't concerned by the
-         theoretical differences between "has contents which have not
-         changed with respect to" and "has the same actual contents
-         as".  We'll do everything we can to avoid transmitting even
-         an empty text-delta in that case.  */
-      if (c->ignore_ancestry)
-        SVN_ERR(svn_repos__compare_files(&changed,
-                                         c->target_root, target_path,
-                                         c->source_root, source_path,
-                                         subpool));
-      else
-        SVN_ERR(svn_fs_contents_changed(&changed,
+      SVN_ERR(svn_fs_contents_different(&changed,
                                         c->target_root, target_path,
                                         c->source_root, source_path,
                                         subpool));

Modified: subversion/trunk/subversion/libsvn_repos/reporter.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/reporter.c?rev=1711507&r1=1711506&r2=1711507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/reporter.c (original)
+++ subversion/trunk/subversion/libsvn_repos/reporter.c Fri Oct 30 16:58:45 2015
@@ -578,8 +578,8 @@ delta_proplists(report_baton_t *b, svn_r
       SVN_ERR(get_source_root(b, &s_root, s_rev));
 
       /* Is this deltification worth our time? */
-      SVN_ERR(svn_fs_props_changed(&changed, b->t_root, t_path, s_root,
-                                   s_path, pool));
+      SVN_ERR(svn_fs_props_different(&changed, b->t_root, t_path, s_root,
+                                     s_path, pool));
       if (! changed)
         return SVN_NO_ERROR;
 

Modified: subversion/trunk/subversion/libsvn_repos/rev_hunt.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/rev_hunt.c?rev=1711507&r1=1711506&r2=1711507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/trunk/subversion/libsvn_repos/rev_hunt.c Fri Oct 30 16:58:45 2015
@@ -1374,17 +1374,31 @@ send_path_revision(struct path_revision
   SVN_ERR(svn_prop_diffs(&prop_diffs, props, sb->last_props,
                          sb->iterpool));
 
-  /* Check if the contents changed. */
+  /* Check if the contents *may* have changed. */
   if (! sb->last_root)
     {
       /* Special case: In the first revision, we always provide a delta. */
       contents_changed = TRUE;
     }
+  else if (sb->include_merged_revisions
+           && strcmp(sb->last_path, path_rev->path))
+    {
+      /* ### This is a HACK!!!
+       * Blame -g, in older clients anyways, relies on getting a notification
+       * whenever the path changes - even if there was no content change.
+       *
+       * TODO: A future release should take an extra parameter and depending
+       * on that either always send a text delta or only send it if there
+       * is a difference. */
+      contents_changed = TRUE;
+    }
   else
     {
-      SVN_ERR(svn_fs_contents_changed(&contents_changed, sb->last_root,
-                                      sb->last_path, root, path_rev->path,
-                                      sb->iterpool));
+      /* Did the file contents actually change?
+       * It could e.g. be a property-only change. */
+      SVN_ERR(svn_fs_contents_different(&contents_changed, sb->last_root,
+                                        sb->last_path, root, path_rev->path,
+                                        sb->iterpool));
     }
 
   /* We have all we need, give to the handler. */


Reply via email to