/* 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_skel__unparse_iproplist(svn_skel_t **skel_p, const apr_array_header_t *inherited_props, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_skel_t *skel = svn_skel__make_empty_list(result_pool); /* Create the skel. */ if (inherited_props) { int i; apr_hash_index_t *hi; for (i = 0; i < inherited_props->nelts; i++) { svn_prop_inherited_item_t *iprop = APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *); svn_skel_t *skel_list = svn_skel__make_empty_list(result_pool); svn_skel_t *skel_atom; /* Loop over hash entries */ for (hi = apr_hash_first(scratch_pool, iprop->prop_hash); hi; hi = apr_hash_next(hi)) { const void *key; void *val; apr_ssize_t klen; svn_string_t *value; apr_hash_this(hi, &key, &klen, &val); value = val; /* VALUE */ svn_skel__prepend(svn_skel__mem_atom(value->data, value->len, result_pool), skel_list); /* NAME */ svn_skel__prepend(svn_skel__mem_atom(key, klen, result_pool), skel_list); } skel_atom = svn_skel__str_atom( apr_pstrdup(result_pool, iprop->path_or_url), result_pool); svn_skel__append(skel, skel_atom); svn_skel__append(skel, skel_list); } } /* Validate and return the skel. */ if (! is_valid_iproplist_skel(skel)) return skel_err("iproplist"); *skel_p = skel; return SVN_NO_ERROR; }
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; }
void svn_skel__prepend_str(const char *value, svn_skel_t *skel, apr_pool_t *result_pool) { svn_skel_t *atom = svn_skel__str_atom(value, result_pool); svn_skel__prepend(atom, skel); }
/* Prepend to SKEL the string corresponding to enumeration value N, as found * in MAP. */ static void skel_prepend_enum(svn_skel_t *skel, const svn_token_map_t *map, int n, apr_pool_t *result_pool) { svn_skel__prepend(svn_skel__str_atom(svn_token__to_word(map, n), result_pool), skel); }
svn_error_t * svn_skel__unparse_proplist(svn_skel_t **skel_p, const apr_hash_t *proplist, apr_pool_t *pool) { svn_skel_t *skel = svn_skel__make_empty_list(pool); apr_hash_index_t *hi; /* Create the skel. */ if (proplist) { /* Loop over hash entries */ for (hi = apr_hash_first(pool, (apr_hash_t *)proplist); hi; hi = apr_hash_next(hi)) { const void *key; void *val; apr_ssize_t klen; svn_string_t *value; apr_hash_this(hi, &key, &klen, &val); value = val; /* VALUE */ svn_skel__prepend(svn_skel__mem_atom(value->data, value->len, pool), skel); /* NAME */ svn_skel__prepend(svn_skel__mem_atom(key, klen, pool), skel); } } /* Validate and return the skel. */ if (! is_valid_proplist_skel(skel)) return skel_err("proplist"); *skel_p = skel; return SVN_NO_ERROR; }