static svn_delta_shim_callbacks_t * get_shim_callbacks(struct revision_baton *rb, apr_pool_t *pool) { svn_delta_shim_callbacks_t *callbacks = svn_delta_shim_callbacks_default(pool); callbacks->fetch_props_func = fetch_props_func; callbacks->fetch_kind_func = fetch_kind_func; callbacks->fetch_base_func = fetch_base_func; callbacks->fetch_baton = rb; return callbacks; }
svn_delta_shim_callbacks_t * svn_client__get_shim_callbacks(svn_wc_context_t *wc_ctx, apr_hash_t *relpath_map, apr_pool_t *result_pool) { svn_delta_shim_callbacks_t *callbacks = svn_delta_shim_callbacks_default(result_pool); struct shim_callbacks_baton *scb = apr_pcalloc(result_pool, sizeof(*scb)); scb->wc_ctx = wc_ctx; if (relpath_map) scb->relpath_map = relpath_map; else scb->relpath_map = apr_hash_make(result_pool); callbacks->fetch_props_func = fetch_props_func; callbacks->fetch_kind_func = fetch_kind_func; callbacks->fetch_base_func = fetch_base_func; callbacks->fetch_baton = scb; return callbacks; }
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; }