[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r33417 - in trunk/subversion: libsvn_wc tests/cmdline

From: Blair Zajac <blair_at_orcaware.com>
Date: Fri, 03 Oct 2008 13:36:41 -0700

vgeorgescu_at_tigris.org wrote:
> Author: vgeorgescu
> Date: Fri Oct 3 11:13:54 2008
> New Revision: 33417
>
> Log:
> Support the usual shell quoting rules in externals definitions (\ to escape,
> " to quote). This allows us to use local paths with spaces in externals
> (issue #2461).
>
> * subversion/libsvn_wc/props.c
> (svn_wc_parse_externals_description3): Use apr_tokenize_to_argv() instead
> of svn_cstring_split(). The former implements quoting and escaping logic.
> Now that line_parts is a normal C array instead of an APR array,
> calculate its length manually and use array indexing instead of
> APR_ARRAY_IDX. Adjust call to find_and_remove_externals_revision().
> (find_and_remove_externals_revision): Change type of line_parts, and add
> a num_line_parts argument. Make the same kind of changes as above.
>
> * subversion/tests/cmdline/externals_tests.py
> (external_into_path_with_spaces): New test.
> (test_list): Run it.
>
> Modified:
> trunk/subversion/libsvn_wc/props.c
> trunk/subversion/tests/cmdline/externals_tests.py
>
> Modified: trunk/subversion/libsvn_wc/props.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/props.c?pathrev=33417&r1=33416&r2=33417
> ==============================================================================
> --- trunk/subversion/libsvn_wc/props.c Fri Oct 3 09:42:01 2008 (r33416)
> +++ trunk/subversion/libsvn_wc/props.c Fri Oct 3 11:13:54 2008 (r33417)
> @@ -3097,7 +3097,8 @@ svn_wc_get_prop_diffs(apr_array_header_t
> */
> static svn_error_t *
> find_and_remove_externals_revision(int *rev_idx,
> - apr_array_header_t *line_parts,
> + const char **line_parts,
> + int num_line_parts,
> svn_wc_external_item2_t *item,
> const char *parent_directory_display,
> const char *line,
> @@ -3107,7 +3108,7 @@ find_and_remove_externals_revision(int *
>
> for (i = 0; i < 2; ++i)
> {
> - const char *token = APR_ARRAY_IDX(line_parts, i, const char *);
> + const char *token = line_parts[i];
>
> if (token[0] == '-' && token[1] == 'r')
> {
> @@ -3122,17 +3123,17 @@ find_and_remove_externals_revision(int *
> {
> /* There must be a total of four elements in the line if
> -r N is used. */
> - if (line_parts->nelts != 4)
> + if (num_line_parts != 4)
> goto parse_error;
>
> shift_count = 2;
> - digits_ptr = APR_ARRAY_IDX(line_parts, i+1, const char *);
> + digits_ptr = line_parts[i+1];
> }
> else
> {
> /* There must be a total of three elements in the line
> if -rN is used. */
> - if (line_parts->nelts != 3)
> + if (num_line_parts != 3)
> goto parse_error;
>
> shift_count = 1;
> @@ -3153,11 +3154,9 @@ find_and_remove_externals_revision(int *
>
> /* Shift any line elements past the revision specification
> down over the revision specification. */
> - for (j = i; j < line_parts->nelts-shift_count; ++j)
> - APR_ARRAY_IDX(line_parts, j, const char *) =
> - APR_ARRAY_IDX(line_parts, j+shift_count, const char *);
> - for (j = 0; j < shift_count; ++j)
> - apr_array_pop(line_parts);
> + for (j = i; j < num_line_parts-shift_count; ++j)
> + line_parts[j] = line_parts[j+shift_count];
> + line_parts[num_line_parts-shift_count] = NULL;

Nice patch. I think we should nominate this for 1.5.

I'm thinking it's probably a good idea to subtract shift_count from
num_line_parts just to keep the two consistent, in case the code is extended for
some reason.

Also, returning the new num_line_parts to the caller would be good if elements
are removed so the caller doesn't need to recount them.

Regards,
Blair

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-10-03 22:37:00 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.