svn_error_t * svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **callbacks, void **parse_baton, svn_repos_t *repos, svn_revnum_t start_rev, svn_revnum_t end_rev, svn_boolean_t use_history, svn_boolean_t validate_props, enum svn_repos_load_uuid uuid_action, const char *parent_dir, svn_repos_notify_func_t notify_func, void *notify_baton, apr_pool_t *pool) { svn_repos_parse_fns3_t *parser = apr_pcalloc(pool, sizeof(*parser)); struct parse_baton *pb = apr_pcalloc(pool, sizeof(*pb)); if (parent_dir) parent_dir = svn_relpath_canonicalize(parent_dir, pool); SVN_ERR_ASSERT((SVN_IS_VALID_REVNUM(start_rev) && SVN_IS_VALID_REVNUM(end_rev)) || ((! SVN_IS_VALID_REVNUM(start_rev)) && (! SVN_IS_VALID_REVNUM(end_rev)))); if (SVN_IS_VALID_REVNUM(start_rev)) SVN_ERR_ASSERT(start_rev <= end_rev); parser->magic_header_record = magic_header_record; parser->uuid_record = uuid_record; parser->new_revision_record = new_revision_record; parser->new_node_record = new_node_record; parser->set_revision_property = set_revision_property; parser->set_node_property = set_node_property; parser->remove_node_props = remove_node_props; parser->set_fulltext = set_fulltext; parser->close_node = close_node; parser->close_revision = close_revision; parser->delete_node_property = delete_node_property; parser->apply_textdelta = apply_textdelta; pb->repos = repos; pb->fs = svn_repos_fs(repos); pb->use_history = use_history; pb->validate_props = validate_props; pb->notify_func = notify_func; pb->notify_baton = notify_baton; pb->uuid_action = uuid_action; pb->parent_dir = parent_dir; pb->pool = pool; pb->notify_pool = svn_pool_create(pool); pb->rev_map = apr_hash_make(pool); pb->oldest_old_rev = SVN_INVALID_REVNUM; pb->last_rev_mapped = SVN_INVALID_REVNUM; pb->start_rev = start_rev; pb->end_rev = end_rev; *callbacks = parser; *parse_baton = pb; return SVN_NO_ERROR; }
svn_error_t * svn_wc__db_pristine_install(svn_wc__db_install_data_t *install_data, const svn_checksum_t *sha1_checksum, const svn_checksum_t *md5_checksum, apr_pool_t *scratch_pool) { svn_wc__db_wcroot_t *wcroot = install_data->wcroot; const char *pristine_abspath; SVN_ERR_ASSERT(sha1_checksum != NULL); SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1); SVN_ERR_ASSERT(md5_checksum != NULL); SVN_ERR_ASSERT(md5_checksum->kind == svn_checksum_md5); SVN_ERR(get_pristine_fname(&pristine_abspath, wcroot->abspath, sha1_checksum, scratch_pool, scratch_pool)); /* Ensure the SQL txn has at least a 'RESERVED' lock before we start looking * at the disk, to ensure no concurrent pristine install/delete txn. */ SVN_SQLITE__WITH_IMMEDIATE_TXN( pristine_install_txn(wcroot->sdb, install_data->inner_stream, pristine_abspath, sha1_checksum, md5_checksum, scratch_pool), wcroot->sdb); return SVN_NO_ERROR; }
svn_error_t * svn_fs_bdb__close(bdb_env_baton_t *bdb_baton) { bdb_env_t *bdb = bdb_baton->bdb; SVN_ERR_ASSERT(bdb_baton->env == bdb_baton->bdb->env); SVN_ERR_ASSERT(bdb_baton->error_info->refcount > 0); /* Neutralize bdb_baton's pool cleanup to prevent double-close. See cleanup_env_baton(). */ bdb_baton->bdb = NULL; /* Note that we only bother with this cleanup if the pool is non-NULL, to guard against potential races between this and the cleanup_env cleanup callback. It's not clear if that can actually happen, but better safe than sorry. */ if (0 == --bdb_baton->error_info->refcount && bdb->pool) { svn_error_clear(bdb_baton->error_info->pending_errors); #if APR_HAS_THREADS free(bdb_baton->error_info); apr_threadkey_private_set(NULL, bdb->error_info); #endif } /* This may run during final pool cleanup when the lock is NULL. */ SVN_MUTEX__WITH_LOCK(bdb_cache_lock, svn_fs_bdb__close_internal(bdb)); return SVN_NO_ERROR; }
static svn_error_t *vwrite_tuple(svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *fmt, va_list ap) { svn_boolean_t opt = FALSE; svn_revnum_t rev; const char *cstr; const svn_string_t *str; if (*fmt == '!') fmt++; else SVN_ERR(svn_ra_svn_start_list(conn, pool)); for (; *fmt; fmt++) { if (*fmt == 'n' && !opt) SVN_ERR(svn_ra_svn_write_number(conn, pool, va_arg(ap, apr_uint64_t))); else if (*fmt == 'r') { rev = va_arg(ap, svn_revnum_t); SVN_ERR_ASSERT(opt || SVN_IS_VALID_REVNUM(rev)); if (SVN_IS_VALID_REVNUM(rev)) SVN_ERR(svn_ra_svn_write_number(conn, pool, rev)); } else if (*fmt == 's') { str = va_arg(ap, const svn_string_t *); SVN_ERR_ASSERT(opt || str); if (str) SVN_ERR(svn_ra_svn_write_string(conn, pool, str)); } else if (*fmt == 'c')
svn_error_t * svn_editor_alter_symlink(svn_editor_t *editor, const char *relpath, svn_revnum_t revision, const char *target, apr_hash_t *props) { svn_error_t *err = SVN_NO_ERROR; SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath)); SVN_ERR_ASSERT(props != NULL || target != NULL); SHOULD_NOT_BE_FINISHED(editor); SHOULD_ALLOW_ALTER(editor, relpath); VERIFY_PARENT_MAY_EXIST(editor, relpath); SVN_ERR(check_cancel(editor)); if (editor->funcs.cb_alter_symlink) { START_CALLBACK(editor); err = editor->funcs.cb_alter_symlink(editor->baton, relpath, revision, target, props, editor->scratch_pool); END_CALLBACK(editor); } MARK_COMPLETED(editor, relpath); MARK_PARENT_STABLE(editor, relpath); svn_pool_clear(editor->scratch_pool); return svn_error_trace(err); }
svn_error_t * svn_editor_copy(svn_editor_t *editor, const char *src_relpath, svn_revnum_t src_revision, const char *dst_relpath, svn_revnum_t replaces_rev) { svn_error_t *err = SVN_NO_ERROR; SVN_ERR_ASSERT(svn_relpath_is_canonical(src_relpath)); SVN_ERR_ASSERT(svn_relpath_is_canonical(dst_relpath)); SHOULD_NOT_BE_FINISHED(editor); SHOULD_ALLOW_ADD(editor, dst_relpath); VERIFY_PARENT_MAY_EXIST(editor, src_relpath); VERIFY_PARENT_MAY_EXIST(editor, dst_relpath); SVN_ERR(check_cancel(editor)); if (editor->funcs.cb_copy) { 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); MARK_PARENT_STABLE(editor, dst_relpath); CLEAR_INCOMPLETE(editor, dst_relpath); svn_pool_clear(editor->scratch_pool); return svn_error_trace(err); }
svn_error_t * svn_wc__serialize_conflict(svn_skel_t **skel, const svn_wc_conflict_description2_t *conflict, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { /* A conflict version struct with all fields null/invalid. */ static const svn_wc_conflict_version_t null_version = { NULL, SVN_INVALID_REVNUM, NULL, svn_node_unknown }; svn_skel_t *c_skel = svn_skel__make_empty_list(result_pool); const char *victim_basename; /* src_right_version */ if (conflict->src_right_version) SVN_ERR(prepend_version_info_skel(c_skel, conflict->src_right_version, result_pool)); else SVN_ERR(prepend_version_info_skel(c_skel, &null_version, result_pool)); /* src_left_version */ if (conflict->src_left_version) SVN_ERR(prepend_version_info_skel(c_skel, conflict->src_left_version, result_pool)); else SVN_ERR(prepend_version_info_skel(c_skel, &null_version, result_pool)); /* local change */ skel_prepend_enum(c_skel, svn_wc__conflict_reason_map, conflict->reason, result_pool); /* incoming change */ skel_prepend_enum(c_skel, svn_wc__conflict_action_map, conflict->action, result_pool); /* operation */ skel_prepend_enum(c_skel, svn_wc__operation_map, conflict->operation, result_pool); /* node_kind */ SVN_ERR_ASSERT(conflict->node_kind == svn_node_dir || conflict->node_kind == svn_node_file || conflict->node_kind == svn_node_none); skel_prepend_enum(c_skel, node_kind_map, conflict->node_kind, result_pool); /* Victim path (escaping separator chars). */ victim_basename = svn_dirent_basename(conflict->local_abspath, result_pool); SVN_ERR_ASSERT(victim_basename[0]); svn_skel__prepend(svn_skel__str_atom(victim_basename, result_pool), c_skel); svn_skel__prepend(svn_skel__str_atom("conflict", result_pool), c_skel); SVN_ERR_ASSERT(is_valid_conflict_skel(c_skel)); *skel = c_skel; return SVN_NO_ERROR; }
svn_error_t * svn_editor_alter_directory(svn_editor_t *editor, const char *relpath, svn_revnum_t revision, const apr_array_header_t *children, apr_hash_t *props) { svn_error_t *err = SVN_NO_ERROR; SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath)); SVN_ERR_ASSERT(children != NULL || props != NULL); /* ### validate children are just basenames? */ SHOULD_NOT_BE_FINISHED(editor); SHOULD_ALLOW_ALTER(editor, relpath); VERIFY_PARENT_MAY_EXIST(editor, relpath); SVN_ERR(check_cancel(editor)); if (editor->funcs.cb_alter_directory) { START_CALLBACK(editor); err = editor->funcs.cb_alter_directory(editor->baton, relpath, revision, children, props, editor->scratch_pool); END_CALLBACK(editor); } MARK_COMPLETED(editor, relpath); MARK_PARENT_STABLE(editor, relpath); #ifdef ENABLE_ORDERING_CHECK /* ### this is not entirely correct. we probably need to adjust the ### check_unknown_child() function for this scenario. */ #if 0 { int i; for (i = 0; i < children->nelts; i++) { const char *child_basename = APR_ARRAY_IDX(children, i, const char *); const char *child = svn_relpath_join(relpath, child_basename, editor->state_pool); apr_hash_set(editor->pending_incomplete_children, child, APR_HASH_KEY_STRING, ""); /* Perhaps MARK_ALLOW_ADD(editor, child); ? */ } } #endif #endif svn_pool_clear(editor->scratch_pool); return svn_error_trace(err); }
svn_error_t *svn_ra_get_locks2(svn_ra_session_t *session, apr_hash_t **locks, const char *path, svn_depth_t depth, apr_pool_t *pool) { SVN_ERR_ASSERT(*path != '/'); SVN_ERR_ASSERT((depth == svn_depth_empty) || (depth == svn_depth_files) || (depth == svn_depth_immediates) || (depth == svn_depth_infinity)); return session->vtable->get_locks(session, locks, path, depth, pool); }
svn_error_t * svn_editor_add_directory(svn_editor_t *editor, const char *relpath, const apr_array_header_t *children, apr_hash_t *props, svn_revnum_t replaces_rev) { svn_error_t *err = SVN_NO_ERROR; SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath)); SVN_ERR_ASSERT(children != NULL); SVN_ERR_ASSERT(props != NULL); /* ### validate children are just basenames? */ SHOULD_NOT_BE_FINISHED(editor); SHOULD_ALLOW_ADD(editor, relpath); VERIFY_PARENT_MAY_EXIST(editor, relpath); CHECK_UNKNOWN_CHILD(editor, relpath); SVN_ERR(check_cancel(editor)); if (editor->funcs.cb_add_directory) { 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); MARK_PARENT_STABLE(editor, relpath); CLEAR_INCOMPLETE(editor, relpath); #ifdef ENABLE_ORDERING_CHECK { int i; for (i = 0; i < children->nelts; i++) { const char *child_basename = APR_ARRAY_IDX(children, i, const char *); const char *child = svn_relpath_join(relpath, child_basename, editor->state_pool); svn_hash_sets(editor->pending_incomplete_children, child, ""); } } #endif svn_pool_clear(editor->scratch_pool); return svn_error_trace(err); }
/* Check that REP refers to a revision that exists in FS. */ static svn_error_t * rep_has_been_born(representation_t *rep, svn_fs_t *fs, apr_pool_t *pool) { fs_fs_data_t *ffd = fs->fsap_data; svn_revnum_t youngest; SVN_ERR_ASSERT(rep); youngest = ffd->youngest_rev_cache; if (youngest < rep->revision) { /* Stale cache. */ SVN_ERR(svn_fs_fs__youngest_rev(&youngest, fs, pool)); /* Fresh cache. */ if (youngest < rep->revision) return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL, _("Youngest revision is r%ld, but " "rep-cache contains r%ld"), youngest, rep->revision); } return SVN_NO_ERROR; }
svn_error_t *svn_ra_lock(svn_ra_session_t *session, apr_hash_t *path_revs, const char *comment, svn_boolean_t steal_lock, svn_ra_lock_callback_t lock_func, void *lock_baton, apr_pool_t *pool) { apr_hash_index_t *hi; for (hi = apr_hash_first(pool, path_revs); hi; hi = apr_hash_next(hi)) { const char *path = svn__apr_hash_index_key(hi); SVN_ERR_ASSERT(*path != '/'); } if (comment && ! svn_xml_is_xml_safe(comment, strlen(comment))) return svn_error_create (SVN_ERR_XML_UNESCAPABLE_DATA, NULL, _("Lock comment contains illegal characters")); return session->vtable->lock(session, path_revs, comment, steal_lock, lock_func, lock_baton, pool); }
svn_error_t *svn_ra_get_file_revs2(svn_ra_session_t *session, const char *path, svn_revnum_t start, svn_revnum_t end, svn_boolean_t include_merged_revisions, svn_file_rev_handler_t handler, void *handler_baton, apr_pool_t *pool) { svn_error_t *err; SVN_ERR_ASSERT(*path != '/'); if (include_merged_revisions) SVN_ERR(svn_ra__assert_mergeinfo_capable_server(session, NULL, pool)); err = session->vtable->get_file_revs(session, path, start, end, include_merged_revisions, handler, handler_baton, pool); if (err && (err->apr_err == SVN_ERR_RA_NOT_IMPLEMENTED)) { svn_error_clear(err); /* Do it the slow way, using get-logs, for older servers. */ err = svn_ra__file_revs_from_log(session, path, start, end, handler, handler_baton, pool); } return err; }
svn_error_t * svn_cl__eat_peg_revisions(apr_array_header_t **true_targets_p, const apr_array_header_t *targets, apr_pool_t *pool) { int i; apr_array_header_t *true_targets; true_targets = apr_array_make(pool, targets->nelts, sizeof(const char *)); for (i = 0; i < targets->nelts; i++) { const char *target = APR_ARRAY_IDX(targets, i, const char *); const char *true_target; SVN_ERR(svn_opt__split_arg_at_peg_revision(&true_target, NULL, target, pool)); APR_ARRAY_PUSH(true_targets, const char *) = true_target; } SVN_ERR_ASSERT(true_targets_p); *true_targets_p = true_targets; return SVN_NO_ERROR; }
svn_error_t * svn_wc__get_all_tree_conflicts(apr_hash_t **tree_conflicts, svn_wc_context_t *wc_ctx, const char *local_abspath, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { apr_hash_t *conflicts; apr_hash_index_t *hi; SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); SVN_ERR(svn_wc__db_op_read_all_tree_conflicts(&conflicts, wc_ctx->db, local_abspath, result_pool, scratch_pool)); *tree_conflicts = apr_hash_make(result_pool); /* Convert from basenames as keys to abspaths as keys. */ for (hi = apr_hash_first(scratch_pool, conflicts); hi; hi = apr_hash_next(hi)) { const char *name = svn__apr_hash_index_key(hi); const svn_wc_conflict_description2_t *conflict = svn__apr_hash_index_val(hi); const char *abspath = svn_dirent_join(local_abspath, name, scratch_pool); apr_hash_set(*tree_conflicts, abspath, APR_HASH_KEY_STRING, conflict); } return SVN_NO_ERROR; }
/* Prepend to PARENT_SKEL the several fields that represent VERSION_INFO, */ static svn_error_t * prepend_version_info_skel(svn_skel_t *parent_skel, const svn_wc_conflict_version_t *version_info, apr_pool_t *pool) { svn_skel_t *skel = svn_skel__make_empty_list(pool); /* node_kind */ skel_prepend_enum(skel, node_kind_map, version_info->node_kind, pool); /* path_in_repos */ svn_skel__prepend(svn_skel__str_atom(version_info->path_in_repos ? version_info->path_in_repos : "", pool), skel); /* peg_rev */ svn_skel__prepend(svn_skel__str_atom(apr_psprintf(pool, "%ld", version_info->peg_rev), pool), skel); /* repos_url */ svn_skel__prepend(svn_skel__str_atom(version_info->repos_url ? version_info->repos_url : "", pool), skel); svn_skel__prepend(svn_skel__str_atom("version", pool), skel); SVN_ERR_ASSERT(is_valid_version_info_skel(skel)); svn_skel__prepend(skel, parent_skel); return SVN_NO_ERROR; }
svn_error_t * svn_fs_x__dag_clone_root(dag_node_t **root_p, svn_fs_t *fs, const svn_fs_x__id_part_t *txn_id, apr_pool_t *pool) { const svn_fs_id_t *base_root_id, *root_id; /* Get the node ID's of the root directories of the transaction and its base revision. */ SVN_ERR(svn_fs_x__get_txn_ids(&root_id, &base_root_id, fs, txn_id, pool)); /* Oh, give me a clone... (If they're the same, we haven't cloned the transaction's root directory yet.) */ SVN_ERR_ASSERT(!svn_fs_x__id_eq(root_id, base_root_id)); /* * (Sung to the tune of "Home, Home on the Range", with thanks to * Randall Garrett and Isaac Asimov.) */ /* One way or another, root_id now identifies a cloned root node. */ return svn_fs_x__dag_get_node(root_p, fs, root_id, pool); }
svn_error_t * svn_cl__eat_peg_revisions(apr_array_header_t **true_targets_p, const apr_array_header_t *targets, apr_pool_t *pool) { int i; apr_array_header_t *true_targets; true_targets = apr_array_make(pool, targets->nelts, sizeof(const char *)); for (i = 0; i < targets->nelts; i++) { const char *target = APR_ARRAY_IDX(targets, i, const char *); const char *true_target, *peg; SVN_ERR(svn_opt__split_arg_at_peg_revision(&true_target, &peg, target, pool)); if (peg[0] && peg[1]) return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL, _("'%s': a peg revision is not allowed here"), target); APR_ARRAY_PUSH(true_targets, const char *) = true_target; } SVN_ERR_ASSERT(true_targets_p); *true_targets_p = true_targets; return SVN_NO_ERROR; }
svn_error_t *svn_ra_get_log2(svn_ra_session_t *session, const apr_array_header_t *paths, svn_revnum_t start, svn_revnum_t end, int limit, svn_boolean_t discover_changed_paths, svn_boolean_t strict_node_history, svn_boolean_t include_merged_revisions, const apr_array_header_t *revprops, svn_log_entry_receiver_t receiver, void *receiver_baton, apr_pool_t *pool) { if (paths) { int i; for (i = 0; i < paths->nelts; i++) { const char *path = APR_ARRAY_IDX(paths, i, const char *); SVN_ERR_ASSERT(*path != '/'); } } if (include_merged_revisions) SVN_ERR(svn_ra__assert_mergeinfo_capable_server(session, NULL, pool)); return session->vtable->get_log(session, paths, start, end, limit, discover_changed_paths, strict_node_history, include_merged_revisions, revprops, receiver, receiver_baton, pool); }
svn_error_t *svn_ra_change_rev_prop2(svn_ra_session_t *session, svn_revnum_t rev, const char *name, const svn_string_t *const *old_value_p, const svn_string_t *value, apr_pool_t *pool) { SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(rev)); /* If an old value was specified, make sure the server supports * specifying it. */ if (old_value_p) { svn_boolean_t has_atomic_revprops; SVN_ERR(svn_ra_has_capability(session, &has_atomic_revprops, SVN_RA_CAPABILITY_ATOMIC_REVPROPS, pool)); if (!has_atomic_revprops) /* API violation. (Should be an ASSERT, but gstein talked me * out of it.) */ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL, _("Specifying 'old_value_p' is not allowed when " "the '%s' capability is not advertised, and " "could indicate a bug in your client"), SVN_RA_CAPABILITY_ATOMIC_REVPROPS); } return session->vtable->change_rev_prop(session, rev, name, old_value_p, value, pool); }
/* Conforms to svn_ra_serf__xml_closed_t */ static svn_error_t * getloc_closed(svn_ra_serf__xml_estate_t *xes, void *baton, int leaving_state, const svn_string_t *cdata, apr_hash_t *attrs, apr_pool_t *scratch_pool) { loc_context_t *loc_ctx = baton; const char *revstr; const char *path; SVN_ERR_ASSERT(leaving_state == LOCATION); revstr = svn_hash_gets(attrs, "rev"); path = svn_hash_gets(attrs, "path"); if (revstr != NULL && path != NULL) { svn_revnum_t rev = SVN_STR_TO_REV(revstr); apr_hash_set(loc_ctx->paths, apr_pmemdup(loc_ctx->pool, &rev, sizeof(rev)), sizeof(rev), apr_pstrdup(loc_ctx->pool, path)); } return SVN_NO_ERROR; }
svn_error_t * svn_editor_delete(svn_editor_t *editor, const char *relpath, svn_revnum_t revision) { svn_error_t *err = SVN_NO_ERROR; SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath)); SHOULD_NOT_BE_FINISHED(editor); SHOULD_NOT_BE_COMPLETED(editor, relpath); VERIFY_PARENT_MAY_EXIST(editor, relpath); CHILD_DELETIONS_ALLOWED(editor, relpath); SVN_ERR(check_cancel(editor)); if (editor->funcs.cb_delete) { START_CALLBACK(editor); err = editor->funcs.cb_delete(editor->baton, relpath, revision, editor->scratch_pool); END_CALLBACK(editor); } MARK_COMPLETED(editor, relpath); MARK_PARENT_STABLE(editor, relpath); svn_pool_clear(editor->scratch_pool); return svn_error_trace(err); }
static svn_error_t * add_open_helper(const char *path, char action, svn_node_kind_t kind, void *parent_baton, const char *copyfrom_path, svn_revnum_t copyfrom_rev, apr_pool_t *pool, void **child_baton) { struct node_baton *pb = parent_baton; struct edit_baton *eb = pb->edit_baton; struct node_baton *nb = apr_pcalloc(pool, sizeof(*nb)); SVN_ERR_ASSERT(parent_baton && path); nb->edit_baton = eb; nb->parent_baton = pb; /* Create and populate the node. */ nb->node = create_child_node(pb->node, svn_path_basename(path, pool), eb->node_pool); nb->node->kind = kind; nb->node->action = action; nb->node->copyfrom_rev = copyfrom_rev; nb->node->copyfrom_path = copyfrom_path ? apr_pstrdup(eb->node_pool, copyfrom_path) : NULL; *child_baton = nb; return SVN_NO_ERROR; }
svn_error_t * svn_editor_add_absent(svn_editor_t *editor, const char *relpath, svn_node_kind_t kind, svn_revnum_t replaces_rev) { svn_error_t *err = SVN_NO_ERROR; SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath)); SHOULD_NOT_BE_FINISHED(editor); SHOULD_ALLOW_ADD(editor, relpath); VERIFY_PARENT_MAY_EXIST(editor, relpath); CHECK_UNKNOWN_CHILD(editor, relpath); SVN_ERR(check_cancel(editor)); if (editor->funcs.cb_add_absent) { 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); MARK_PARENT_STABLE(editor, relpath); CLEAR_INCOMPLETE(editor, relpath); svn_pool_clear(editor->scratch_pool); return svn_error_trace(err); }
svn_error_t *svn_ra_get_mergeinfo(svn_ra_session_t *session, svn_mergeinfo_catalog_t *catalog, const apr_array_header_t *paths, svn_revnum_t revision, svn_mergeinfo_inheritance_t inherit, svn_boolean_t include_descendants, apr_pool_t *pool) { svn_error_t *err; int i; /* Validate path format. */ for (i = 0; i < paths->nelts; i++) { const char *path = APR_ARRAY_IDX(paths, i, const char *); SVN_ERR_ASSERT(*path != '/'); } /* Check server Merge Tracking capability. */ err = svn_ra__assert_mergeinfo_capable_server(session, NULL, pool); if (err) { *catalog = NULL; return err; } return session->vtable->get_mergeinfo(session, catalog, paths, revision, inherit, include_descendants, pool); }
/* Add the blame for the diffs between LAST_FILE and CUR_FILE with the rev specified in FRB. LAST_FILE may be NULL in which case blame is added for every line of CUR_FILE. */ static svn_error_t * add_file_blame(const char *last_file, const char *cur_file, struct blame_chain *chain, struct rev *rev, const svn_diff_file_options_t *diff_options, apr_pool_t *pool) { if (!last_file) { SVN_ERR_ASSERT(chain->blame == NULL); chain->blame = blame_create(chain, rev, 0); } else { svn_diff_t *diff; struct diff_baton diff_baton; diff_baton.chain = chain; diff_baton.rev = rev; /* We have a previous file. Get the diff and adjust blame info. */ SVN_ERR(svn_diff_file_diff_2(&diff, last_file, cur_file, diff_options, pool)); SVN_ERR(svn_diff_output(diff, &diff_baton, &output_fns)); } return SVN_NO_ERROR; }
svn_error_t * svn_ra_get_location_segments(svn_ra_session_t *session, const char *path, svn_revnum_t peg_revision, svn_revnum_t start_rev, svn_revnum_t end_rev, svn_location_segment_receiver_t receiver, void *receiver_baton, apr_pool_t *pool) { svn_error_t *err; SVN_ERR_ASSERT(*path != '/'); err = session->vtable->get_location_segments(session, path, peg_revision, start_rev, end_rev, receiver, receiver_baton, pool); if (err && (err->apr_err == SVN_ERR_RA_NOT_IMPLEMENTED)) { svn_error_clear(err); /* Do it the slow way, using get-logs, for older servers. */ err = svn_ra__location_segments_from_log(session, path, peg_revision, start_rev, end_rev, receiver, receiver_baton, pool); } return err; }
/* Normalize the encoding and line ending style of *STR, so that it contains * only LF (\n) line endings and is encoded in UTF-8. After return, *STR may * point at a new svn_string_t* allocated in RESULT_POOL. * * If SOURCE_PROP_ENCODING is NULL, then *STR is presumed to be encoded in * UTF-8. * * *WAS_NORMALIZED is set to TRUE when *STR needed line ending normalization. * Otherwise it is set to FALSE. * * SCRATCH_POOL is used for temporary allocations. */ static svn_error_t * normalize_string(const svn_string_t **str, svn_boolean_t *was_normalized, const char *source_prop_encoding, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_string_t *new_str; *was_normalized = FALSE; if (*str == NULL) return SVN_NO_ERROR; SVN_ERR_ASSERT((*str)->data != NULL); if (source_prop_encoding == NULL) source_prop_encoding = "UTF-8"; new_str = NULL; SVN_ERR(svn_subst_translate_string2(&new_str, NULL, was_normalized, *str, source_prop_encoding, TRUE, result_pool, scratch_pool)); *str = new_str; return SVN_NO_ERROR; }
/* This implements svn_editor_cb_alter_file_t */ static svn_error_t * alter_file_cb(void *baton, const char *relpath, svn_revnum_t revision, apr_hash_t *props, const svn_checksum_t *checksum, svn_stream_t *contents, apr_pool_t *scratch_pool) { struct edit_baton *eb = baton; const char *fspath = FSPATH(relpath, scratch_pool); svn_fs_root_t *root; SVN_ERR(get_root(&root, eb)); SVN_ERR(can_modify(root, fspath, revision, scratch_pool)); if (contents != NULL) { SVN_ERR_ASSERT(checksum != NULL); SVN_ERR(set_text(root, fspath, checksum, contents, eb->cancel_func, eb->cancel_baton, scratch_pool)); } if (props != NULL) { SVN_ERR(alter_props(root, fspath, props, scratch_pool)); } return SVN_NO_ERROR; }
/* Call B->summarize_func with B->summarize_func_baton, passing it a * summary object composed from PATH (but made to be relative to the target * of the diff), SUMMARIZE_KIND, PROP_CHANGED (or FALSE if the action is an * add or delete) and NODE_KIND. */ static svn_error_t * send_summary(struct summarize_baton_t *b, const char *path, svn_client_diff_summarize_kind_t summarize_kind, svn_boolean_t prop_changed, svn_node_kind_t node_kind, apr_pool_t *scratch_pool) { svn_client_diff_summarize_t *sum = apr_pcalloc(scratch_pool, sizeof(*sum)); SVN_ERR_ASSERT(summarize_kind != svn_client_diff_summarize_kind_normal || prop_changed); /* PATH is relative to the anchor of the diff, but SUM->path needs to be relative to the target of the diff. */ sum->path = svn_relpath_skip_ancestor(b->target, path); sum->summarize_kind = summarize_kind; if (summarize_kind == svn_client_diff_summarize_kind_modified || summarize_kind == svn_client_diff_summarize_kind_normal) sum->prop_changed = prop_changed; sum->node_kind = node_kind; SVN_ERR(b->summarize_func(sum, b->summarize_func_baton, scratch_pool)); return SVN_NO_ERROR; }