static svn_error_t * tree_dump_dir(const char *local_abspath, svn_node_kind_t kind, void *walk_baton, apr_pool_t *scratch_pool) { struct directory_walk_baton *bt = walk_baton; const char *path; if (kind != svn_node_dir) return SVN_NO_ERROR; if (strcmp(local_abspath, bt->root_abspath) != 0) { svn_boolean_t is_wcroot; SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, bt->wc_ctx->db, local_abspath, scratch_pool)); if (is_wcroot) return SVN_NO_ERROR; /* Report the stub, but not the data */ } /* If LOCAL_ABSPATH a child of or equal to ROOT_ABSPATH, then display a relative path starting with PREFIX_PATH. */ path = svn_dirent_skip_ancestor(bt->root_abspath, local_abspath); if (path) path = svn_dirent_join(bt->prefix_path, path, scratch_pool); else path = local_abspath; printf("entries = {}\n"); SVN_ERR(entries_dump(path, bt->adm_access, scratch_pool)); printf("dirs['%s'] = entries\n", path); return SVN_NO_ERROR; }
svn_error_t * svn_wc__delete_many(svn_wc_context_t *wc_ctx, const apr_array_header_t *targets, svn_boolean_t keep_local, svn_boolean_t delete_unversioned_target, svn_cancel_func_t cancel_func, void *cancel_baton, svn_wc_notify_func2_t notify_func, void *notify_baton, apr_pool_t *scratch_pool) { svn_wc__db_t *db = wc_ctx->db; svn_error_t *err; svn_wc__db_status_t status; svn_node_kind_t kind; svn_skel_t *work_items = NULL; apr_array_header_t *versioned_targets; const char *local_abspath; int i; apr_pool_t *iterpool; iterpool = svn_pool_create(scratch_pool); versioned_targets = apr_array_make(scratch_pool, targets->nelts, sizeof(const char *)); for (i = 0; i < targets->nelts; i++) { svn_boolean_t conflicted = FALSE; const char *repos_relpath; svn_pool_clear(iterpool); local_abspath = APR_ARRAY_IDX(targets, i, const char *); err = svn_wc__db_read_info(&status, &kind, NULL, &repos_relpath, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &conflicted, NULL, NULL, NULL, NULL, NULL, NULL, db, local_abspath, iterpool, iterpool); if (err) { if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND) { svn_error_clear(err); if (delete_unversioned_target && !keep_local) SVN_ERR(erase_unversioned_from_wc(local_abspath, FALSE, cancel_func, cancel_baton, iterpool)); continue; } else return svn_error_trace(err); } APR_ARRAY_PUSH(versioned_targets, const char *) = local_abspath; switch (status) { /* svn_wc__db_status_server_excluded handled by * svn_wc__db_op_delete_many */ case svn_wc__db_status_excluded: case svn_wc__db_status_not_present: return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL, _("'%s' cannot be deleted"), svn_dirent_local_style(local_abspath, iterpool)); /* Explicitly ignore other statii */ default: break; } if (status == svn_wc__db_status_normal && kind == svn_node_dir) { svn_boolean_t is_wcroot; SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, local_abspath, iterpool)); if (is_wcroot) return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL, _("'%s' is the root of a working copy and " "cannot be deleted"), svn_dirent_local_style(local_abspath, iterpool)); } if (repos_relpath && !repos_relpath[0]) return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL, _("'%s' represents the repository root " "and cannot be deleted"), svn_dirent_local_style(local_abspath, iterpool)); /* Verify if we have a write lock on the parent of this node as we might be changing the childlist of that directory. */ SVN_ERR(svn_wc__write_check(db, svn_dirent_dirname(local_abspath, iterpool), iterpool)); /* Prepare the on-disk delete */ if (!keep_local) { svn_skel_t *work_item; SVN_ERR(create_delete_wq_items(&work_item, db, local_abspath, kind, conflicted, scratch_pool, iterpool)); work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool); } } if (versioned_targets->nelts == 0) return SVN_NO_ERROR; SVN_ERR(svn_wc__db_op_delete_many(db, versioned_targets, !keep_local /* delete_dir_externals */, work_items, cancel_func, cancel_baton, notify_func, notify_baton, iterpool)); if (work_items != NULL) { /* Our only caller locked the wc, so for now assume it only passed nodes from a single wc (asserted in svn_wc__db_op_delete_many) */ local_abspath = APR_ARRAY_IDX(versioned_targets, 0, const char *); SVN_ERR(svn_wc__wq_run(db, local_abspath, cancel_func, cancel_baton, iterpool)); }