[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] svn rm removes a file when not modified

From: Yoshiki Hayashi <yoshiki_at_xemacs.org>
Date: 2002-02-14 15:20:50 CET

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
Received on Sat Oct 21 14:37:07 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.