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 2012/05/19 02:39:32 UTC
svn commit: r1340321 - in /subversion/trunk/subversion/libsvn_client:
client.h delete.c
Author: rhuijben
Date: Sat May 19 00:39:31 2012
New Revision: 1340321
URL: http://svn.apache.org/viewvc?rev=1340321&view=rev
Log:
Use the working copy instead of the client status walker when determining
if a node can be deleted without force. This avoids unneeded wrapping.
* subversion/libsvn_client/client.h
(svn_client__can_delete): Remove function from header.
* subversion/libsvn_client/delete.c
(find_undeletables): Implement svn_wc_status_func4_t.
(svn_client__can_delete): Rename to ...
(can_delete_node): ... this. Make static. Assume that it always receives an
abspath and call svn_wc_walk_status instead of the libsvn_client equivalent
that copies all data a few times.
(svn_client__wc_delete, svn_client__wc_delete_many): Update callers.
Modified:
subversion/trunk/subversion/libsvn_client/client.h
subversion/trunk/subversion/libsvn_client/delete.c
Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1340321&r1=1340320&r2=1340321&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Sat May 19 00:39:31 2012
@@ -384,21 +384,6 @@ svn_client__ra_make_cb_baton(svn_wc_cont
apr_hash_t *relpath_map,
apr_pool_t *result_pool);
-
-/* ---------------------------------------------------------------- */
-
-/*** Status ***/
-
-/* Verify that the path can be deleted without losing stuff,
- i.e. ensure that there are no modified or unversioned resources
- under PATH. This is similar to checking the output of the status
- command. CTX is used for the client's config options. POOL is
- used for all temporary allocations. */
-svn_error_t * svn_client__can_delete(const char *path,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool);
-
-
/* ---------------------------------------------------------------- */
/*** Add/delete ***/
Modified: subversion/trunk/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/delete.c?rev=1340321&r1=1340320&r2=1340321&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/delete.c (original)
+++ subversion/trunk/subversion/libsvn_client/delete.c Sat May 19 00:39:31 2012
@@ -47,12 +47,12 @@
/*** Code. ***/
-/* An svn_client_status_func_t callback function for finding
+/* An svn_wc_status_func4_t callback function for finding
status structures which are not safely deletable. */
static svn_error_t *
find_undeletables(void *baton,
const char *path,
- const svn_client_status_t *status,
+ const svn_wc_status3_t *status,
apr_pool_t *pool)
{
/* Check for error-ful states. */
@@ -80,20 +80,19 @@ find_undeletables(void *baton,
return SVN_NO_ERROR;
}
-
-svn_error_t *
-svn_client__can_delete(const char *path,
- svn_client_ctx_t *ctx,
- apr_pool_t *scratch_pool)
+/* Verify that the path can be deleted without losing stuff,
+ i.e. ensure that there are no modified or unversioned resources
+ under PATH. This is similar to checking the output of the status
+ command. CTX is used for the client's config options. POOL is
+ used for all temporary allocations. */
+static svn_error_t *
+can_delete_node(const char *local_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool)
{
- svn_opt_revision_t revision;
svn_node_kind_t external_kind;
const char *defining_abspath;
- const char* local_abspath;
-
- revision.kind = svn_opt_revision_unspecified;
-
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
+ apr_array_header_t *ignores;
/* A file external should not be deleted since the file external is
implemented as a switched file and it would delete the file the
@@ -121,11 +120,19 @@ svn_client__can_delete(const char *path,
status callback function find_undeletables() makes the
determination, returning an error if it finds anything that shouldn't
be deleted. */
- return svn_error_trace(svn_client_status5(NULL, ctx, path, &revision,
- svn_depth_infinity, FALSE,
- FALSE, FALSE, FALSE, FALSE,
- NULL,
+
+ SVN_ERR(svn_wc_get_default_ignores(&ignores, ctx->config, scratch_pool));
+
+ return svn_error_trace(svn_wc_walk_status(ctx->wc_ctx,
+ local_abspath,
+ svn_depth_infinity,
+ FALSE /* get_all */,
+ FALSE /* no_ignore */,
+ FALSE /* ignore_text_mod */,
+ ignores,
find_undeletables, NULL,
+ ctx->cancel_func,
+ ctx->cancel_baton,
scratch_pool));
}
@@ -327,7 +334,7 @@ svn_client__wc_delete(const char *path,
if (!force && !keep_local)
/* Verify that there are no "awkward" files */
- SVN_ERR(svn_client__can_delete(local_abspath, ctx, pool));
+ SVN_ERR(can_delete_node(local_abspath, ctx, pool));
if (!dry_run)
/* Mark the entry for commit deletion and perform wc deletion */
@@ -363,7 +370,7 @@ svn_client__wc_delete_many(const apr_arr
if (!force && !keep_local)
/* Verify that there are no "awkward" files */
- SVN_ERR(svn_client__can_delete(local_abspath, ctx, pool));
+ SVN_ERR(can_delete_node(local_abspath, ctx, pool));
}
if (!dry_run)