Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_ra_serf/replay.c view on Meta::CPAN
push_state(svn_ra_serf__xml_parser_t *parser,
replay_context_t *replay_ctx,
replay_state_e state)
{
svn_ra_serf__xml_push_state(parser, state);
if (state == OPEN_DIR || state == ADD_DIR ||
state == OPEN_FILE || state == ADD_FILE)
{
replay_info_t *info;
apr_pool_t *pool = svn_pool_create(replay_ctx->dst_rev_pool);
info = apr_palloc(pool, sizeof(*info));
info->pool = pool;
info->parent = parser->state->private;
info->baton = NULL;
info->stream = NULL;
parser->state->private = info;
}
else if (state == CHANGE_PROP)
{
prop_info_t *info;
apr_pool_t *pool = svn_pool_create(replay_ctx->dst_rev_pool);
info = apr_pcalloc(pool, sizeof(*info));
info->pool = pool;
info->parent = parser->state->private;
info->prop_value = svn_stringbuf_create_empty(pool);
parser->state->private = info;
}
return parser->state->private;
}
static svn_error_t *
start_replay(svn_ra_serf__xml_parser_t *parser,
svn_ra_serf__dav_props_t name,
const char **attrs,
apr_pool_t *scratch_pool)
{
replay_context_t *ctx = parser->user_data;
replay_state_e state;
state = parser->state->current_state;
if (state == NONE &&
strcmp(name.name, "editor-report") == 0)
{
push_state(parser, ctx, REPORT);
/* Before we can continue, we need the revision properties. */
SVN_ERR_ASSERT(!ctx->propfind_handler || ctx->propfind_handler->done);
/* Create a pool for the commit editor. */
ctx->dst_rev_pool = svn_pool_create(ctx->src_rev_pool);
SVN_ERR(svn_ra_serf__select_revprops(&ctx->props,
ctx->revprop_target,
ctx->revprop_rev,
ctx->revs_props,
ctx->dst_rev_pool,
scratch_pool));
if (ctx->revstart_func)
{
SVN_ERR(ctx->revstart_func(ctx->revision, ctx->replay_baton,
&ctx->editor, &ctx->editor_baton,
ctx->props,
ctx->dst_rev_pool));
}
}
else if (state == REPORT &&
strcmp(name.name, "target-revision") == 0)
{
const char *rev;
rev = svn_xml_get_attr_value("rev", attrs);
if (!rev)
{
return svn_error_create(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
_("Missing revision attr in target-revision element"));
}
SVN_ERR(ctx->editor->set_target_revision(ctx->editor_baton,
SVN_STR_TO_REV(rev),
scratch_pool));
}
else if (state == REPORT &&
strcmp(name.name, "open-root") == 0)
{
const char *rev;
replay_info_t *info;
rev = svn_xml_get_attr_value("rev", attrs);
if (!rev)
{
return svn_error_create(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
_("Missing revision attr in open-root element"));
}
info = push_state(parser, ctx, OPEN_DIR);
SVN_ERR(ctx->editor->open_root(ctx->editor_baton,
SVN_STR_TO_REV(rev),
ctx->dst_rev_pool,
&info->baton));
}
else if ((state == OPEN_DIR || state == ADD_DIR) &&
strcmp(name.name, "delete-entry") == 0)
{
const char *file_name, *rev;
replay_info_t *info;
file_name = svn_xml_get_attr_value("name", attrs);
if (!file_name)
{
( run in 1.521 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )