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

Re: Fix for issue 3620 - unlock command

From: Noorul Islam K M <noorul_at_collab.net>
Date: Fri, 05 Nov 2010 17:10:03 +0530

Noorul Islam K M <noorul_at_collab.net> writes:

> Stefan Sperling <stsp_at_elego.de> writes:
>
>> On Wed, Nov 03, 2010 at 09:12:41PM +0100, Stefan Sperling wrote:
>>
>>> $ svn lock blah ^/
>>> subversion/libsvn_client/cmdline.c:330: (apr_err=235000)
>>> svn: In file 'subversion/libsvn_subr/dirent_uri.c' line 1649: assertion failed (! svn_path_is_url(relative))
>>> Abort trap (core dumped)
>>
>> Ooops, this patch for for unlock, not lock.
>> But the same problem happens for unlock.
>
> Modified the patch a bit. Attached is the updated one.
>
> Log
>
> [[[
>
> Make 'svn unlock' verify that both working copy paths and URLs are
> not passed.
>
> * subversion/tests/cmdline/input_validation_tests.py
> (invalid_unlock_targets): New test, verifying that svn unlock copes well
> with invalid target combinations.
>
> * subversion/svn/unlock-cmd.c
> (svn_cl__unlock): For consistency with other sub-commands, raise the
> SVN_ERR_CL_ARG_PARSING_ERROR if both working copy paths and URLs are
> passed, and use the same error message also used elsewhere.
>
> Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
>
> ]]]
>
> Thanks and Regards
> Noorul
>
> Index: subversion/tests/cmdline/input_validation_tests.py
> ===================================================================
> --- subversion/tests/cmdline/input_validation_tests.py (revision 1030801)
> +++ subversion/tests/cmdline/input_validation_tests.py (working copy)
> @@ -201,6 +201,13 @@
> run_and_verify_svn_in_wc(sbox, "svn: Cannot mix repository and working "
> "copy targets", 'lock', target1, target2)
>
> +def invalid_unlock_targets(sbox):
> + "wc paths and repo URL target mixture for 'unlock'"
> + sbox.build(read_only=True)
> + for (target1, target2) in [("iota", "^/"), ("file://", "iota")]:
> + run_and_verify_svn_in_wc(sbox, "svn: Cannot mix repository and working "
> + "copy targets", 'unlock', target1, target2)
> +
> ########################################################################
> # Run the tests
>
> @@ -223,6 +230,7 @@
> invalid_resolved_targets,
> invalid_revert_targets,
> invalid_lock_targets,
> + invalid_unlock_targets,
> ]
>
> if __name__ == '__main__':
> Index: subversion/svn/unlock-cmd.c
> ===================================================================
> --- subversion/svn/unlock-cmd.c (revision 1030801)
> +++ subversion/svn/unlock-cmd.c (working copy)
> @@ -27,6 +27,7 @@
>
> /*** Includes. ***/
>
> +#include "svn_path.h"
> #include "svn_pools.h"
> #include "svn_client.h"
> #include "svn_error_codes.h"
> @@ -48,6 +49,8 @@
> svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
> svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
> apr_array_header_t *targets;
> + svn_boolean_t wc_present = FALSE, url_present = FALSE;
> + int i;
>
> SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
> opt_state->targets,
> @@ -59,6 +62,23 @@
>
> SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool));
>
> + /* Check to see if at least one of our paths is a working copy
> + * path or a repository url. */
> + for (i = 0; i < targets->nelts; ++i)
> + {
> + const char *target = APR_ARRAY_IDX(targets, i, const char *);
> +
> + if (! svn_path_is_url(target))
> + wc_present = TRUE;
> + else
> + url_present = TRUE;
> + }
> +
> + if (url_present && wc_present)
> + return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
> + _("Cannot mix repository and working copy "
> + "targets"));
> +
> return svn_error_return(
> svn_client_unlock(targets, opt_state->force, ctx, scratch_pool));
> }

I think you missed reviewing this.

Thanks and Regards
Noorul
Received on 2010-11-05 12:41:03 CET

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.