hwri...@apache.org wrote on Wed, Sep 07, 2011 at 19:36:01 -0000: > @@ -276,6 +345,60 @@ ev2_close_edit(void *edit_baton, > apr_pool_t *scratch_pool) > { > struct ev2_edit_baton *eb = edit_baton; > + apr_array_header_t *sorted_hash; > + apr_pool_t *iterpool; > + int i; > + > + /* Sort the paths touched by this edit. > + * Ev2 doesn't really have any particular need for depth-first-ness, but > + * we want to ensure all parent directories are handled before children in > + * the case of adds (which does introduce an element of depth-first-ness). > */ > + sorted_hash = svn_sort__hash(eb->paths, svn_sort_compare_items_as_paths, > + scratch_pool); > + > + iterpool = svn_pool_create(scratch_pool); > + for (i = 0; i < sorted_hash->nelts; i++) > + { > + svn_sort__item_t *item = &APR_ARRAY_IDX(sorted_hash, i, > svn_sort__item_t); > + apr_array_header_t *actions = item->value; > + const char *path = item->key; > + apr_hash_t *props; > + int j; > + > + svn_pool_clear(iterpool); > + > + props = apr_hash_make(iterpool); > + > + /* Go through all of our actions, populating various datastructures > + * dependent on them. */ > + for (j = 0; j < actions->nelts; j++) > + { > + struct path_action *action = APR_ARRAY_IDX(actions, j, > + struct path_action *); > + > + switch (action->action) > + { > + case set_prop: > + { > + struct prop_args *p_args = action->args; > + > + apr_hash_set(props, p_args->name, APR_HASH_KEY_STRING, > + p_args->value); > + break; > + } > + > + default: > + break; > + } > + } > + > + /* We've now got a wholistic view of what has happened to this node, > + * so we can call our own editor APIs on it. */ > + if (apr_hash_count(props) > 0)
What if ACTIONS contains only property deletions? > + SVN_ERR(svn_editor_set_props(eb->editor, path, SVN_INVALID_REVNUM, > + props, TRUE)); > + } > + svn_pool_destroy(iterpool); > > return svn_error_trace(svn_editor_complete(eb->editor)); > }