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/18 19:26:16 UTC

svn commit: r1552054 - in /subversion/trunk/subversion/libsvn_ra_serf: blame.c commit.c get_lock.c getdate.c getlocations.c getlocationsegments.c inherited_props.c log.c mergeinfo.c options.c property.c replay.c update.c

Author: rhuijben
Date: Wed Dec 18 18:26:15 2013
New Revision: 1552054

URL: http://svn.apache.org/r1552054
Log:
Following up on r1552043, handle http status 404 as an http failure. Use the
new non-fatal handle mode (see r1551993) in the few places where a 404 error
is not a failure.

Remove duplicated http status based error messages from the error chains.

* subversion/libsvn_ra_serf/blame.c
  (svn_ra_serf__get_file_revs): Avoid duplicated errors.

* subversion/libsvn_ra_serf/commit.c
  (open_root): Use standard error when possible.

* subversion/libsvn_ra_serf/getdate.c
  (svn_ra_serf__get_dated_revision): Avoid duplicated errors.

* subversion/libsvn_ra_serf/getlocations.c
  (svn_ra_serf__get_locations): Avoid duplicated errors.

* subversion/libsvn_ra_serf/getlocationsegments.c
  (svn_ra_serf__get_location_segments): Avoid duplicated errors.

* subversion/libsvn_ra_serf/get_lock.c
  (svn_ra_serf__get_lock): Avoid duplicated errors.

* subversion/libsvn_ra_serf/inherited_props.c
  (svn_ra_serf__get_inherited_props): Avoid duplicated errors.

* subversion/libsvn_ra_serf/log.c
  (svn_ra_serf__get_log): Avoid duplicated errors.

* subversion/libsvn_ra_serf/mergeinfo.c
  (svn_ra_serf__get_mergeinfo): Avoid duplicated errors.

* subversion/libsvn_ra_serf/options.c
  (svn_ra_serf__exchange_capabilities): Avoid duplicated errors.

* subversion/libsvn_ra_serf/property.c
  (svn_ra_serf__wait_for_props): Avoid duplicated errors.

* subversion/libsvn_ra_serf/replay.c
  (svn_ra_serf__replay): Avoid duplicated errors.

* subversion/libsvn_ra_serf/update.c
  (finish_report): Avoid duplicated errors.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/blame.c
    subversion/trunk/subversion/libsvn_ra_serf/commit.c
    subversion/trunk/subversion/libsvn_ra_serf/get_lock.c
    subversion/trunk/subversion/libsvn_ra_serf/getdate.c
    subversion/trunk/subversion/libsvn_ra_serf/getlocations.c
    subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c
    subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c
    subversion/trunk/subversion/libsvn_ra_serf/log.c
    subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c
    subversion/trunk/subversion/libsvn_ra_serf/options.c
    subversion/trunk/subversion/libsvn_ra_serf/property.c
    subversion/trunk/subversion/libsvn_ra_serf/replay.c
    subversion/trunk/subversion/libsvn_ra_serf/update.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/blame.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/blame.c Wed Dec 18 18:26:15 2013
@@ -329,7 +329,6 @@ svn_ra_serf__get_file_revs(svn_ra_sessio
   svn_ra_serf__handler_t *handler;
   svn_ra_serf__xml_context_t *xmlctx;
   const char *req_url;
-  svn_error_t *err;
   svn_revnum_t peg_rev;
 
   blame_ctx = apr_pcalloc(pool, sizeof(*blame_ctx));
@@ -370,13 +369,10 @@ svn_ra_serf__get_file_revs(svn_ra_sessio
   handler->conn = session->conns[0];
   handler->session = session;
 
-  err = svn_ra_serf__context_run_one(handler, pool);
+  SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
 
-  err = svn_error_compose_create(
+  return svn_error_trace(
             svn_ra_serf__error_on_status(handler->sline,
                                          handler->path,
-                                         handler->location),
-            err);
-
-  return svn_error_trace(err);
+                                         handler->location));
 }

Modified: subversion/trunk/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/commit.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Wed Dec 18 18:26:15 2013
@@ -1358,19 +1358,12 @@ open_root(void *edit_baton,
 
       if (handler->sline.code != 201)
         {
-          apr_status_t status = SVN_ERR_RA_DAV_REQUEST_FAILED;
-
-          switch (handler->sline.code)
-            {
-              case 403:
-                status = SVN_ERR_RA_DAV_FORBIDDEN;
-                break;
-              case 404:
-                status = SVN_ERR_FS_NOT_FOUND;
-                break;
-            }
+          /* If there is some standard error code: use it */
+          SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
+                                               handler->path,
+                                               handler->location));
 
-          return svn_error_createf(status, NULL,
+          return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
                                    _("%s of '%s': %d %s (%s://%s)"),
                                    handler->method, handler->path,
                                    handler->sline.code, handler->sline.reason,

Modified: subversion/trunk/subversion/libsvn_ra_serf/get_lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/get_lock.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/get_lock.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/get_lock.c Wed Dec 18 18:26:15 2013
@@ -300,11 +300,13 @@ svn_ra_serf__get_lock(svn_ra_session_t *
   lock_ctx->handler = handler;
 
   err = svn_ra_serf__context_run_one(handler, pool);
-  err = svn_error_compose_create(
-                    svn_ra_serf__error_on_status(handler->sline,
-                                                 handler->path,
-                                                 handler->location),
-                    err);
+
+  if (!err)
+    {
+      err = svn_ra_serf__error_on_status(handler->sline,
+                                         handler->path,
+                                         handler->location);
+    }
 
   if (err)
     {

Modified: subversion/trunk/subversion/libsvn_ra_serf/getdate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/getdate.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/getdate.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/getdate.c Wed Dec 18 18:26:15 2013
@@ -131,7 +131,6 @@ svn_ra_serf__get_dated_revision(svn_ra_s
   svn_ra_serf__handler_t *handler;
   svn_ra_serf__xml_context_t *xmlctx;
   const char *report_target;
-  svn_error_t *err;
 
   date_ctx = apr_palloc(pool, sizeof(*date_ctx));
   date_ctx->time = tm;
@@ -156,13 +155,11 @@ svn_ra_serf__get_dated_revision(svn_ra_s
 
   *date_ctx->revision = SVN_INVALID_REVNUM;
 
-  err = svn_ra_serf__context_run_one(handler, pool);
+  SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
 
-  SVN_ERR(svn_error_compose_create(
-              svn_ra_serf__error_on_status(handler->sline,
-                                           report_target,
-                                           handler->location),
-              err));
+  SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
+                                       report_target,
+                                       handler->location));
 
   SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(*revision));
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/getlocations.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/getlocations.c Wed Dec 18 18:26:15 2013
@@ -159,7 +159,6 @@ svn_ra_serf__get_locations(svn_ra_sessio
   svn_ra_serf__handler_t *handler;
   svn_ra_serf__xml_context_t *xmlctx;
   const char *req_url;
-  svn_error_t *err;
 
   loc_ctx = apr_pcalloc(pool, sizeof(*loc_ctx));
   loc_ctx->pool = pool;
@@ -189,13 +188,11 @@ svn_ra_serf__get_locations(svn_ra_sessio
   handler->conn = session->conns[0];
   handler->session = session;
 
-  err = svn_ra_serf__context_run_one(handler, pool);
+  SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
 
-  SVN_ERR(svn_error_compose_create(
-              svn_ra_serf__error_on_status(handler->sline,
-                                           req_url,
-                                           handler->location),
-              err));
+  SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
+                                       handler->path,
+                                       handler->location));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/getlocationsegments.c Wed Dec 18 18:26:15 2013
@@ -193,11 +193,12 @@ svn_ra_serf__get_location_segments(svn_r
 
   err = svn_ra_serf__context_run_one(handler, pool);
 
-  err = svn_error_compose_create(
-         svn_ra_serf__error_on_status(handler->sline,
-                                      handler->path,
-                                      handler->location),
-         err);
+  if (!err)
+    {
+      err = svn_ra_serf__error_on_status(handler->sline,
+                                         handler->path,
+                                         handler->location);
+    }
 
   if (err && (err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE))
     return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, err, NULL);

Modified: subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c Wed Dec 18 18:26:15 2013
@@ -230,7 +230,6 @@ svn_ra_serf__get_inherited_props(svn_ra_
                                  apr_pool_t *result_pool,
                                  apr_pool_t *scratch_pool)
 {
-  svn_error_t *err;
   iprops_context_t *iprops_ctx;
   svn_ra_serf__session_t *session = ra_session->priv;
   svn_ra_serf__handler_t *handler;
@@ -273,12 +272,11 @@ svn_ra_serf__get_inherited_props(svn_ra_
   handler->body_type = "text/xml";
   handler->handler_pool = scratch_pool;
 
-  err = svn_ra_serf__context_run_one(handler, scratch_pool);
-  SVN_ERR(svn_error_compose_create(
-                    svn_ra_serf__error_on_status(handler->sline,
-                                                 handler->path,
-                                                 handler->location),
-                    err));
+  SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool));
+
+  SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
+                                       handler->path,
+                                       handler->location));
 
   *iprops = iprops_ctx->iprops;
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/log.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/log.c Wed Dec 18 18:26:15 2013
@@ -542,7 +542,6 @@ svn_ra_serf__get_log(svn_ra_session_t *r
   svn_ra_serf__xml_context_t *xmlctx;
   svn_boolean_t want_custom_revprops;
   svn_revnum_t peg_rev;
-  svn_error_t *err;
   const char *req_url;
 
   log_ctx = apr_pcalloc(pool, sizeof(*log_ctx));
@@ -617,13 +616,10 @@ svn_ra_serf__get_log(svn_ra_session_t *r
   handler->conn = session->conns[0];
   handler->session = session;
 
-  err = svn_ra_serf__context_run_one(handler, pool);
+  SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
 
-  SVN_ERR(svn_error_compose_create(
+  return svn_error_trace(
               svn_ra_serf__error_on_status(handler->sline,
                                            req_url,
-                                           handler->location),
-              err));
-
-  return SVN_NO_ERROR;
+                                           handler->location));
 }

Modified: subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c Wed Dec 18 18:26:15 2013
@@ -191,7 +191,6 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
                            svn_boolean_t include_descendants,
                            apr_pool_t *pool)
 {
-  svn_error_t *err;
   mergeinfo_context_t *mergeinfo_ctx;
   svn_ra_serf__session_t *session = ra_session->priv;
   svn_ra_serf__handler_t *handler;
@@ -227,14 +226,12 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
   handler->body_delegate_baton = mergeinfo_ctx;
   handler->body_type = "text/xml";
 
-  err = svn_ra_serf__context_run_one(handler, pool);
+  SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
 
-  SVN_ERR(svn_error_compose_create(
-                svn_ra_serf__error_on_status(handler->sline, handler->path,
-                                             handler->location),
-                err));
+  SVN_ERR(svn_ra_serf__error_on_status(handler->sline, handler->path,
+                                       handler->location));
 
-  if (handler->done && apr_hash_count(mergeinfo_ctx->result_catalog))
+  if (apr_hash_count(mergeinfo_ctx->result_catalog))
     *catalog = mergeinfo_ctx->result_catalog;
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/options.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/options.c Wed Dec 18 18:26:15 2013
@@ -488,7 +488,7 @@ svn_ra_serf__exchange_capabilities(svn_r
   /* This routine automatically fills in serf_sess->capabilities */
   SVN_ERR(create_options_req(&opt_ctx, serf_sess, serf_sess->conns[0], pool));
 
-  err = svn_ra_serf__context_run_one(opt_ctx->handler, pool);
+  SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, pool));
 
   /* If our caller cares about server redirections, and our response
      carries such a thing, report as much.  We'll disregard ERR --
@@ -496,16 +496,13 @@ svn_ra_serf__exchange_capabilities(svn_r
      successfully parsing as XML or somesuch. */
   if (corrected_url && (opt_ctx->handler->sline.code == 301))
     {
-      svn_error_clear(err);
       *corrected_url = opt_ctx->handler->location;
       return SVN_NO_ERROR;
     }
 
-  SVN_ERR(svn_error_compose_create(
-              svn_ra_serf__error_on_status(opt_ctx->handler->sline,
-                                           serf_sess->session_url.path,
-                                           opt_ctx->handler->location),
-              err));
+  SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline,
+                                       serf_sess->session_url.path,
+                                       opt_ctx->handler->location));
 
   /* Opportunistically cache any reported activity URL.  (We don't
      want to have to ask for this again later, potentially against an
@@ -558,6 +555,7 @@ svn_ra_serf__probe_proxy(svn_ra_serf__se
 
   /* We need a simple body, in order to send it in chunked format.  */
   handler->body_delegate = create_simple_options_body;
+  handler->no_fail_on_http_failure_status = TRUE;
 
   /* No special headers.  */
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/property.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/property.c Wed Dec 18 18:26:15 2013
@@ -636,16 +636,12 @@ svn_error_t *
 svn_ra_serf__wait_for_props(svn_ra_serf__handler_t *handler,
                             apr_pool_t *scratch_pool)
 {
-  svn_error_t *err;
-  svn_error_t *err2;
+  SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool));
 
-  err = svn_ra_serf__context_run_one(handler, scratch_pool);
-
-  err2 = svn_ra_serf__error_on_status(handler->sline,
-                                      handler->path,
-                                      handler->location);
-
-  return svn_error_compose_create(err2, err);
+  return svn_error_trace(
+                svn_ra_serf__error_on_status(handler->sline,
+                                             handler->path,
+                                             handler->location));
 }
 
 /*

Modified: subversion/trunk/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/replay.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/replay.c Wed Dec 18 18:26:15 2013
@@ -555,7 +555,6 @@ svn_ra_serf__replay(svn_ra_session_t *ra
   svn_ra_serf__session_t *session = ra_session->priv;
   svn_ra_serf__handler_t *handler;
   svn_ra_serf__xml_context_t *xmlctx;
-  svn_error_t *err;
   const char *report_target;
 
   SVN_ERR(svn_ra_serf__report_resource(&report_target, session, NULL,
@@ -591,15 +590,13 @@ svn_ra_serf__replay(svn_ra_session_t *ra
 
   svn_ra_serf__request_create(handler);
 
-  err = svn_ra_serf__context_run_wait(&handler->done, session, scratch_pool);
+  SVN_ERR(svn_ra_serf__context_run_wait(&handler->done, session,
+                                        scratch_pool));
 
-  SVN_ERR(svn_error_compose_create(
+  return svn_error_trace(
               svn_ra_serf__error_on_status(handler->sline,
                                            handler->path,
-                                           handler->location),
-              err));
-
-  return SVN_NO_ERROR;
+                                           handler->location));
 }
 
 /* The maximum number of outstanding requests at any time. When this

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1552054&r1=1552053&r2=1552054&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Wed Dec 18 18:26:15 2013
@@ -2968,18 +2968,15 @@ finish_report(void *report_baton,
           waittime_left = sess->timeout;
         }
 
-      if (status && handler->sline.code != 200)
-        {
-          return svn_error_trace(
-                    svn_error_compose_create(
-                        svn_ra_serf__error_on_status(handler->sline,
-                                                     handler->path,
-                                                     handler->location),
-                        err));
-        }
       SVN_ERR(err);
+
       if (status)
         {
+          if (handler->sline.code != 200)
+            SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
+                                                 handler->path,
+                                                 handler->location));
+
           return svn_ra_serf__wrap_err(status, _("Error retrieving REPORT"));
         }