[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] ra_svn: Advertise acceptance of svndiff2 deltas

From: Daniel Shahaf <danielsh_at_apache.org>
Date: Tue, 25 Jul 2017 19:30:43 +0000

[[[
ra_svn: Advertise acceptance of svndiff2 deltas.

Add an "accepts-svndiff2" wire capability, and have both the client and
the server advertise it. While currently neither the client nor the
server sends svndiff2 over the wire, this capability will allow
1.11 endpoints to send svndiff2 to 1.10 endpoints.

No change was needed beyond the capability addition; the incumbent code
would already accept svndiff2 if a (non-compliant) remote endpoint used it.
]]]

[[[
Index: subversion/include/svn_ra_svn.h
===================================================================
--- subversion/include/svn_ra_svn.h (revision 1802987)
+++ subversion/include/svn_ra_svn.h (working copy)
@@ -49,6 +49,7 @@ extern "C" {
 /** Currently-defined capabilities. */
 #define SVN_RA_SVN_CAP_EDIT_PIPELINE "edit-pipeline"
 #define SVN_RA_SVN_CAP_SVNDIFF1 "svndiff1"
+#define SVN_RA_SVN_CAP_SVNDIFF2_ACCEPTED "accepts-svndiff2"
 #define SVN_RA_SVN_CAP_ABSENT_ENTRIES "absent-entries"
 /* maps to SVN_RA_CAPABILITY_COMMIT_REVPROPS: */
 #define SVN_RA_SVN_CAP_COMMIT_REVPROPS "commit-revprops"
Index: subversion/libsvn_ra_svn/client.c
===================================================================
--- subversion/libsvn_ra_svn/client.c (revision 1802987)
+++ subversion/libsvn_ra_svn/client.c (working copy)
@@ -746,10 +746,11 @@ static svn_error_t *open_session(svn_ra_svn__sessi
    * capability list, and the URL, and subsequently there is an auth
    * request. */
   /* Client-side capabilities list: */
- SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "n(wwwwww)cc(?c)",
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "n(wwwwwww)cc(?c)",
                                   (apr_uint64_t) 2,
                                   SVN_RA_SVN_CAP_EDIT_PIPELINE,
                                   SVN_RA_SVN_CAP_SVNDIFF1,
+ SVN_RA_SVN_CAP_SVNDIFF2_ACCEPTED,
                                   SVN_RA_SVN_CAP_ABSENT_ENTRIES,
                                   SVN_RA_SVN_CAP_DEPTH,
                                   SVN_RA_SVN_CAP_MERGEINFO,
Index: subversion/libsvn_ra_svn/editorp.c
===================================================================
--- subversion/libsvn_ra_svn/editorp.c (revision 1802987)
+++ subversion/libsvn_ra_svn/editorp.c (working copy)
@@ -353,6 +353,8 @@ static svn_error_t *ra_svn_apply_textdelta(void *f
 
   /* 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,
Index: subversion/libsvn_ra_svn/protocol
===================================================================
--- subversion/libsvn_ra_svn/protocol (revision 1802987)
+++ subversion/libsvn_ra_svn/protocol (working copy)
@@ -188,6 +188,10 @@ capability and C indicates a client capability):
 [CS] svndiff1 If both the client and server support svndiff version
                        1, this will be used as the on-the-wire format for
                        svndiff instead of svndiff version 0.
+[CS] accepts-svndiff2 This capability advertises support for accepting
+ svndiff2 deltas. The sender of a delta (= the editor
+ driver) may send it in any svndiff version the receiver
+ has announced it can accept.
 [CS] absent-entries If the remote end announces support for this capability,
                        it will accept the absent-dir and absent-file editor
                        commands.
Index: subversion/svnserve/serve.c
===================================================================
--- subversion/svnserve/serve.c (revision 1802987)
+++ subversion/svnserve/serve.c (working copy)
@@ -2823,6 +2823,8 @@ static svn_error_t *file_rev_handler(void *baton,
 
       /* 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,
@@ -4122,10 +4124,11 @@ construct_server_baton(server_baton_t **baton,
    * send an empty mechlist. */
   if (params->compression_level > 0)
     SVN_ERR(svn_ra_svn__write_cmd_response(conn, scratch_pool,
- "nn()(wwwwwwwwwwww)",
+ "nn()(wwwwwwwwwwwww)",
                                            (apr_uint64_t) 2, (apr_uint64_t) 2,
                                            SVN_RA_SVN_CAP_EDIT_PIPELINE,
                                            SVN_RA_SVN_CAP_SVNDIFF1,
+ SVN_RA_SVN_CAP_SVNDIFF2_ACCEPTED,
                                            SVN_RA_SVN_CAP_ABSENT_ENTRIES,
                                            SVN_RA_SVN_CAP_COMMIT_REVPROPS,
                                            SVN_RA_SVN_CAP_DEPTH,
]]]

As noted in the log message, this patch never actually sends svndiff2
over the wire. I don't personally plan to work on that, but it'd be a
simple patch: the logic of SVNCompressionLevel would need to be ported
to svnserve's --compression-level option. (See r1801974)

Cheers,

Daniel
Received on 2017-07-25 21:30:51 CEST

This is an archived mail posted to the Subversion Dev mailing list.