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

Re: [PATCH] wc-ng - Remove use of entry_t from calculate_target_mergeinfo

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Tue, 02 Mar 2010 10:39:19 +0000

Matthew Bentham <mjb67_at_artvps.com> writes:

> static svn_error_t *
> calculate_target_mergeinfo(svn_ra_session_t *ra_session,
> apr_hash_t **target_mergeinfo,
> svn_wc_adm_access_t *adm_access,
> const char *src_path_or_url,
> svn_revnum_t src_revnum,
> - svn_boolean_t no_repos_access,
> svn_client_ctx_t *ctx,
> apr_pool_t *pool)
> {
> - const svn_wc_entry_t *entry = NULL;
> svn_boolean_t locally_added = FALSE;
> const char *src_url;
> apr_hash_t *src_mergeinfo = NULL;
> @@ -94,13 +90,15 @@
> bother checking. */
> if (adm_access)
> {
> + svn_boolean_t added, copied;
> const char *local_abspath;
>
> SVN_ERR(svn_dirent_get_absolute(&local_abspath, src_path_or_url, pool));
> - SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, local_abspath,
> - svn_node_unknown, FALSE, FALSE,
> - pool, pool));
> - if (entry->schedule == svn_wc_schedule_add && (! entry->copied))
> + SVN_ERR(svn_wc__node_is_status_added(&added, ctx->wc_ctx,
> + local_abspath, pool));
> + SVN_ERR(svn_wc__node_is_status_copied(&copied, ctx->wc_ctx,
> + local_abspath, pool));

It looks a bit odd to call _added just before _copied when _copied
itself calls _added.

> + if (added && !copied)
> {
> locally_added = TRUE;
> }

> +svn_wc__node_is_status_copied(svn_boolean_t *is_copied,
> + svn_wc_context_t *wc_ctx,
> + const char *local_abspath,
> + apr_pool_t *scratch_pool)
> +{
> + svn_wc__db_status_t status;
> + svn_boolean_t added;
> +
> + SVN_ERR(svn_wc__node_is_status_added(&added, wc_ctx, local_abspath,
> + scratch_pool));
> + if (!added)
> + {
> + *is_copied = FALSE;
> + return SVN_NO_ERROR;
> + }
> +
> + SVN_ERR(svn_wc__db_scan_addition(&status,
> + NULL, NULL, NULL, NULL,
> + NULL, NULL, NULL, NULL,
> + wc_ctx->db, local_abspath,
> + scratch_pool, scratch_pool));
> + *is_copied = (status == svn_wc__db_status_copied);

What about svn_wc__db_status_moved_here? That's a copy where the
source happened to be deleted as well. What should _is_status_copied
return? How should calculate_target_mergeinfo handle _moved_here?
Like copied or like added?

> +
> + return SVN_NO_ERROR;

Perhaps calculate_target_mergeinfo should simply call _scan_addition
to get the added/copied/moved status?

-- 
Philip
Received on 2010-03-02 11:40:01 CET

This is an archived mail posted to the Subversion Dev mailing list.