966
966
void *cancel_baton;
967
967
svn_client__check_url_kind_t check_url_func;
968
968
void *check_url_baton;
969
svn_client__committables_t *committables;
971
972
/* Helper for the commit harvesters */
972
973
static svn_error_t *
973
974
handle_descendants(void *baton,
974
const void *key, apr_ssize_t klen, void *val,
975
const void *key, apr_ssize_t klen, void *val,
977
978
struct handle_descendants_baton *hdb = baton;
978
979
apr_array_header_t *commit_items = val;
979
980
apr_pool_t *iterpool = svn_pool_create(pool);
981
const char *repos_root_url = key;
982
984
for (i = 0; i < commit_items->nelts; i++)
1003
1005
for (j = 0; j < absent_descendants->nelts; j++)
1006
svn_boolean_t found_item = FALSE;
1007
1007
svn_node_kind_t kind;
1008
svn_client_commit_item3_t *desc_item;
1008
1009
const char *relpath = APR_ARRAY_IDX(absent_descendants, j,
1010
1011
const char *local_abspath = svn_dirent_join(item->path, relpath,
1013
/* If the path has a commit operation, we do nothing.
1014
(It will be deleted by the operation) */
1015
for (k = 0; k < commit_items->nelts; k++)
1017
svn_client_commit_item3_t *cmt_item =
1018
APR_ARRAY_IDX(commit_items, k, svn_client_commit_item3_t *);
1020
if (! strcmp(cmt_item->path, local_abspath))
1028
continue; /* We have an explicit delete or replace for this path */
1030
1014
/* ### Need a sub-iterpool? */
1017
/* We found a 'not present' descendant during a copy (at op_depth>0),
1018
this is most commonly caused by copying some mixed revision tree.
1020
In this case not present can imply that the node does not exist
1021
in the parent revision, or that the node does. But we want to copy
1022
the working copy state in which it does not exist, but might be
1025
desc_item = svn_hash_gets(hdb->committables->by_path, local_abspath);
1027
/* If the path has a commit operation (possibly at an higher
1028
op_depth, we might want to turn an add in a replace. */
1032
svn_boolean_t found_intermediate = FALSE;
1034
if (desc_item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
1035
continue; /* We already have a delete or replace */
1036
else if (!(desc_item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD))
1037
continue; /* Not a copy/add, just a modification */
1039
dir = svn_dirent_dirname(local_abspath, iterpool);
1041
while (strcmp(dir, item->path))
1043
svn_client_commit_item3_t *i_item;
1045
i_item = svn_hash_gets(hdb->committables->by_path, dir);
1049
if ((i_item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
1050
|| (i_item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD))
1052
found_intermediate = TRUE;
1056
dir = svn_dirent_dirname(dir, iterpool);
1059
if (found_intermediate)
1060
continue; /* Some intermediate ancestor is an add or delete */
1062
/* Fall through to detect if we need to turn the add in a
1032
1066
if (hdb->check_url_func)
1034
1068
const char *from_url = svn_path_url_add_component2(
1046
1080
kind = svn_node_unknown; /* 'Ok' for a delete of something */
1049
/* Add a new commit item that describes the delete */
1050
apr_pool_t *result_pool = commit_items->pool;
1051
svn_client_commit_item3_t *new_item
1052
= svn_client_commit_item3_create(result_pool);
1054
new_item->path = svn_dirent_join(item->path, relpath,
1056
new_item->kind = kind;
1057
new_item->url = svn_path_url_add_component2(item->url, relpath,
1059
new_item->revision = SVN_INVALID_REVNUM;
1060
new_item->state_flags = SVN_CLIENT_COMMIT_ITEM_DELETE;
1061
new_item->incoming_prop_changes = apr_array_make(result_pool, 1,
1062
sizeof(svn_prop_t *));
1064
APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *)
1084
/* Extend the existing add/copy item to create a replace */
1085
desc_item->state_flags |= SVN_CLIENT_COMMIT_ITEM_DELETE;
1089
/* Add a new commit item that describes the delete */
1091
SVN_ERR(add_committable(hdb->committables,
1092
svn_dirent_join(item->path, relpath,
1096
svn_uri_skip_ancestor(
1098
svn_path_url_add_component2(item->url,
1103
NULL /* copyfrom_relpath */,
1105
NULL /* moved_from_abspath */,
1106
SVN_CLIENT_COMMIT_ITEM_DELETE,
1107
NULL /* lock tokens */,
1181
1225
hdb.cancel_baton = ctx->cancel_baton;
1182
1226
hdb.check_url_func = check_url_func;
1183
1227
hdb.check_url_baton = check_url_baton;
1228
hdb.committables = *committables;
1185
1230
SVN_ERR(svn_iter_apr_hash(NULL, (*committables)->by_repository,
1186
1231
handle_descendants, &hdb, iterpool));
1274
1319
hdb.cancel_baton = btn->ctx->cancel_baton;
1275
1320
hdb.check_url_func = btn->check_url_func;
1276
1321
hdb.check_url_baton = btn->check_url_baton;
1322
hdb.committables = btn->committables;
1278
1324
SVN_ERR(svn_iter_apr_hash(NULL, btn->committables->by_repository,
1279
1325
handle_descendants, &hdb, pool));