Author: rinrab
Date: Tue Jun 17 14:37:10 2025
New Revision: 1926504
URL: http://svn.apache.org/viewvc?rev=1926504&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: revert a bunch of unrelated changes,
related to the experiments with args_to_target_array family.
It's not scope of this branch. Let's keep it simple.
Reverted revisions: 1925942, 1925944, 1925945, 1925946, 1925947, 1925951,
1925954, 1926013, 1926014, 1926018, 1926019, 1926098
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/cmdline.c
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h
URL:
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h?rev=1926504&r1=1926503&r2=1926504&view=diff
==============================================================================
---
subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h
(original)
+++
subversion/branches/utf8-cmdline-prototype/subversion/include/private/svn_opt_private.h
Tue Jun 17 14:37:10 2025
@@ -119,20 +119,6 @@ svn_opt__process_target_array(apr_array_
apr_pool_t *pool);
/**
- * Collects targets from @a utf8_targets (unamed arguments from apr_getopt)
- * and @a known_targets (--targets).
- *
- * If a relative URL was found, sets @a rel_url_found_p to @c TRUE, if
- * it is not @c NULL.
- */
-svn_error_t *
-svn_opt__collect_targets(apr_array_header_t **targets_p,
- svn_boolean_t *rel_url_found_p,
- const apr_array_header_t *utf8_targets,
- const apr_array_header_t *known_targets,
- apr_pool_t *pool);
-
-/**
* Return a human-readable description of @a revision. The result
* will be allocated statically or from @a result_pool.
*
@@ -162,105 +148,6 @@ svn_opt__revision_range_from_revnums(svn
svn_revnum_t end_revnum,
apr_pool_t *result_pool);
-/**
- *
- */
-typedef enum svn_opt__target_type_e
-{
- svn_opt__target_type_local_abspath,
- svn_opt__target_type_absolute_url,
- svn_opt__target_type_relative_url
-
-} svn_opt__target_type_e;
-
-/**
- * Stores info about a parsed target.
- *
- * FIXME: peg_revision wouldn yet be an empty string instead of NULL if
- * one wasn't found.
- *
- * TODO: potentially also parse peg_revision to svn_opt_revision_t so we
- * won't need to do it later in the cmdline.
- *
- * TODO: add an option to reject all peg revisions which might be useful,
- * for example, in svnadmin, which doesn't support it by design.
- *
- * TODO: pass this directly into the cmdline so we won't need to parse
- * targets twice and could operate with pretty parsed ones.
- */
-typedef struct svn_opt__target_t
-{
- /* Type of the target */
- svn_opt__target_type_e type;
-
- /* Path component of the target */
- const char *true_target;
-
- /* Peg revision of the target or @c NULL if it wasn't found */
- const char *peg_revision;
-
-} svn_opt__target_t;
-
-/**
- * Parses a target described in @a str into @a target_p, allocated in @a pool.
- *
- * If the target represents a relative URL and @a rel_url_found_p is not
- * @c NULL, sets it to @c TRUE.
- */
-svn_error_t *
-svn_opt__target_parse(svn_opt__target_t **target_p,
- svn_boolean_t *rel_url_found_p,
- const char *str,
- apr_pool_t *pool);
-
-/**
- * Converts @a target back into its canonical string representation,
- * including svn_opt__target_t::peg_revision, and sets @a path_p with
- * the result.
- */
-svn_error_t *
-svn_opt__target_to_string(const char **path_p,
- svn_opt__target_t *target,
- apr_pool_t *pool);
-
-/**
- * Resolves @a target of type @c svn_opt__target_type_relative_url, by
- * adding @a root path before and changing type to @c
- * svn_opt__target_type_absolute_url.
- */
-svn_error_t *
-svn_opt__target_resolve(svn_opt__target_t *target,
- const char *root,
- apr_pool_t *pool);
-
-/**
- * Parses targets described in @a paths (an array of const char *)
- * into @a targets_p (an array of svn_opt__target_t *).
- *
- * If any of the targets represents a relative URL and @a rel_url_found_p
- * is not @c NULL, sets it to @c TRUE.
- *
- * @see svn_opt__target_parse()
- */
-svn_error_t *
-svn_opt__target_array_parse(apr_array_header_t **targets_p,
- svn_boolean_t *rel_url_found_p,
- apr_array_header_t *paths,
- apr_pool_t *pool);
-
-/**
- * Converts all targets in @a targets (an array of svn_opt__target_t *)
- * back into its canonical string representation, including
- * svn_opt__target_t::peg_revision, and sets @a path_p (an array of
- * const char *) with the result.
- *
- * @see svn_opt__target_to_string()
- */
-svn_error_t *
-svn_opt__target_array_to_string(apr_array_header_t **paths_p,
- apr_array_header_t *targets,
- apr_pool_t *pool);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
URL:
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c?rev=1926504&r1=1926503&r2=1926504&view=diff
==============================================================================
---
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
(original)
+++
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
Tue Jun 17 14:37:10 2025
@@ -108,46 +108,6 @@ check_root_url_of_target(const char **ro
return SVN_NO_ERROR;
}
-static svn_error_t *
-find_root_url(const char **root_url_p,
- const apr_array_header_t *raw_targets,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool)
-{
- int i;
-
- for (i = 0; i < raw_targets->nelts; i++)
- {
- const char *target = APR_ARRAY_IDX(raw_targets, i, const char *);
-
- /* Later targets have priority over earlier target, I
- don't know why, see basic_relative_url_multi_repo. */
- SVN_ERR(check_root_url_of_target(root_url_p, target, ctx, pool));
- }
-
- /*
- * Use the current directory's root url if one wasn't found using the
- * arguments.
- */
- if (*root_url_p == NULL)
- {
- const char *current_abspath;
- svn_error_t *err;
-
- SVN_ERR(svn_dirent_get_absolute(¤t_abspath, "", pool));
- err = svn_client_get_repos_root(root_url_p, NULL /* uuid */,
- current_abspath, ctx, pool, pool);
- if (err || *root_url_p == NULL)
- return svn_error_create(SVN_ERR_WC_NOT_WORKING_COPY, err,
- _("Resolving '^/': no repository root "
- "found in the target arguments or "
- "in the current directory"));
- }
-
- return SVN_NO_ERROR;
-}
-
-
/* Note: This is substantially copied from svn_opt__process_target_array() in
* order to move to libsvn_client while maintaining backward compatibility. */
svn_error_t *
@@ -161,8 +121,10 @@ svn_client__process_target_array(apr_arr
int i;
svn_boolean_t rel_url_found = FALSE;
const char *root_url = NULL;
- apr_array_header_t *input_targets = NULL;
- apr_array_header_t *parsed_targets = NULL;
+ apr_array_header_t *input_targets = apr_array_make(
+ pool, utf8_targets->nelts, sizeof(const char *));
+ apr_array_header_t *output_targets = apr_array_make(
+ pool, utf8_targets->nelts, sizeof(const char *));
apr_array_header_t *reserved_names = NULL;
/* Step 1: create a master array of targets that are in UTF-8
@@ -171,34 +133,51 @@ svn_client__process_target_array(apr_arr
If any of the targets are relative urls, then set the rel_url_found
flag.*/
- SVN_ERR(svn_opt__collect_targets(&input_targets, &rel_url_found,
- utf8_targets, known_targets, pool));
+ for (i = 0; i < utf8_targets->nelts; i++)
+ {
+ const char *utf8_target = APR_ARRAY_IDX(utf8_targets, i, const char *);
- SVN_ERR(svn_opt__target_array_parse(&parsed_targets, &rel_url_found,
- input_targets, pool));
+ if (svn_path_is_repos_relative_url(utf8_target))
+ rel_url_found = TRUE;
- /* Step 2: process each target. */
+ APR_ARRAY_PUSH(input_targets, const char *) = utf8_target;
+ }
- for (i = 0; i < parsed_targets->nelts; i++)
+ if (known_targets)
{
- svn_opt__target_t *target = APR_ARRAY_IDX(parsed_targets, i,
- svn_opt__target_t *);
- const char *raw_target = APR_ARRAY_IDX(input_targets, i, const char *);
-
- /* Reject the form "@abc", a peg specifier with no path. */
- if (target->true_target[0] == '\0' && target->peg_revision[0] != '\0')
+ for (i = 0; i < known_targets->nelts; i++)
{
- return svn_error_createf(SVN_ERR_BAD_FILENAME, NULL,
- _("'%s' is just a peg revision. "
- "Maybe try '%s@' instead?"),
- raw_target, raw_target);
+ /* The --targets array have already been converted to UTF-8,
+ because we needed to split up the list with svn_cstring_split. */
+ const char *utf8_target = APR_ARRAY_IDX(known_targets,
+ i, const char *);
+
+ if (svn_path_is_repos_relative_url(utf8_target))
+ rel_url_found = TRUE;
+
+ APR_ARRAY_PUSH(input_targets, const char *) = utf8_target;
}
+ }
+
+ /* Step 2: process each target. */
+
+ for (i = 0; i < input_targets->nelts; i++)
+ {
+ const char *utf8_target = APR_ARRAY_IDX(input_targets, i, const char *);
/* Relative urls will be canonicalized when they are resolved later in
* the function
*/
- if (target->type == svn_opt__target_type_absolute_url)
+ if (svn_path_is_repos_relative_url(utf8_target))
{
+ APR_ARRAY_PUSH(output_targets, const char *) = utf8_target;
+ }
+ else
+ {
+ const char *true_target;
+ const char *peg_rev;
+ const char *target;
+
/*
* This is needed so that the target can be properly canonicalized,
* otherwise the canonicalization does not treat a ".@BASE" as a "."
@@ -211,14 +190,32 @@ svn_client__process_target_array(apr_arr
* a string would not necessarily preserve the exact bytes of the
* input date, so its easier just to keep it in string form.
*/
+ SVN_ERR(svn_opt__split_arg_at_peg_revision(&true_target, &peg_rev,
+ utf8_target, pool));
+
+ /* Reject the form "@abc", a peg specifier with no path. */
+ if (true_target[0] == '\0' && peg_rev[0] != '\0')
+ {
+ return svn_error_createf(SVN_ERR_BAD_FILENAME, NULL,
+ _("'%s' is just a peg revision. "
+ "Maybe try '%s@' instead?"),
+ utf8_target, utf8_target);
+ }
- if (target->type == svn_opt__target_type_local_abspath)
+ /* URLs and wc-paths get treated differently. */
+ if (svn_path_is_url(true_target))
+ {
+ SVN_ERR(svn_opt__arg_canonicalize_url(&true_target,
+ true_target, pool));
+ }
+ else /* not a url, so treat as a path */
{
const char *base_name;
const char *original_target;
- original_target = svn_dirent_internal_style(target->true_target,
- pool);
+ original_target = svn_dirent_internal_style(true_target, pool);
+ SVN_ERR(svn_opt__arg_canonicalize_path(&true_target,
+ true_target, pool));
/* There are two situations in which a 'truepath-conversion'
(case-canonicalization to on-disk path on case-insensitive
@@ -229,19 +226,19 @@ svn_client__process_target_array(apr_arr
both targets have the same truepath. */
if (keep_last_origpath_on_truepath_collision
&& input_targets->nelts == 2 && i == 1
- && strcmp(original_target, target->true_target) != 0)
+ && strcmp(original_target, true_target) != 0)
{
- const char *src_truepath = APR_ARRAY_IDX(input_targets,
+ const char *src_truepath = APR_ARRAY_IDX(output_targets,
0,
const char *);
- if (strcmp(src_truepath, target->true_target) == 0)
- target->true_target = original_target;
+ if (strcmp(src_truepath, true_target) == 0)
+ true_target = original_target;
}
/* 2. If there is an exact match in the wc-db without a
corresponding on-disk path (e.g. a scheduled-for-delete
file only differing in case from an on-disk file). */
- if (strcmp(original_target, target->true_target) != 0)
+ if (strcmp(original_target, true_target) != 0)
{
const char *target_abspath;
svn_node_kind_t kind;
@@ -263,13 +260,13 @@ svn_client__process_target_array(apr_arr
/* We successfully did a lookup in the wc-db. Now see
if it's something interesting. */
if (kind == svn_node_file || kind == svn_node_dir)
- target->true_target = original_target;
+ true_target = original_target;
}
}
/* If the target has the same name as a Subversion
working copy administrative dir, skip it. */
- base_name = svn_dirent_basename(target->true_target, pool);
+ base_name = svn_dirent_basename(true_target, pool);
if (svn_wc_is_adm_dir(base_name, pool))
{
@@ -277,42 +274,80 @@ svn_client__process_target_array(apr_arr
reserved_names = apr_array_make(pool, 1,
sizeof(const char *));
- APR_ARRAY_PUSH(reserved_names, const char *) = raw_target;
+ APR_ARRAY_PUSH(reserved_names, const char *) = utf8_target;
continue;
}
}
- if (rel_url_found
- && target->type != svn_opt__target_type_relative_url)
+ target = apr_pstrcat(pool, true_target, peg_rev, SVN_VA_NULL);
+
+ if (rel_url_found)
{
/* Later targets have priority over earlier target, I
don't know why, see basic_relative_url_multi_repo. */
- SVN_ERR(check_root_url_of_target(&root_url, target->true_target,
+ SVN_ERR(check_root_url_of_target(&root_url, target,
ctx, pool));
}
+
+ APR_ARRAY_PUSH(output_targets, const char *) = target;
}
}
/* Only resolve relative urls if there were some actually found earlier. */
if (rel_url_found)
{
- SVN_ERR(find_root_url(&root_url, input_targets, ctx, pool));
-
- for (i = 0; i < parsed_targets->nelts; i++)
+ /*
+ * Use the current directory's root url if one wasn't found using the
+ * arguments.
+ */
+ if (root_url == NULL)
{
- svn_opt__target_t *target = APR_ARRAY_IDX(parsed_targets, i,
- svn_opt__target_t *);
+ const char *current_abspath;
+ svn_error_t *err;
- if (target->type == svn_opt__target_type_relative_url)
- SVN_ERR(svn_opt__target_resolve(target, root_url, pool));
+ SVN_ERR(svn_dirent_get_absolute(¤t_abspath, "", pool));
+ err = svn_client_get_repos_root(&root_url, NULL /* uuid */,
+ current_abspath, ctx, pool, pool);
+ if (err || root_url == NULL)
+ return svn_error_create(SVN_ERR_WC_NOT_WORKING_COPY, err,
+ _("Resolving '^/': no repository root "
+ "found in the target arguments or "
+ "in the current directory"));
}
- }
- *targets_p = apr_array_make(pool, parsed_targets->nelts,
- sizeof(const char *));
+ *targets_p = apr_array_make(pool, output_targets->nelts,
+ sizeof(const char *));
+
+ for (i = 0; i < output_targets->nelts; i++)
+ {
+ const char *target = APR_ARRAY_IDX(output_targets, i,
+ const char *);
+
+ if (svn_path_is_repos_relative_url(target))
+ {
+ const char *abs_target;
+ const char *true_target;
+ const char *peg_rev;
+
+ SVN_ERR(svn_opt__split_arg_at_peg_revision(&true_target,
&peg_rev,
+ target, pool));
- SVN_ERR(svn_opt__target_array_to_string(targets_p, parsed_targets, pool));
+ SVN_ERR(svn_path_resolve_repos_relative_url(&abs_target,
+ true_target,
+ root_url, pool));
+
+ SVN_ERR(svn_opt__arg_canonicalize_url(&true_target, abs_target,
+ pool));
+
+ target = apr_pstrcat(pool, true_target, peg_rev, SVN_VA_NULL);
+ }
+
+ APR_ARRAY_PUSH(*targets_p, const char *) = target;
+ }
+ }
+ else
+ *targets_p = output_targets;
if (reserved_names)
{
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/cmdline.c
URL:
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/cmdline.c?rev=1926504&r1=1926503&r2=1926504&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/cmdline.c
(original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/cmdline.c
Tue Jun 17 14:37:10 2025
@@ -1450,7 +1450,7 @@ svn_cmdline__win32_get_utf8_argv(const c
for (i = 0; i < argc; i++)
{
const wchar_t *arg = argv[i];
- const char *utf8_arg;
+ char *utf8_arg;
SVN_ERR(svn_utf__win32_utf16_to_utf8(&utf8_arg, arg, NULL, result_pool));
@@ -1489,7 +1489,7 @@ svn_cmdline__default_get_utf8_argv(const
for (i = 0; i < argc; i++)
{
const char *arg = argv[i];
- const char *utf8_arg;
+ char *utf8_arg;
SVN_ERR(svn_utf_cstring_to_utf8(&utf8_arg, arg, result_pool));
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c
URL:
http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c?rev=1926504&r1=1926503&r2=1926504&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c
(original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/libsvn_subr/opt.c Tue
Jun 17 14:37:10 2025
@@ -249,29 +249,22 @@ svn_opt__args_to_target_array(apr_array_
targets_p, utf8_input_targets, known_targets, pool));
}
+/* Note: This is substantially copied into svn_client___target_array() in
+ * order to move to libsvn_client while maintaining backward compatibility. */
svn_error_t *
-svn_opt__collect_targets(apr_array_header_t **targets_p,
- svn_boolean_t *rel_url_found_p,
- const apr_array_header_t *utf8_targets,
- const apr_array_header_t *known_targets,
- apr_pool_t *pool)
+svn_opt__process_target_array(apr_array_header_t **targets_p,
+ apr_array_header_t *input_targets,
+ const apr_array_header_t *known_targets,
+ apr_pool_t *pool)
{
int i;
- int target_count = utf8_targets->nelts + (known_targets
- ? known_targets->nelts : 0);
- apr_array_header_t *input_targets = apr_array_make(pool, target_count,
- sizeof(const char *));
-
- for (i = 0; i < utf8_targets->nelts; i++)
- {
- const char *utf8_target = APR_ARRAY_IDX(utf8_targets, i, const char *);
+ svn_error_t *err = SVN_NO_ERROR;
+ apr_array_header_t *output_targets =
+ apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
- if (rel_url_found_p != NULL &&
- svn_path_is_repos_relative_url(utf8_target))
- *rel_url_found_p = TRUE;
-
- APR_ARRAY_PUSH(input_targets, const char *) = utf8_target;
- }
+ /* Step 1: create a master array of targets, and come from concatenating
+ the targets left by apr_getopt, plus any extra targets (e.g., from the
+ --targets switch.) */
if (known_targets)
{
@@ -281,50 +274,18 @@ svn_opt__collect_targets(apr_array_heade
because we needed to split up the list with svn_cstring_split. */
const char *utf8_target = APR_ARRAY_IDX(known_targets,
i, const char *);
-
- if (rel_url_found_p != NULL &&
- svn_path_is_repos_relative_url(utf8_target))
- *rel_url_found_p = TRUE;
-
APR_ARRAY_PUSH(input_targets, const char *) = utf8_target;
}
}
- *targets_p = input_targets;
- return SVN_NO_ERROR;
-}
-
-/* Note: This is substantially copied into svn_client_args_to_target_array() in
- * order to move to libsvn_client while maintaining backward compatibility. */
-svn_error_t *
-svn_opt__process_target_array(apr_array_header_t **targets_p,
- apr_array_header_t *utf8_targets,
- const apr_array_header_t *known_targets,
- apr_pool_t *pool)
-{
- int i;
- apr_array_header_t *input_targets;
- apr_array_header_t *output_targets;
- apr_array_header_t *reserved_names = NULL;
-
- /* Step 1: create a master array of targets, and come from concatenating
- the targets left by apr_getopt, plus any extra targets (e.g., from the
- --targets switch.) */
-
- SVN_ERR(svn_opt__collect_targets(&input_targets, NULL,
- utf8_targets, known_targets, pool));
-
/* Step 2: process each target. */
- output_targets = apr_array_make(pool, input_targets->nelts,
- sizeof(const char *));
-
for (i = 0; i < input_targets->nelts; i++)
{
const char *utf8_target = APR_ARRAY_IDX(input_targets, i, const char *);
const char *true_target;
- const char *peg_rev;
const char *target; /* after all processing is finished */
+ const char *peg_rev;
/*
* This is needed so that the target can be properly canonicalized,
@@ -344,15 +305,15 @@ svn_opt__process_target_array(apr_array_
/* URLs and wc-paths get treated differently. */
if (svn_path_is_url(true_target))
{
- SVN_ERR(svn_opt__arg_canonicalize_url(&true_target,
- true_target, pool));
+ SVN_ERR(svn_opt__arg_canonicalize_url(&true_target, true_target,
+ pool));
}
else /* not a url, so treat as a path */
{
const char *base_name;
- SVN_ERR(svn_opt__arg_canonicalize_path(&true_target,
- true_target, pool));
+ SVN_ERR(svn_opt__arg_canonicalize_path(&true_target, true_target,
+ pool));
/* If the target has the same name as a Subversion
working copy administrative dir, skip it. */
@@ -368,11 +329,9 @@ svn_opt__process_target_array(apr_array_
if (0 == strcmp(base_name, ".svn")
|| 0 == strcmp(base_name, "_svn"))
{
- if (!reserved_names)
- reserved_names = apr_array_make(pool, 1,
- sizeof(const char *));
-
- APR_ARRAY_PUSH(reserved_names, const char *) = utf8_target;
+ err = svn_error_createf(SVN_ERR_RESERVED_FILENAME_SPECIFIED,
+ err, _("'%s' ends in a reserved name"),
+ utf8_target);
continue;
}
}
@@ -388,19 +347,7 @@ svn_opt__process_target_array(apr_array_
*targets_p = output_targets;
- if (reserved_names)
- {
- svn_error_t *err = SVN_NO_ERROR;
-
- for (i = 0; i < reserved_names->nelts; ++i)
- err = svn_error_createf(SVN_ERR_RESERVED_FILENAME_SPECIFIED, err,
- _("'%s' ends in a reserved name"),
- APR_ARRAY_IDX(reserved_names, i,
- const char *));
- return svn_error_trace(err);
- }
-
- return SVN_NO_ERROR;
+ return err;
}
svn_error_t *
@@ -551,120 +498,3 @@ svn_opt__arg_canonicalize_path(const cha
return SVN_NO_ERROR;
}
-
-svn_error_t *
-svn_opt__target_parse(svn_opt__target_t **target_p,
- svn_boolean_t *rel_url_found_p,
- const char *path,
- apr_pool_t *pool)
-{
- svn_opt__target_t *new_target = apr_pcalloc(pool,
- sizeof(*new_target));
-
- SVN_ERR(svn_opt__split_arg_at_peg_revision(&new_target->true_target,
- &new_target->peg_revision,
- path, pool));
-
- if (svn_path_is_repos_relative_url(path))
- {
- new_target->type = svn_opt__target_type_relative_url;
-
- if (rel_url_found_p != NULL)
- *rel_url_found_p = TRUE;
- }
- if (svn_path_is_url(path))
- new_target->type = svn_opt__target_type_absolute_url;
- else
- new_target->type = svn_opt__target_type_local_abspath;
-
- *target_p = new_target;
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_opt__target_to_string(const char **path_p,
- svn_opt__target_t *target,
- apr_pool_t *pool)
-{
- const char *canonical_target;
-
- if (target->type == svn_opt__target_type_absolute_url
- || target->type == svn_opt__target_type_relative_url)
- {
- SVN_ERR(svn_opt__arg_canonicalize_url(&canonical_target,
- target->true_target, pool));
- }
- else
- {
- canonical_target = target->true_target;
- }
-
- *path_p = apr_pstrcat(pool, canonical_target,
- target->peg_revision, SVN_VA_NULL);
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_opt__target_resolve(svn_opt__target_t *target,
- const char *root,
- apr_pool_t *pool)
-{
- const char *abs_target;
-
- assert(target->type == svn_opt__target_type_relative_url);
-
- SVN_ERR(svn_path_resolve_repos_relative_url(&abs_target, target->true_target,
- root, pool));
-
- target->true_target = abs_target;
- target->type = svn_opt__target_type_absolute_url;
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_opt__target_array_parse(apr_array_header_t **targets_p,
- svn_boolean_t *rel_url_found_p,
- apr_array_header_t *paths,
- apr_pool_t *pool)
-{
- int i;
-
- if (*targets_p == NULL)
- *targets_p = apr_array_make(pool, DEFAULT_ARRAY_SIZE,
- sizeof(svn_opt__target_t *));
-
- for (i = 0; i < paths->nelts; i++)
- {
- const char *path = APR_ARRAY_IDX(paths, i, const char *);
- svn_opt__target_t *target;
-
- SVN_ERR(svn_opt__target_parse(&target, rel_url_found_p, path, pool));
- APR_ARRAY_PUSH(*targets_p, svn_opt__target_t *) = target;
- }
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_opt__target_array_to_string(apr_array_header_t **paths_p,
- apr_array_header_t *targets,
- apr_pool_t *pool)
-{
- int i;
-
- if (*paths_p == NULL)
- *paths_p = apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
-
- for (i = 0; i < targets->nelts; i++)
- {
- const char *path;
- svn_opt__target_t *target = APR_ARRAY_IDX(targets, i,
- svn_opt__target_t *);
-
- SVN_ERR(svn_opt__target_to_string(&path, target, pool));
- APR_ARRAY_PUSH(*paths_p, const char *) = path;
- }
-
- return SVN_NO_ERROR;
-}