You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/03/30 15:55:31 UTC
svn commit: r1307424 [4/11] - in /subversion/branches/revprop-packing: ./
build/ac-macros/ notes/ notes/directory-index/ notes/wc-ng/
subversion/bindings/javahl/ subversion/bindings/swig/python/svn/
subversion/bindings/swig/python/tests/ subversion/bin...
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/mergeinfo.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/mergeinfo.c Fri Mar 30 13:55:26 2012
@@ -43,6 +43,7 @@
#include "private/svn_wc_private.h"
#include "private/svn_ra_private.h"
#include "private/svn_fspath.h"
+#include "private/svn_client_private.h"
#include "client.h"
#include "mergeinfo.h"
#include "svn_private_config.h"
@@ -1063,20 +1064,13 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
contact the repository for the requested PEG_REVISION. */
if (!use_url)
{
- const char *repos_root_url;
- const char *repos_relpath;
const char *origin_url = NULL;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url,
scratch_pool));
- SVN_ERR(svn_wc__node_get_origin(NULL, &rev, &repos_relpath,
- &repos_root_url, NULL, NULL,
- ctx->wc_ctx, local_abspath, FALSE,
- scratch_pool, scratch_pool));
-
- if(repos_relpath)
- origin_url = svn_path_url_add_component2(repos_root_url, repos_relpath,
- scratch_pool);
+ SVN_ERR(svn_client__wc_node_get_origin(NULL, NULL, &rev, &origin_url,
+ local_abspath, ctx,
+ scratch_pool, scratch_pool));
if (!origin_url
|| strcmp(origin_url, url) != 0
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/prop_commands.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/prop_commands.c Fri Mar 30 13:55:26 2012
@@ -75,7 +75,7 @@ is_revision_prop_name(const char *name)
static svn_error_t *
error_if_wcprop_name(const char *name)
{
- if (svn_property_kind(NULL, name) == svn_prop_wc_kind)
+ if (svn_property_kind2(name) == svn_prop_wc_kind)
{
return svn_error_createf
(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
@@ -162,7 +162,7 @@ propset_on_url(const char *propname,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- enum svn_prop_kind prop_kind = svn_property_kind(NULL, propname);
+ enum svn_prop_kind prop_kind = svn_property_kind2(propname);
svn_ra_session_t *ra_session;
svn_node_kind_t node_kind;
const char *message;
@@ -980,7 +980,7 @@ remote_proplist(const char *target_prefi
svn_string_t *value = svn__apr_hash_index_val(hi);
svn_prop_kind_t prop_kind;
- prop_kind = svn_property_kind(NULL, name);
+ prop_kind = svn_property_kind2(name);
if (prop_kind == svn_prop_regular_kind)
{
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/ra.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/ra.c Fri Mar 30 13:55:26 2012
@@ -52,10 +52,6 @@ typedef struct callback_baton_t
this base directory. */
const char *base_dir_abspath;
- /* When true, makes sure temporary files are created
- outside the working copy. */
- svn_boolean_t read_only_wc;
-
/* An array of svn_client_commit_item3_t * structures, present only
during working copy commits. */
const apr_array_header_t *commit_items;
@@ -63,9 +59,6 @@ typedef struct callback_baton_t
/* A client context. */
svn_client_ctx_t *ctx;
- /* The pool to use for session-related items. */
- apr_pool_t *pool;
-
} callback_baton_t;
@@ -293,8 +286,6 @@ svn_client__open_ra_session_internal(svn
cbtable->get_client_string = get_client_string;
cb->base_dir_abspath = base_dir_abspath;
- cb->read_only_wc = read_only_wc;
- cb->pool = pool;
cb->commit_items = commit_items;
cb->ctx = ctx;
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/util.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/util.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/util.c Fri Mar 30 13:55:26 2012
@@ -90,10 +90,7 @@ svn_client__path_relative_to_root(const
/* If we have a WC path... */
if (! svn_path_is_url(abspath_or_url))
{
- /* ...fetch its entry, and attempt to get both its full URL and
- repository root URL. If we can't get REPOS_ROOT from the WC
- entry, we'll get it from the RA layer.*/
-
+ /* ... query it directly. */
SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
wc_ctx,
abspath_or_url,
@@ -142,6 +139,50 @@ svn_client__path_relative_to_root(const
}
svn_error_t *
+svn_client__wc_node_get_origin(const char **repos_root_url_p,
+ const char **repos_uuid_p,
+ svn_revnum_t *rev_p,
+ const char **url_p,
+ const char *wc_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const char *repos_root_url, *relpath;
+
+ SVN_ERR(svn_wc__node_get_origin(NULL /* is_copy */, rev_p, &relpath,
+ &repos_root_url, repos_uuid_p,
+ NULL, ctx->wc_ctx, wc_abspath,
+ FALSE /* scan_deleted */,
+ result_pool, scratch_pool));
+ if (repos_root_url && relpath)
+ {
+ *url_p = svn_path_url_add_component2(repos_root_url, relpath,
+ result_pool);
+ }
+ else
+ {
+ /* The node has no location in the repository. It's unversioned or
+ * locally added or locally deleted.
+ *
+ * If it's locally added or deleted, find the repository root
+ * URL and UUID anyway, and leave the node URL and revision as NULL
+ * and INVALID. If it's unversioned, this will throw an error. */
+ *url_p = NULL;
+ SVN_ERR(svn_client_get_repos_root(&repos_root_url, repos_uuid_p,
+ wc_abspath,
+ ctx, result_pool, scratch_pool));
+ }
+
+ if (repos_root_url_p)
+ *repos_root_url_p = repos_root_url;
+
+ SVN_ERR_ASSERT(!repos_root_url_p || *repos_root_url_p);
+ SVN_ERR_ASSERT(!repos_uuid_p || *repos_uuid_p);
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
svn_client_get_repos_root(const char **repos_root,
const char **repos_uuid,
const char *abspath_or_url,
Modified: subversion/branches/revprop-packing/subversion/libsvn_delta/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_delta/compat.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_delta/compat.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_delta/compat.c Fri Mar 30 13:55:26 2012
@@ -31,7 +31,7 @@
#include "svn_props.h"
#include "svn_pools.h"
-
+
struct file_rev_handler_wrapper_baton {
void *baton;
svn_file_rev_handler_old_t handler;
@@ -130,6 +130,8 @@ struct ev2_edit_baton
{
svn_editor_t *editor;
+ /* ### need to ensure we understand the proper root for these relpaths */
+ apr_hash_t *changes; /* RELPATH -> struct change_node */
apr_hash_t *paths;
apr_array_header_t *path_order;
int paths_processed;
@@ -179,7 +181,6 @@ enum action_code_t
ACTION_ADD,
ACTION_DELETE,
ACTION_ADD_ABSENT,
- ACTION_SET_TEXT,
ACTION_UNLOCK
};
@@ -189,26 +190,43 @@ struct path_action
void *args;
};
-struct prop_args
-{
- const char *name;
- svn_revnum_t base_revision;
- const svn_string_t *value;
- svn_kind_t kind;
-};
-
struct copy_args
{
const char *copyfrom_path;
svn_revnum_t copyfrom_rev;
};
-struct path_checksum_args
+enum restructure_action_t
{
- const char *path;
+ RESTRUCTURE_NONE = 0,
+ RESTRUCTURE_ADD, /* add the node, maybe replacing. maybe copy */
+ RESTRUCTURE_ADD_ABSENT, /* add an absent node, possibly replacing */
+ RESTRUCTURE_DELETE, /* delete this node */
+};
+
+/* Records everything about how this node is to be changed. */
+struct change_node
+{
+ /* what kind of (tree) restructure is occurring at this node? */
+ enum restructure_action_t action;
+
+ svn_kind_t kind; /* the NEW kind of this node */
+
+ /* The revision we're trying to change. Replace it, modify it, etc. */
svn_revnum_t base_revision;
+
+ apr_hash_t *props; /* new/final set of props to apply */
+
+ const char *contents_abspath; /* file containing new fulltext */
+ svn_checksum_t *checksum; /* checksum of new fulltext */
+
+ /* If COPYFROM_PATH is not NULL, then copy PATH@REV to this node.
+ RESTRUCTURE must be RESTRUCTURE_ADD. */
+ const char *copyfrom_path;
+ svn_revnum_t copyfrom_rev;
};
+
static svn_error_t *
add_action(struct ev2_edit_baton *eb,
const char *path,
@@ -238,6 +256,96 @@ add_action(struct ev2_edit_baton *eb,
return SVN_NO_ERROR;
}
+
+static struct change_node *
+locate_change(struct ev2_edit_baton *eb,
+ const char *relpath)
+{
+ struct change_node *change = apr_hash_get(eb->changes, relpath,
+ APR_HASH_KEY_STRING);
+ apr_array_header_t *action_list;
+
+ if (change != NULL)
+ return change;
+
+ /* Shift RELPATH into the proper pool. */
+ relpath = apr_pstrdup(eb->edit_pool, relpath);
+
+ /* Investigate whether there is an action in PATHS. Any presence there
+ will determine whether we need to update PATH_ORDER. */
+ action_list = apr_hash_get(eb->paths, relpath, APR_HASH_KEY_STRING);
+ if (action_list == NULL)
+ {
+ /* Store an empty ACTION_LIST into PATHS. */
+ action_list = apr_array_make(eb->edit_pool, 1,
+ sizeof(struct path_action *));
+ apr_hash_set(eb->paths, relpath, APR_HASH_KEY_STRING, action_list);
+ APR_ARRAY_PUSH(eb->path_order, const char *) = relpath;
+ }
+
+ /* Return an empty change. Callers will tweak as needed. */
+ change = apr_pcalloc(eb->edit_pool, sizeof(*change));
+ change->base_revision = SVN_INVALID_REVNUM;
+
+ apr_hash_set(eb->changes, relpath, APR_HASH_KEY_STRING, change);
+
+ return change;
+}
+
+
+static svn_error_t *
+apply_propedit(struct ev2_edit_baton *eb,
+ const char *relpath,
+ svn_kind_t kind,
+ svn_revnum_t base_revision,
+ const char *name,
+ const svn_string_t *value,
+ apr_pool_t *scratch_pool)
+{
+ struct change_node *change = locate_change(eb, relpath);
+
+ SVN_ERR_ASSERT(change->kind == svn_kind_unknown || change->kind == kind);
+ change->kind = kind;
+
+ SVN_ERR_ASSERT(!SVN_IS_VALID_REVNUM(change->base_revision)
+ || change->base_revision == base_revision);
+ change->base_revision = base_revision;
+
+ if (change->props == NULL)
+ {
+ /* Fetch the original set of properties. We'll apply edits to create
+ the new/target set of properties.
+
+ If this is a copied/moved now, then the original properties come
+ from there. If the node has been added, it starts with empty props.
+ Otherwise, we get the properties from BASE. */
+
+ if (change->copyfrom_path)
+ SVN_ERR(eb->fetch_props_func(&change->props,
+ eb->fetch_props_baton,
+ change->copyfrom_path,
+ change->copyfrom_rev,
+ eb->edit_pool, scratch_pool));
+ else if (change->action == RESTRUCTURE_ADD)
+ change->props = apr_hash_make(eb->edit_pool);
+ else
+ SVN_ERR(eb->fetch_props_func(&change->props,
+ eb->fetch_props_baton,
+ relpath, base_revision,
+ eb->edit_pool, scratch_pool));
+ }
+
+ if (value == NULL)
+ apr_hash_set(change->props, name, APR_HASH_KEY_STRING, NULL);
+ else
+ apr_hash_set(change->props,
+ apr_pstrdup(eb->edit_pool, name), APR_HASH_KEY_STRING,
+ svn_string_dup(value, eb->edit_pool));
+
+ return SVN_NO_ERROR;
+}
+
+
/* Find all the paths which are immediate children of PATH and return their
basenames in a list. */
static apr_array_header_t *
@@ -275,12 +383,12 @@ get_children(struct ev2_edit_baton *eb,
static svn_error_t *
-process_actions(void *edit_baton,
+process_actions(struct ev2_edit_baton *eb,
const char *path,
apr_array_header_t *actions,
+ const struct change_node *change,
apr_pool_t *scratch_pool)
{
- struct ev2_edit_baton *eb = edit_baton;
apr_hash_t *props = NULL;
svn_boolean_t need_add = FALSE;
svn_boolean_t need_delete = FALSE;
@@ -311,42 +419,6 @@ process_actions(void *edit_baton,
switch (action->action)
{
- case ACTION_PROPSET:
- {
- const struct prop_args *p_args = action->args;
-
- kind = p_args->kind;
-
- if (!SVN_IS_VALID_REVNUM(props_base_revision))
- props_base_revision = p_args->base_revision;
- else
- SVN_ERR_ASSERT(p_args->base_revision == props_base_revision);
-
- if (!props)
- {
- /* Fetch the original props. We can then apply each of
- the modifications to it. */
- if (need_delete && need_add)
- props = apr_hash_make(scratch_pool);
- else if (need_copy)
- SVN_ERR(eb->fetch_props_func(&props,
- eb->fetch_props_baton,
- copyfrom_path,
- copyfrom_rev,
- scratch_pool, scratch_pool));
- else
- SVN_ERR(eb->fetch_props_func(&props,
- eb->fetch_props_baton,
- path, props_base_revision,
- scratch_pool, scratch_pool));
- }
-
- /* Note that p_args->value may be NULL. */
- apr_hash_set(props, p_args->name, APR_HASH_KEY_STRING,
- p_args->value);
- break;
- }
-
case ACTION_DELETE:
{
delete_revnum = *((svn_revnum_t *) action->args);
@@ -373,26 +445,6 @@ process_actions(void *edit_baton,
break;
}
- case ACTION_SET_TEXT:
- {
- struct path_checksum_args *pca = action->args;
-
- /* We can only set text on files. */
- kind = svn_kind_file;
-
- SVN_ERR(svn_io_file_checksum2(&checksum, pca->path,
- svn_checksum_sha1, scratch_pool));
- SVN_ERR(svn_stream_open_readonly(&contents, pca->path,
- scratch_pool, scratch_pool));
-
- if (!SVN_IS_VALID_REVNUM(text_base_revision))
- text_base_revision = pca->base_revision;
- else
- SVN_ERR_ASSERT(pca->base_revision == text_base_revision);
-
- break;
- }
-
case ACTION_COPY:
{
struct copy_args *c_args = action->args;
@@ -422,6 +474,32 @@ process_actions(void *edit_baton,
}
}
+ if (change != NULL)
+ {
+ if (change->contents_abspath != NULL)
+ {
+ /* We can only set text on files. */
+ /* ### validate we aren't overwriting KIND? */
+ kind = svn_kind_file;
+
+ /* ### the checksum might be in CHANGE->CHECKSUM */
+ SVN_ERR(svn_io_file_checksum2(&checksum, change->contents_abspath,
+ svn_checksum_sha1, scratch_pool));
+ SVN_ERR(svn_stream_open_readonly(&contents, change->contents_abspath,
+ scratch_pool, scratch_pool));
+
+ text_base_revision = change->base_revision;
+ }
+
+ if (change->props != NULL)
+ {
+ /* ### validate we aren't overwriting KIND? */
+ kind = change->kind;
+ props = change->props;
+ props_base_revision = change->base_revision;
+ }
+ }
+
/* We've now got a wholistic view of what has happened to this node,
* so we can call our own editor APIs on it. */
@@ -486,10 +564,9 @@ process_actions(void *edit_baton,
}
static svn_error_t *
-run_ev2_actions(void *edit_baton,
+run_ev2_actions(struct ev2_edit_baton *eb,
apr_pool_t *scratch_pool)
{
- struct ev2_edit_baton *eb = edit_baton;
apr_pool_t *iterpool;
iterpool = svn_pool_create(scratch_pool);
@@ -502,9 +579,12 @@ run_ev2_actions(void *edit_baton,
const char *);
apr_array_header_t *actions = apr_hash_get(eb->paths, path,
APR_HASH_KEY_STRING);
+ struct change_node *change = apr_hash_get(eb->changes, path,
+ APR_HASH_KEY_STRING);
svn_pool_clear(iterpool);
- SVN_ERR(process_actions(edit_baton, path, actions, iterpool));
+
+ SVN_ERR(process_actions(eb, path, actions, change, iterpool));
}
svn_pool_destroy(iterpool);
@@ -554,10 +634,29 @@ ev2_delete_entry(const char *path,
{
struct ev2_dir_baton *pb = parent_baton;
svn_revnum_t *revnum = apr_palloc(pb->eb->edit_pool, sizeof(*revnum));
+ struct change_node *change = locate_change(pb->eb, path);
+
+ if (SVN_IS_VALID_REVNUM(revision))
+ *revnum = revision;
+ else
+ *revnum = pb->base_revision;
- *revnum = revision;
SVN_ERR(add_action(pb->eb, path, ACTION_DELETE, revnum));
+ /* ### note: cannot switch to CHANGES just yet. the action loop needs
+ ### to see a delete action, and set NEED_DELETE. that is used for
+ ### the file properties. once fileprops are converted, then we
+ ### can fully switch over. */
+
+ /* ### assert that RESTRUCTURE is NONE? */
+ change->action = RESTRUCTURE_DELETE;
+
+#if 0
+ SVN_ERR_ASSERT(!SVN_IS_VALID_REVNUM(change->base_revision)
+ || change->base_revision == revision);
+ change->base_revision = revision;
+#endif
+
return SVN_NO_ERROR;
}
@@ -571,6 +670,10 @@ ev2_add_directory(const char *path,
{
struct ev2_dir_baton *pb = parent_baton;
struct ev2_dir_baton *cb = apr_pcalloc(result_pool, sizeof(*cb));
+ struct change_node *change = locate_change(pb->eb, path);
+
+ /* ### assert that RESTRUCTURE is NONE or DELETE? */
+ change->action = RESTRUCTURE_ADD;
cb->eb = pb->eb;
cb->path = apr_pstrdup(result_pool, path);
@@ -604,6 +707,9 @@ ev2_add_directory(const char *path,
cb->copyfrom_path = args->copyfrom_path;
cb->copyfrom_rev = args->copyfrom_rev;
+
+ change->copyfrom_path = apr_pstrdup(pb->eb->edit_pool, copyfrom_path);
+ change->copyfrom_rev = copyfrom_revision;
}
return SVN_NO_ERROR;
@@ -644,14 +750,9 @@ ev2_change_dir_prop(void *dir_baton,
apr_pool_t *scratch_pool)
{
struct ev2_dir_baton *db = dir_baton;
- struct prop_args *p_args = apr_palloc(db->eb->edit_pool, sizeof(*p_args));
-
- p_args->name = apr_pstrdup(db->eb->edit_pool, name);
- p_args->value = value ? svn_string_dup(value, db->eb->edit_pool) : NULL;
- p_args->base_revision = db->base_revision;
- p_args->kind = svn_kind_dir;
- SVN_ERR(add_action(db->eb, db->path, ACTION_PROPSET, p_args));
+ SVN_ERR(apply_propedit(db->eb, db->path, svn_kind_dir, db->base_revision,
+ name, value, scratch_pool));
return SVN_NO_ERROR;
}
@@ -687,6 +788,10 @@ ev2_add_file(const char *path,
{
struct ev2_file_baton *fb = apr_pcalloc(result_pool, sizeof(*fb));
struct ev2_dir_baton *pb = parent_baton;
+ struct change_node *change = locate_change(pb->eb, path);
+
+ /* ### assert that RESTRUCTURE is NONE or DELETE? */
+ change->action = RESTRUCTURE_ADD;
fb->eb = pb->eb;
fb->path = apr_pstrdup(result_pool, path);
@@ -717,6 +822,9 @@ ev2_add_file(const char *path,
args->copyfrom_path = apr_pstrdup(pb->eb->edit_pool, copyfrom_path);
args->copyfrom_rev = copyfrom_revision;
SVN_ERR(add_action(pb->eb, path, ACTION_COPY, args));
+
+ change->copyfrom_path = apr_pstrdup(fb->eb->edit_pool, copyfrom_path);
+ change->copyfrom_rev = copyfrom_revision;
}
return SVN_NO_ERROR;
@@ -799,11 +907,14 @@ ev2_apply_textdelta(void *file_baton,
struct ev2_file_baton *fb = file_baton;
apr_pool_t *handler_pool = svn_pool_create(fb->eb->edit_pool);
struct handler_baton *hb = apr_pcalloc(handler_pool, sizeof(*hb));
+ struct change_node *change;
svn_stream_t *target;
- struct path_checksum_args *pca = apr_pcalloc(fb->eb->edit_pool,
- sizeof(*pca));
- pca->base_revision = fb->base_revision;
+ change = locate_change(fb->eb, fb->path);
+ SVN_ERR_ASSERT(change->contents_abspath == NULL);
+ SVN_ERR_ASSERT(!SVN_IS_VALID_REVNUM(change->base_revision)
+ || change->base_revision == fb->base_revision);
+ change->base_revision = fb->base_revision;
if (! fb->delta_base)
hb->source = svn_stream_empty(handler_pool);
@@ -811,7 +922,7 @@ ev2_apply_textdelta(void *file_baton,
SVN_ERR(svn_stream_open_readonly(&hb->source, fb->delta_base, handler_pool,
result_pool));
- SVN_ERR(svn_stream_open_unique(&target, &pca->path, NULL,
+ SVN_ERR(svn_stream_open_unique(&target, &change->contents_abspath, NULL,
svn_io_file_del_on_pool_cleanup,
fb->eb->edit_pool, result_pool));
@@ -825,8 +936,6 @@ ev2_apply_textdelta(void *file_baton,
*handler_baton = hb;
*handler = window_handler;
- SVN_ERR(add_action(fb->eb, fb->path, ACTION_SET_TEXT, pca));
-
return SVN_NO_ERROR;
}
@@ -837,7 +946,6 @@ ev2_change_file_prop(void *file_baton,
apr_pool_t *scratch_pool)
{
struct ev2_file_baton *fb = file_baton;
- struct prop_args *p_args = apr_palloc(fb->eb->edit_pool, sizeof(*p_args));
if (!strcmp(name, SVN_PROP_ENTRY_LOCK_TOKEN) && value == NULL)
{
@@ -846,14 +954,8 @@ ev2_change_file_prop(void *file_baton,
SVN_ERR(add_action(fb->eb, fb->path, ACTION_UNLOCK, NULL));
}
- /* We also pass through the deletion, since there may actually exist such
- a property we want to get rid of. In the worse case, this is a no-op. */
- p_args->name = apr_pstrdup(fb->eb->edit_pool, name);
- p_args->value = value ? svn_string_dup(value, fb->eb->edit_pool) : NULL;
- p_args->base_revision = fb->base_revision;
- p_args->kind = svn_kind_file;
-
- SVN_ERR(add_action(fb->eb, fb->path, ACTION_PROPSET, p_args));
+ SVN_ERR(apply_propedit(fb->eb, fb->path, svn_kind_file, fb->base_revision,
+ name, value, scratch_pool));
return SVN_NO_ERROR;
}
@@ -960,6 +1062,7 @@ delta_from_editor(const svn_delta_editor
struct ev2_edit_baton *eb = apr_pcalloc(pool, sizeof(*eb));
eb->editor = editor;
+ eb->changes = apr_hash_make(pool);
eb->paths = apr_hash_make(pool);
eb->path_order = apr_array_make(pool, 1, sizeof(const char *));
eb->edit_pool = pool;
@@ -982,10 +1085,9 @@ delta_from_editor(const svn_delta_editor
return SVN_NO_ERROR;
}
-
-
-
+/* ### note the similarity to struct change_node. these structures will
+ ### be combined in the future. */
struct operation {
enum {
OP_OPEN,
Modified: subversion/branches/revprop-packing/subversion/libsvn_delta/editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_delta/editor.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_delta/editor.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_delta/editor.c Fri Mar 30 13:55:26 2012
@@ -55,6 +55,8 @@ struct svn_editor_t
apr_pool_t *scratch_pool;
#ifdef ENABLE_ORDERING_CHECK
+ svn_boolean_t within_callback;
+
apr_hash_t *pending_incomplete_children;
apr_hash_t *completed_nodes;
svn_boolean_t finished;
@@ -63,8 +65,17 @@ struct svn_editor_t
#endif
};
+
#ifdef ENABLE_ORDERING_CHECK
+#define START_CALLBACK(editor) \
+ do { \
+ svn_editor_t *editor__tmp_e = (editor); \
+ SVN_ERR_ASSERT(!editor__tmp_e->within_callback); \
+ editor__tmp_e->within_callback = TRUE; \
+ } while (0)
+#define END_CALLBACK(editor) ((editor)->within_callback = FALSE)
+
/* Marker to indicate no further changes are allowed on this node. */
static const int marker_done;
#define MARKER_DONE (&marker_done)
@@ -161,6 +172,9 @@ check_unknown_child(const svn_editor_t *
end up with "statement with no effect" warnings. Obviously, this
depends upon particular usage, which is easy to verify. */
+#define START_CALLBACK(editor) /* empty */
+#define END_CALLBACK(editor) /* empty */
+
#define MARK_FINISHED(editor) /* empty */
#define SHOULD_NOT_BE_FINISHED(editor) /* empty */
@@ -364,6 +378,22 @@ svn_editor_setcb_many(svn_editor_t *edit
}
+static svn_error_t *
+check_cancel(svn_editor_t *editor)
+{
+ svn_error_t *err = NULL;
+
+ if (editor->cancel_func)
+ {
+ START_CALLBACK(editor);
+ err = editor->cancel_func(editor->cancel_baton);
+ END_CALLBACK(editor);
+ }
+
+ return err;
+}
+
+
svn_error_t *
svn_editor_add_directory(svn_editor_t *editor,
const char *relpath,
@@ -379,13 +409,16 @@ svn_editor_add_directory(svn_editor_t *e
SHOULD_ALLOW_ADD(editor, relpath);
CHECK_UNKNOWN_CHILD(editor, relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_add_directory)
- err = editor->funcs.cb_add_directory(editor->baton, relpath, children,
- props, replaces_rev,
- editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_add_directory(editor->baton, relpath, children,
+ props, replaces_rev,
+ editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_ADDED_DIR(editor, relpath);
CLEAR_INCOMPLETE(editor, relpath);
@@ -428,13 +461,16 @@ svn_editor_add_file(svn_editor_t *editor
SHOULD_ALLOW_ADD(editor, relpath);
CHECK_UNKNOWN_CHILD(editor, relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_add_file)
- err = editor->funcs.cb_add_file(editor->baton, relpath,
- checksum, contents, props,
- replaces_rev, editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_add_file(editor->baton, relpath,
+ checksum, contents, props,
+ replaces_rev, editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_COMPLETED(editor, relpath);
CLEAR_INCOMPLETE(editor, relpath);
@@ -458,12 +494,15 @@ svn_editor_add_symlink(svn_editor_t *edi
SHOULD_ALLOW_ADD(editor, relpath);
CHECK_UNKNOWN_CHILD(editor, relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_add_symlink)
- err = editor->funcs.cb_add_symlink(editor->baton, relpath, target, props,
- replaces_rev, editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_add_symlink(editor->baton, relpath, target, props,
+ replaces_rev, editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_COMPLETED(editor, relpath);
CLEAR_INCOMPLETE(editor, relpath);
@@ -485,12 +524,15 @@ svn_editor_add_absent(svn_editor_t *edit
SHOULD_ALLOW_ADD(editor, relpath);
CHECK_UNKNOWN_CHILD(editor, relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_add_absent)
- err = editor->funcs.cb_add_absent(editor->baton, relpath, kind,
- replaces_rev, editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_add_absent(editor->baton, relpath, kind,
+ replaces_rev, editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_COMPLETED(editor, relpath);
CLEAR_INCOMPLETE(editor, relpath);
@@ -512,13 +554,16 @@ svn_editor_alter_directory(svn_editor_t
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ALTER(editor, relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_alter_directory)
- err = editor->funcs.cb_alter_directory(editor->baton,
- relpath, revision, props,
- editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_alter_directory(editor->baton,
+ relpath, revision, props,
+ editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_COMPLETED(editor, relpath);
@@ -545,14 +590,17 @@ svn_editor_alter_file(svn_editor_t *edit
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ALTER(editor, relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_alter_file)
- err = editor->funcs.cb_alter_file(editor->baton,
- relpath, revision, props,
- checksum, contents,
- editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_alter_file(editor->baton,
+ relpath, revision, props,
+ checksum, contents,
+ editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_COMPLETED(editor, relpath);
@@ -574,14 +622,17 @@ svn_editor_alter_symlink(svn_editor_t *e
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ALTER(editor, relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_alter_symlink)
- err = editor->funcs.cb_alter_symlink(editor->baton,
- relpath, revision, props,
- target,
- editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_alter_symlink(editor->baton,
+ relpath, revision, props,
+ target,
+ editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_COMPLETED(editor, relpath);
@@ -600,12 +651,15 @@ svn_editor_delete(svn_editor_t *editor,
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_NOT_BE_COMPLETED(editor, relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_delete)
- err = editor->funcs.cb_delete(editor->baton, relpath, revision,
- editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_delete(editor->baton, relpath, revision,
+ editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_COMPLETED(editor, relpath);
@@ -626,13 +680,16 @@ svn_editor_copy(svn_editor_t *editor,
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ADD(editor, dst_relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_copy)
- err = editor->funcs.cb_copy(editor->baton, src_relpath, src_revision,
- dst_relpath, replaces_rev,
- editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_copy(editor->baton, src_relpath, src_revision,
+ dst_relpath, replaces_rev,
+ editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_ALLOW_ALTER(editor, dst_relpath);
CLEAR_INCOMPLETE(editor, dst_relpath);
@@ -655,13 +712,16 @@ svn_editor_move(svn_editor_t *editor,
SHOULD_NOT_BE_COMPLETED(editor, src_relpath);
SHOULD_ALLOW_ADD(editor, dst_relpath);
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_move)
- err = editor->funcs.cb_move(editor->baton, src_relpath, src_revision,
- dst_relpath, replaces_rev,
- editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_move(editor->baton, src_relpath, src_revision,
+ dst_relpath, replaces_rev,
+ editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_ALLOW_ADD(editor, src_relpath);
MARK_ALLOW_ALTER(editor, dst_relpath);
@@ -691,12 +751,15 @@ svn_editor_rotate(svn_editor_t *editor,
}
#endif
- if (editor->cancel_func)
- SVN_ERR(editor->cancel_func(editor->cancel_baton));
+ SVN_ERR(check_cancel(editor));
if (editor->funcs.cb_rotate)
- err = editor->funcs.cb_rotate(editor->baton, relpaths, revisions,
- editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_rotate(editor->baton, relpaths, revisions,
+ editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
#ifdef ENABLE_ORDERING_CHECK
{
@@ -725,7 +788,11 @@ svn_editor_complete(svn_editor_t *editor
#endif
if (editor->funcs.cb_complete)
- err = editor->funcs.cb_complete(editor->baton, editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_complete(editor->baton, editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_FINISHED(editor);
@@ -742,7 +809,11 @@ svn_editor_abort(svn_editor_t *editor)
SHOULD_NOT_BE_FINISHED(editor);
if (editor->funcs.cb_abort)
- err = editor->funcs.cb_abort(editor->baton, editor->scratch_pool);
+ {
+ START_CALLBACK(editor);
+ err = editor->funcs.cb_abort(editor->baton, editor->scratch_pool);
+ END_CALLBACK(editor);
+ }
MARK_FINISHED(editor);
Modified: subversion/branches/revprop-packing/subversion/libsvn_fs/fs-loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_fs/fs-loader.h?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_fs/fs-loader.h Fri Mar 30 13:55:26 2012
@@ -333,6 +333,7 @@ typedef struct root_vtable_t
svn_fs_root_t *ancestor_root,
const char *ancestor_path,
apr_pool_t *pool);
+ /* Mergeinfo. */
svn_error_t *(*get_mergeinfo)(svn_mergeinfo_catalog_t *catalog,
svn_fs_root_t *root,
const apr_array_header_t *paths,
Modified: subversion/branches/revprop-packing/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_fs_fs/dag.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_fs_fs/dag.c Fri Mar 30 13:55:26 2012
@@ -1296,3 +1296,27 @@ svn_fs_fs__dag_get_copyfrom_path(const c
return SVN_NO_ERROR;
}
+
+svn_error_t *
+svn_fs_fs__dag_update_ancestry(dag_node_t *target,
+ dag_node_t *source,
+ apr_pool_t *pool)
+{
+ node_revision_t *source_noderev, *target_noderev;
+
+ if (! svn_fs_fs__dag_check_mutable(target))
+ return svn_error_createf
+ (SVN_ERR_FS_NOT_MUTABLE, NULL,
+ _("Attempted to update ancestry of non-mutable node"));
+
+ SVN_ERR(get_node_revision(&source_noderev, source, pool));
+ SVN_ERR(get_node_revision(&target_noderev, target, pool));
+
+ target_noderev->predecessor_id = source->id;
+ target_noderev->predecessor_count = source_noderev->predecessor_count;
+ if (target_noderev->predecessor_count != -1)
+ target_noderev->predecessor_count++;
+
+ return svn_fs_fs__put_node_revision(target->fs, target->id, target_noderev,
+ FALSE, pool);
+}
Modified: subversion/branches/revprop-packing/subversion/libsvn_fs_fs/dag.h
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_fs_fs/dag.h?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_fs_fs/dag.h (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_fs_fs/dag.h Fri Mar 30 13:55:26 2012
@@ -603,6 +603,12 @@ svn_error_t *svn_fs_fs__dag_get_copyfrom
dag_node_t *node,
apr_pool_t *pool);
+/* Update *TARGET so that SOURCE is it's predecessor.
+ */
+svn_error_t *
+svn_fs_fs__dag_update_ancestry(dag_node_t *target,
+ dag_node_t *source,
+ apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs.h?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs.h Fri Mar 30 13:55:26 2012
@@ -264,7 +264,7 @@ typedef struct fs_fs_data_t
/* If set, there are or have been more than one concurrent transaction */
svn_boolean_t concurrent_transactions;
- /* Tempoary cache for changed directories yet to be committed; maps from
+ /* Temporary cache for changed directories yet to be committed; maps from
unparsed FS ID to ###x. NULL outside transactions. */
svn_cache__t *txn_dir_cache;
Modified: subversion/branches/revprop-packing/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_fs_fs/temp_serializer.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_fs_fs/temp_serializer.c Fri Mar 30 13:55:26 2012
@@ -136,7 +136,7 @@ serialize_svn_string(svn_temp_serializer
* Thus, we cannot use svn_temp_serializer__add_string. */
svn_temp_serializer__push(context,
(const void * const *)&string->data,
- string->len);
+ string->len + 1);
/* back to the caller's nesting level */
svn_temp_serializer__pop(context);
Modified: subversion/branches/revprop-packing/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_fs_fs/tree.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_fs_fs/tree.c Fri Mar 30 13:55:26 2012
@@ -1142,30 +1142,6 @@ get_root(dag_node_t **node, svn_fs_root_
}
-static svn_error_t *
-update_ancestry(svn_fs_t *fs,
- const svn_fs_id_t *source_id,
- const svn_fs_id_t *target_id,
- const char *target_path,
- int source_pred_count,
- apr_pool_t *pool)
-{
- node_revision_t *noderev;
-
- if (svn_fs_fs__id_txn_id(target_id) == NULL)
- return svn_error_createf
- (SVN_ERR_FS_NOT_MUTABLE, NULL,
- _("Unexpected immutable node at '%s'"), target_path);
-
- SVN_ERR(svn_fs_fs__get_node_revision(&noderev, fs, target_id, pool));
- noderev->predecessor_id = source_id;
- noderev->predecessor_count = source_pred_count;
- if (noderev->predecessor_count != -1)
- noderev->predecessor_count++;
- return svn_fs_fs__put_node_revision(fs, target_id, noderev, FALSE, pool);
-}
-
-
/* Set the contents of CONFLICT_PATH to PATH, and return an
SVN_ERR_FS_CONFLICT error that indicates that there was a conflict
at PATH. Perform all allocations in POOL (except the allocation of
@@ -1217,7 +1193,6 @@ merge(svn_stringbuf_t *conflict_p,
apr_hash_index_t *hi;
svn_fs_t *fs;
apr_pool_t *iterpool;
- int pred_count;
apr_int64_t mergeinfo_increment = 0;
/* Make sure everyone comes from the same filesystem. */
@@ -1541,9 +1516,7 @@ merge(svn_stringbuf_t *conflict_p,
}
svn_pool_destroy(iterpool);
- SVN_ERR(svn_fs_fs__dag_get_predecessor_count(&pred_count, source, pool));
- SVN_ERR(update_ancestry(fs, source_id, target_id, target_path,
- pred_count, pool));
+ SVN_ERR(svn_fs_fs__dag_update_ancestry(target, source, pool));
if (svn_fs_fs__fs_supports_mergeinfo(fs))
SVN_ERR(svn_fs_fs__dag_increment_mergeinfo_count(target,
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/blame.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/blame.c Fri Mar 30 13:55:26 2012
@@ -39,6 +39,8 @@
#include "svn_private_config.h"
+#include "private/svn_string_private.h"
+
#include "ra_serf.h"
#include "../libsvn_ra/ra_loader.h"
@@ -85,10 +87,7 @@ typedef struct blame_info_t {
/* The currently collected value as we build it up */
const char *prop_name;
- const char *prop_attr;
- apr_size_t prop_attr_len;
-
- svn_string_t *prop_string;
+ svn_stringbuf_t *prop_value;
/* Merged revision flag */
svn_boolean_t merged_revision;
@@ -125,18 +124,16 @@ push_state(svn_ra_serf__xml_parser_t *pa
{
blame_info_t *info;
- info = apr_palloc(parser->state->pool, sizeof(*info));
+ info = apr_pcalloc(parser->state->pool, sizeof(*info));
info->pool = parser->state->pool;
info->rev = SVN_INVALID_REVNUM;
- info->path = NULL;
info->rev_props = apr_hash_make(info->pool);
info->prop_diffs = apr_array_make(info->pool, 0, sizeof(svn_prop_t));
- info->stream = NULL;
- info->merged_revision = FALSE;
+ info->prop_value = svn_stringbuf_create_empty(info->pool);
parser->state->private = info;
}
@@ -144,36 +141,31 @@ push_state(svn_ra_serf__xml_parser_t *pa
return parser->state->private;
}
+
static const svn_string_t *
create_propval(blame_info_t *info)
{
- const svn_string_t *s;
-
- if (!info->prop_attr)
- {
- return svn_string_create_empty(info->pool);
- }
- else
- {
- info->prop_attr = apr_pmemdup(info->pool, info->prop_attr,
- info->prop_attr_len + 1);
- }
-
- s = svn_string_ncreate(info->prop_attr, info->prop_attr_len, info->pool);
if (info->prop_base64)
{
- s = svn_base64_decode_string(s, info->pool);
+ const svn_string_t *morph;
+
+ morph = svn_stringbuf__morph_into_string(info->prop_value);
+#ifdef SVN_DEBUG
+ info->prop_value = NULL; /* morph killed the stringbuf. */
+#endif
+ return svn_base64_decode_string(morph, info->pool);
}
- return s;
+
+ return svn_string_create_from_buf(info->prop_value, info->pool);
}
static svn_error_t *
start_blame(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- blame_context_t *blame_ctx = userData;
+ blame_context_t *blame_ctx = parser->user_data;
blame_state_e state;
state = parser->state->current_state;
@@ -240,8 +232,7 @@ start_blame(svn_ra_serf__xml_parser_t *p
case REMOVE_PROP:
info->prop_name = apr_pstrdup(info->pool,
svn_xml_get_attr_value("name", attrs));
- info->prop_attr = NULL;
- info->prop_attr_len = 0;
+ svn_stringbuf_setempty(info->prop_value);
enc = svn_xml_get_attr_value("encoding", attrs);
if (enc && strcmp(enc, "base64") == 0)
@@ -266,10 +257,10 @@ start_blame(svn_ra_serf__xml_parser_t *p
static svn_error_t *
end_blame(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- blame_context_t *blame_ctx = userData;
+ blame_context_t *blame_ctx = parser->user_data;
blame_state_e state;
blame_info_t *info;
@@ -338,11 +329,11 @@ end_blame(svn_ra_serf__xml_parser_t *par
static svn_error_t *
cdata_blame(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- blame_context_t *blame_ctx = userData;
+ blame_context_t *blame_ctx = parser->user_data;
blame_state_e state;
blame_info_t *info;
@@ -360,8 +351,7 @@ cdata_blame(svn_ra_serf__xml_parser_t *p
{
case REV_PROP:
case SET_PROP:
- svn_ra_serf__expand_string(&info->prop_attr, &info->prop_attr_len,
- data, len, parser->state->pool);
+ svn_stringbuf_appendbytes(info->prop_value, data, len);
break;
case TXDELTA:
if (info->stream)
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/commit.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/commit.c Fri Mar 30 13:55:26 2012
@@ -2217,7 +2217,10 @@ close_edit(void *edit_baton,
if (svn_ra_serf__merge_get_status(merge_ctx) != 200)
{
- SVN_ERR_MALFUNCTION();
+ return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+ _("MERGE request failed: returned %d "
+ "(during commit)"),
+ svn_ra_serf__merge_get_status(merge_ctx));
}
/* Inform the WC that we did a commit. */
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/get_deleted_rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/get_deleted_rev.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/get_deleted_rev.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/get_deleted_rev.c Fri Mar 30 13:55:26 2012
@@ -70,11 +70,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
static svn_error_t *
start_getdrev(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- drev_context_t *drev_ctx = userData;
+ drev_context_t *drev_ctx = parser->user_data;
drev_state_e state;
state = parser->state->current_state;
@@ -90,10 +90,10 @@ start_getdrev(svn_ra_serf__xml_parser_t
static svn_error_t *
end_getdrev(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- drev_context_t *drev_ctx = userData;
+ drev_context_t *drev_ctx = parser->user_data;
drev_state_e state;
svn_string_t *info;
@@ -113,11 +113,11 @@ end_getdrev(svn_ra_serf__xml_parser_t *p
static svn_error_t *
cdata_getdrev(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- drev_context_t *drev_ctx = userData;
+ drev_context_t *drev_ctx = parser->user_data;
drev_state_e state;
UNUSED_CTX(drev_ctx);
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getdate.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getdate.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getdate.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getdate.c Fri Mar 30 13:55:26 2012
@@ -51,15 +51,8 @@ typedef enum date_state_e {
VERSION_NAME
} date_state_e;
-typedef struct date_info_t {
- /* The currently collected value as we build it up */
- const char *tmp;
- apr_size_t tmp_len;
-} date_info_t;
typedef struct date_context_t {
- apr_pool_t *pool;
-
/* The time asked about. */
apr_time_t time;
@@ -71,41 +64,24 @@ typedef struct date_context_t {
} date_context_t;
-
-static date_info_t *
-push_state(svn_ra_serf__xml_parser_t *parser,
- date_context_t *date_ctx,
- date_state_e state)
-{
- svn_ra_serf__xml_push_state(parser, state);
-
- if (state == VERSION_NAME)
- {
- date_info_t *info;
-
- info = apr_pcalloc(parser->state->pool, sizeof(*info));
-
- parser->state->private = info;
- }
-
- return parser->state->private;
-}
static svn_error_t *
start_getdate(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- date_context_t *date_ctx = userData;
- date_state_e state;
+ date_context_t *date_ctx = parser->user_data;
+ date_state_e state = parser->state->current_state;
- state = parser->state->current_state;
+ UNUSED_CTX(date_ctx);
if (state == NONE &&
strcmp(name.name, SVN_DAV__VERSION_NAME) == 0)
{
- push_state(parser, date_ctx, VERSION_NAME);
+ svn_ra_serf__xml_push_state(parser, VERSION_NAME);
+
+ parser->state->private = svn_stringbuf_create_empty(parser->state->pool);
}
return SVN_NO_ERROR;
@@ -113,20 +89,18 @@ start_getdate(svn_ra_serf__xml_parser_t
static svn_error_t *
end_getdate(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- date_context_t *date_ctx = userData;
- date_state_e state;
- date_info_t *info;
-
- state = parser->state->current_state;
- info = parser->state->private;
+ date_context_t *date_ctx = parser->user_data;
+ date_state_e state = parser->state->current_state;
if (state == VERSION_NAME &&
strcmp(name.name, SVN_DAV__VERSION_NAME) == 0)
{
- *date_ctx->revision = SVN_STR_TO_REV(info->tmp);
+ const svn_stringbuf_t *datebuf = parser->state->private;
+
+ *date_ctx->revision = SVN_STR_TO_REV(datebuf->data);
svn_ra_serf__xml_pop_state(parser);
}
@@ -135,24 +109,21 @@ end_getdate(svn_ra_serf__xml_parser_t *p
static svn_error_t *
cdata_getdate(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- date_context_t *date_ctx = userData;
- date_state_e state;
- date_info_t *info;
+ date_context_t *date_ctx = parser->user_data;
+ date_state_e state = parser->state->current_state;
+ svn_stringbuf_t *datebuf;
UNUSED_CTX(date_ctx);
- state = parser->state->current_state;
- info = parser->state->private;
-
switch (state)
{
case VERSION_NAME:
- svn_ra_serf__expand_string(&info->tmp, &info->tmp_len,
- data, len, parser->state->pool);
+ datebuf = parser->state->private;
+ svn_stringbuf_appendbytes(datebuf, data, len);
break;
default:
break;
@@ -202,8 +173,7 @@ svn_ra_serf__get_dated_revision(svn_ra_s
const char *report_target;
int status_code;
- date_ctx = apr_pcalloc(pool, sizeof(*date_ctx));
- date_ctx->pool = pool;
+ date_ctx = apr_palloc(pool, sizeof(*date_ctx));
date_ctx->time = tm;
date_ctx->revision = revision;
date_ctx->done = FALSE;
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocations.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocations.c Fri Mar 30 13:55:26 2012
@@ -109,11 +109,11 @@ static void pop_state(loc_context_t *loc
static svn_error_t *
start_getloc(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- loc_context_t *loc_ctx = userData;
+ loc_context_t *loc_ctx = parser->user_data;
if (!loc_ctx->state && strcmp(name.name, "get-locations-report") == 0)
{
@@ -148,10 +148,10 @@ start_getloc(svn_ra_serf__xml_parser_t *
static svn_error_t *
end_getloc(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- loc_context_t *loc_ctx = userData;
+ loc_context_t *loc_ctx = parser->user_data;
loc_state_list_t *cur_state;
if (!loc_ctx->state)
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocationsegments.c Fri Mar 30 13:55:26 2012
@@ -64,11 +64,11 @@ typedef struct gls_context_t {
static svn_error_t *
start_gls(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- gls_context_t *gls_ctx = userData;
+ gls_context_t *gls_ctx = parser->user_data;
if ((! gls_ctx->inside_report)
&& strcmp(name.name, "get-location-segments-report") == 0)
@@ -115,10 +115,10 @@ start_gls(svn_ra_serf__xml_parser_t *par
static svn_error_t *
end_gls(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- gls_context_t *gls_ctx = userData;
+ gls_context_t *gls_ctx = parser->user_data;
if (strcmp(name.name, "get-location-segments-report") == 0)
gls_ctx->inside_report = FALSE;
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocks.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocks.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocks.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/getlocks.c Fri Mar 30 13:55:26 2012
@@ -65,8 +65,7 @@ typedef struct lock_info_t {
svn_lock_t *lock;
/* The currently collected value as we build it up */
- const char *tmp;
- apr_size_t tmp_len;
+ svn_stringbuf_t *cdata;
} lock_info_t;
@@ -101,7 +100,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
info->pool = lock_ctx->pool;
info->lock = svn_lock_create(lock_ctx->pool);
- info->lock->path =
+ info->cdata = svn_stringbuf_create_empty(info->pool);
parser->state->private = info;
}
@@ -111,11 +110,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
static svn_error_t *
start_getlocks(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- lock_context_t *lock_ctx = userData;
+ lock_context_t *lock_ctx = parser->user_data;
lock_state_e state;
state = parser->state->current_state;
@@ -163,10 +162,10 @@ start_getlocks(svn_ra_serf__xml_parser_t
static svn_error_t *
end_getlocks(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- lock_context_t *lock_ctx = userData;
+ lock_context_t *lock_ctx = parser->user_data;
lock_state_e state;
lock_info_t *info;
@@ -212,46 +211,50 @@ end_getlocks(svn_ra_serf__xml_parser_t *
else if (state == PATH &&
strcmp(name.name, "path") == 0)
{
- info->lock->path = apr_pstrmemdup(info->pool, info->tmp, info->tmp_len);
- info->tmp_len = 0;
+ info->lock->path = apr_pstrmemdup(info->pool,
+ info->cdata->data, info->cdata->len);
+ svn_stringbuf_setempty(info->cdata);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == TOKEN &&
strcmp(name.name, "token") == 0)
{
- info->lock->token = apr_pstrmemdup(info->pool, info->tmp, info->tmp_len);
- info->tmp_len = 0;
+ info->lock->token = apr_pstrmemdup(info->pool,
+ info->cdata->data, info->cdata->len);
+ svn_stringbuf_setempty(info->cdata);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == OWNER &&
strcmp(name.name, "owner") == 0)
{
- info->lock->owner = apr_pstrmemdup(info->pool, info->tmp, info->tmp_len);
- info->tmp_len = 0;
+ info->lock->owner = apr_pstrmemdup(info->pool,
+ info->cdata->data, info->cdata->len);
+ svn_stringbuf_setempty(info->cdata);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == COMMENT &&
strcmp(name.name, "comment") == 0)
{
info->lock->comment = apr_pstrmemdup(info->pool,
- info->tmp, info->tmp_len);
- info->tmp_len = 0;
+ info->cdata->data,
+ info->cdata->len);
+ svn_stringbuf_setempty(info->cdata);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == CREATION_DATE &&
strcmp(name.name, SVN_DAV__CREATIONDATE) == 0)
{
SVN_ERR(svn_time_from_cstring(&info->lock->creation_date,
- info->tmp, info->pool));
- info->tmp_len = 0;
+ info->cdata->data, info->pool));
+ svn_stringbuf_setempty(info->cdata);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == EXPIRATION_DATE &&
strcmp(name.name, "expirationdate") == 0)
{
SVN_ERR(svn_time_from_cstring(&info->lock->expiration_date,
- info->tmp, info->pool));
- info->tmp_len = 0;
+ info->cdata->data, info->pool));
+ svn_stringbuf_setempty(info->cdata);
svn_ra_serf__xml_pop_state(parser);
}
@@ -260,11 +263,11 @@ end_getlocks(svn_ra_serf__xml_parser_t *
static svn_error_t *
cdata_getlocks(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- lock_context_t *lock_ctx = userData;
+ lock_context_t *lock_ctx = parser->user_data;
lock_state_e state;
lock_info_t *info;
@@ -281,8 +284,7 @@ cdata_getlocks(svn_ra_serf__xml_parser_t
case COMMENT:
case CREATION_DATE:
case EXPIRATION_DATE:
- svn_ra_serf__expand_string(&info->tmp, &info->tmp_len,
- data, len, parser->state->pool);
+ svn_stringbuf_appendbytes(info->cdata, data, len);
break;
default:
break;
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/locks.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/locks.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/locks.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/locks.c Fri Mar 30 13:55:26 2012
@@ -58,11 +58,6 @@ typedef enum lock_state_e {
COMMENT
} lock_state_e;
-typedef struct lock_prop_info_t {
- const char *data;
- apr_size_t len;
-} lock_prop_info_t;
-
typedef struct lock_info_t {
apr_pool_t *pool;
@@ -79,16 +74,12 @@ typedef struct lock_info_t {
int status_code;
const char *reason;
- /* The currently collected value as we build it up */
- const char *tmp;
- apr_size_t tmp_len;
-
/* are we done? */
svn_boolean_t done;
} lock_info_t;
-static lock_prop_info_t*
+static svn_stringbuf_t *
push_state(svn_ra_serf__xml_parser_t *parser,
lock_info_t *lock_ctx,
lock_state_e state)
@@ -102,8 +93,8 @@ push_state(svn_ra_serf__xml_parser_t *pa
case TIMEOUT:
case LOCK_TOKEN:
case COMMENT:
- parser->state->private = apr_pcalloc(parser->state->pool,
- sizeof(lock_prop_info_t));
+ parser->state->private =
+ svn_stringbuf_create_empty(parser->state->pool);
break;
default:
break;
@@ -117,11 +108,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
*/
static svn_error_t *
start_lock(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- lock_info_t *ctx = userData;
+ lock_info_t *ctx = parser->user_data;
lock_state_e state;
state = parser->state->current_state;
@@ -198,10 +189,10 @@ start_lock(svn_ra_serf__xml_parser_t *pa
*/
static svn_error_t *
end_lock(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- lock_info_t *ctx = userData;
+ lock_info_t *ctx = parser->user_data;
lock_state_e state;
state = parser->state->current_state;
@@ -239,7 +230,7 @@ end_lock(svn_ra_serf__xml_parser_t *pars
else if (state == TIMEOUT &&
strcmp(name.name, "timeout") == 0)
{
- lock_prop_info_t *info = parser->state->private;
+ svn_stringbuf_t *info = parser->state->private;
if (strcmp(info->data, "Infinite") == 0)
{
@@ -255,12 +246,12 @@ end_lock(svn_ra_serf__xml_parser_t *pars
else if (state == LOCK_TOKEN &&
strcmp(name.name, "locktoken") == 0)
{
- lock_prop_info_t *info = parser->state->private;
+ svn_stringbuf_t *info = parser->state->private;
if (!ctx->lock->token && info->len)
{
- apr_collapse_spaces((char*)info->data, info->data);
- ctx->lock->token = apr_pstrndup(ctx->pool, info->data, info->len);
+ apr_collapse_spaces(info->data, info->data);
+ ctx->lock->token = apr_pstrmemdup(ctx->pool, info->data, info->len);
}
/* We don't actually need the lock token. */
svn_ra_serf__xml_pop_state(parser);
@@ -268,11 +259,12 @@ end_lock(svn_ra_serf__xml_parser_t *pars
else if (state == COMMENT &&
strcmp(name.name, "owner") == 0)
{
- lock_prop_info_t *info = parser->state->private;
+ svn_stringbuf_t *info = parser->state->private;
if (info->len)
{
- ctx->lock->comment = apr_pstrndup(ctx->pool, info->data, info->len);
+ ctx->lock->comment = apr_pstrmemdup(ctx->pool,
+ info->data, info->len);
}
svn_ra_serf__xml_pop_state(parser);
}
@@ -282,13 +274,13 @@ end_lock(svn_ra_serf__xml_parser_t *pars
static svn_error_t *
cdata_lock(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- lock_info_t *lock_ctx = userData;
+ lock_info_t *lock_ctx = parser->user_data;
lock_state_e state;
- lock_prop_info_t *info;
+ svn_stringbuf_t *info;
UNUSED_CTX(lock_ctx);
@@ -303,9 +295,9 @@ cdata_lock(svn_ra_serf__xml_parser_t *pa
case TIMEOUT:
case LOCK_TOKEN:
case COMMENT:
- svn_ra_serf__expand_string(&info->data, &info->len,
- data, len, parser->state->pool);
+ svn_stringbuf_appendbytes(info, data, len);
break;
+
default:
break;
}
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/log.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/log.c Fri Mar 30 13:55:26 2012
@@ -39,6 +39,7 @@
#include "svn_props.h"
#include "private/svn_dav_protocol.h"
+#include "private/svn_string_private.h"
#include "svn_private_config.h"
#include "ra_serf.h"
@@ -71,8 +72,7 @@ typedef struct log_info_t {
/* The currently collected value as we build it up, and its wire
* encoding (if any).
*/
- const char *tmp;
- apr_size_t tmp_len;
+ svn_stringbuf_t *tmp;
const char *tmp_encoding;
/* Temporary change path - ultimately inserted into changed_paths hash. */
@@ -130,6 +130,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
info = apr_pcalloc(info_pool, sizeof(*info));
info->pool = info_pool;
+ info->tmp = svn_stringbuf_create_empty(info_pool);
info->log_entry = svn_log_entry_create(info_pool);
info->log_entry->revision = SVN_INVALID_REVNUM;
@@ -189,11 +190,11 @@ read_changed_path_attributes(svn_log_cha
static svn_error_t *
start_log(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- log_context_t *log_ctx = userData;
+ log_context_t *log_ctx = parser->user_data;
log_state_e state;
state = parser->state->current_state;
@@ -218,15 +219,15 @@ start_log(svn_ra_serf__xml_parser_t *par
}
else if (strcmp(name.name, "creator-displayname") == 0)
{
- info = push_state(parser, log_ctx, CREATOR, attrs);
+ push_state(parser, log_ctx, CREATOR, attrs);
}
else if (strcmp(name.name, "date") == 0)
{
- info = push_state(parser, log_ctx, DATE, attrs);
+ push_state(parser, log_ctx, DATE, attrs);
}
else if (strcmp(name.name, "comment") == 0)
{
- info = push_state(parser, log_ctx, COMMENT, attrs);
+ push_state(parser, log_ctx, COMMENT, attrs);
}
else if (strcmp(name.name, "revprop") == 0)
{
@@ -321,11 +322,15 @@ static svn_error_t *
maybe_decode_log_cdata(const svn_string_t **decoded_cdata,
log_info_t *info)
{
+
if (info->tmp_encoding)
{
- svn_string_t in;
- in.data = info->tmp;
- in.len = info->tmp_len;
+ svn_string_t tmp;
+
+ /* Don't use morph_info_string cuz we need info->tmp to
+ remain usable. */
+ tmp.data = info->tmp->data;
+ tmp.len = info->tmp->len;
/* Check for a known encoding type. This is easy -- there's
only one. */
@@ -336,22 +341,21 @@ maybe_decode_log_cdata(const svn_string_
info->tmp_encoding);
}
- *decoded_cdata = svn_base64_decode_string(&in, info->pool);
+ *decoded_cdata = svn_base64_decode_string(&tmp, info->pool);
}
else
{
- *decoded_cdata = svn_string_ncreate(info->tmp, info->tmp_len,
- info->pool);
+ *decoded_cdata = svn_string_create_from_buf(info->tmp, info->pool);
}
return SVN_NO_ERROR;
}
static svn_error_t *
end_log(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- log_context_t *log_ctx = userData;
+ log_context_t *log_ctx = parser->user_data;
log_state_e state;
log_info_t *info;
@@ -393,8 +397,8 @@ end_log(svn_ra_serf__xml_parser_t *parse
else if (state == VERSION &&
strcmp(name.name, SVN_DAV__VERSION_NAME) == 0)
{
- info->log_entry->revision = SVN_STR_TO_REV(info->tmp);
- info->tmp_len = 0;
+ info->log_entry->revision = SVN_STR_TO_REV(info->tmp->data);
+ svn_stringbuf_setempty(info->tmp);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == CREATOR &&
@@ -407,7 +411,7 @@ end_log(svn_ra_serf__xml_parser_t *parse
apr_hash_set(info->log_entry->revprops, SVN_PROP_REVISION_AUTHOR,
APR_HASH_KEY_STRING, decoded_cdata);
}
- info->tmp_len = 0;
+ svn_stringbuf_setempty(info->tmp);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == DATE &&
@@ -420,7 +424,7 @@ end_log(svn_ra_serf__xml_parser_t *parse
apr_hash_set(info->log_entry->revprops, SVN_PROP_REVISION_DATE,
APR_HASH_KEY_STRING, decoded_cdata);
}
- info->tmp_len = 0;
+ svn_stringbuf_setempty(info->tmp);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == COMMENT &&
@@ -433,7 +437,7 @@ end_log(svn_ra_serf__xml_parser_t *parse
apr_hash_set(info->log_entry->revprops, SVN_PROP_REVISION_LOG,
APR_HASH_KEY_STRING, decoded_cdata);
}
- info->tmp_len = 0;
+ svn_stringbuf_setempty(info->tmp);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == REVPROP)
@@ -442,7 +446,7 @@ end_log(svn_ra_serf__xml_parser_t *parse
SVN_ERR(maybe_decode_log_cdata(&decoded_cdata, info));
apr_hash_set(info->log_entry->revprops, info->revprop_name,
APR_HASH_KEY_STRING, decoded_cdata);
- info->tmp_len = 0;
+ svn_stringbuf_setempty(info->tmp);
svn_ra_serf__xml_pop_state(parser);
}
else if (state == HAS_CHILDREN &&
@@ -468,8 +472,8 @@ end_log(svn_ra_serf__xml_parser_t *parse
{
char *path;
- path = apr_pstrmemdup(info->pool, info->tmp, info->tmp_len);
- info->tmp_len = 0;
+ path = apr_pstrmemdup(info->pool, info->tmp->data, info->tmp->len);
+ svn_stringbuf_setempty(info->tmp);
apr_hash_set(info->log_entry->changed_paths2, path, APR_HASH_KEY_STRING,
info->tmp_path);
@@ -481,11 +485,11 @@ end_log(svn_ra_serf__xml_parser_t *parse
static svn_error_t *
cdata_log(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- log_context_t *log_ctx = userData;
+ log_context_t *log_ctx = parser->user_data;
log_state_e state;
log_info_t *info;
@@ -505,9 +509,9 @@ cdata_log(svn_ra_serf__xml_parser_t *par
case REPLACED_PATH:
case DELETED_PATH:
case MODIFIED_PATH:
- svn_ra_serf__expand_string(&info->tmp, &info->tmp_len,
- data, len, info->pool);
+ svn_stringbuf_appendbytes(info->tmp, data, len);
break;
+
default:
break;
}
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/merge.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/merge.c Fri Mar 30 13:55:26 2012
@@ -80,8 +80,8 @@ typedef struct merge_info_t {
const char *prop_ns;
const char *prop_name;
- const char *prop_val;
- apr_size_t prop_val_len;
+ svn_stringbuf_t *prop_value;
+
} merge_info_t;
/* Structure associated with a MERGE request. */
@@ -119,6 +119,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
info = apr_palloc(parser->state->pool, sizeof(*info));
info->pool = parser->state->pool;
info->props = apr_hash_make(info->pool);
+ info->prop_value = svn_stringbuf_create_empty(info->pool);
parser->state->private = info;
}
@@ -128,11 +129,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
static svn_error_t *
start_merge(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__merge_context_t *ctx = userData;
+ svn_ra_serf__merge_context_t *ctx = parser->user_data;
merge_state_e state;
merge_info_t *info;
@@ -163,9 +164,8 @@ start_merge(svn_ra_serf__xml_parser_t *p
info = push_state(parser, ctx, PROP_VAL);
info->prop_ns = name.namespace;
- info->prop_name = apr_pstrdup(info->pool, name.name);
- info->prop_val = NULL;
- info->prop_val_len = 0;
+ info->prop_name = "href";
+ svn_stringbuf_setempty(info->prop_value);
}
else if (state == RESPONSE &&
strcmp(name.name, "propstat") == 0)
@@ -206,11 +206,9 @@ start_merge(svn_ra_serf__xml_parser_t *p
strcmp(name.name, "checked-in") == 0)
{
info = push_state(parser, ctx, IGNORE_PROP_NAME);
-
info->prop_ns = name.namespace;
- info->prop_name = apr_pstrdup(info->pool, name.name);
- info->prop_val = NULL;
- info->prop_val_len = 0;
+ info->prop_name = "checked-in";
+ svn_stringbuf_setempty(info->prop_value);
}
else if (state == PROP)
{
@@ -225,8 +223,7 @@ start_merge(svn_ra_serf__xml_parser_t *p
info = push_state(parser, ctx, PROP_VAL);
info->prop_ns = name.namespace;
info->prop_name = apr_pstrdup(info->pool, name.name);
- info->prop_val = NULL;
- info->prop_val_len = 0;
+ svn_stringbuf_setempty(info->prop_value);
}
else
{
@@ -238,10 +235,10 @@ start_merge(svn_ra_serf__xml_parser_t *p
static svn_error_t *
end_merge(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__merge_context_t *ctx = userData;
+ svn_ra_serf__merge_context_t *ctx = parser->user_data;
merge_state_e state;
merge_info_t *info;
@@ -349,24 +346,27 @@ end_merge(svn_ra_serf__xml_parser_t *par
}
else if (state == PROP_VAL)
{
+ const char *value;
+
if (!info->prop_name)
{
+ /* ### gstein sez: dunno what this is about. */
info->prop_name = apr_pstrdup(info->pool, name.name);
}
- info->prop_val = apr_pstrmemdup(info->pool, info->prop_val,
- info->prop_val_len);
+
if (strcmp(info->prop_name, "href") == 0)
- info->prop_val = svn_urlpath__canonicalize(info->prop_val,
- info->pool);
+ value = svn_urlpath__canonicalize(info->prop_value->data, info->pool);
+ else
+ value = apr_pstrmemdup(info->pool,
+ info->prop_value->data, info->prop_value->len);
/* Set our property. */
apr_hash_set(info->props, info->prop_name, APR_HASH_KEY_STRING,
- info->prop_val);
+ value);
info->prop_ns = NULL;
info->prop_name = NULL;
- info->prop_val = NULL;
- info->prop_val_len = 0;
+ svn_stringbuf_setempty(info->prop_value);
svn_ra_serf__xml_pop_state(parser);
}
@@ -376,11 +376,11 @@ end_merge(svn_ra_serf__xml_parser_t *par
static svn_error_t *
cdata_merge(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__merge_context_t *ctx = userData;
+ svn_ra_serf__merge_context_t *ctx = parser->user_data;
merge_state_e state;
merge_info_t *info;
@@ -390,10 +390,7 @@ cdata_merge(svn_ra_serf__xml_parser_t *p
info = parser->state->private;
if (state == PROP_VAL)
- {
- svn_ra_serf__expand_string(&info->prop_val, &info->prop_val_len,
- data, len, parser->state->pool);
- }
+ svn_stringbuf_appendbytes(info->prop_value, data, len);
return SVN_NO_ERROR;
}
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/mergeinfo.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/mergeinfo.c Fri Mar 30 13:55:26 2012
@@ -66,11 +66,11 @@ typedef struct mergeinfo_context_t {
static svn_error_t *
start_element(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- mergeinfo_context_t *mergeinfo_ctx = userData;
+ mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
mergeinfo_state_e state;
state = parser->state->current_state;
@@ -99,10 +99,11 @@ start_element(svn_ra_serf__xml_parser_t
}
static svn_error_t *
-end_element(svn_ra_serf__xml_parser_t *parser, void *userData,
- svn_ra_serf__dav_props_t name)
+end_element(svn_ra_serf__xml_parser_t *parser,
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- mergeinfo_context_t *mergeinfo_ctx = userData;
+ mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
mergeinfo_state_e state;
state = parser->state->current_state;
@@ -149,10 +150,12 @@ end_element(svn_ra_serf__xml_parser_t *p
static svn_error_t *
-cdata_handler(svn_ra_serf__xml_parser_t *parser, void *userData,
- const char *data, apr_size_t len)
+cdata_handler(svn_ra_serf__xml_parser_t *parser,
+ const char *data,
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- mergeinfo_context_t *mergeinfo_ctx = userData;
+ mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
mergeinfo_state_e state;
state = parser->state->current_state;
Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/options.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/options.c Fri Mar 30 13:55:26 2012
@@ -66,8 +66,8 @@ struct svn_ra_serf__options_context_t {
/* pool to allocate memory from */
apr_pool_t *pool;
- const char *attr_val;
- apr_size_t attr_val_len;
+ /* Buffer for the activity-collection */
+ svn_stringbuf_t *acbuf;
svn_boolean_t collect_cdata;
/* Current state we're in */
@@ -127,11 +127,11 @@ static void pop_state(svn_ra_serf__optio
static svn_error_t *
start_options(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__options_context_t *options_ctx = userData;
+ svn_ra_serf__options_context_t *options_ctx = parser->user_data;
if (!options_ctx->state && strcmp(name.name, "options-response") == 0)
{
@@ -159,10 +159,10 @@ start_options(svn_ra_serf__xml_parser_t
static svn_error_t *
end_options(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__options_context_t *options_ctx = userData;
+ svn_ra_serf__options_context_t *options_ctx = parser->user_data;
options_state_list_t *cur_state;
if (!options_ctx->state)
@@ -187,7 +187,7 @@ end_options(svn_ra_serf__xml_parser_t *p
{
options_ctx->collect_cdata = FALSE;
options_ctx->activity_collection =
- svn_urlpath__canonicalize(options_ctx->attr_val, options_ctx->pool);
+ svn_urlpath__canonicalize(options_ctx->acbuf->data, options_ctx->pool);
pop_state(options_ctx);
}
@@ -196,16 +196,14 @@ end_options(svn_ra_serf__xml_parser_t *p
static svn_error_t *
cdata_options(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__options_context_t *ctx = userData;
+ svn_ra_serf__options_context_t *ctx = parser->user_data;
+
if (ctx->collect_cdata)
- {
- svn_ra_serf__expand_string(&ctx->attr_val, &ctx->attr_val_len,
- data, len, ctx->pool);
- }
+ svn_stringbuf_appendbytes(ctx->acbuf, data, len);
return SVN_NO_ERROR;
}
@@ -442,6 +440,8 @@ svn_ra_serf__create_options_req(svn_ra_s
new_ctx->pool = pool;
+ new_ctx->acbuf = svn_stringbuf_create_empty(pool);
+
new_ctx->path = path;
new_ctx->youngest_rev = SVN_INVALID_REVNUM;