You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.name> on 2011/03/31 11:18:23 UTC

Re: svn commit: r1087015 - in /subversion/trunk/subversion: include/ libsvn_client/ svn/ tests/cmdline/ tests/cmdline/getopt_tests_data/ tests/cmdline/svntest/

cmpilato@apache.org wrote on Wed, Mar 30, 2011 at 16:54:02 -0000:
> +++ subversion/trunk/subversion/libsvn_client/switch.c Wed Mar 30 16:54:01 2011
> @@ -174,6 +176,30 @@ switch_internal(svn_revnum_t *result_rev
>                               _("'%s'\nis not the same repository as\n'%s'"),
>                               url, source_root);
>  
> +  /* If we're not ignoring ancestry, then error out if the switch
> +     source and target don't have a common ancestory.
> +
> +     ### We're acting on the anchor here, not the target.  Is that
> +     ### okay? */
> +  if (! ignore_ancestry)
> +    {
> +      const char *target_url, *yc_path;
> +      svn_revnum_t target_rev, yc_rev;
> +
> +      SVN_ERR(svn_wc__node_get_url(&target_url, ctx->wc_ctx, local_abspath,
> +                                   pool, pool));
> +      SVN_ERR(svn_wc__node_get_base_rev(&target_rev, ctx->wc_ctx,
> +                                        local_abspath, pool));
> +      SVN_ERR(svn_client__get_youngest_common_ancestor(&yc_path, &yc_rev,
> +                                                       switch_rev_url, revnum,
> +                                                       target_url, target_rev,
> +                                                       ctx, pool));
> +      if (! (yc_path && SVN_IS_VALID_REVNUM(yc_rev)))
> +        return svn_error_create(SVN_ERR_CLIENT_UNRELATED_RESOURCES,
> +                                NULL, NULL);

Perhaps mention SWITCH_REV_URL and TARGET_URL in the error message?

I think many of our error messages would benefit from growing a %s
substitute (eg, compare "Bogus date" and "Bogus date '%s'" \
% malformatted_date_string).

> +++ subversion/trunk/subversion/svn/switch-cmd.c Wed Mar 30 16:54:01 2011
> @@ -172,10 +173,21 @@ svn_cl__switch(apr_getopt_t *os,
>    ctx->notify_baton2 = &nwb;
>  
>    /* Do the 'switch' update. */
> -  SVN_ERR(svn_client_switch2(NULL, target, switch_url, &peg_revision,
> -                             &(opt_state->start_revision), depth,
> -                             depth_is_sticky, opt_state->ignore_externals,
> -                             opt_state->force, ctx, scratch_pool));
> +  err = svn_client_switch3(NULL, target, switch_url, &peg_revision,
> +                           &(opt_state->start_revision), depth,
> +                           depth_is_sticky, opt_state->ignore_externals,
> +                           opt_state->force, opt_state->ignore_ancestry,
> +                           ctx, scratch_pool);
> +  if (err)
> +    {
> +      if (err->apr_err == SVN_ERR_CLIENT_UNRELATED_RESOURCES)
> +        return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, err,
> +                                 "Path '%s' does not share common version "
> +                                 "control ancestry with the requested switch "
> +                                 "location.  Use --ignore-ancestry to disable "
> +                                 "this check.", target);

You aren't _()'ing the error message.

> +      return err;
> +    }

Re: svn commit: r1087015 - in /subversion/trunk/subversion: include/ libsvn_client/ svn/ tests/cmdline/ tests/cmdline/getopt_tests_data/ tests/cmdline/svntest/

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 03/31/2011 05:18 AM, Daniel Shahaf wrote:
> cmpilato@apache.org wrote on Wed, Mar 30, 2011 at 16:54:02 -0000:

[...]

>> +      if (! (yc_path && SVN_IS_VALID_REVNUM(yc_rev)))
>> +        return svn_error_create(SVN_ERR_CLIENT_UNRELATED_RESOURCES,
>> +                                NULL, NULL);
> 
> Perhaps mention SWITCH_REV_URL and TARGET_URL in the error message?

SWITCH_REV_URL and TARGET_URL won't be directly meaningful to the caller, as
neither are inputs to the function.  But I should be able to use SWITCH_URL
and LOCAL_ABSPATH.

>> +      if (err->apr_err == SVN_ERR_CLIENT_UNRELATED_RESOURCES)
>> +        return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, err,
>> +                                 "Path '%s' does not share common version "
>> +                                 "control ancestry with the requested switch "
>> +                                 "location.  Use --ignore-ancestry to disable "
>> +                                 "this check.", target);
> 
> You aren't _()'ing the error message.

Doh!  That's so easy for me to forget.

Thanks for the review, Daniel.  Improvements committed:

   Sending        trunk/subversion/libsvn_client/switch.c
   Sending        trunk/subversion/svn/switch-cmd.c
   Sending        trunk/subversion/tests/cmdline/basic_tests.py
   Transmitting file data ...
   Committed revision 1087302.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand