Even though it doesn't change our public API, external consumers may be
relying on the current behavior of svn_opt_parse_path(). We should release
note this (or something).
On Tue, 16 Oct 2007, blair@tigris.org wrote:
> Author: blair
> Date: Tue Oct 16 22:17:15 2007
> New Revision: 27236
>
> Log:
> For relative externals, svn_opt_parse_path() needs to return the input
> path minus the trailing peg revision specification regardless of
> canonicalization; for example, the scheme relative URL
> //hostname/path@HEAD needs to retain the //, as changing it to a /
> leads to a server root relative URL.
>
> Currently svn_opt_parse_path() canonicalizes all input, even though
> the public documentation API does not state that. Change the code to
> not canonicalize and also to reflect the documentation better.
>
> I checked all callers of svn_opt_parse_path() and they canonicalize
> the path to to svn_opt_parse_path() before calling it, except for
> svn_wc_parse_externals_description3(), which will need the
> uncanonicalized form anyway for relative externals.
>
> * subversion/include/svn_opt.h
> (svn_opt_parse_path):
> Add documentation that the function does not require a
> canonicalized path and does no canonicalization.
> Update the example output for a string.
>
> * subversion/libsvn_subr/opt.c
> (svn_opt_parse_path):
> Do not canonicalize the input path.
>
> * subversion/tests/libsvn_subr/opt-test.c
> (test_parse_peg_rev):
> Update the output for an input "foo/bar/@13".
>
>
> Modified:
> trunk/subversion/include/svn_opt.h
> trunk/subversion/libsvn_subr/opt.c
> trunk/subversion/tests/libsvn_subr/opt-test.c
>
> Modified: trunk/subversion/include/svn_opt.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_opt.h?pathrev=27236&r1=27235&r2=27236
> ==============================================================================
> --- trunk/subversion/include/svn_opt.h (original)
> +++ trunk/subversion/include/svn_opt.h Tue Oct 16 22:17:15 2007
> @@ -520,7 +520,7 @@
> * "foo/bar@1:2" -> error
> * "foo/bar@baz" -> error
> * "foo/bar@" -> "foo/bar", (base)
> - * "foo/bar/@13" -> "foo/bar", (number, 13)
> + * "foo/bar/@13" -> "foo/bar/", (number, 13)
> * "foo/bar@@13" -> "foo/bar@", (number, 13)
> * "foo/@bar@HEAD" -> "foo/@bar", (head)
> * "foo@/bar" -> "foo@/bar", (unspecified)
> @@ -535,6 +535,10 @@
> * set @a *truepath to @a path and @a rev->kind to @c
> * svn_opt_revision_unspecified.
> *
> + * This function does not require that @a path be in canonical form.
> + * No canonicalization is done and @a *truepath will only be in
> + * canonical form if @a path is in canonical form.
> + *
> * @since New in 1.1.
> */
> svn_error_t *
>
> Modified: trunk/subversion/libsvn_subr/opt.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/opt.c?pathrev=27236&r1=27235&r2=27236
> ==============================================================================
> --- trunk/subversion/libsvn_subr/opt.c (original)
> +++ trunk/subversion/libsvn_subr/opt.c Tue Oct 16 22:17:15 2007
> @@ -799,8 +799,7 @@
> _("Syntax error parsing revision '%s'"),
> path + i + 1);
>
> - *truepath = svn_path_canonicalize(apr_pstrmemdup(pool, path, i),
> - pool);
> + *truepath = apr_pstrmemdup(pool, path, i);
> rev->kind = start_revision.kind;
> rev->value = start_revision.value;
>
> @@ -809,7 +808,7 @@
> }
>
> /* Didn't find an @-sign. */
> - *truepath = svn_path_canonicalize(path, pool);
> + *truepath = path;
> rev->kind = svn_opt_revision_unspecified;
>
> return SVN_NO_ERROR;
>
> Modified: trunk/subversion/tests/libsvn_subr/opt-test.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/libsvn_subr/opt-test.c?pathrev=27236&r1=27235&r2=27236
> ==============================================================================
> --- trunk/subversion/tests/libsvn_subr/opt-test.c (original)
> +++ trunk/subversion/tests/libsvn_subr/opt-test.c Tue Oct 16 22:17:15 2007
> @@ -44,7 +44,7 @@
> { "foo/bar@1:2", NULL, {svn_opt_revision_unspecified} },
> { "foo/bar@baz", NULL, {svn_opt_revision_unspecified} },
> { "foo/bar@", "foo/bar", {svn_opt_revision_base} },
> - { "foo/bar/@13", "foo/bar", {svn_opt_revision_number, {13}} },
> + { "foo/bar/@13", "foo/bar/", {svn_opt_revision_number, {13}} },
> { "foo/bar@@13", "foo/bar@", {svn_opt_revision_number, {13}} },
> { "foo/@bar@HEAD", "foo/@bar", {svn_opt_revision_head} },
> { "foo@/bar", "foo@/bar", {svn_opt_revision_unspecified} },
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
--
Daniel Rall
- application/pgp-signature attachment: stored
Received on Mon Oct 22 10:06:10 2007