void svn_ra_svn_get_editor(const svn_delta_editor_t **editor, void **edit_baton, svn_ra_svn_conn_t *conn, apr_pool_t *pool, svn_ra_svn_edit_callback callback, void *callback_baton) { svn_delta_editor_t *ra_svn_editor = svn_delta_default_editor(pool); ra_svn_edit_baton_t *eb; eb = apr_palloc(pool, sizeof(*eb)); eb->conn = conn; eb->callback = callback; eb->callback_baton = callback_baton; eb->next_token = 0; eb->got_status = FALSE; ra_svn_editor->set_target_revision = ra_svn_target_rev; ra_svn_editor->open_root = ra_svn_open_root; ra_svn_editor->delete_entry = ra_svn_delete_entry; ra_svn_editor->add_directory = ra_svn_add_dir; ra_svn_editor->open_directory = ra_svn_open_dir; ra_svn_editor->change_dir_prop = ra_svn_change_dir_prop; ra_svn_editor->close_directory = ra_svn_close_dir; ra_svn_editor->absent_directory = ra_svn_absent_dir; ra_svn_editor->add_file = ra_svn_add_file; ra_svn_editor->open_file = ra_svn_open_file; ra_svn_editor->apply_textdelta = ra_svn_apply_textdelta; ra_svn_editor->change_file_prop = ra_svn_change_file_prop; ra_svn_editor->close_file = ra_svn_close_file; ra_svn_editor->absent_file = ra_svn_absent_file; ra_svn_editor->close_edit = ra_svn_close_edit; ra_svn_editor->abort_edit = ra_svn_abort_edit; *editor = ra_svn_editor; *edit_baton = eb; svn_error_clear(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, NULL, NULL, conn->shim_callbacks, pool, pool)); }
svn_error_t * svn_repos_get_commit_editor5(const svn_delta_editor_t **editor, void **edit_baton, svn_repos_t *repos, svn_fs_txn_t *txn, const char *repos_url_decoded, const char *base_path, apr_hash_t *revprop_table, svn_commit_callback2_t commit_callback, void *commit_baton, svn_repos_authz_callback_t authz_callback, void *authz_baton, apr_pool_t *pool) { svn_delta_editor_t *e; apr_pool_t *subpool = svn_pool_create(pool); struct edit_baton *eb; svn_delta_shim_callbacks_t *shim_callbacks = svn_delta_shim_callbacks_default(pool); const char *repos_url = svn_path_uri_encode(repos_url_decoded, pool); /* Do a global authz access lookup. Users with no write access whatsoever to the repository don't get a commit editor. */ if (authz_callback) { svn_boolean_t allowed; SVN_ERR(authz_callback(svn_authz_write, &allowed, NULL, NULL, authz_baton, pool)); if (!allowed) return svn_error_create(SVN_ERR_AUTHZ_UNWRITABLE, NULL, "Not authorized to open a commit editor."); } /* Allocate the structures. */ e = svn_delta_default_editor(pool); eb = apr_pcalloc(subpool, sizeof(*eb)); /* Set up the editor. */ e->open_root = open_root; e->delete_entry = delete_entry; e->add_directory = add_directory; e->open_directory = open_directory; e->change_dir_prop = change_dir_prop; e->add_file = add_file; e->open_file = open_file; e->close_file = close_file; e->apply_textdelta = apply_textdelta; e->change_file_prop = change_file_prop; e->close_edit = close_edit; e->abort_edit = abort_edit; /* Set up the edit baton. */ eb->pool = subpool; eb->revprop_table = svn_prop_hash_dup(revprop_table, subpool); eb->commit_callback = commit_callback; eb->commit_callback_baton = commit_baton; eb->authz_callback = authz_callback; eb->authz_baton = authz_baton; eb->base_path = svn_fspath__canonicalize(base_path, subpool); eb->repos = repos; eb->repos_url_decoded = repos_url_decoded; eb->repos_name = svn_dirent_basename(svn_repos_path(repos, subpool), subpool); eb->fs = svn_repos_fs(repos); eb->txn = txn; eb->txn_owner = txn == NULL; *edit_baton = eb; *editor = e; shim_callbacks->fetch_props_func = fetch_props_func; shim_callbacks->fetch_kind_func = fetch_kind_func; shim_callbacks->fetch_base_func = fetch_base_func; shim_callbacks->fetch_baton = eb; SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, repos_url, eb->base_path, shim_callbacks, pool, pool)); return SVN_NO_ERROR; }
/* Create a repository diff editor and baton. */ svn_error_t * svn_client__get_diff_editor(const svn_delta_editor_t **editor, void **edit_baton, svn_depth_t depth, svn_ra_session_t *ra_session, svn_revnum_t revision, svn_boolean_t walk_deleted_dirs, svn_boolean_t text_deltas, const svn_wc_diff_callbacks4_t *diff_callbacks, void *diff_cmd_baton, svn_cancel_func_t cancel_func, void *cancel_baton, svn_wc_notify_func2_t notify_func, void *notify_baton, apr_pool_t *result_pool) { apr_pool_t *editor_pool = svn_pool_create(result_pool); svn_delta_editor_t *tree_editor = svn_delta_default_editor(editor_pool); struct edit_baton *eb = apr_pcalloc(editor_pool, sizeof(*eb)); svn_delta_shim_callbacks_t *shim_callbacks = svn_delta_shim_callbacks_default(editor_pool); eb->pool = editor_pool; eb->depth = depth; eb->diff_callbacks = diff_callbacks; eb->diff_cmd_baton = diff_cmd_baton; eb->ra_session = ra_session; eb->revision = revision; eb->empty_file = NULL; eb->empty_hash = apr_hash_make(eb->pool); eb->deleted_paths = apr_hash_make(eb->pool); eb->notify_func = notify_func; eb->notify_baton = notify_baton; eb->walk_deleted_repos_dirs = walk_deleted_dirs; eb->text_deltas = text_deltas; eb->cancel_func = cancel_func; eb->cancel_baton = cancel_baton; tree_editor->set_target_revision = set_target_revision; tree_editor->open_root = open_root; tree_editor->delete_entry = delete_entry; tree_editor->add_directory = add_directory; tree_editor->open_directory = open_directory; tree_editor->add_file = add_file; tree_editor->open_file = open_file; tree_editor->apply_textdelta = apply_textdelta; tree_editor->close_file = close_file; tree_editor->close_directory = close_directory; tree_editor->change_file_prop = change_file_prop; tree_editor->change_dir_prop = change_dir_prop; tree_editor->close_edit = close_edit; tree_editor->absent_directory = absent_directory; tree_editor->absent_file = absent_file; SVN_ERR(svn_delta_get_cancellation_editor(cancel_func, cancel_baton, tree_editor, eb, editor, edit_baton, eb->pool)); shim_callbacks->fetch_kind_func = fetch_kind_func; shim_callbacks->fetch_props_func = fetch_props_func; shim_callbacks->fetch_base_func = fetch_base_func; shim_callbacks->fetch_baton = eb; SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, shim_callbacks, result_pool, result_pool)); return SVN_NO_ERROR; }