You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/10/29 23:14:46 UTC
svn commit: r1536914 -
/subversion/trunk/subversion/libsvn_client/commit_util.c
Author: rhuijben
Date: Tue Oct 29 22:14:45 2013
New Revision: 1536914
URL: http://svn.apache.org/r1536914
Log:
In the commit harvester: make handle_descendants() use the standard
committables structure to detect and register committables.
* subversion/libsvn_client/commit_util.c
(handle_descendants_baton): Add variable.
(handle_descendants): Detect existing items via the hash table.
Create items via add_committable().
(svn_client__harvest_committables,
harvest_copy_committables): Update caller.
Modified:
subversion/trunk/subversion/libsvn_client/commit_util.c
Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1536914&r1=1536913&r2=1536914&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Tue Oct 29 22:14:45 2013
@@ -966,17 +966,19 @@ struct handle_descendants_baton
void *cancel_baton;
svn_client__check_url_kind_t check_url_func;
void *check_url_baton;
+ svn_client__committables_t *committables;
};
/* Helper for the commit harvesters */
static svn_error_t *
handle_descendants(void *baton,
- const void *key, apr_ssize_t klen, void *val,
- apr_pool_t *pool)
+ const void *key, apr_ssize_t klen, void *val,
+ apr_pool_t *pool)
{
struct handle_descendants_baton *hdb = baton;
apr_array_header_t *commit_items = val;
apr_pool_t *iterpool = svn_pool_create(pool);
+ const char *repos_root_url = key;
int i;
for (i = 0; i < commit_items->nelts; i++)
@@ -1002,8 +1004,6 @@ handle_descendants(void *baton,
for (j = 0; j < absent_descendants->nelts; j++)
{
- int k;
- svn_boolean_t found_item = FALSE;
svn_node_kind_t kind;
const char *relpath = APR_ARRAY_IDX(absent_descendants, j,
const char *);
@@ -1012,19 +1012,7 @@ handle_descendants(void *baton,
/* If the path has a commit operation, we do nothing.
(It will be deleted by the operation) */
- for (k = 0; k < commit_items->nelts; k++)
- {
- svn_client_commit_item3_t *cmt_item =
- APR_ARRAY_IDX(commit_items, k, svn_client_commit_item3_t *);
-
- if (! strcmp(cmt_item->path, local_abspath))
- {
- found_item = TRUE;
- break;
- }
- }
-
- if (found_item)
+ if (svn_hash_gets(hdb->committables->by_path, local_abspath))
continue; /* We have an explicit delete or replace for this path */
/* ### Need a sub-iterpool? */
@@ -1045,25 +1033,28 @@ handle_descendants(void *baton,
else
kind = svn_node_unknown; /* 'Ok' for a delete of something */
- {
- /* Add a new commit item that describes the delete */
- apr_pool_t *result_pool = commit_items->pool;
- svn_client_commit_item3_t *new_item
- = svn_client_commit_item3_create(result_pool);
-
- new_item->path = svn_dirent_join(item->path, relpath,
- result_pool);
- new_item->kind = kind;
- new_item->url = svn_path_url_add_component2(item->url, relpath,
- result_pool);
- new_item->revision = SVN_INVALID_REVNUM;
- new_item->state_flags = SVN_CLIENT_COMMIT_ITEM_DELETE;
- new_item->incoming_prop_changes = apr_array_make(result_pool, 1,
- sizeof(svn_prop_t *));
-
- APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *)
- = new_item;
- }
+ /* Add a new commit item that describes the delete */
+
+ SVN_ERR(add_committable(hdb->committables,
+ svn_dirent_join(item->path, relpath,
+ iterpool),
+ kind,
+ repos_root_url,
+ svn_uri_skip_ancestor(
+ repos_root_url,
+ svn_path_url_add_component2(item->url,
+ relpath,
+ iterpool),
+ iterpool),
+ SVN_INVALID_REVNUM,
+ NULL /* copyfrom_relpath */,
+ SVN_INVALID_REVNUM,
+ NULL /* moved_from_abspath */,
+ SVN_CLIENT_COMMIT_ITEM_DELETE,
+ NULL /* lock tokens */,
+ NULL /* lock */,
+ commit_items->pool,
+ iterpool));
}
}
@@ -1181,6 +1172,7 @@ svn_client__harvest_committables(svn_cli
hdb.cancel_baton = ctx->cancel_baton;
hdb.check_url_func = check_url_func;
hdb.check_url_baton = check_url_baton;
+ hdb.committables = *committables;
SVN_ERR(svn_iter_apr_hash(NULL, (*committables)->by_repository,
handle_descendants, &hdb, iterpool));
@@ -1274,6 +1266,7 @@ harvest_copy_committables(void *baton, v
hdb.cancel_baton = btn->ctx->cancel_baton;
hdb.check_url_func = btn->check_url_func;
hdb.check_url_baton = btn->check_url_baton;
+ hdb.committables = btn->committables;
SVN_ERR(svn_iter_apr_hash(NULL, btn->committables->by_repository,
handle_descendants, &hdb, pool));