Hi Paul. Would you be willing to factor out those 40 lines of update-the-list code? Then that part of the notification_receiver function can be as nice and readable as
...
if (notify->action == svn_wc_notify_update_add)
{
update_the_list_of_added_subtrees(...);
}
...
and not distract the eye from its overall flow.
- Julian
> Modified: subversion/trunk/subversion/libsvn_client/merge.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1330444&r1=1330443&r2=1330444&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/merge.c (original)
> +++ subversion/trunk/subversion/libsvn_client/merge.c Wed Apr 25 17:57:30 2012
> @@ -2941,30 +2941,47 @@ notification_receiver(void *baton, const
>
> if (notify->action == svn_wc_notify_update_add)
> {
> - svn_boolean_t is_root_of_added_subtree = FALSE;
> - const char *added_path = apr_pstrdup(notify_b->pool,
> - notify_abspath);
> - const char *added_path_parent = NULL;
> + svn_boolean_t root_of_added_subtree = TRUE;
>
> /* Stash the root path of any added subtrees. */
> if (notify_b->added_abspaths == NULL)
> {
> + /* The first added path is always a root. */
> notify_b->added_abspaths = apr_hash_make(notify_b->pool);
> - is_root_of_added_subtree = TRUE;
> }
> else
> {
> - added_path_parent = svn_dirent_dirname(added_path, pool);
> - /* ### Bug. Testing whether its immediate parent is in the
> - * hash isn't enough: this is letting every other level of
> - * the added subtree hierarchy into the hash. */
> - if (!apr_hash_get(notify_b->added_abspaths, added_path_parent,
> - APR_HASH_KEY_STRING))
> - is_root_of_added_subtree = TRUE;
> - }
> - if (is_root_of_added_subtree)
> - apr_hash_set(notify_b->added_abspaths, added_path,
> - APR_HASH_KEY_STRING, added_path);
> + const char *added_path_parent =
> + svn_dirent_dirname(notify_abspath, pool);
> + apr_pool_t *iterpool = svn_pool_create(pool);
> +
> + /* Is NOTIFY->PATH the root of an added subtree? */
> + while (strcmp(notify_b->merge_b->target->abspath,
> + added_path_parent))
> + {
> + if (apr_hash_get(notify_b->added_abspaths,
> + added_path_parent,
> + APR_HASH_KEY_STRING))
> + {
> + root_of_added_subtree = FALSE;
> + break;
> + }
> +
> + svn_pool_clear(iterpool);
> + added_path_parent = svn_dirent_dirname(
> + added_path_parent, iterpool);
> + }
> +
> + svn_pool_destroy(iterpool);
> + }
> +
> + if (root_of_added_subtree)
> + {
> + const char *added_root_path = apr_pstrdup(notify_b->pool,
> + notify_abspath);
> + apr_hash_set(notify_b->added_abspaths, added_root_path,
> + APR_HASH_KEY_STRING, added_root_path);
> + }
> }
>
> if (notify->action == svn_wc_notify_update_delete
>
Received on 2012-04-26 17:11:05 CEST