You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Yoshiki Hayashi <yo...@xemacs.org> on 2002/02/14 14:20:50 UTC
[PATCH] svn rm removes a file when not modified
Fixes issue #611.
* delete.c (svn_client_delete): Only try to remove file. Otherwise you'll get
bogus error trying to remove directory. When the file is not modified,
remove it from working directory.
Index: ./subversion/libsvn_client/delete.c
===================================================================
--- ./subversion/libsvn_client/delete.c
+++ ./subversion/libsvn_client/delete.c Wed Feb 13 22:29:52 2002
@@ -29,6 +29,7 @@
#include "svn_string.h"
#include "svn_error.h"
#include "svn_path.h"
+#include "svn_io.h"
#include "client.h"
@@ -47,6 +48,7 @@
{
apr_status_t apr_err;
svn_string_t str;
+ enum svn_node_kind kind;
str.data = path->data;
str.len = path->len;
@@ -104,14 +106,23 @@
/* Mark the entry for deletion. */
SVN_ERR (svn_wc_delete (path, notify_func, notify_baton, pool));
- if (force)
+
+ SVN_ERR (svn_io_check_path (path, &kind, pool));
+ if (kind == svn_node_file)
{
- /* Remove the file. */
- apr_err = apr_file_remove (path->data, pool);
- if (apr_err)
- return svn_error_createf (apr_err, 0, NULL, pool,
- "svn_client_delete: error deleting %s",
- path->data);
+ svn_boolean_t modified;
+
+ SVN_ERR (svn_wc_text_modified_p (&modified, path, pool));
+
+ if (force || !modified)
+ {
+ apr_err = apr_file_remove (path->data, pool);
+
+ if (apr_err)
+ return svn_error_createf (apr_err, 0, NULL, pool,
+ "svn_client_delete: error deleting %s",
+ path->data);
+ }
}
return SVN_NO_ERROR;
--
Yoshiki Hayashi
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] svn rm removes a file when not modified
Posted by cm...@collab.net.
Yoshiki Hayashi <yo...@xemacs.org> writes:
> Fixes issue #611.
This patch may fix Issue #611, but on my box, it causes make check to
break in about 10 different ways. Please verify that the test pass on
your machine, and get back to us with that report. Thanks!
> * delete.c (svn_client_delete): Only try to remove file. Otherwise
> you'll get bogus error trying to remove directory. When the file is
> not modified, remove it from working directory.
[rest of original mail omitted]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org