Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_subr/opt.c view on Meta::CPAN
if (known_targets)
{
for (i = 0; i < known_targets->nelts; i++)
{
/* 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 *);
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 *);
const char *true_target;
const char *target; /* after all processing is finished */
const char *peg_rev;
/*
* This is needed so that the target can be properly canonicalized,
* otherwise the canonicalization does not treat a ".@BASE" as a "."
* with a BASE peg revision, and it is not canonicalized to "@BASE".
* If any peg revision exists, it is appended to the final
* canonicalized path or URL. Do not use svn_opt_parse_path()
* because the resulting peg revision is a structure that would have
* to be converted back into a string. Converting from a string date
* to the apr_time_t field in the svn_opt_revision_value_t and back to
* 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));
/* 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;
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. */
base_name = svn_dirent_basename(true_target, pool);
/* FIXME:
The canonical list of administrative directory names is
maintained in libsvn_wc/adm_files.c:svn_wc_set_adm_dir().
That list can't be used here, because that use would
create a circular dependency between libsvn_wc and
libsvn_subr. Make sure changes to the lists are always
synchronized! */
if (0 == strcmp(base_name, ".svn")
|| 0 == strcmp(base_name, "_svn"))
{
err = svn_error_createf(SVN_ERR_RESERVED_FILENAME_SPECIFIED,
err, _("'%s' ends in a reserved name"),
utf8_target);
continue;
}
}
target = apr_pstrcat(pool, true_target, peg_rev, (char *)NULL);
APR_ARRAY_PUSH(output_targets, const char *) = target;
}
/* kff todo: need to remove redundancies from targets before
passing it to the cmd_func. */
*targets_p = output_targets;
return err;
}
svn_error_t *
svn_opt_parse_revprop(apr_hash_t **revprop_table_p, const char *revprop_spec,
apr_pool_t *pool)
{
const char *sep, *propname;
svn_string_t *propval;
if (! *revprop_spec)
return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("Revision property pair is empty"));
if (! *revprop_table_p)
*revprop_table_p = apr_hash_make(pool);
sep = strchr(revprop_spec, '=');
if (sep)
{
propname = apr_pstrndup(pool, revprop_spec, sep - revprop_spec);
SVN_ERR(svn_utf_cstring_to_utf8(&propname, propname, pool));
propval = svn_string_create(sep + 1, pool);
}
else
{
SVN_ERR(svn_utf_cstring_to_utf8(&propname, revprop_spec, pool));
propval = svn_string_create_empty(pool);
}
if (!svn_prop_name_is_valid(propname))
return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
_("'%s' is not a valid Subversion property name"),
propname);
svn_hash_sets(*revprop_table_p, propname, propval);
return SVN_NO_ERROR;
}
( run in 1.510 second using v1.01-cache-2.11-cpan-d7f47b0818f )