static svn_error_t * reconcile_errors(svn_error_t *commit_err, svn_error_t *unlock_err, svn_error_t *bump_err, apr_pool_t *pool) { svn_error_t *err; /* Early release (for good behavior). */ if (! (commit_err || unlock_err || bump_err)) return SVN_NO_ERROR; /* If there was a commit error, start off our error chain with that. */ if (commit_err) { commit_err = svn_error_quick_wrap (commit_err, _("Commit failed (details follow):")); err = commit_err; } /* Else, create a new "general" error that will lead off the errors that follow. */ else err = svn_error_create(SVN_ERR_BASE, NULL, _("Commit succeeded, but other errors follow:")); /* If there was an unlock error... */ if (unlock_err) { /* Wrap the error with some headers. */ unlock_err = svn_error_quick_wrap (unlock_err, _("Error unlocking locked dirs (details follow):")); /* Append this error to the chain. */ svn_error_compose(err, unlock_err); } /* If there was a bumping error... */ if (bump_err) { /* Wrap the error with some headers. */ bump_err = svn_error_quick_wrap (bump_err, _("Error bumping revisions post-commit (details follow):")); /* Append this error to the chain. */ svn_error_compose(err, bump_err); } return err; }
svn_error_t * svn_cl__cleanup_log_msg(void *log_msg_baton, svn_error_t *commit_err, apr_pool_t *pool) { struct log_msg_baton *lmb = log_msg_baton; svn_error_t *err; /* If there was no tmpfile left, or there is no log message baton, return COMMIT_ERR. */ if ((! lmb) || (! lmb->tmpfile_left)) return commit_err; /* If there was no commit error, cleanup the tmpfile and return. */ if (! commit_err) return svn_io_remove_file2(lmb->tmpfile_left, FALSE, lmb->pool); /* There was a commit error; there is a tmpfile. Leave the tmpfile around, and add message about its presence to the commit error chain. Then return COMMIT_ERR. If the conversion from UTF-8 to native encoding fails, we have to compose that error with the commit error chain, too. */ err = svn_error_createf(commit_err->apr_err, NULL, _(" '%s'"), svn_dirent_local_style(lmb->tmpfile_left, pool)); svn_error_compose(commit_err, svn_error_create(commit_err->apr_err, err, _("Your commit message was left in " "a temporary file:"))); return commit_err; }
svn_error_t * svn_error_compose_create(svn_error_t *err1, svn_error_t *err2) { if (err1 && err2) { svn_error_compose(err1, err2); return err1; } return err1 ? err1 : err2; }
/* BDB error callback. See bdb_error_info_t in env.h for more info. Note: bdb_error_gatherer is a macro with BDB < 4.3, so be careful how you use it! */ static void bdb_error_gatherer(const DB_ENV *dbenv, const char *baton, const char *msg) { /* See the documentation at bdb_env_t's definition why the (bdb_env_t *) cast is safe and why it is done. */ bdb_error_info_t *error_info = get_error_info((const bdb_env_t *) baton); svn_error_t *new_err; SVN_BDB_ERROR_GATHERER_IGNORE(dbenv); new_err = svn_error_createf(APR_SUCCESS, NULL, "bdb: %s", msg); if (error_info->pending_errors) svn_error_compose(error_info->pending_errors, new_err); else error_info->pending_errors = new_err; if (error_info->user_callback) error_info->user_callback(NULL, (char *)msg); /* ### I hate this cast... */ }
/* See doc string for svn_ra_neon__parsed_request. */ static svn_error_t * parsed_request(svn_ra_neon__request_t *req, svn_ra_neon__session_t *ras, const char *method, const char *url, const char *body, apr_file_t *body_file, void set_parser(ne_xml_parser *parser, void *baton), svn_ra_neon__startelm_cb_t startelm_cb, svn_ra_neon__cdata_cb_t cdata_cb, svn_ra_neon__endelm_cb_t endelm_cb, void *baton, apr_hash_t *extra_headers, int *status_code, svn_boolean_t spool_response, apr_pool_t *pool) { ne_xml_parser *success_parser = NULL; spool_reader_baton_t spool_reader_baton; if (body == NULL) SVN_ERR(svn_ra_neon__set_neon_body_provider(req, body_file)); /* ### use a symbolic name somewhere for this MIME type? */ ne_add_request_header(req->ne_req, "Content-Type", "text/xml"); /* create a parser to read the normal response body */ success_parser = svn_ra_neon__xml_parser_create(req, NULL, startelm_cb, cdata_cb, endelm_cb, baton); /* if our caller is interested in having access to this parser, call the SET_PARSER callback with BATON. */ if (set_parser != NULL) set_parser(success_parser, baton); /* Register the "main" accepter and body-reader with the request -- the one to use when the HTTP status is 2XX. If we are spooling the response to disk first, we use our custom spool reader. */ if (spool_response) { /* Blow the temp-file away as soon as we eliminate the entire request */ SVN_ERR(svn_io_open_unique_file3(&spool_reader_baton.spool_file, &spool_reader_baton.spool_file_name, NULL, svn_io_file_del_on_pool_cleanup, req->pool, pool)); spool_reader_baton.req = req; svn_ra_neon__add_response_body_reader(req, ne_accept_2xx, spool_reader, &spool_reader_baton); } else attach_ne_body_reader(req, ne_accept_2xx, cancellation_callback, get_cancellation_baton(req, ne_xml_parse_v, success_parser, pool)); /* run the request and get the resulting status code. */ SVN_ERR(svn_ra_neon__request_dispatch( status_code, req, extra_headers, body, (strcmp(method, "PROPFIND") == 0) ? 207 : 200, 0, pool)); if (spool_response) { /* All done with the temporary file we spooled the response into. */ (void) apr_file_close(spool_reader_baton.spool_file); /* The success parser may set an error value in req->err */ SVN_RA_NEON__REQ_ERR (req, parse_spool_file(ras, spool_reader_baton.spool_file_name, success_parser, req->pool)); if (req->err) { svn_error_compose(req->err, svn_error_createf (SVN_ERR_RA_DAV_REQUEST_FAILED, NULL, _("Error reading spooled %s request response"), method)); return req->err; } } SVN_ERR(svn_ra_neon__check_parse_error(method, success_parser, url)); return SVN_NO_ERROR; }