Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_ra_serf/locks.c view on Meta::CPAN
alloc);
}
svn_ra_serf__add_close_tag_buckets(buckets, alloc, "lockinfo");
*body_bkt = buckets;
return SVN_NO_ERROR;
}
svn_error_t *
svn_ra_serf__get_lock(svn_ra_session_t *ra_session,
svn_lock_t **lock,
const char *path,
apr_pool_t *result_pool)
{
svn_ra_serf__session_t *session = ra_session->priv;
svn_ra_serf__handler_t *handler;
svn_ra_serf__xml_context_t *xmlctx;
apr_pool_t *scratch_pool = svn_pool_create(result_pool);
lock_info_t *lock_ctx;
const char *req_url;
svn_error_t *err;
req_url = svn_path_url_add_component2(session->session_url.path, path,
scratch_pool);
lock_ctx = apr_pcalloc(scratch_pool, sizeof(*lock_ctx));
lock_ctx->pool = result_pool;
lock_ctx->path = req_url;
lock_ctx->lock = svn_lock_create(result_pool);
lock_ctx->lock->path = apr_pstrdup(result_pool, path);
xmlctx = svn_ra_serf__xml_context_create(locks_ttable,
NULL, locks_closed, NULL,
lock_ctx,
scratch_pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, scratch_pool);
handler->method = "PROPFIND";
handler->path = req_url;
handler->body_type = "text/xml";
handler->conn = session->conns[0];
handler->session = session;
handler->body_delegate = create_getlock_body;
handler->body_delegate_baton = lock_ctx;
handler->header_delegate = setup_getlock_headers;
handler->header_delegate_baton = lock_ctx;
lock_ctx->inner_handler = handler->response_handler;
lock_ctx->inner_baton = handler->response_baton;
handler->response_handler = handle_lock;
handler->response_baton = lock_ctx;
lock_ctx->handler = handler;
err = svn_ra_serf__context_run_one(handler, scratch_pool);
err = determine_error(handler, err);
if (handler->sline.code == 404)
{
return svn_error_create(SVN_ERR_RA_ILLEGAL_URL, err,
_("Malformed URL for repository"));
}
if (err)
{
/* TODO Shh. We're telling a white lie for now. */
return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, err,
_("Server does not support locking features"));
}
if (lock_ctx->lock && lock_ctx->lock->token)
*lock = lock_ctx->lock;
else
*lock = NULL;
svn_pool_destroy(scratch_pool);
return SVN_NO_ERROR;
}
svn_error_t *
svn_ra_serf__lock(svn_ra_session_t *ra_session,
apr_hash_t *path_revs,
const char *comment,
svn_boolean_t force,
svn_ra_lock_callback_t lock_func,
void *lock_baton,
apr_pool_t *scratch_pool)
{
svn_ra_serf__session_t *session = ra_session->priv;
apr_hash_index_t *hi;
apr_pool_t *iterpool;
iterpool = svn_pool_create(scratch_pool);
/* ### TODO for issue 2263: Send all the locks over the wire at once. This
### loop is just a temporary shim.
### an alternative, which is backwards-compat with all servers is to
### pipeline these requests. ie. stop using run_wait/run_one. */
for (hi = apr_hash_first(scratch_pool, path_revs);
hi;
hi = apr_hash_next(hi))
{
svn_ra_serf__handler_t *handler;
svn_ra_serf__xml_context_t *xmlctx;
const char *req_url;
lock_info_t *lock_ctx;
svn_error_t *err;
svn_error_t *new_err = NULL;
svn_pool_clear(iterpool);
lock_ctx = apr_pcalloc(iterpool, sizeof(*lock_ctx));
lock_ctx->pool = iterpool;
lock_ctx->path = svn__apr_hash_index_key(hi);
lock_ctx->revision = *((svn_revnum_t*)svn__apr_hash_index_val(hi));
lock_ctx->lock = svn_lock_create(iterpool);
( run in 0.611 second using v1.01-cache-2.11-cpan-39bf76dae61 )