You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/12/26 14:48:47 UTC

svn commit: r1553484 - in /subversion/trunk/subversion: libsvn_ra_serf/commit.c tests/cmdline/prop_tests.py

Author: rhuijben
Date: Thu Dec 26 13:48:47 2013
New Revision: 1553484

URL: http://svn.apache.org/r1553484
Log:
Following up on recent server error processing improvements in libsvn_ra_serf
remove more client side error message generation. The server generated error
just tells us if the administrator should install a hook.

* subversion/libsvn_ra_serf/commit.c
  (maybe_set_lock_token_header): Filter the root relpath, as we only support
    locks on files there will never be one.
  (setup_proppatch_headers): Don't call maybe_set_lock_token_header if we don't
    have a path.
  (proppatch_resource): Patch error code to give API users some hints to avoid
    having to wrap with now unneeded information in...
  (svn_ra_serf__change_rev_prop): ... this function.

* subversion/tests/cmdline/prop_tests.py
  (post_revprop_change_hook): Assume more detailed error code.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/commit.c
    subversion/trunk/subversion/tests/cmdline/prop_tests.py

Modified: subversion/trunk/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/commit.c?rev=1553484&r1=1553483&r2=1553484&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Thu Dec 26 13:48:47 2013
@@ -798,7 +798,7 @@ maybe_set_lock_token_header(serf_bucket_
 {
   const char *token;
 
-  if (! (relpath && commit_ctx->lock_tokens))
+  if (! (*relpath && commit_ctx->lock_tokens))
     return SVN_NO_ERROR;
 
   if (! svn_hash_gets(commit_ctx->deleted_entries, relpath))
@@ -840,8 +840,9 @@ setup_proppatch_headers(serf_bucket_t *h
                                            proppatch->base_revision));
     }
 
-  SVN_ERR(maybe_set_lock_token_header(headers, proppatch->commit,
-                                      proppatch->relpath, pool));
+  if (proppatch->relpath)
+    SVN_ERR(maybe_set_lock_token_header(headers, proppatch->commit,
+                                        proppatch->relpath, pool));
 
   return SVN_NO_ERROR;
 }
@@ -943,6 +944,7 @@ proppatch_resource(proppatch_context_t *
 {
   svn_ra_serf__handler_t *handler;
   struct proppatch_body_baton_t pbb;
+  svn_error_t *err;
 
   handler = apr_pcalloc(pool, sizeof(*handler));
   handler->handler_pool = pool;
@@ -962,12 +964,25 @@ proppatch_resource(proppatch_context_t *
   handler->response_handler = svn_ra_serf__handle_multistatus_only;
   handler->response_baton = handler;
 
-  SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
+  err = svn_ra_serf__context_run_one(handler, pool);
 
-  if (handler->sline.code != 207)
-    return svn_error_trace(unexpected_status_error(handler));
+  if (!err && handler->sline.code != 207)
+    err = svn_error_trace(unexpected_status_error(handler));
 
-  return SVN_NO_ERROR;
+  /* Use specific error code for property handling errors.
+     Use loop to provide the right result with tracing */
+  if (err && err->apr_err == SVN_ERR_RA_DAV_REQUEST_FAILED)
+    {
+      svn_error_t *e = err;
+
+      while (e && e->apr_err == SVN_ERR_RA_DAV_REQUEST_FAILED)
+        {
+          e->apr_err = SVN_ERR_RA_DAV_PROPPATCH_FAILED;
+          e = e->child;
+        }
+    }
+
+  return svn_error_trace(err);
 }
 
 /* Implements svn_ra_serf__request_body_delegate_t */
@@ -2459,12 +2474,5 @@ svn_ra_serf__change_rev_prop(svn_ra_sess
                             ns, name, value, pool);
     }
 
-  err = proppatch_resource(proppatch_ctx, commit, pool);
-  if (err)
-    return
-      svn_error_create(SVN_ERR_RA_DAV_PROPPATCH_FAILED, err,
-       _("DAV request failed; it's possible that the repository's "
-         "pre-revprop-change hook either failed or is non-existent"));
-
-  return SVN_NO_ERROR;
+  return svn_error_trace(proppatch_resource(proppatch_ctx, commit, pool));
 }

Modified: subversion/trunk/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/prop_tests.py?rev=1553484&r1=1553483&r2=1553484&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/prop_tests.py Thu Dec 26 13:48:47 2013
@@ -1738,9 +1738,9 @@ def post_revprop_change_hook(sbox):
   svntest.actions.create_failing_hook(repo_dir, 'post-revprop-change',
                                       error_msg)
 
-  # serf/neon/mod_dav_svn give SVN_ERR_RA_DAV_REQUEST_FAILED
+  # serf/mod_dav_svn give SVN_ERR_RA_DAV_PROPPATCH_FAILED
   # file/svn give SVN_ERR_REPOS_HOOK_FAILURE
-  expected_error = 'svn: (E175002|E165001).*post-revprop-change hook failed'
+  expected_error = 'svn: (E175008|E165001).*post-revprop-change hook failed'
 
   svntest.actions.run_and_verify_svn(None, [], expected_error,
                                      'ps', '--revprop', '-r0', 'p', 'v',