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

Re: svn commit: r1034432 - in /subversion/trunk/subversion/libsvn_client: client.h externals.c relocate.c

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: Fri, 12 Nov 2010 09:47:33 -0600

On Fri, Nov 12, 2010 at 9:43 AM, <cmpilato_at_apache.org> wrote:
> Author: cmpilato
> Date: Fri Nov 12 15:43:28 2010
> New Revision: 1034432
>
> URL: http://svn.apache.org/viewvc?rev=1034432&view=rev
> Log:
> Promote an bit of generally useful logic into a module-private helper

Could you include a brief description of *which* bit of useful logic
you promoted? (It isn't obvious from the rest of the log message, nor
the contents.)

> function so it's easier to spot and reuse later.
>
> * subversion/libsvn_client/client.h
>  (svn_client__crawl_for_externals): New function.
>
> * subversion/libsvn_client/externals.c
>  (externals_update_func, status_noop_func): Moved here from relocate.c.
>  (svn_client__crawl_for_externals): New function, largely cored from
>    code previously in svn_client_relocate2().
>
> * subversion/libsvn_client/relocate.c
>  (externals_update_func, status_noop_func): Moved to externals.c.
>  (svn_client_relocate2): Now use svn_client__crawl_for_externals().
>
> Modified:
>    subversion/trunk/subversion/libsvn_client/client.h
>    subversion/trunk/subversion/libsvn_client/externals.c
>    subversion/trunk/subversion/libsvn_client/relocate.c
>
> Modified: subversion/trunk/subversion/libsvn_client/client.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1034432&r1=1034431&r2=1034432&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/client.h (original)
> +++ subversion/trunk/subversion/libsvn_client/client.h Fri Nov 12 15:43:28 2010
> @@ -1011,6 +1011,17 @@ svn_client__do_external_status(svn_clien
>                                void *status_baton,
>                                apr_pool_t *pool);
>
> +/* Set *EXTERNALS_P to a hash mapping const char * local absolute
> +   paths to const svn_string_t * svn:externals property values, those
> +   found by crawling LOCAL_ABSPATH to DEPTH. */
> +svn_error_t *
> +svn_client__crawl_for_externals(apr_hash_t **externals_p,
> +                                const char *local_abspath,
> +                                svn_depth_t depth,
> +                                svn_client_ctx_t *ctx,
> +                                apr_pool_t *scratch_pool,
> +                                apr_pool_t *result_pool);
> +
>
>
>  /* Retrieve log messages using the first provided (non-NULL) callback
>
> Modified: subversion/trunk/subversion/libsvn_client/externals.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1034432&r1=1034431&r2=1034432&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/externals.c (original)
> +++ subversion/trunk/subversion/libsvn_client/externals.c Fri Nov 12 15:43:28 2010
> @@ -1425,7 +1425,6 @@ svn_cl__store_externals(void *baton,
>  }
>
>
> -
>  svn_error_t *
>  svn_client__external_info_gatherer(void *baton,
>                                    const char *local_abspath,
> @@ -1459,3 +1458,56 @@ svn_client__external_info_gatherer(void
>
>   return SVN_NO_ERROR;
>  }
> +
> +
> +/* Callback of type svn_wc_external_update_t.  Just squirrels away an
> +   svn:externals property value into BATON (which is an apr_hash_t *
> +   keyed on local absolute path).  */
> +static svn_error_t *
> +externals_update_func(void *baton,
> +                      const char *local_abspath,
> +                      const svn_string_t *old_val,
> +                      const svn_string_t *new_val,
> +                      svn_depth_t depth,
> +                      apr_pool_t *scratch_pool)
> +{
> +  apr_hash_t *externals_hash = baton;
> +  apr_pool_t *hash_pool = apr_hash_pool_get(externals_hash);
> +
> +  apr_hash_set(externals_hash, apr_pstrdup(hash_pool, local_abspath),
> +               APR_HASH_KEY_STRING, svn_string_dup(new_val, hash_pool));
> +  return SVN_NO_ERROR;
> +}
> +
> +
> +/* Callback of type svn_wc_status_func4_t.  Does nothing. */
> +static svn_error_t *
> +status_noop_func(void *baton,
> +                 const char *local_abspath,
> +                 const svn_wc_status3_t *status,
> +                 apr_pool_t *scratch_pool)
> +{
> +  return SVN_NO_ERROR;
> +}
> +
> +
> +svn_error_t *
> +svn_client__crawl_for_externals(apr_hash_t **externals_p,
> +                                const char *local_abspath,
> +                                svn_depth_t depth,
> +                                svn_client_ctx_t *ctx,
> +                                apr_pool_t *scratch_pool,
> +                                apr_pool_t *result_pool)
> +{
> +  apr_hash_t *externals_hash = apr_hash_make(result_pool);
> +
> +  /* Do a status run just to harvest externals definitions. */
> +  SVN_ERR(svn_wc_walk_status(ctx->wc_ctx, local_abspath, depth,
> +                             FALSE, FALSE, NULL, status_noop_func, NULL,
> +                             externals_update_func, externals_hash,
> +                             ctx->cancel_func, ctx->cancel_baton,
> +                             scratch_pool));
> +
> +  *externals_p = externals_hash;
> +  return SVN_NO_ERROR;
> +}
>
> Modified: subversion/trunk/subversion/libsvn_client/relocate.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/relocate.c?rev=1034432&r1=1034431&r2=1034432&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/relocate.c (original)
> +++ subversion/trunk/subversion/libsvn_client/relocate.c Fri Nov 12 15:43:28 2010
> @@ -126,37 +126,6 @@ validator_func(void *baton,
>  }
>
>
> -/* Callback of type svn_wc_external_update_t.  Just squirrels away an
> -   svn:externals property value into BATON (which is an apr_hash_t *
> -   keyed on local absolute path).  */
> -static svn_error_t *
> -externals_update_func(void *baton,
> -                      const char *local_abspath,
> -                      const svn_string_t *old_val,
> -                      const svn_string_t *new_val,
> -                      svn_depth_t depth,
> -                      apr_pool_t *scratch_pool)
> -{
> -  apr_hash_t *externals_hash = baton;
> -  apr_pool_t *hash_pool = apr_hash_pool_get(externals_hash);
> -
> -  apr_hash_set(externals_hash, apr_pstrdup(hash_pool, local_abspath),
> -               APR_HASH_KEY_STRING, svn_string_dup(new_val, hash_pool));
> -  return SVN_NO_ERROR;
> -}
> -
> -
> -/* Callback of type svn_wc_status_func4_t.  Does nothing. */
> -static svn_error_t *
> -status_noop_func(void *baton,
> -                 const char *local_abspath,
> -                 const svn_wc_status3_t *status,
> -                 apr_pool_t *scratch_pool)
> -{
> -  return SVN_NO_ERROR;
> -}
> -
> -
>  /* Examing the array of svn_wc_external_item2_t's EXT_DESC (parsed
>    from the svn:externals property set on LOCAL_ABSPATH) and determine
>    if the external working copies described by such should be
> @@ -270,16 +239,10 @@ svn_client_relocate2(const char *wcroot_
>   SVN_ERR(svn_client_root_url_from_path(&new_repos_root_url, local_abspath,
>                                         ctx, pool));
>
> -  externals_hash = apr_hash_make(pool);
> -
> -  /* Do a status run just to harvest externals definitions. */
> -  SVN_ERR(svn_wc_walk_status(ctx->wc_ctx, local_abspath,
> -                             svn_depth_infinity, FALSE, FALSE, NULL,
> -                             status_noop_func, NULL,
> -                             externals_update_func, externals_hash,
> -                             ctx->cancel_func, ctx->cancel_baton, pool));
>
> -  /* No externals?  No problem.  We're done here. */
> +  /* Relocate externals, too (if any). */
> +  SVN_ERR(svn_client__crawl_for_externals(&externals_hash, local_abspath,
> +                                          svn_depth_infinity, ctx, pool, pool));
>   if (! apr_hash_count(externals_hash))
>     return SVN_NO_ERROR;
>
>
>
>
Received on 2010-11-12 16:48:14 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.