subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noorul Islam K M <noo...@collab.net>
Subject Re: svn commit: r1070510 - in /subversion/trunk/subversion: svn/list-cmd.c tests/cmdline/basic_tests.py
Date Mon, 14 Feb 2011 15:18:22 GMT
stsp@apache.org writes:

> Author: stsp
> Date: Mon Feb 14 14:44:50 2011
> New Revision: 1070510
>
> URL: http://svn.apache.org/viewvc?rev=1070510&view=rev
> Log:
> * subversion/svn/list-cmd.c
>   (svn_cl__list): If one of the targets is a non-existent URL or
>     wc-entry, don't bail out.  Just warn and move on to the next
>     target. Also return a non-zero error code and print an error message
>     at the end in those situations.
>
> * subversion/tests/cmdline/basic_tests.py
>   (ls_non_existent_wc_target, ls_non_existent_url_target, 
>    ls_multiple_wc_targets, ls_multiple_url_targets): New tests.
>   (test_list): Add reference to new tests.
>
> Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
>
> Modified:
>     subversion/trunk/subversion/svn/list-cmd.c
>     subversion/trunk/subversion/tests/cmdline/basic_tests.py
>
> Modified: subversion/trunk/subversion/svn/list-cmd.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/list-cmd.c?rev=1070510&r1=1070509&r2=1070510&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svn/list-cmd.c (original)
> +++ subversion/trunk/subversion/svn/list-cmd.c Mon Feb 14 14:44:50 2011
> @@ -215,6 +215,8 @@ svn_cl__list(apr_getopt_t *os,
>    apr_pool_t *subpool = svn_pool_create(pool);
>    apr_uint32_t dirent_fields;
>    struct print_baton pb;
> +  svn_boolean_t seen_nonexistent_target = FALSE;
> +  svn_error_t *err;
>  
>    SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
>                                                        opt_state->targets,
> @@ -280,13 +282,28 @@ svn_cl__list(apr_getopt_t *os,
>            SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout));
>          }
>  
> -      SVN_ERR(svn_client_list2(truepath, &peg_revision,
> -                               &(opt_state->start_revision),
> -                               opt_state->depth,
> -                               dirent_fields,
> -                               (opt_state->xml || opt_state->verbose),
> -                               opt_state->xml ? print_dirent_xml : print_dirent,
> -                               &pb, ctx, subpool));
> +      err = svn_client_list2(truepath, &peg_revision,
> +                             &(opt_state->start_revision),
> +                             opt_state->depth,
> +                             dirent_fields,
> +                             (opt_state->xml || opt_state->verbose),
> +                             opt_state->xml ? print_dirent_xml : print_dirent,
> +                             &pb, ctx, subpool);
> +
> +      if (err)
> +        {
> +          /* If one of the targets is a non-existent URL or wc-entry,
> +             don't bail out.  Just warn and move on to the next target. */
> +          if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND ||
> +              err->apr_err == SVN_ERR_FS_NOT_FOUND)
> +              svn_handle_warning2(stderr, err, "svn: ");
> +          else
> +              return svn_error_return(err);
> +
> +          svn_error_clear(err);
> +          err = NULL;
> +          seen_nonexistent_target = TRUE;
> +        }
>  
>        if (opt_state->xml)
>          {
> @@ -301,5 +318,10 @@ svn_cl__list(apr_getopt_t *os,
>    if (opt_state->xml && ! opt_state->incremental)
>      SVN_ERR(svn_cl__xml_print_footer("lists", pool));
>  
> -  return SVN_NO_ERROR;
> +  if (seen_nonexistent_target)
> +    return svn_error_create(
> +      SVN_ERR_ILLEGAL_TARGET, NULL,
> +      _("Could not list all targets because some targets don't exist"));
> +  else
> +    return SVN_NO_ERROR;
>  }
>
> Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1070510&r1=1070509&r2=1070510&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
> +++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Mon Feb 14 14:44:50 2011
> @@ -2690,6 +2690,87 @@ def ls_url_special_characters(sbox):
>                                         [], 'ls',
>                                         url)
>  
> +def ls_non_existent_wc_target(sbox):
> +  "ls a non-existent wc target"
> +
> +  sbox.build(read_only = True)
> +  wc_dir = sbox.wc_dir
> +
> +  non_existent_path = os.path.join(wc_dir, 'non-existent')
> +
> +  expected_err = "svn: warning: W155010: The node '" + \
> +      re.escape(os.path.abspath(non_existent_path)) + "' was not found"
> +
> +  svntest.actions.run_and_verify_svn2(None, None, expected_err,
> +                                      1, 'ls', non_existent_path)
> +
> +def ls_non_existent_url_target(sbox):
> +  "ls a non-existent url target"
> +
> +  sbox.build(read_only = True, create_wc = False)
> +
> +  non_existent_url = sbox.repo_url + '/non-existent'
> +  expected_err = "svn: warning: W160013: .*"
> +
> +  svntest.actions.run_and_verify_svn2(None, None, expected_err,
> +                                      1, 'ls', non_existent_url)
> +
> +def ls_multiple_wc_targets(sbox):
> +  "ls multiple wc targets"
> +
> +  sbox.build(read_only = True)
> +  wc_dir = sbox.wc_dir
> +
> +  alpha = sbox.ospath('A/B/E/alpha')
> +  beta = sbox.ospath('A/B/E/beta')
> +  non_existent_path = os.path.join(wc_dir, 'non-existent')
> +
> +  # All targets are existing
> +  svntest.actions.run_and_verify_svn2(None, None, [],
> +                                      0, 'ls', alpha, beta)
> +
> +  # One non-existing target
> +  expected_err = "svn: warning: W155010: The node '" + \
> +      re.escape(os.path.abspath(non_existent_path)) + "' was not found.\n" + \
> +      ".*\nsvn: E200009: Could not list all targets because some targets " + \
> +      "don't exist\n"
> +  expected_err_re = re.compile(expected_err)
> +
> +  exit_code, output, error = svntest.main.run_svn(1, 'ls', alpha, 
> +                                                  non_existent_path, beta)
> +
> +  # Verify error
> +  if not expected_err_re.match("".join(error)):
> +    raise svntest.Failure('Cat failed: expected error "%s", but received '
> +                          '"%s"' % (expected_err, "".join(error)))
> +

My bad, I forgot to replace Cat with ls. Attached is the patch.

> +def ls_multiple_url_targets(sbox):
> +  "ls multiple url targets"
> +
> +  sbox.build(read_only = True, create_wc = False)
> +
> +  alpha = sbox.repo_url +  '/A/B/E/alpha'
> +  beta = sbox.repo_url +  '/A/B/E/beta'
> +  non_existent_url = sbox.repo_url +  '/non-existent'
> +
> +  # All targets are existing
> +  svntest.actions.run_and_verify_svn2(None, None, [],
> +                                      0, 'ls', alpha, beta)
> +
> +  # One non-existing target
> +  expected_err = "svn: warning: W160013: .*\n" + \
> +      ".*\nsvn: E200009: Could not list all targets because some targets " + \
> +      "don't exist\n"
> +  expected_err_re = re.compile(expected_err)
> +
> +  exit_code, output, error = svntest.main.run_svn(1, 'ls', alpha, 
> +                                                  non_existent_url, beta)
> +
> +  # Verify error
> +  if not expected_err_re.match("".join(error)):
> +    raise svntest.Failure('Cat failed: expected error "%s", but received "%s"' % \
> +                          (expected_err, "".join(error)))
> +

Same here.

Log
[[[

Follow-up to r1070510. Replace 'Cat' with 'ls' in error message.

* subversion/trunk/subversion/tests/cmdline/basic_tests.py
  (ls_multiple_wc_targets, ls_multiple_url_targets): Fix error message.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
]]]

Thanks and Regards
Noorul


Mime
View raw message