You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/10/01 19:48:17 UTC

svn commit: r1392474 - in /subversion/trunk/subversion: include/svn_ra_svn.h libsvn_ra_svn/client.c svnserve/serve.c tests/cmdline/svnlook_tests.py

Author: cmpilato
Date: Mon Oct  1 17:48:17 2012
New Revision: 1392474

URL: http://svn.apache.org/viewvc?rev=1392474&view=rev
Log:
For issue #4124 ("Give servers sufficient means to disallow commits
from clients based on version numbers"): Add svnserve/ra_svn support
for communicating ephemeral transaction properties in general and,
specifically, the client compat version string.

* subversion/include/svn_ra_svn.h
  (SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS): New.

* subversion/svnserve/serve.c
  (serve): Advertise support for ephemeral txnprops.

* subversion/libsvn_ra_svn/client.c
  (ra_svn_has_capability): Support queries for ephemeral txnprop support.
  (ra_svn_commit): When ephemeral txnprop support is available, pass
    along the client compat version property during commits.

* subversion/tests/cmdline/svnlook_tests.py
  (test_txn_flag): Now expect the 'txn-client-compat-version' txn prop
    for ra_svn, too.

Modified:
    subversion/trunk/subversion/include/svn_ra_svn.h
    subversion/trunk/subversion/libsvn_ra_svn/client.c
    subversion/trunk/subversion/svnserve/serve.c
    subversion/trunk/subversion/tests/cmdline/svnlook_tests.py

Modified: subversion/trunk/subversion/include/svn_ra_svn.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra_svn.h?rev=1392474&r1=1392473&r2=1392474&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_ra_svn.h (original)
+++ subversion/trunk/subversion/include/svn_ra_svn.h Mon Oct  1 17:48:17 2012
@@ -62,6 +62,8 @@ extern "C" {
 #define SVN_RA_SVN_CAP_PARTIAL_REPLAY "partial-replay"
 /* maps to SVN_RA_CAPABILITY_ATOMIC_REVPROPS */
 #define SVN_RA_SVN_CAP_ATOMIC_REVPROPS "atomic-revprops"
+/* maps to SVN_RA_CAPABILITY_EPHEMERAL_TXNPROPS */
+#define SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS "ephemeral-txnprops"
 
 /** ra_svn passes @c svn_dirent_t fields over the wire as a list of
  * words, these are the values used to represent each field.

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1392474&r1=1392473&r2=1392474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Mon Oct  1 17:48:17 2012
@@ -982,6 +982,17 @@ static svn_error_t *ra_svn_commit(svn_ra
                             _("Server doesn't support setting arbitrary "
                               "revision properties during commit"));
 
+  /* If the server supports ephemeral txnprops, add the one that
+     reports the client's version level string. */
+  if (svn_ra_svn_has_capability(conn, SVN_RA_SVN_CAP_COMMIT_REVPROPS) &&
+      svn_ra_svn_has_capability(conn, SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS))
+    {
+      apr_hash_set(revprop_table,
+                   apr_pstrdup(pool, SVN_PROP_TXN_CLIENT_COMPAT_VERSION),
+                   APR_HASH_KEY_STRING,
+                   svn_string_create(SVN_VER_NUMBER, pool));
+    }
+
   /* Tell the server we're starting the commit.
      Send log message here for backwards compatibility with servers
      before 1.5. */
@@ -2502,6 +2513,9 @@ static svn_error_t *ra_svn_has_capabilit
   else if (strcmp(capability, SVN_RA_CAPABILITY_ATOMIC_REVPROPS) == 0)
     *has = svn_ra_svn_has_capability(sess->conn,
                                      SVN_RA_SVN_CAP_ATOMIC_REVPROPS);
+  else if (strcmp(capability, SVN_RA_CAPABILITY_EPHEMERAL_TXNPROPS) == 0)
+    *has = svn_ra_svn_has_capability(sess->conn,
+                                     SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS);
   else  /* Don't know any other capabilities, so error. */
     {
       return svn_error_createf

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1392474&r1=1392473&r2=1392474&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Mon Oct  1 17:48:17 2012
@@ -3239,7 +3239,7 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
   /* Send greeting.  We don't support version 1 any more, so we can
    * send an empty mechlist. */
   if (params->compression_level > 0)
-    SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwwww)",
+    SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwwwww)",
                                           (apr_uint64_t) 2, (apr_uint64_t) 2,
                                           SVN_RA_SVN_CAP_EDIT_PIPELINE,
                                           SVN_RA_SVN_CAP_SVNDIFF1,
@@ -3248,9 +3248,10 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
                                           SVN_RA_SVN_CAP_DEPTH,
                                           SVN_RA_SVN_CAP_LOG_REVPROPS,
                                           SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
-                                          SVN_RA_SVN_CAP_PARTIAL_REPLAY));
+                                          SVN_RA_SVN_CAP_PARTIAL_REPLAY,
+                                          SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS));
   else
-    SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwww)",
+    SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwwwww)",
                                           (apr_uint64_t) 2, (apr_uint64_t) 2,
                                           SVN_RA_SVN_CAP_EDIT_PIPELINE,
                                           SVN_RA_SVN_CAP_ABSENT_ENTRIES,
@@ -3258,7 +3259,8 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
                                           SVN_RA_SVN_CAP_DEPTH,
                                           SVN_RA_SVN_CAP_LOG_REVPROPS,
                                           SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
-                                          SVN_RA_SVN_CAP_PARTIAL_REPLAY));
+                                          SVN_RA_SVN_CAP_PARTIAL_REPLAY,
+                                          SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS));
 
   /* Read client response, which we assume to be in version 2 format:
    * version, capability list, and client URL; then we do an auth

Modified: subversion/trunk/subversion/tests/cmdline/svnlook_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnlook_tests.py?rev=1392474&r1=1392473&r2=1392474&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnlook_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnlook_tests.py Mon Oct  1 17:48:17 2012
@@ -701,11 +701,8 @@ fp.close()"""
                     '  svn:check-locks\n', # internal prop, not really expected
                     '  bogus_rev_prop\n',
                     '  svn:date\n',
+                    '  svn:txn-client-compat-version\n',                    
                     ]
-  # ra_dav and ra_local add the client-compat-version ephemeral property.
-  # FIXME: ra_svn will soon, too.  cmpilato just hasn't gotten there yet.
-  if svntest.main.is_ra_type_dav() or svntest.main.is_ra_type_file():
-    expected_data.append('  svn:txn-client-compat-version\n')
   # ra_dav adds the user-agent ephemeral property
   if svntest.main.is_ra_type_dav():
     expected_data.append('  svn:txn-user-agent\n')