subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1816135 - in /subversion/trunk/subversion: include/private/svn_ra_svn_private.h libsvn_ra_svn/editorp.c libsvn_ra_svn/marshal.c svnserve/serve.c
Date Thu, 23 Nov 2017 11:12:21 GMT
Author: stefan2
Date: Thu Nov 23 11:12:21 2017
New Revision: 1816135

URL: http://svn.apache.org/viewvc?rev=1816135&view=rev
Log:
In ra_svn, use SVNDIFF2 if supported by both sides of the connection and
compression has not been disabled.

We use this opportunity to factor out the code that decides what svndiff
version to use.

* subversion/include/private/svn_ra_svn_private.h
  (svn_ra_svn__svndiff_version): Declare new utility function.

* subversion/libsvn_ra_svn/marshal.c
  (svn_ra_svn__svndiff_version): Implement, taking most of the logic from
                                 the following two callers.

* subversion/libsvn_ra_svn/editorp.c
  (ra_svn_apply_textdelta): Use the new utility to pick an appropriate
                            svndelta level.

* subversion/svnserve/serve.c
  (file_rev_handler): Same.

Modified:
    subversion/trunk/subversion/include/private/svn_ra_svn_private.h
    subversion/trunk/subversion/libsvn_ra_svn/editorp.c
    subversion/trunk/subversion/libsvn_ra_svn/marshal.c
    subversion/trunk/subversion/svnserve/serve.c

Modified: subversion/trunk/subversion/include/private/svn_ra_svn_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_ra_svn_private.h?rev=1816135&r1=1816134&r2=1816135&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_ra_svn_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_ra_svn_private.h Thu Nov 23 11:12:21 2017
@@ -127,6 +127,11 @@ svn_error_t *
 svn_ra_svn__set_capabilities(svn_ra_svn_conn_t *conn,
                              const svn_ra_svn__list_t *list);
 
+/** Returns the preferred svndiff version to be used with connection @a conn.
+ */
+int
+svn_ra_svn__svndiff_version(svn_ra_svn_conn_t *conn);
+
 
 /**
  * Set the shim callbacks to be used by @a conn to @a shim_callbacks.

Modified: subversion/trunk/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/editorp.c?rev=1816135&r1=1816134&r2=1816135&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/editorp.c Thu Nov 23 11:12:21 2017
@@ -351,17 +351,9 @@ static svn_error_t *ra_svn_apply_textdel
   svn_stream_set_write(diff_stream, ra_svn_svndiff_handler);
   svn_stream_set_close(diff_stream, ra_svn_svndiff_close_handler);
 
-  /* If the connection does not support SVNDIFF1 or if we don't want to use
-   * compression, use the non-compressing "version 0" implementation */
- /* ### TODO: Check SVN_RA_SVN_CAP_SVNDIFF2_ACCEPTED and decide between
-  * ###       svndiff1[at compression_level] and svndiff2 */
-  if (   svn_ra_svn_compression_level(b->conn) > 0
-      && svn_ra_svn_has_capability(b->conn, SVN_RA_SVN_CAP_SVNDIFF1))
-    svn_txdelta_to_svndiff3(wh, wh_baton, diff_stream, 1,
-                            b->conn->compression_level, pool);
-  else
-    svn_txdelta_to_svndiff3(wh, wh_baton, diff_stream, 0,
-                            b->conn->compression_level, pool);
+  svn_txdelta_to_svndiff3(wh, wh_baton, diff_stream,
+                          svn_ra_svn__svndiff_version(b->conn),
+                          b->conn->compression_level, pool);
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1816135&r1=1816134&r2=1816135&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Thu Nov 23 11:12:21 2017
@@ -265,6 +265,24 @@ svn_ra_svn__set_capabilities(svn_ra_svn_
   return SVN_NO_ERROR;
 }
 
+int
+svn_ra_svn__svndiff_version(svn_ra_svn_conn_t *conn)
+{
+  /* If we don't want to use compression, use the non-compressing
+   * "version 0" implementation. */
+  if (svn_ra_svn_compression_level(conn) <= 0)
+    return 0;
+
+  /* Prefer SVNDIFF2 over SVNDIFF1. */
+  if (svn_ra_svn_has_capability(conn, SVN_RA_SVN_CAP_SVNDIFF2_ACCEPTED))
+    return 2;
+  if (svn_ra_svn_has_capability(conn, SVN_RA_SVN_CAP_SVNDIFF1))
+    return 1;
+
+  /* The connection does not support SVNDIFF1/2; default to "version 0". */
+  return 0;
+}
+
 apr_pool_t *
 svn_ra_svn__get_pool(svn_ra_svn_conn_t *conn)
 {

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1816135&r1=1816134&r2=1816135&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Thu Nov 23 11:12:21 2017
@@ -2821,17 +2821,9 @@ static svn_error_t *file_rev_handler(voi
       svn_stream_set_write(stream, svndiff_handler);
       svn_stream_set_close(stream, svndiff_close_handler);
 
-      /* If the connection does not support SVNDIFF1 or if we don't want to use
-       * compression, use the non-compressing "version 0" implementation */
-      /* ### TODO: Check SVN_RA_SVN_CAP_SVNDIFF2_ACCEPTED and decide between
-       * ###       svndiff1[at compression_level] and svndiff2 */
-      if (   svn_ra_svn_compression_level(frb->conn) > 0
-          && svn_ra_svn_has_capability(frb->conn, SVN_RA_SVN_CAP_SVNDIFF1))
-        svn_txdelta_to_svndiff3(d_handler, d_baton, stream, 1,
-                                svn_ra_svn_compression_level(frb->conn), pool);
-      else
-        svn_txdelta_to_svndiff3(d_handler, d_baton, stream, 0,
-                                svn_ra_svn_compression_level(frb->conn), pool);
+      svn_txdelta_to_svndiff3(d_handler, d_baton, stream,
+                              svn_ra_svn__svndiff_version(frb->conn),
+                              svn_ra_svn_compression_level(frb->conn), pool);
     }
   else
     SVN_ERR(svn_ra_svn__write_cstring(frb->conn, pool, ""));



Mime
View raw message