[email protected] 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;
> +    }

Reply via email to