You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/02/21 21:40:50 UTC
svn commit: r1073138 [4/9] - in /subversion/branches/ignore-mergeinfo-log:
./ build/ build/ac-macros/ build/generator/ build/generator/templates/
notes/ notes/wc-ng/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversio...
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/serf.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/serf.c Mon Feb 21 20:40:44 2011
@@ -86,10 +86,10 @@ ra_serf_get_schemes(apr_pool_t *pool)
static svn_error_t *
load_http_auth_types(apr_pool_t *pool, svn_config_t *config,
const char *server_group,
- svn_ra_serf__authn_types *authn_types)
+ int *authn_types)
{
const char *http_auth_types = NULL;
- *authn_types = svn_ra_serf__authn_none;
+ *authn_types = SERF_AUTHN_NONE;
svn_config_get(config, &http_auth_types, SVN_CONFIG_SECTION_GLOBAL,
SVN_CONFIG_OPTION_HTTP_AUTH_TYPES, NULL);
@@ -109,13 +109,13 @@ load_http_auth_types(apr_pool_t *pool, s
{
auth_types_list = NULL;
if (svn_cstring_casecmp("basic", token) == 0)
- *authn_types |= svn_ra_serf__authn_basic;
+ *authn_types |= SERF_AUTHN_BASIC;
else if (svn_cstring_casecmp("digest", token) == 0)
- *authn_types |= svn_ra_serf__authn_digest;
+ *authn_types |= SERF_AUTHN_DIGEST;
else if (svn_cstring_casecmp("ntlm", token) == 0)
- *authn_types |= svn_ra_serf__authn_ntlm;
+ *authn_types |= SERF_AUTHN_NTLM;
else if (svn_cstring_casecmp("negotiate", token) == 0)
- *authn_types |= svn_ra_serf__authn_negotiate;
+ *authn_types |= SERF_AUTHN_NEGOTIATE;
else
return svn_error_createf(SVN_ERR_BAD_CONFIG_VALUE, NULL,
_("Invalid config: unknown http auth"
@@ -125,7 +125,7 @@ load_http_auth_types(apr_pool_t *pool, s
else
{
/* Nothing specified by the user, so accept all types. */
- *authn_types = svn_ra_serf__authn_all;
+ *authn_types = SERF_AUTHN_ALL;
}
return SVN_NO_ERROR;
@@ -298,6 +298,12 @@ load_config(svn_ra_serf__session_t *sess
status = apr_sockaddr_info_get(&proxy_addr, proxy_host,
APR_UNSPEC, proxy_port, 0,
session->pool);
+ if (status)
+ {
+ return svn_error_wrap_apr(status,
+ _("Could not resolve proxy server '%s'"),
+ proxy_host);
+ }
session->using_proxy = TRUE;
serf_config_proxy(session->context, proxy_addr);
}
@@ -307,12 +313,9 @@ load_config(svn_ra_serf__session_t *sess
/* Setup authentication. */
SVN_ERR(load_http_auth_types(pool, config, server_group,
&session->authn_types));
-#if SERF_VERSION_AT_LEAST(0, 4, 0)
- /* TODO: convert string authn types to SERF_AUTHN bitmask.
- serf_config_authn_types(session->context, session->authn_types);*/
+ serf_config_authn_types(session->context, session->authn_types);
serf_config_credentials_callback(session->context,
svn_ra_serf__credentials_callback);
-#endif
return SVN_NO_ERROR;
}
@@ -351,7 +354,6 @@ svn_ra_serf__open(svn_ra_session_t *sess
serf_sess->pool = svn_pool_create(pool);
serf_sess->bkt_alloc = serf_bucket_allocator_create(serf_sess->pool, NULL,
NULL);
- serf_sess->cached_props = apr_hash_make(serf_sess->pool);
serf_sess->wc_callbacks = callbacks;
serf_sess->wc_callback_baton = callback_baton;
serf_sess->wc_progress_baton = callbacks->progress_baton;
@@ -397,35 +399,9 @@ svn_ra_serf__open(svn_ra_session_t *sess
serf_sess->conns[0]->session = serf_sess;
serf_sess->conns[0]->last_status_code = -1;
- /* Unless we're using a proxy, fetch the DNS record for this host */
- if (! serf_sess->using_proxy)
- {
- status = apr_sockaddr_info_get(&serf_sess->conns[0]->address,
- url.hostname,
- APR_UNSPEC, url.port, 0, serf_sess->pool);
- if (status)
- {
- return svn_error_wrap_apr(status,
- _("Could not lookup hostname `%s'"),
- url.hostname);
- }
- }
- else
- {
- /* Create an address with unresolved hostname. */
- apr_sockaddr_t *sa = apr_pcalloc(serf_sess->pool, sizeof(apr_sockaddr_t));
- sa->pool = serf_sess->pool;
- sa->hostname = apr_pstrdup(serf_sess->pool, url.hostname);
- sa->port = url.port;
- sa->family = APR_UNSPEC;
- serf_sess->conns[0]->address = sa;
- }
-
serf_sess->conns[0]->using_ssl = serf_sess->using_ssl;
serf_sess->conns[0]->using_compression = serf_sess->using_compression;
serf_sess->conns[0]->hostinfo = url.hostinfo;
- serf_sess->conns[0]->auth_header = NULL;
- serf_sess->conns[0]->auth_value = NULL;
serf_sess->conns[0]->useragent = NULL;
/* create the user agent string */
@@ -603,8 +579,8 @@ fetch_path_props(svn_ra_serf__propfind_c
{
SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx, props, session,
session->conns[0], path, revision,
- "0", desired_props, TRUE, NULL,
- session->pool));
+ "0", desired_props, NULL,
+ pool));
}
else
{
@@ -623,8 +599,8 @@ fetch_path_props(svn_ra_serf__propfind_c
revision = SVN_INVALID_REVNUM;
SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx, props, session,
session->conns[0], path, revision,
- "0", desired_props, TRUE, NULL,
- session->pool));
+ "0", desired_props, NULL,
+ pool));
}
if (prop_ctx)
@@ -650,7 +626,7 @@ svn_ra_serf__check_path(svn_ra_session_t
svn_ra_serf__session_t *session = ra_session->priv;
apr_hash_t *props;
svn_ra_serf__propfind_context_t *prop_ctx;
- const char *path, *res_type;
+ const char *path;
svn_revnum_t fetched_rev;
svn_error_t *err = fetch_path_props(&prop_ctx, &props, &path, &fetched_rev,
@@ -668,23 +644,7 @@ svn_ra_serf__check_path(svn_ra_session_t
if (err)
return err;
- res_type = svn_ra_serf__get_ver_prop(props, path, fetched_rev,
- "DAV:", "resourcetype");
- if (!res_type)
- {
- /* How did this happen? */
- return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
- _("The OPTIONS response did not include the "
- "requested resourcetype value"));
- }
- else if (strcmp(res_type, "collection") == 0)
- {
- *kind = svn_node_dir;
- }
- else
- {
- *kind = svn_node_file;
- }
+ SVN_ERR(svn_ra_serf__get_resource_type(kind, props, path, fetched_rev));
}
return SVN_NO_ERROR;
@@ -707,6 +667,15 @@ dirent_walker(void *baton,
{
entry->has_props = TRUE;
}
+ else if (strcmp(ns, SVN_DAV_PROP_NS_DAV) == 0)
+ {
+ if(strcmp(name, "deadprop-count") == 0)
+ {
+ apr_int64_t deadprop_count;
+ SVN_ERR(svn_cstring_atoi64(&deadprop_count, val->data));
+ entry->has_props = deadprop_count > 0;
+ }
+ }
else if (strcmp(ns, "DAV:") == 0)
{
if (strcmp(name, SVN_DAV__VERSION_NAME) == 0)
@@ -723,7 +692,11 @@ dirent_walker(void *baton,
}
else if (strcmp(name, "getcontentlength") == 0)
{
- SVN_ERR(svn_cstring_atoi64(&entry->size, val->data));
+ /* 'getcontentlength' property is empty for directories. */
+ if (val->len)
+ {
+ SVN_ERR(svn_cstring_atoi64(&entry->size, val->data));
+ }
}
else if (strcmp(name, "resourcetype") == 0)
{
@@ -783,6 +756,62 @@ path_dirent_walker(void *baton,
return dirent_walker(entry, ns, ns_len, name, name_len, val, pool);
}
+static const svn_ra_serf__dav_props_t *
+get_dirent_props(apr_uint32_t dirent_fields, apr_pool_t *pool)
+{
+ svn_ra_serf__dav_props_t *prop;
+ apr_array_header_t *props = apr_array_make
+ (pool, 7, sizeof(svn_ra_serf__dav_props_t));
+
+ if (dirent_fields & SVN_DIRENT_KIND)
+ {
+ prop = apr_array_push(props);
+ prop->namespace = "DAV:";
+ prop->name = "resourcetype";
+ }
+
+ if (dirent_fields & SVN_DIRENT_SIZE)
+ {
+ prop = apr_array_push(props);
+ prop->namespace = "DAV:";
+ prop->name = "getcontentlength";
+ }
+
+ if (dirent_fields & SVN_DIRENT_HAS_PROPS)
+ {
+ prop = apr_array_push(props);
+ prop->namespace = SVN_DAV_PROP_NS_DAV;
+ prop->name = "deadprop-count";
+ }
+
+ if (dirent_fields & SVN_DIRENT_CREATED_REV)
+ {
+ svn_ra_serf__dav_props_t *p = apr_array_push(props);
+ p->namespace = "DAV:";
+ p->name = SVN_DAV__VERSION_NAME;
+ }
+
+ if (dirent_fields & SVN_DIRENT_TIME)
+ {
+ prop = apr_array_push(props);
+ prop->namespace = "DAV:";
+ prop->name = SVN_DAV__CREATIONDATE;
+ }
+
+ if (dirent_fields & SVN_DIRENT_LAST_AUTHOR)
+ {
+ prop = apr_array_push(props);
+ prop->namespace = "DAV:";
+ prop->name = "creator-displayname";
+ }
+
+ prop = apr_array_push(props);
+ prop->namespace = NULL;
+ prop->name = NULL;
+
+ return (svn_ra_serf__dav_props_t *) props->elts;
+}
+
static svn_error_t *
svn_ra_serf__stat(svn_ra_session_t *ra_session,
const char *rel_path,
@@ -799,7 +828,8 @@ svn_ra_serf__stat(svn_ra_session_t *ra_s
svn_error_t *err;
err = fetch_path_props(&prop_ctx, &props, &path, &fetched_rev,
- session, rel_path, revision, all_props, pool);
+ session, rel_path, revision,
+ get_dirent_props(SVN_DIRENT_ALL, pool), pool);
if (err)
{
if (err->apr_err == SVN_ERR_FS_NOT_FOUND)
@@ -831,21 +861,14 @@ resource_is_directory(apr_hash_t *props,
const char *path,
svn_revnum_t revision)
{
- const char *res_type;
+ svn_node_kind_t kind;
- res_type = svn_ra_serf__get_ver_prop(props, path, revision,
- "DAV:", "resourcetype");
- if (!res_type)
- {
- /* How did this happen? */
- return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
- _("The PROPFIND response did not include the "
- "requested resourcetype value"));
- }
- else if (strcmp(res_type, "collection") != 0)
+ SVN_ERR(svn_ra_serf__get_resource_type(&kind, props, path, revision));
+
+ if (kind != svn_node_dir)
{
- return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
- _("Can't get entries of non-directory"));
+ return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
+ _("Can't get entries of non-directory"));
}
return SVN_NO_ERROR;
@@ -895,9 +918,15 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
{
struct path_dirent_visitor_t dirent_walk;
+ /* Always request node kind to check that path is really a
+ * directory.
+ */
+ dirent_fields |= SVN_DIRENT_KIND;
SVN_ERR(svn_ra_serf__retrieve_props(props, session, session->conns[0],
- path, revision, "1", all_props,
- session->pool));
+ path, revision, "1",
+ get_dirent_props(dirent_fields,
+ pool),
+ pool));
/* Check if the path is really a directory. */
SVN_ERR(resource_is_directory (props, path, revision));
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/update.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/update.c Mon Feb 21 20:40:44 2011
@@ -1193,7 +1193,7 @@ fetch_file(report_context_t *ctx, report
SVN_ERR(svn_ra_serf__deliver_props(&info->propfind, info->props,
ctx->sess, conn, info->url,
info->target_rev, "0", all_props,
- FALSE, &ctx->done_propfinds,
+ &ctx->done_propfinds,
info->dir->pool));
SVN_ERR_ASSERT(info->propfind);
@@ -1752,7 +1752,7 @@ end_report(svn_ra_serf__xml_parser_t *pa
ctx->sess->conns[ctx->sess->cur_conn],
info->dir->url,
info->dir->target_rev, "0",
- all_props, FALSE,
+ all_props,
&ctx->done_propfinds,
info->dir->pool));
@@ -2194,12 +2194,9 @@ open_connection_if_needed(svn_ra_serf__s
sess->conns[cur] = apr_palloc(sess->pool, sizeof(*sess->conns[cur]));
sess->conns[cur]->bkt_alloc = serf_bucket_allocator_create(sess->pool,
NULL, NULL);
- sess->conns[cur]->address = sess->conns[0]->address;
sess->conns[cur]->hostinfo = sess->conns[0]->hostinfo;
sess->conns[cur]->using_ssl = sess->conns[0]->using_ssl;
sess->conns[cur]->using_compression = sess->conns[0]->using_compression;
- sess->conns[cur]->proxy_auth_header = sess->conns[0]->proxy_auth_header;
- sess->conns[cur]->proxy_auth_value = sess->conns[0]->proxy_auth_value;
sess->conns[cur]->useragent = sess->conns[0]->useragent;
sess->conns[cur]->last_status_code = -1;
sess->conns[cur]->ssl_context = NULL;
@@ -2216,15 +2213,6 @@ open_connection_if_needed(svn_ra_serf__s
return svn_error_wrap_apr(status, NULL);
sess->num_conns++;
-
- /* Authentication protocol specific initalization. */
- if (sess->auth_protocol)
- SVN_ERR(sess->auth_protocol->init_conn_func(sess, sess->conns[cur],
- sess->pool));
- if (sess->proxy_auth_protocol)
- SVN_ERR(sess->proxy_auth_protocol->init_conn_func(sess,
- sess->conns[cur],
- sess->pool));
}
return SVN_NO_ERROR;
@@ -2262,6 +2250,7 @@ finish_report(void *report_baton,
svn_boolean_t closed_root;
int status_code, i;
svn_stringbuf_t *buf = NULL;
+ apr_pool_t *iterpool;
svn_xml_make_close_tag(&buf, pool, "S:update-report");
SVN_ERR(svn_io_file_write_full(report->body_file, buf->data, buf->len,
@@ -2319,10 +2308,14 @@ finish_report(void *report_baton,
sess->cur_conn = 1;
closed_root = FALSE;
+ iterpool = svn_pool_create(pool);
while (!report->done || report->active_fetches || report->active_propfinds)
{
svn_error_t *err;
- status = serf_context_run(sess->context, sess->timeout, pool);
+
+ svn_pool_clear(iterpool);
+
+ status = serf_context_run(sess->context, sess->timeout, iterpool);
err = sess->pending_error;
sess->pending_error = SVN_NO_ERROR;
@@ -2454,6 +2447,7 @@ finish_report(void *report_baton,
serf_debug__closed_conn(sess->conns[i]->bkt_alloc);
}
}
+ svn_pool_destroy(iterpool);
/* Ensure that we opened and closed our root dir and that we closed
* all of our children. */
@@ -2707,6 +2701,7 @@ svn_ra_serf__get_file(svn_ra_session_t *
svn_ra_serf__handler_t *handler;
const char *fetch_url;
apr_hash_t *fetch_props;
+ svn_node_kind_t res_kind;
/* What connection should we go on? */
conn = session->conns[session->cur_conn];
@@ -2721,25 +2716,36 @@ svn_ra_serf__get_file(svn_ra_session_t *
* Otherwise, we need to get the baseline version for this particular
* revision and then fetch that file.
*/
- if (SVN_IS_VALID_REVNUM(revision))
+ if (SVN_IS_VALID_REVNUM(revision) || fetched_rev)
{
const char *baseline_url, *rel_path;
SVN_ERR(svn_ra_serf__get_baseline_info(&baseline_url, &rel_path,
session, conn, fetch_url,
- revision, NULL, pool));
+ revision, fetched_rev, pool));
fetch_url = svn_path_url_add_component2(baseline_url, rel_path, pool);
revision = SVN_INVALID_REVNUM;
}
+ SVN_ERR(svn_ra_serf__retrieve_props(fetch_props, session, conn, fetch_url,
+ revision, "0",
+ props ? all_props : check_path_props,
+ pool));
+
+ /* Verify that resource type is not colelction. */
+ SVN_ERR(svn_ra_serf__get_resource_type(&res_kind, fetch_props, fetch_url,
+ revision));
+ if (res_kind != svn_node_file)
+ {
+ return svn_error_create(SVN_ERR_FS_NOT_FILE, NULL,
+ _("Can't get text contents of a directory"));
+ }
+
/* TODO Filter out all of our props into a usable format. */
if (props)
{
*props = apr_hash_make(pool);
- SVN_ERR(svn_ra_serf__retrieve_props(fetch_props, session, conn, fetch_url,
- revision, "0", all_props, pool));
-
SVN_ERR(svn_ra_serf__walk_all_props(fetch_props, fetch_url, revision,
svn_ra_serf__set_flat_props, *props, pool));
}
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/util.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/util.c Mon Feb 21 20:40:44 2011
@@ -326,10 +326,6 @@ conn_setup(apr_socket_t *sock,
return SVN_NO_ERROR;
}
-#if SERF_VERSION_AT_LEAST(0, 4, 0)
-/* This ugly ifdef construction can be cleaned up as soon as serf >= 0.4
- gets the minimum supported serf version! */
-
/* svn_ra_serf__conn_setup is a callback for serf. This function
creates a read bucket and will wrap the write bucket if SSL
is needed. */
@@ -340,18 +336,6 @@ svn_ra_serf__conn_setup(apr_socket_t *so
void *baton,
apr_pool_t *pool)
{
-#else
-/* This is the old API, for compatibility with serf
- versions <= 0.3. */
-serf_bucket_t *
-svn_ra_serf__conn_setup(apr_socket_t *sock,
- void *baton,
- apr_pool_t *pool)
-{
- serf_bucket_t **write_bkt = NULL;
- serf_bucket_t *rb = NULL;
- serf_bucket_t **read_bkt = &rb;
-#endif
svn_ra_serf__connection_t *conn = baton;
svn_ra_serf__session_t *session = conn->session;
apr_status_t status = SVN_NO_ERROR;
@@ -371,12 +355,7 @@ svn_ra_serf__conn_setup(apr_socket_t *so
status = session->pending_error->apr_err;
}
-#if ! SERF_VERSION_AT_LEAST(0, 4, 0)
- SVN_ERR_ASSERT_NO_RETURN(rb != NULL);
- return rb;
-#else
return status;
-#endif
}
serf_bucket_t*
@@ -425,12 +404,6 @@ connection_closed(serf_connection_t *con
if (sc->using_ssl)
sc->ssl_context = NULL;
- /* Restart the authentication phase on this new connection. */
- if (sc->session->auth_protocol)
- SVN_ERR(sc->session->auth_protocol->init_conn_func(sc->session,
- sc,
- sc->session->pool));
-
return SVN_NO_ERROR;
}
@@ -619,38 +592,6 @@ svn_ra_serf__setup_serf_req(serf_request
serf_bucket_headers_set(hdrs_bkt, "DAV", SVN_DAV_NS_DAV_SVN_MERGEINFO);
serf_bucket_headers_set(hdrs_bkt, "DAV", SVN_DAV_NS_DAV_SVN_LOG_REVPROPS);
- /* Setup server authorization headers */
- if (conn->session->auth_protocol)
- SVN_ERR(conn->session->auth_protocol->setup_request_func(conn, method, url,
- hdrs_bkt));
-
- /* Setup proxy authorization headers */
- if (conn->session->proxy_auth_protocol)
- SVN_ERR(conn->session->proxy_auth_protocol->setup_request_func(conn,
- method,
- url,
- hdrs_bkt));
-
-#if ! SERF_VERSION_AT_LEAST(0, 4, 0)
- /* Set up SSL if we need to */
- if (conn->using_ssl)
- {
- *req_bkt = serf_bucket_ssl_encrypt_create(*req_bkt, conn->ssl_context,
- serf_request_get_alloc(request));
- if (!conn->ssl_context)
- {
- conn->ssl_context = serf_bucket_ssl_encrypt_context_get(*req_bkt);
-
- serf_ssl_client_cert_provider_set(conn->ssl_context,
- svn_ra_serf__handle_client_cert,
- conn, conn->session->pool);
- serf_ssl_client_cert_password_set(conn->ssl_context,
- svn_ra_serf__handle_client_cert_pw,
- conn, conn->session->pool);
- }
- }
-#endif
-
if (ret_hdrs_bkt)
{
*ret_hdrs_bkt = hdrs_bkt;
@@ -665,19 +606,23 @@ svn_ra_serf__context_run_wait(svn_boolea
apr_pool_t *pool)
{
apr_status_t status;
+ apr_pool_t *iterpool;
assert(sess->pending_error == SVN_NO_ERROR);
+ iterpool = svn_pool_create(pool);
while (!*done)
{
svn_error_t *err;
int i;
+ svn_pool_clear(iterpool);
+
if (sess->wc_callbacks &&
sess->wc_callbacks->cancel_func)
SVN_ERR((sess->wc_callbacks->cancel_func)(sess->wc_callback_baton));
- status = serf_context_run(sess->context, sess->timeout, pool);
+ status = serf_context_run(sess->context, sess->timeout, iterpool);
err = sess->pending_error;
sess->pending_error = SVN_NO_ERROR;
@@ -709,6 +654,7 @@ svn_ra_serf__context_run_wait(svn_boolea
serf_debug__closed_conn(sess->conns[i]->bkt_alloc);
}
}
+ svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -1508,34 +1454,11 @@ handle_response(serf_request_t *request,
ctx->session->pool));
ctx->session->auth_attempts = 0;
ctx->session->auth_state = NULL;
- ctx->session->realm = NULL;
}
ctx->conn->last_status_code = sl.code;
- if (sl.code == 401 || sl.code == 407)
- {
- /* 401 Authorization or 407 Proxy-Authentication required */
- status = svn_ra_serf__response_discard_handler(request, response, NULL, pool);
-
- /* Don't bother handling the authentication request if the response
- wasn't received completely yet. Serf will call handle_response
- again when more data is received. */
- if (APR_STATUS_IS_EAGAIN(status))
- {
- *serf_status = status;
- return SVN_NO_ERROR;
- }
-
- SVN_ERR(svn_ra_serf__handle_auth(sl.code, ctx,
- request, response, pool));
-
- svn_ra_serf__priority_request_create(ctx);
-
- *serf_status = status;
- return SVN_NO_ERROR;
- }
- else if (sl.code == 409 || sl.code >= 500)
+ if (sl.code == 409 || sl.code >= 500)
{
/* 409 Conflict: can indicate a hook error.
5xx (Internal) Server error. */
@@ -1554,28 +1477,6 @@ handle_response(serf_request_t *request,
{
svn_error_t *err;
- /* Validate this response message. */
- if (ctx->session->auth_protocol ||
- ctx->session->proxy_auth_protocol)
- {
- const svn_ra_serf__auth_protocol_t *prot;
-
- if (ctx->session->auth_protocol)
- prot = ctx->session->auth_protocol;
- else
- prot = ctx->session->proxy_auth_protocol;
-
- err = prot->validate_response_func(ctx, request, response, pool);
- if (err)
- {
- svn_ra_serf__response_discard_handler(request, response, NULL,
- pool);
- /* Ignore serf status code, just return the real error */
-
- return svn_error_return(err);
- }
- }
-
err = ctx->response_handler(request,response, ctx->response_baton, pool);
if (err
@@ -1732,13 +1633,6 @@ svn_ra_serf__request_create(svn_ra_serf_
setup_request_cb, handler);
}
-serf_request_t *
-svn_ra_serf__priority_request_create(svn_ra_serf__handler_t *handler)
-{
- return serf_connection_priority_request_create(handler->conn->conn,
- setup_request_cb, handler);
-}
-
svn_error_t *
svn_ra_serf__discover_vcc(const char **vcc_url,
svn_ra_serf__session_t *session,
@@ -1805,12 +1699,10 @@ svn_ra_serf__discover_vcc(const char **v
/* Okay, strip off a component from PATH. */
path = svn_urlpath__dirname(path, pool);
-#if SERF_VERSION_AT_LEAST(0, 4, 0)
/* An error occurred on conns. serf 0.4.0 remembers that
the connection had a problem. We need to reset it, in
order to use it again. */
serf_connection_reset(conn->conn);
-#endif
}
}
}
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/editorp.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/editorp.c Mon Feb 21 20:40:44 2011
@@ -316,10 +316,16 @@ static svn_error_t *ra_svn_apply_textdel
diff_stream = svn_stream_create(b, pool);
svn_stream_set_write(diff_stream, ra_svn_svndiff_handler);
svn_stream_set_close(diff_stream, ra_svn_svndiff_close_handler);
- if (svn_ra_svn_has_capability(b->conn, SVN_RA_SVN_CAP_SVNDIFF1))
- svn_txdelta_to_svndiff2(wh, wh_baton, diff_stream, 1, pool);
+
+ /* If the connection does not support SVNDIFF1 or if we don't want to use
+ * compression, use the non-compressing "version 0" implementation */
+ if ( svn_ra_svn_compression_level(b->conn) > 0
+ && svn_ra_svn_has_capability(b->conn, SVN_RA_SVN_CAP_SVNDIFF1))
+ svn_txdelta_to_svndiff3(wh, wh_baton, diff_stream, 1,
+ b->conn->compression_level, pool);
else
- svn_txdelta_to_svndiff2(wh, wh_baton, diff_stream, 0, pool);
+ svn_txdelta_to_svndiff3(wh, wh_baton, diff_stream, 0,
+ b->conn->compression_level, pool);
return SVN_NO_ERROR;
}
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/marshal.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/marshal.c Mon Feb 21 20:40:44 2011
@@ -52,10 +52,11 @@
/* --- CONNECTION INITIALIZATION --- */
-svn_ra_svn_conn_t *svn_ra_svn_create_conn(apr_socket_t *sock,
- apr_file_t *in_file,
- apr_file_t *out_file,
- apr_pool_t *pool)
+svn_ra_svn_conn_t *svn_ra_svn_create_conn2(apr_socket_t *sock,
+ apr_file_t *in_file,
+ apr_file_t *out_file,
+ int compression_level,
+ apr_pool_t *pool)
{
svn_ra_svn_conn_t *conn = apr_palloc(pool, sizeof(*conn));
@@ -71,6 +72,7 @@ svn_ra_svn_conn_t *svn_ra_svn_create_con
conn->block_handler = NULL;
conn->block_baton = NULL;
conn->capabilities = apr_hash_make(pool);
+ conn->compression_level = compression_level;
conn->pool = pool;
if (sock != NULL)
@@ -90,6 +92,16 @@ svn_ra_svn_conn_t *svn_ra_svn_create_con
return conn;
}
+/* backward-compatible implementation using the default compression level */
+svn_ra_svn_conn_t *svn_ra_svn_create_conn(apr_socket_t *sock,
+ apr_file_t *in_file,
+ apr_file_t *out_file,
+ apr_pool_t *pool)
+{
+ return svn_ra_svn_create_conn2(sock, in_file, out_file,
+ SVN_DEFAULT_COMPRESSION_LEVEL, pool);
+}
+
svn_error_t *svn_ra_svn_set_capabilities(svn_ra_svn_conn_t *conn,
const apr_array_header_t *list)
{
@@ -116,6 +128,12 @@ svn_boolean_t svn_ra_svn_has_capability(
APR_HASH_KEY_STRING) != NULL);
}
+int
+svn_ra_svn_compression_level(svn_ra_svn_conn_t *conn)
+{
+ return conn->compression_level;
+}
+
const char *svn_ra_svn_conn_remote_host(svn_ra_svn_conn_t *conn)
{
return conn->remote_ip;
@@ -602,7 +620,7 @@ static svn_error_t *read_string(svn_ra_s
* enough to prevent re-allocation as long as the data transmission
* is not flawed.
*/
- stringbuf = svn_stringbuf_create_ensure(len, pool);
+ stringbuf = svn_stringbuf_create_ensure((apr_size_t)len, pool);
/* Read the string data directly into the string structure.
* Do it iteratively, if necessary.
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/ra_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/ra_svn.h?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/ra_svn.h (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/ra_svn.h Mon Feb 21 20:40:44 2011
@@ -85,6 +85,7 @@ struct svn_ra_svn_conn_st {
ra_svn_block_handler_t block_handler;
void *block_baton;
apr_hash_t *capabilities;
+ int compression_level;
char *remote_ip;
apr_pool_t *pool;
};
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/authz.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/authz.c Mon Feb 21 20:40:44 2011
@@ -746,7 +746,7 @@ svn_repos_authz_read(svn_authz_t **authz
baton.err = SVN_NO_ERROR;
/* Load the rule file. */
- SVN_ERR(svn_config_read(&authz->cfg, file, must_exist, pool));
+ SVN_ERR(svn_config_read2(&authz->cfg, file, must_exist, TRUE, pool));
baton.config = authz->cfg;
/* Step through the entire rule file, stopping on error. */
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/commit.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/commit.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/commit.c Mon Feb 21 20:40:44 2011
@@ -568,16 +568,9 @@ close_file(void *file_baton,
text_digest, pool));
if (!svn_checksum_match(text_checksum, checksum))
- {
- return svn_error_createf
- (SVN_ERR_CHECKSUM_MISMATCH, NULL,
- apr_psprintf(pool, "%s:\n%s\n%s\n",
- _("Checksum mismatch for resulting fulltext\n(%s)"),
- _(" expected: %s"),
- _(" actual: %s")),
- fb->path, svn_checksum_to_cstring_display(text_checksum, pool),
- svn_checksum_to_cstring_display(checksum, pool));
- }
+ return svn_checksum_mismatch_err(text_checksum, checksum, pool,
+ _("Checksum mismatch for resulting fulltext\n(%s)"),
+ fb->path);
}
return SVN_NO_ERROR;
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/load-fs-vtable.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/load-fs-vtable.c Mon Feb 21 20:40:44 2011
@@ -516,18 +516,11 @@ maybe_add_with_history(struct node_baton
SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5, copy_root,
nb->copyfrom_path, TRUE, pool));
if (!svn_checksum_match(nb->copy_source_checksum, checksum))
- return svn_error_createf
- (SVN_ERR_CHECKSUM_MISMATCH,
- NULL,
- apr_psprintf(pool, "%s:\n%s\n%s\n",
- _("Copy source checksum mismatch on copy from '%s'@%ld\n"
- "to '%s' in rev based on r%ld"),
- _(" expected: %s"),
- _(" actual: %s")),
- nb->copyfrom_path, src_rev,
- nb->path, rb->rev,
- svn_checksum_to_cstring_display(nb->copy_source_checksum, pool),
- svn_checksum_to_cstring_display(checksum, pool));
+ return svn_checksum_mismatch_err(nb->copy_source_checksum,
+ checksum, pool,
+ _("Copy source checksum mismatch on copy from '%s'@%ld\n"
+ "to '%s' in rev based on r%ld"),
+ nb->copyfrom_path, src_rev, nb->path, rb->rev);
}
SVN_ERR(svn_fs_copy(copy_root, nb->copyfrom_path,
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/replay.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/replay.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/replay.c Mon Feb 21 20:40:44 2011
@@ -34,6 +34,7 @@
#include "svn_pools.h"
#include "svn_path.h"
#include "svn_private_config.h"
+#include "private/svn_fspath.h"
/*** Backstory ***/
@@ -107,9 +108,11 @@
working on and which was added with history. */
struct copy_info
{
- /* Destination path. */
+ /* Destination relpath (relative to the root of the . */
const char *path;
- /* Copy source. NULL/invalid if this is an add without history,
+
+ /* Copy source path (expressed as an absolute FS path) or revision.
+ NULL and SVN_INVALID_REVNUM if this is an add without history,
nested inside an add with history. */
const char *copyfrom_path;
svn_revnum_t copyfrom_rev;
@@ -132,7 +135,7 @@ struct path_driver_cb_baton
svn_repos_authz_func_t authz_read_func;
void *authz_read_baton;
- const char *base_path;
+ const char *base_path; /* relpath */
int base_path_len;
svn_revnum_t low_water_mark;
@@ -143,7 +146,7 @@ struct path_driver_cb_baton
apr_pool_t *pool;
};
-/* Recursively traverse PATH (as it exists under SOURCE_ROOT) emitting
+/* Recursively traverse EDIT_PATH (as it exists under SOURCE_ROOT) emitting
the appropriate editor calls to add it and its children without any
history. This is meant to be used when either a subset of the tree
has been ignored and we need to copy something from that subset to
@@ -155,9 +158,9 @@ add_subdir(svn_fs_root_t *source_root,
svn_fs_root_t *target_root,
const svn_delta_editor_t *editor,
void *edit_baton,
- const char *path,
+ const char *edit_path,
void *parent_baton,
- const char *source_path,
+ const char *source_fspath,
svn_repos_authz_func_t authz_read_func,
void *authz_read_baton,
apr_hash_t *changed_paths,
@@ -169,10 +172,10 @@ add_subdir(svn_fs_root_t *source_root,
apr_hash_t *dirents;
apr_hash_t *props;
- SVN_ERR(editor->add_directory(path, parent_baton, NULL,
+ SVN_ERR(editor->add_directory(edit_path, parent_baton, NULL,
SVN_INVALID_REVNUM, pool, dir_baton));
- SVN_ERR(svn_fs_node_proplist(&props, target_root, path, pool));
+ SVN_ERR(svn_fs_node_proplist(&props, target_root, edit_path, pool));
for (phi = apr_hash_first(pool, props); phi; phi = apr_hash_next(phi))
{
@@ -180,19 +183,14 @@ add_subdir(svn_fs_root_t *source_root,
void *val;
svn_pool_clear(subpool);
-
apr_hash_this(phi, &key, NULL, &val);
-
- SVN_ERR(editor->change_dir_prop(*dir_baton,
- key,
- val,
- subpool));
+ SVN_ERR(editor->change_dir_prop(*dir_baton, key, val, subpool));
}
/* We have to get the dirents from the source path, not the target,
because we want nested copies from *readable* paths to be handled by
path_driver_cb_func, not add_subdir (in order to preserve history). */
- SVN_ERR(svn_fs_dir_entries(&dirents, source_root, source_path, pool));
+ SVN_ERR(svn_fs_dir_entries(&dirents, source_root, source_fspath, pool));
for (hi = apr_hash_first(pool, dirents); hi; hi = apr_hash_next(hi))
{
@@ -201,7 +199,7 @@ add_subdir(svn_fs_root_t *source_root,
svn_fs_dirent_t *dent;
const char *copyfrom_path = NULL;
svn_revnum_t copyfrom_rev = SVN_INVALID_REVNUM;
- const char *new_path;
+ const char *new_edit_path;
void *val;
svn_pool_clear(subpool);
@@ -210,26 +208,30 @@ add_subdir(svn_fs_root_t *source_root,
dent = val;
- new_path = svn_path_join(path, dent->name, subpool);
+ new_edit_path = svn_relpath_join(edit_path, dent->name, subpool);
/* If a file or subdirectory of the copied directory is listed as a
changed path (because it was modified after the copy but before the
commit), we remove it from the changed_paths hash so that future
calls to path_driver_cb_func will ignore it. */
- change = apr_hash_get(changed_paths, new_path, APR_HASH_KEY_STRING);
+ change = apr_hash_get(changed_paths, new_edit_path, APR_HASH_KEY_STRING);
if (change)
{
- apr_hash_set(changed_paths, new_path, APR_HASH_KEY_STRING, NULL);
+ apr_hash_set(changed_paths, new_edit_path, APR_HASH_KEY_STRING, NULL);
+
/* If it's a delete, skip this entry. */
if (change->change_kind == svn_fs_path_change_delete)
continue;
- else if (change->change_kind == svn_fs_path_change_replace)
+
+ /* If it's a replacement, check for copyfrom info (if we
+ don't have it already. */
+ if (change->change_kind == svn_fs_path_change_replace)
{
if (! change->copyfrom_known)
{
SVN_ERR(svn_fs_copied_from(&change->copyfrom_rev,
&change->copyfrom_path,
- target_root, new_path, pool));
+ target_root, new_edit_path, pool));
change->copyfrom_known = TRUE;
}
copyfrom_path = change->copyfrom_path;
@@ -238,7 +240,7 @@ add_subdir(svn_fs_root_t *source_root,
}
if (authz_read_func)
- SVN_ERR(authz_read_func(&readable, target_root, new_path,
+ SVN_ERR(authz_read_func(&readable, target_root, new_edit_path,
authz_read_baton, pool));
if (! readable)
@@ -247,40 +249,40 @@ add_subdir(svn_fs_root_t *source_root,
if (dent->kind == svn_node_dir)
{
svn_fs_root_t *new_source_root;
- const char *new_source_path;
+ const char *new_source_fspath;
void *new_dir_baton;
if (copyfrom_path)
{
svn_fs_t *fs = svn_fs_root_fs(source_root);
- SVN_ERR(svn_fs_revision_root(&new_source_root, fs, copyfrom_rev,
- pool));
- new_source_path = copyfrom_path;
+ SVN_ERR(svn_fs_revision_root(&new_source_root, fs,
+ copyfrom_rev, pool));
+ new_source_fspath = copyfrom_path;
}
else
{
new_source_root = source_root;
- new_source_path = svn_path_join(source_path, dent->name,
- subpool);
+ new_source_fspath = svn_fspath__join(source_fspath, dent->name,
+ subpool);
}
/* ### authz considerations?
*
* I think not; when path_driver_cb_func() calls add_subdir(), it
- * passes SOURCE_ROOT and SOURCE_PATH that are unreadable.
+ * passes SOURCE_ROOT and SOURCE_FSPATH that are unreadable.
*/
if (change && change->change_kind == svn_fs_path_change_replace
&& copyfrom_path == NULL)
{
- SVN_ERR(editor->add_directory(new_path, *dir_baton,
+ SVN_ERR(editor->add_directory(new_edit_path, *dir_baton,
NULL, SVN_INVALID_REVNUM,
subpool, &new_dir_baton));
}
else
{
- SVN_ERR(add_subdir(new_source_root, target_root, editor, edit_baton,
- new_path, *dir_baton,
- new_source_path,
+ SVN_ERR(add_subdir(new_source_root, target_root,
+ editor, edit_baton, new_edit_path,
+ *dir_baton, new_source_fspath,
authz_read_func, authz_read_baton,
changed_paths, subpool, &new_dir_baton));
}
@@ -294,32 +296,27 @@ add_subdir(svn_fs_root_t *source_root,
svn_txdelta_stream_t *delta_stream;
svn_checksum_t *checksum;
- SVN_ERR(editor->add_file(new_path, *dir_baton, NULL,
+ SVN_ERR(editor->add_file(new_edit_path, *dir_baton, NULL,
SVN_INVALID_REVNUM, pool, &file_baton));
- SVN_ERR(svn_fs_node_proplist(&props, target_root, new_path, subpool));
+ SVN_ERR(svn_fs_node_proplist(&props, target_root,
+ new_edit_path, subpool));
- for (phi = apr_hash_first(pool, props);
- phi;
- phi = apr_hash_next(phi))
+ for (phi = apr_hash_first(pool, props); phi; phi = apr_hash_next(phi))
{
const void *key;
apr_hash_this(phi, &key, NULL, &val);
-
- SVN_ERR(editor->change_file_prop(file_baton,
- key,
- val,
- subpool));
+ SVN_ERR(editor->change_file_prop(file_baton, key, val, subpool));
}
SVN_ERR(editor->apply_textdelta(file_baton, NULL, pool,
&delta_handler,
&delta_handler_baton));
- SVN_ERR(svn_fs_get_file_delta_stream
- (&delta_stream, NULL, NULL, target_root, new_path,
- pool));
+ SVN_ERR(svn_fs_get_file_delta_stream(&delta_stream, NULL, NULL,
+ target_root, new_edit_path,
+ pool));
SVN_ERR(svn_txdelta_send_txstream(delta_stream,
delta_handler,
@@ -327,7 +324,7 @@ add_subdir(svn_fs_root_t *source_root,
pool));
SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5, target_root,
- new_path, TRUE, pool));
+ new_edit_path, TRUE, pool));
SVN_ERR(editor->close_file(file_baton,
svn_checksum_to_cstring(checksum, pool),
pool));
@@ -359,7 +356,7 @@ static svn_error_t *
path_driver_cb_func(void **dir_baton,
void *parent_baton,
void *callback_baton,
- const char *path,
+ const char *edit_path,
apr_pool_t *pool)
{
struct path_driver_cb_baton *cb = callback_baton;
@@ -373,21 +370,25 @@ path_driver_cb_func(void **dir_baton,
const char *copyfrom_path;
svn_boolean_t src_readable = TRUE;
svn_fs_root_t *source_root = cb->compare_root;
- const char *source_path = source_root ? path : NULL;
+ const char *source_fspath = NULL;
const char *base_path = cb->base_path;
int base_path_len = cb->base_path_len;
*dir_baton = NULL;
+ /* Initialize SOURCE_FSPATH. */
+ if (source_root)
+ source_fspath = svn_fspath__canonicalize(edit_path, pool);
+
/* First, flush the copies stack so it only contains ancestors of path. */
while (cb->copies->nelts > 0
&& ! svn_dirent_is_ancestor(APR_ARRAY_IDX(cb->copies,
cb->copies->nelts - 1,
struct copy_info).path,
- path))
+ edit_path))
cb->copies->nelts--;
- change = apr_hash_get(cb->changed_paths, path, APR_HASH_KEY_STRING);
+ change = apr_hash_get(cb->changed_paths, edit_path, APR_HASH_KEY_STRING);
if (! change)
{
/* This can only happen if the path was removed from cb->changed_paths
@@ -418,19 +419,19 @@ path_driver_cb_func(void **dir_baton,
/* Handle any deletions. */
if (do_delete)
- SVN_ERR(editor->delete_entry(path, SVN_INVALID_REVNUM,
+ SVN_ERR(editor->delete_entry(edit_path, SVN_INVALID_REVNUM,
parent_baton, pool));
/* Fetch the node kind if it makes sense to do so. */
if (! do_delete || do_add)
{
if (change->node_kind == svn_node_unknown)
- SVN_ERR(svn_fs_check_path(&(change->node_kind), root, path, pool));
+ SVN_ERR(svn_fs_check_path(&(change->node_kind), root, edit_path, pool));
if ((change->node_kind != svn_node_dir) &&
(change->node_kind != svn_node_file))
- return svn_error_createf
- (SVN_ERR_FS_NOT_FOUND, NULL,
- _("Filesystem path '%s' is neither a file nor a directory"), path);
+ return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
+ _("Filesystem path '%s' is neither a file "
+ "nor a directory"), edit_path);
}
/* Handle any adds/opens. */
@@ -442,7 +443,7 @@ path_driver_cb_func(void **dir_baton,
{
SVN_ERR(svn_fs_copied_from(&(change->copyfrom_rev),
&(change->copyfrom_path),
- root, path, pool));
+ root, edit_path, pool));
change->copyfrom_known = TRUE;
}
copyfrom_rev = change->copyfrom_rev;
@@ -467,10 +468,10 @@ path_driver_cb_func(void **dir_baton,
then we just null them out and do a raw add with no history at
all. */
if (copyfrom_path
- && (! src_readable
- || ! is_within_base_path(copyfrom_path + 1, base_path,
- base_path_len)
- || cb->low_water_mark > copyfrom_rev))
+ && ((! src_readable)
+ || (! is_within_base_path(copyfrom_path + 1, base_path,
+ base_path_len))
+ || (cb->low_water_mark > copyfrom_rev)))
{
copyfrom_path = NULL;
copyfrom_rev = SVN_INVALID_REVNUM;
@@ -485,20 +486,20 @@ path_driver_cb_func(void **dir_baton,
if (change->copyfrom_path && ! copyfrom_path)
{
SVN_ERR(add_subdir(copyfrom_root, root, editor, edit_baton,
- path, parent_baton, change->copyfrom_path,
+ edit_path, parent_baton, change->copyfrom_path,
cb->authz_read_func, cb->authz_read_baton,
cb->changed_paths, pool, dir_baton));
}
else
{
- SVN_ERR(editor->add_directory(path, parent_baton,
+ SVN_ERR(editor->add_directory(edit_path, parent_baton,
copyfrom_path, copyfrom_rev,
pool, dir_baton));
}
}
else
{
- SVN_ERR(editor->add_file(path, parent_baton, copyfrom_path,
+ SVN_ERR(editor->add_file(edit_path, parent_baton, copyfrom_path,
copyfrom_rev, pool, &file_baton));
}
@@ -512,7 +513,7 @@ path_driver_cb_func(void **dir_baton,
{
struct copy_info *info = &APR_ARRAY_PUSH(cb->copies,
struct copy_info);
- info->path = apr_pstrdup(cb->pool, path);
+ info->path = apr_pstrdup(cb->pool, edit_path);
info->copyfrom_path = apr_pstrdup(cb->pool, copyfrom_path);
info->copyfrom_rev = copyfrom_rev;
}
@@ -520,7 +521,7 @@ path_driver_cb_func(void **dir_baton,
/* Save the source so that we can use it later, when we
need to generate text and prop deltas. */
source_root = copyfrom_root;
- source_path = copyfrom_path;
+ source_fspath = copyfrom_path;
}
else
/* Else, we are an add without history... */
@@ -532,12 +533,12 @@ path_driver_cb_func(void **dir_baton,
{
struct copy_info *info = &APR_ARRAY_PUSH(cb->copies,
struct copy_info);
- info->path = apr_pstrdup(cb->pool, path);
+ info->path = apr_pstrdup(cb->pool, edit_path);
info->copyfrom_path = NULL;
info->copyfrom_rev = SVN_INVALID_REVNUM;
}
source_root = NULL;
- source_path = NULL;
+ source_fspath = NULL;
}
}
else if (! do_delete)
@@ -548,7 +549,7 @@ path_driver_cb_func(void **dir_baton,
{
if (parent_baton)
{
- SVN_ERR(editor->open_directory(path, parent_baton,
+ SVN_ERR(editor->open_directory(edit_path, parent_baton,
SVN_INVALID_REVNUM,
pool, dir_baton));
}
@@ -560,7 +561,7 @@ path_driver_cb_func(void **dir_baton,
}
else
{
- SVN_ERR(editor->open_file(path, parent_baton, SVN_INVALID_REVNUM,
+ SVN_ERR(editor->open_file(edit_path, parent_baton, SVN_INVALID_REVNUM,
pool, &file_baton));
}
/* If we are inside an add with history, we need to adjust the
@@ -572,19 +573,20 @@ path_driver_cb_func(void **dir_baton,
struct copy_info);
if (info->copyfrom_path)
{
+ const char *relpath = svn_relpath_is_child(info->path,
+ edit_path, pool);
SVN_ERR(svn_fs_revision_root(&source_root,
svn_fs_root_fs(root),
info->copyfrom_rev, pool));
- source_path = svn_path_join(info->copyfrom_path,
- svn_path_is_child(info->path, path,
- pool), pool);
+ source_fspath = svn_fspath__join(info->copyfrom_path,
+ relpath, pool);
}
else
{
/* This is an add without history, nested inside an
add with history. We have no delta source in this case. */
source_root = NULL;
- source_path = NULL;
+ source_fspath = NULL;
}
}
}
@@ -602,12 +604,12 @@ path_driver_cb_func(void **dir_baton,
int i;
if (source_root)
- SVN_ERR(svn_fs_node_proplist
- (&old_props, source_root, source_path, pool));
+ SVN_ERR(svn_fs_node_proplist(&old_props, source_root,
+ source_fspath, pool));
else
old_props = apr_hash_make(pool);
- SVN_ERR(svn_fs_node_proplist(&new_props, root, path, pool));
+ SVN_ERR(svn_fs_node_proplist(&new_props, root, edit_path, pool));
SVN_ERR(svn_prop_diffs(&prop_diffs, new_props, old_props,
pool));
@@ -649,11 +651,11 @@ path_driver_cb_func(void **dir_baton,
void *delta_handler_baton;
const char *hex_digest = NULL;
- if (cb->compare_root && source_root && source_path)
+ if (cb->compare_root && source_root && source_fspath)
{
svn_checksum_t *checksum;
SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5,
- source_root, source_path, TRUE,
+ source_root, source_fspath, TRUE,
pool));
hex_digest = svn_checksum_to_cstring(checksum, pool);
}
@@ -665,14 +667,11 @@ path_driver_cb_func(void **dir_baton,
{
svn_txdelta_stream_t *delta_stream;
- SVN_ERR(svn_fs_get_file_delta_stream
- (&delta_stream, source_root, source_path,
- root, path, pool));
-
- SVN_ERR(svn_txdelta_send_txstream(delta_stream,
- delta_handler,
- delta_handler_baton,
- pool));
+ SVN_ERR(svn_fs_get_file_delta_stream(&delta_stream, source_root,
+ source_fspath, root,
+ edit_path, pool));
+ SVN_ERR(svn_txdelta_send_txstream(delta_stream, delta_handler,
+ delta_handler_baton, pool));
}
else
SVN_ERR(delta_handler(NULL, delta_handler_baton));
@@ -683,7 +682,7 @@ path_driver_cb_func(void **dir_baton,
if (file_baton)
{
svn_checksum_t *checksum;
- SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5, root, path,
+ SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5, root, edit_path,
TRUE, pool));
SVN_ERR(editor->close_file(file_baton,
svn_checksum_to_cstring(checksum, pool),
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/reporter.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/reporter.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/reporter.c Mon Feb 21 20:40:44 2011
@@ -201,7 +201,7 @@ read_string(const char **str, apr_file_t
size = (apr_size_t)len;
buf = apr_palloc(pool, size+1);
- SVN_ERR(svn_io_file_read_full(temp, buf, size, NULL, pool));
+ SVN_ERR(svn_io_file_read_full2(temp, buf, size, NULL, NULL, pool));
buf[len] = 0;
*str = buf;
return SVN_NO_ERROR;
@@ -1454,7 +1454,7 @@ svn_repos_begin_report2(void **report_ba
b->s_operand = apr_pstrdup(pool, s_operand);
b->t_rev = revnum;
b->t_path = switch_path ? svn_fspath__canonicalize(switch_path, pool)
- : svn_fspath__join(fs_base, s_operand, pool);
+ : svn_fspath__join(b->fs_base, s_operand, pool);
b->text_deltas = text_deltas;
b->requested_depth = depth;
b->ignore_ancestry = ignore_ancestry;
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/repos.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/repos.c Mon Feb 21 20:40:44 2011
@@ -1369,6 +1369,7 @@ svn_repos_create(svn_repos_t **repos_p,
svn_repos_t *repos;
svn_error_t *err;
const char *root_path;
+ const char *local_abspath;
/* Allocate a repository object, filling in the format we will create. */
repos = create_svn_repos_t(path, pool);
@@ -1388,13 +1389,21 @@ svn_repos_create(svn_repos_t **repos_p,
repos->fs_type = DEFAULT_FS_TYPE;
/* Don't create a repository inside another repository. */
- root_path = svn_repos_find_root_path(path, pool);
+ SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+ root_path = svn_repos_find_root_path(local_abspath, pool);
if (root_path != NULL)
- return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL, _("'%s' is a "
- "subdirectory of an existing repository rooted "
- "at '%s'"),
- svn_dirent_local_style(path, pool),
- svn_dirent_local_style(root_path, pool));
+ {
+ if (strcmp(root_path, local_abspath) == 0)
+ return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL,
+ _("'%s' is an existing repository"),
+ svn_dirent_local_style(root_path, pool));
+ else
+ return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL,
+ _("'%s' is a subdirectory of an existing "
+ "repository " "rooted at '%s'"),
+ svn_dirent_local_style(local_abspath, pool),
+ svn_dirent_local_style(root_path, pool));
+ }
/* Create the various files and subdirectories for the repository. */
SVN_ERR_W(create_repos_structure(repos, path, fs_config, pool),
Propchange: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/adler32.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb 21 20:40:44 2011
@@ -1,3 +1,3 @@
/subversion/branches/diff-optimizations/subversion/libsvn_subr/adler32.c:1031270-1037352
/subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/adler32.c:1037353-1067789
-/subversion/trunk/subversion/libsvn_subr/adler32.c:1054732-1068046
+/subversion/trunk/subversion/libsvn_subr/adler32.c:1054732-1073136
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-inprocess.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-inprocess.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-inprocess.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-inprocess.c Mon Feb 21 20:40:44 2011
@@ -37,8 +37,11 @@ typedef struct inprocess_cache_t {
apr_hash_t *hash;
apr_ssize_t klen;
- /* Used to copy values in and out of the cache. */
- svn_cache__dup_func_t dup_func;
+ /* Used to copy values into the cache. */
+ svn_cache__serialize_func_t serialize_func;
+
+ /* Used to copy values out of the cache. */
+ svn_cache__deserialize_func_t deserialize_func;
/* The number of pages we're allowed to allocate before having to
* try to reuse one. */
@@ -94,8 +97,13 @@ struct cache_page {
/* An cache entry. */
struct cache_entry {
const void *key;
+
+ /* serialized value */
void *value;
+ /* length of the serialized value in bytes */
+ apr_size_t size;
+
/* The page it's on (needed so that the LRU list can be
* maintained). */
struct cache_page *page;
@@ -142,21 +150,6 @@ move_page_to_front(inprocess_cache_t *ca
insert_page(cache, page);
}
-/* Uses CACHE->dup_func to copy VALUE into *VALUE_P inside POOL, or
- just sets *VALUE_P to NULL if VALUE is NULL. */
-static svn_error_t *
-duplicate_value(void **value_p,
- inprocess_cache_t *cache,
- void *value,
- apr_pool_t *pool)
-{
- if (value)
- SVN_ERR((cache->dup_func)(value_p, value, pool));
- else
- *value_p = NULL;
- return SVN_NO_ERROR;
-}
-
/* Return a copy of KEY inside POOL, using CACHE->KLEN to figure out
* how. */
static const void *
@@ -214,7 +207,7 @@ inprocess_cache_get(void **value_p,
{
inprocess_cache_t *cache = cache_void;
struct cache_entry *entry;
- svn_error_t *err;
+ char* buffer;
SVN_ERR(lock_cache(cache));
@@ -227,9 +220,23 @@ inprocess_cache_get(void **value_p,
move_page_to_front(cache, entry->page);
+ /* duplicate the buffer entry */
+ buffer = apr_palloc(pool, entry->size);
+ memcpy(buffer, entry->value, entry->size);
+
+ /* the cache is no longer being accessed */
+ SVN_ERR(unlock_cache(cache, SVN_NO_ERROR));
+
+ /* deserialize the buffer content. Usually, this will directly
+ modify the buffer content directly.
+ */
*found = TRUE;
- err = duplicate_value(value_p, cache, entry->value, pool);
- return unlock_cache(cache, err);
+ if (entry->value)
+ return cache->deserialize_func(value_p, buffer, entry->size, pool);
+ else
+ *value_p = NULL;
+
+ return unlock_cache(cache, SVN_NO_ERROR);
}
/* Removes PAGE from the LRU list, removes all of its entries from
@@ -302,8 +309,19 @@ inprocess_cache_set(void *cache_void,
struct cache_page *page = existing_entry->page;
move_page_to_front(cache, page);
- err = duplicate_value(&(existing_entry->value), cache,
- value, page->page_pool);
+ if (value)
+ {
+ err = cache->serialize_func((char **)&existing_entry->value,
+ &existing_entry->size,
+ value,
+ page->page_pool);
+ }
+ else
+ {
+ existing_entry->value = NULL;
+ existing_entry->size = 0;
+ }
+
goto cleanup;
}
@@ -340,8 +358,19 @@ inprocess_cache_set(void *cache_void,
/* Copy the key and value into the page's pool. */
new_entry->key = duplicate_key(cache, key, page->page_pool);
- err = duplicate_value(&(new_entry->value), cache, value,
- page->page_pool);
+ if (value)
+ {
+ err = cache->serialize_func((char **)&new_entry->value,
+ &new_entry->size,
+ value,
+ page->page_pool);
+ }
+ else
+ {
+ new_entry->value = NULL;
+ new_entry->size = 0;
+ }
+
if (err)
goto cleanup;
@@ -417,7 +446,8 @@ static svn_cache__vtable_t inprocess_cac
svn_error_t *
svn_cache__create_inprocess(svn_cache__t **cache_p,
- svn_cache__dup_func_t dup_func,
+ svn_cache__serialize_func_t serialize,
+ svn_cache__deserialize_func_t deserialize,
apr_ssize_t klen,
apr_int64_t pages,
apr_int64_t items_per_page,
@@ -430,7 +460,8 @@ svn_cache__create_inprocess(svn_cache__t
cache->hash = apr_hash_make(pool);
cache->klen = klen;
- cache->dup_func = dup_func;
+ cache->serialize_func = serialize;
+ cache->deserialize_func = deserialize;
SVN_ERR_ASSERT(pages >= 1);
cache->unallocated_pages = pages;
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-membuffer.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-membuffer.c Mon Feb 21 20:40:44 2011
@@ -32,57 +32,63 @@
#include "private/svn_dep_compat.h"
/*
+ * This svn_cache__t implementation actually consists of two parts:
+ * a shared (per-process) singleton membuffer cache instance and shallow
+ * svn_cache__t frontend instances that each use different key spaces.
+ * For data management, they all forward to the singleton membuffer cache.
+ *
* A membuffer cache consists of two parts:
*
- * 1. A linear data buffer containing a cached items in a serialized
+ * 1. A linear data buffer containing cached items in a serialized
* representation. There may be arbitrary gaps between entries.
* 2. A directory of cache entries. This is organized similar to CPU
* data caches: for every possible key, there is exactly one group
* of entries that may contain the header info for an item with
* that given key. The result is a GROUP_SIZE-way associative cache.
*
- * Only the begnnings of these two data parts are addressed through a
- * native pointer. All other references are expressed as offsets to
- * these array pointers. With that design, it is relatively easy to
- * share the same data structure between different processes and / or
- * to persist them on disk.
+ * Only the start address of these two data parts are given as a native
+ * pointer. All other references are expressed as offsets to these pointers.
+ * With that design, it is relatively easy to share the same data structure
+ * between different processes and / or to persist them on disk. These
+ * out-of-process features have not been implemented, yet.
*
* The data buffer usage information is implicitly given by the directory
- * entries. Every *used* entry has a reference to the previous and the
- * next used dictionary entry - in the order their item data is stored
- * in the data buffer. So, removing data, for instance, is done simply
- * by unlinking it from the chain, marking it as unused and possibly
- * adjusting global list pointers.
+ * entries. Every USED entry has a reference to the previous and the next
+ * used dictionary entry and this double-linked list is ordered by the
+ * offsets of their item data within the the data buffer. So removing data,
+ * for instance, is done simply by unlinking it from the chain, implicitly
+ * marking the entry as well as the data buffer section previously
+ * associated to it as unused.
*
- * Insertion can occur at one position. It is marked by its offset in
- * the data buffer plus the index of the first used entry equal or
- * larger that position. If this gap is too small to accomodate the
- * new item, the insertion window is extended as described below. The
- * new entry will always be inserted at the bottom end of the window
- * and since the next used entry is known, properly sorted insertion
- * is possible.
+ * Insertion can occur at only one, sliding position. It is marked by its
+ * offset in the data buffer plus the index of the first used entry at or
+ * behind that position. If this gap is too small to accomodate the new
+ * item, the insertion window is extended as described below. The new entry
+ * will always be inserted at the bottom end of the window and since the
+ * next used entry is known, properly sorted insertion is possible.
*
* To make the cache perform robustly in a wide range of usage scenarios,
- * a randomized variant of LFU is used. Every item holds a (read)
- * hit counter and there is a global (read) hit counter. The more hits
- * an entry has in relation to the average, the more it is likely to be
- * kept using a rand()-based condition. The test is applied only to the
- * entry at the end of the insertion window. If it doesn't get evicted,
- * its being moved to the begin of that window and this window is moved.
+ * a randomized variant of LFU is used. Every item holds a read hit counter
+ * and there is a global read hit counter. The more hits an entry has in
+ * relation to the average, the more it is likely to be kept using a rand()-
+ * based condition. The test is applied only to the entry following the
+ * insertion window. If it doesn't get evicted, it is moved to the begin of
+ * that window and the window is moved.
*
- * Moreover, the entry's hits get halfed to make that entry more likely
- * to be removed the next time, the sliding insertion / auto-removal
- * window comes by. As a result, frequently used entries are likely not
- * to be dropped until they get not used for a while. Also, even a cache
- * thrashing situation about 50% of the content survives every 50% of the
- * cache being re-written with new entries. For details on the fine-
- * tuning involved, see the comments in ensure_data_insertable().
+ * Moreover, the entry's hits get halfed to make that entry more likely to
+ * be removed the next time the sliding insertion / removal window comes by.
+ * As a result, frequently used entries are likely not to be dropped until
+ * they get not used for a while. Also, even a cache thrashing situation
+ * about 50% of the content survives every 50% of the cache being re-written
+ * with new entries. For details on the fine-tuning involved, see the
+ * comments in ensure_data_insertable().
*
- * To limit the entry size and management overhead, the actual item keys
- * will not be stored but only their MD5 checksums, instead. This is
- * reasonably safe to do since users have only limited control over the
- * full keys, even if these are folder paths. So, it is very hard to
- * construct colliding keys.
+ * To limit the entry size and management overhead, not the actual item keys
+ * but only their MD5 checksums will not be stored. This is reasonably safe
+ * to do since users have only limited control over the full keys, even if
+ * these contain folder paths. So, it is very hard to deliberately construct
+ * colliding keys. Random checksum collisions can be shown to be extremely
+ * unlikely.
*
* All access to the cached data needs to be serialized. Because we want
* to scale well despite that bottleneck, we simply segment the cache into
@@ -706,6 +712,24 @@ ensure_data_insertable(svn_membuffer_t *
return FALSE;
}
+/* Mimic apr_pcalloc in APR_POOL_DEBUG mode, i.e. handle failed allocations
+ * (e.g. OOM) properly: Allocate at least SIZE bytes from POOL and zero
+ * the content of the allocated memory. If the allocation fails, return NULL.
+ *
+ * Also, satisfy our buffer alignment needs for performance reasons.
+ */
+static void* secure_aligned_pcalloc(apr_pool_t *pool, apr_size_t size)
+{
+ char* memory = apr_palloc(pool, (apr_size_t)size + ITEM_ALIGNMENT);
+ if (memory != NULL)
+ {
+ memory = (char *)ALIGN_POINTER(memory);
+ memset(memory, 0, size);
+ }
+
+ return memory;
+}
+
/* Create a new membuffer cache instance. If the TOTAL_SIZE of the
* memory i too small to accomodate the DICTIONARY_SIZE, the latte
* will be resized automatically. Also, a minumum size is assured
@@ -723,16 +747,11 @@ svn_cache__membuffer_cache_create(svn_me
apr_pool_t *pool)
{
/* allocate cache as an array of segments / cache objects */
- svn_membuffer_t *c = apr_palloc(pool, CACHE_SEGMENTS * sizeof(*c));
+ svn_membuffer_t *c = apr_pcalloc(pool, CACHE_SEGMENTS * sizeof(*c));
apr_uint32_t seg;
apr_uint32_t group_count;
apr_uint64_t data_size;
- /* We use this sub-pool to allocate the data buffer and the dictionary
- * so that we can release this memory easily upon OOM.
- */
- apr_pool_t *sub_pool = svn_pool_create(pool);
-
/* Split total cache size into segments of equal size
*/
total_size /= CACHE_SEGMENTS;
@@ -773,15 +792,13 @@ svn_cache__membuffer_cache_create(svn_me
*/
c[seg].group_count = group_count;
c[seg].directory =
- apr_palloc(sub_pool, group_count * sizeof(entry_group_t));
+ secure_aligned_pcalloc(pool, group_count * sizeof(entry_group_t));
c[seg].first = NO_INDEX;
c[seg].last = NO_INDEX;
c[seg].next = NO_INDEX;
c[seg].data_size = data_size;
- c[seg].data = apr_palloc(sub_pool, (apr_size_t)data_size);
- c[seg].data = (unsigned char *)ALIGN_POINTER(c[seg].data);
- c[seg].data_size -= ITEM_ALIGNMENT;
+ c[seg].data = secure_aligned_pcalloc(pool, (apr_size_t)data_size);
c[seg].current_data = 0;
c[seg].data_used = 0;
@@ -796,21 +813,9 @@ svn_cache__membuffer_cache_create(svn_me
*/
if (c[seg].data == NULL || c[seg].directory == NULL)
{
- /* in case we successfully allocated one part of the cache
- * make sure we release it asap.
- */
- svn_pool_destroy(sub_pool);
-
- c[seg].group_count = 1;
- c[seg].data_size = 0;
-
- if (c[seg].directory == NULL)
- c[seg].directory = apr_palloc(pool, sizeof(entry_group_t));
-
- /* if that modest allocation failed as well, we definitly are OOM.
+ /* We are OOM. There is no need to proceed with "half a cache".
*/
- if (c[seg].directory == NULL)
- return svn_error_wrap_apr(APR_ENOMEM, _("OOM"));
+ return svn_error_wrap_apr(APR_ENOMEM, _("OOM"));
}
/* initialize directory entries as "unused"
@@ -1253,7 +1258,7 @@ svn_membuffer_cache_is_cachable(void *ca
* must be small enough to be stored in a 32 bit value.
*/
svn_membuffer_cache_t *cache = cache_void;
- return (size < cache->membuffer->data_size / 4 / CACHE_SEGMENTS)
+ return (size < cache->membuffer->data_size / 4)
&& (size < APR_UINT32_MAX - ITEM_ALIGNMENT);
}
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-memcache.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-memcache.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-memcache.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/cache-memcache.c Mon Feb 21 20:40:44 2011
@@ -144,7 +144,7 @@ memcache_get(void **value_p,
SVN_ERR(build_key(&mc_key, cache, key, subpool));
apr_err = apr_memcache_getp(cache->memcache,
- (cache->deserialize_func ? subpool : pool),
+ pool,
mc_key,
&data,
&data_len,
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/checksum.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/checksum.c Mon Feb 21 20:40:44 2011
@@ -408,23 +408,18 @@ svn_checksum_mismatch_err(const svn_chec
const char *fmt,
...)
{
- if (!svn_checksum_match(expected, actual))
- {
- va_list ap;
- const char *desc;
+ va_list ap;
+ const char *desc;
- va_start(ap, fmt);
- desc = apr_pvsprintf(scratch_pool, fmt, ap);
- va_end(ap);
+ va_start(ap, fmt);
+ desc = apr_pvsprintf(scratch_pool, fmt, ap);
+ va_end(ap);
- return svn_error_createf(SVN_ERR_CHECKSUM_MISMATCH, NULL,
- _("%s:\n"
- " expected: %s\n"
- " actual: %s\n"),
- desc,
- svn_checksum_to_cstring_display(expected, scratch_pool),
- svn_checksum_to_cstring_display(actual, scratch_pool));
- }
- else
- return SVN_NO_ERROR;
+ return svn_error_createf(SVN_ERR_CHECKSUM_MISMATCH, NULL,
+ _("%s:\n"
+ " expected: %s\n"
+ " actual: %s\n"),
+ desc,
+ svn_checksum_to_cstring_display(expected, scratch_pool),
+ svn_checksum_to_cstring_display(actual, scratch_pool));
}
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/config.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/config.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/config.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/config.c Mon Feb 21 20:40:44 2011
@@ -78,7 +78,9 @@ struct cfg_option_t
svn_error_t *
-svn_config_create(svn_config_t **cfgp, apr_pool_t *result_pool)
+svn_config_create(svn_config_t **cfgp,
+ svn_boolean_t section_names_case_sensitive,
+ apr_pool_t *result_pool)
{
svn_config_t *cfg = apr_palloc(result_pool, sizeof(*cfg));
@@ -88,19 +90,22 @@ svn_config_create(svn_config_t **cfgp, a
cfg->x_values = FALSE;
cfg->tmp_key = svn_stringbuf_create("", result_pool);
cfg->tmp_value = svn_stringbuf_create("", result_pool);
-
+ cfg->section_names_case_sensitive = section_names_case_sensitive;
+
*cfgp = cfg;
return SVN_NO_ERROR;
}
svn_error_t *
-svn_config_read(svn_config_t **cfgp, const char *file,
- svn_boolean_t must_exist, apr_pool_t *pool)
+svn_config_read2(svn_config_t **cfgp, const char *file,
+ svn_boolean_t must_exist,
+ svn_boolean_t section_names_case_sensitive,
+ apr_pool_t *pool)
{
svn_config_t *cfg;
svn_error_t *err;
- SVN_ERR(svn_config_create(&cfg, pool));
+ SVN_ERR(svn_config_create(&cfg, section_names_case_sensitive, pool));
/* Yes, this is platform-specific code in Subversion, but there's no
practical way to migrate it into APR, as it's simultaneously
@@ -154,7 +159,7 @@ read_all(svn_config_t **cfgp,
#ifdef WIN32
if (sys_registry_path)
{
- SVN_ERR(svn_config_read(cfgp, sys_registry_path, FALSE, pool));
+ SVN_ERR(svn_config_read2(cfgp, sys_registry_path, FALSE, FALSE, pool));
red_config = TRUE;
}
#endif /* WIN32 */
@@ -165,7 +170,7 @@ read_all(svn_config_t **cfgp,
SVN_ERR(svn_config_merge(*cfgp, sys_file_path, FALSE));
else
{
- SVN_ERR(svn_config_read(cfgp, sys_file_path, FALSE, pool));
+ SVN_ERR(svn_config_read2(cfgp, sys_file_path, FALSE, FALSE, pool));
red_config = TRUE;
}
}
@@ -179,7 +184,8 @@ read_all(svn_config_t **cfgp,
SVN_ERR(svn_config_merge(*cfgp, usr_registry_path, FALSE));
else
{
- SVN_ERR(svn_config_read(cfgp, usr_registry_path, FALSE, pool));
+ SVN_ERR(svn_config_read2(cfgp, usr_registry_path,
+ FALSE, FALSE, pool));
red_config = TRUE;
}
}
@@ -191,7 +197,7 @@ read_all(svn_config_t **cfgp,
SVN_ERR(svn_config_merge(*cfgp, usr_file_path, FALSE));
else
{
- SVN_ERR(svn_config_read(cfgp, usr_file_path, FALSE, pool));
+ SVN_ERR(svn_config_read2(cfgp, usr_file_path, FALSE, FALSE, pool));
red_config = TRUE;
}
}
@@ -327,7 +333,7 @@ svn_config_merge(svn_config_t *cfg, cons
### We could use a tmp subpool for this, since merge_cfg is going
to be tossed afterwards. Premature optimization, though? */
svn_config_t *merge_cfg;
- SVN_ERR(svn_config_read(&merge_cfg, file, must_exist, cfg->pool));
+ SVN_ERR(svn_config_read2(&merge_cfg, file, must_exist, FALSE, cfg->pool));
/* Now copy the new options into the original table. */
for_each_option(merge_cfg, cfg, merge_cfg->pool, merge_callback);
@@ -387,7 +393,8 @@ find_option(svn_config_t *cfg, const cha
/* Canonicalize the hash key */
svn_stringbuf_set(cfg->tmp_key, section);
- make_hash_key(cfg->tmp_key->data);
+ if (! cfg->section_names_case_sensitive)
+ make_hash_key(cfg->tmp_key->data);
sec_ptr = apr_hash_get(cfg->sections, cfg->tmp_key->data,
cfg->tmp_key->len);
@@ -618,7 +625,10 @@ svn_config_set(svn_config_t *cfg,
/* Even the section doesn't exist. Create it. */
sec = apr_palloc(cfg->pool, sizeof(*sec));
sec->name = apr_pstrdup(cfg->pool, section);
- sec->hash_key = make_hash_key(apr_pstrdup(cfg->pool, section));
+ if(cfg->section_names_case_sensitive)
+ sec->hash_key = sec->name;
+ else
+ sec->hash_key = make_hash_key(apr_pstrdup(cfg->pool, section));
sec->options = apr_hash_make(cfg->pool);
apr_hash_set(cfg->sections, sec->hash_key, APR_HASH_KEY_STRING, sec);
}
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/config_impl.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/config_impl.h?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/config_impl.h (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/config_impl.h Mon Feb 21 20:40:44 2011
@@ -63,6 +63,9 @@ struct svn_config_t
/* Temporary value used for expanded default values in svn_config_get.
(Using a stringbuf so that frequent resetting is efficient.) */
svn_stringbuf_t *tmp_value;
+
+ /* Specifies whether section names are populated case sensitively. */
+ svn_boolean_t section_names_case_sensitive;
};
Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/deprecated.c?rev=1073138&r1=1073137&r2=1073138&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/deprecated.c Mon Feb 21 20:40:44 2011
@@ -779,6 +779,13 @@ svn_io_start_cmd(apr_proc_t *cmd_proc,
infile, FALSE, outfile, FALSE, errfile, pool);
}
+svn_error_t *
+svn_io_file_read_full(apr_file_t *file, void *buf,
+ apr_size_t nbytes, apr_size_t *bytes_read,
+ apr_pool_t *pool)
+{
+ return svn_io_file_read_full2(file, buf, nbytes, bytes_read, NULL, pool);
+}
struct walk_func_filter_baton_t
{
@@ -1064,3 +1071,16 @@ svn_rangelist_inheritable(apr_array_head
start, end, TRUE,
pool, pool));
}
+
+/*** From config.c ***/
+
+svn_error_t *
+svn_config_read(svn_config_t **cfgp, const char *file,
+ svn_boolean_t must_exist,
+ apr_pool_t *pool)
+{
+ return svn_error_return(svn_config_read2(cfgp, file,
+ must_exist,
+ FALSE,
+ pool));
+}