diff options
Diffstat (limited to 'subversion/libsvn_ra_serf/getlocks.c')
| -rw-r--r-- | subversion/libsvn_ra_serf/getlocks.c | 50 | 
1 files changed, 29 insertions, 21 deletions
| diff --git a/subversion/libsvn_ra_serf/getlocks.c b/subversion/libsvn_ra_serf/getlocks.c index df201a7506f5..518d2aaa08bd 100644 --- a/subversion/libsvn_ra_serf/getlocks.c +++ b/subversion/libsvn_ra_serf/getlocks.c @@ -47,8 +47,8 @@  /*   * This enum represents the current state of our XML parsing for a REPORT.   */ -enum { -  INITIAL = 0, +enum getlocks_state_e { +  INITIAL = XML_STATE_INITIAL,    REPORT,    LOCK,    PATH, @@ -213,7 +213,8 @@ static svn_error_t *  create_getlocks_body(serf_bucket_t **body_bkt,                       void *baton,                       serf_bucket_alloc_t *alloc, -                     apr_pool_t *pool) +                     apr_pool_t *pool /* request pool */, +                     apr_pool_t *scratch_pool)  {    lock_context_t *lock_ctx = baton;    serf_bucket_t *buckets; @@ -222,7 +223,7 @@ create_getlocks_body(serf_bucket_t **body_bkt,    svn_ra_serf__add_open_tag_buckets(      buckets, alloc, "S:get-locks-report", "xmlns:S", SVN_XML_NAMESPACE, -    "depth", svn_depth_to_word(lock_ctx->requested_depth), NULL); +    "depth", svn_depth_to_word(lock_ctx->requested_depth), SVN_VA_NULL);    svn_ra_serf__add_close_tag_buckets(buckets, alloc, "S:get-locks-report");    *body_bkt = buckets; @@ -244,12 +245,11 @@ svn_ra_serf__get_locks(svn_ra_session_t *ra_session,    svn_error_t *err;    req_url = svn_path_url_add_component2(session->session_url.path, path, pool); -  SVN_ERR(svn_ra_serf__get_relative_path(&rel_path, req_url, session, -                                         NULL, pool)); +  SVN_ERR(svn_ra_serf__get_relative_path(&rel_path, req_url, session, pool));    lock_ctx = apr_pcalloc(pool, sizeof(*lock_ctx));    lock_ctx->pool = pool; -  lock_ctx->path = apr_pstrcat(pool, "/", rel_path, (char *)NULL); +  lock_ctx->path = apr_pstrcat(pool, "/", rel_path, SVN_VA_NULL);    lock_ctx->requested_depth = depth;    lock_ctx->hash = apr_hash_make(pool); @@ -257,33 +257,41 @@ svn_ra_serf__get_locks(svn_ra_session_t *ra_session,                                             NULL, getlocks_closed, NULL,                                             lock_ctx,                                             pool); -  handler = svn_ra_serf__create_expat_handler(xmlctx, pool); +  handler = svn_ra_serf__create_expat_handler(session, xmlctx, NULL, pool);    handler->method = "REPORT";    handler->path = req_url;    handler->body_type = "text/xml"; -  handler->conn = session->conns[0]; -  handler->session = session;    handler->body_delegate = create_getlocks_body;    handler->body_delegate_baton = lock_ctx;    err = svn_ra_serf__context_run_one(handler, pool); -   -  /* Wrap the server generated error for an unsupported report with the -     documented error for this ra function. */ -  if (svn_error_find_cause(err, SVN_ERR_UNSUPPORTED_FEATURE)) -    err = svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, err, NULL); -     -  SVN_ERR(err); + +  if (err) +    { +      if (svn_error_find_cause(err, SVN_ERR_UNSUPPORTED_FEATURE)) +        { +          /* The server told us that it doesn't support this report type. +             We return the documented error for svn_ra_get_locks(), but +             with the original error report */ +          return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, err, NULL); +        } +      else if (err->apr_err == SVN_ERR_FS_NOT_FOUND) +        { +          /* File doesn't exist in HEAD: Not an error */ +          svn_error_clear(err); +        } +      else +        return svn_error_trace(err); +    }    /* We get a 404 when a path doesn't exist in HEAD, but it might       have existed earlier (E.g. 'svn ls http://s/svn/trunk/file@1' */ -  if (handler->sline.code != 404) +  if (handler->sline.code != 200 +      && handler->sline.code != 404)      { -      SVN_ERR(svn_ra_serf__error_on_status(handler->sline, -                                           handler->path, -                                           handler->location)); +      return svn_error_trace(svn_ra_serf__unexpected_status(handler));      }    *locks = lock_ctx->hash; | 
