You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Noorul Islam K M <no...@collab.net> on 2010/11/03 20:06:42 UTC

Fix for issue 3620 - lock command

Log 

[[[

Make 'svn lock' verify that both working copy paths and URLs are
not passed.

* subversion/tests/cmdline/input_validation_tests.py
  (invalid_lock_targets): New test, verifying that svn lock copes well
   with invalid target combinations.

* subversion/svn/lock-cmd.c
  (svn_cl__lock): 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


Re: Fix for issue 3620 - lock command

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Nov 04, 2010 at 02:14:32AM +0530, Noorul Islam K M wrote:
> Sending updated patch with libsvn_client modifications.

Thanks, r1030704. I've tweaked the log message slightly.

Stefan

Re: Fix for issue 3620 - lock command

Posted by Noorul Islam K M <no...@collab.net>.
Noorul Islam K M <no...@collab.net> writes:

> Log 
>
> [[[
>
> Make 'svn lock' verify that both working copy paths and URLs are
> not passed.
>
> * subversion/tests/cmdline/input_validation_tests.py
>   (invalid_lock_targets): New test, verifying that svn lock copes well
>    with invalid target combinations.
>
> * subversion/svn/lock-cmd.c
>   (svn_cl__lock): 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 1030628)
> +++ subversion/tests/cmdline/input_validation_tests.py	(working copy)
> @@ -194,6 +194,13 @@
>      run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'revert',
>                               target)
>  
> +def invalid_lock_targets(sbox):
> +  "wc paths and repo URL target mixture for 'lock'"
> +  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", 'lock', target1, target2)
> +
>  ########################################################################
>  # Run the tests
>  
> @@ -215,6 +222,7 @@
>                invalid_resolve_targets,
>                invalid_resolved_targets,
>                invalid_revert_targets,
> +              invalid_lock_targets,
>               ]
>  
>  if __name__ == '__main__':
> Index: subversion/svn/lock-cmd.c
> ===================================================================
> --- subversion/svn/lock-cmd.c	(revision 1030628)
> +++ subversion/svn/lock-cmd.c	(working copy)
> @@ -89,6 +89,8 @@
>    svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
>    apr_array_header_t *targets;
>    const char *comment;
> +  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,
> @@ -98,6 +100,22 @@
>    if (! targets->nelts)
>      return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL);
>  
> +  /* 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 *path = APR_ARRAY_IDX(targets, i, const char *);
> +      if (! svn_path_is_url(path))
> +       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"));
> +
>    /* Get comment. */
>    SVN_ERR(get_comment(&comment, ctx, opt_state, pool));
>  

Sending updated patch with libsvn_client modifications.

Log 

[[[

Make 'svn lock' verify that both working copy paths and URLs are
not passed.

* subversion/tests/cmdline/input_validation_tests.py
  (invalid_lock_targets): New test, verifying that svn lock copes well
   with invalid target combinations.

* subversion/svn/lock-cmd.c,
  subversion/libsvn_client/locking_commands.c
  (svn_cl__lock, organize_lock_targets): 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