subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject svn commit: r927523 - in /subversion/trunk/subversion/libsvn_wc: workqueue.c workqueue.h
Date Thu, 25 Mar 2010 17:44:54 GMT
Author: gstein
Date: Thu Mar 25 17:44:53 2010
New Revision: 927523

URL: http://svn.apache.org/viewvc?rev=927523&view=rev
Log:
Implement a new work item to remove files.

* subversion/libsvn_wc/workqueue.h:
  (svn_wc__wq_build_file_remove): new declaration

* subversion/libsvn_wc/workqueue.c:
  (OP_FILE_REMOVE): new operation code
  (run_file_remove): new operation handler to remove a file
  (svn_wc__wq_build_file_remove): new function to build an OP_FILE_REMOVE
    work item skel.
  (dispatch_table): add the new OP/handler

Modified:
    subversion/trunk/subversion/libsvn_wc/workqueue.c
    subversion/trunk/subversion/libsvn_wc/workqueue.h

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=927523&r1=927522&r2=927523&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Thu Mar 25 17:44:53 2010
@@ -60,6 +60,7 @@
 #define OP_INSTALL_PROPERTIES "install-properties"
 #define OP_DELETE "delete"
 #define OP_FILE_INSTALL "file-install"
+#define OP_FILE_REMOVE "file-remove"
 
 
 struct work_item_dispatch {
@@ -2076,6 +2077,51 @@ svn_wc__wq_build_file_install(const svn_
 
 /* ------------------------------------------------------------------------ */
 
+/* OP_FILE_REMOVE  */
+
+/* Process the OP_FILE_REMOVE work item WORK_ITEM.
+ * See svn_wc__wq_build_file_remove() which generates this work item.
+ * Implements (struct work_item_dispatch).func. */
+static svn_error_t *
+run_file_remove(svn_wc__db_t *db,
+                 const svn_skel_t *work_item,
+                 svn_cancel_func_t cancel_func,
+                 void *cancel_baton,
+                 apr_pool_t *scratch_pool)
+{
+  const svn_skel_t *arg1 = work_item->children->next;
+  const char *local_abspath;
+
+  local_abspath = apr_pstrmemdup(scratch_pool, arg1->data, arg1->len);
+
+  /* Remove the path, no worrying if it isn't there.  */
+  return svn_error_return(svn_io_remove_file2(local_abspath, TRUE,
+                                              scratch_pool));
+}
+
+
+svn_error_t *
+svn_wc__wq_build_file_remove(const svn_skel_t **work_item,
+                             svn_wc__db_t *db,
+                             const char *local_abspath,
+                             apr_pool_t *result_pool,
+                             apr_pool_t *scratch_pool)
+{
+  svn_skel_t *build_item = svn_skel__make_empty_list(result_pool);
+
+  svn_skel__prepend_str(apr_pstrdup(result_pool, local_abspath),
+                        build_item, result_pool);
+  svn_skel__prepend_str(OP_FILE_REMOVE, build_item, result_pool);
+
+  /* Done. Assign to the const-ful WORK_ITEM.  */
+  *work_item = build_item;
+
+  return SVN_NO_ERROR;
+}
+
+
+/* ------------------------------------------------------------------------ */
+
 static const struct work_item_dispatch dispatch_table[] = {
   { OP_REVERT, run_revert },
   { OP_PREPARE_REVERT_FILES, run_prepare_revert_files },
@@ -2087,6 +2133,7 @@ static const struct work_item_dispatch d
   { OP_INSTALL_PROPERTIES, run_install_properties },
   { OP_DELETE, run_delete },
   { OP_FILE_INSTALL, run_file_install },
+  { OP_FILE_REMOVE, run_file_remove },
 
   /* Sentinel.  */
   { NULL }

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.h?rev=927523&r1=927522&r2=927523&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.h Thu Mar 25 17:44:53 2010
@@ -77,6 +77,16 @@ svn_wc__wq_build_file_install(const svn_
                               apr_pool_t *scratch_pool);
 
 
+/* Build a work item (returned in *WORK_ITEM) that will remove a single
+   file.  */
+svn_error_t *
+svn_wc__wq_build_file_remove(const svn_skel_t **work_item,
+                             svn_wc__db_t *db,
+                             const char *local_abspath,
+                             apr_pool_t *result_pool,
+                             apr_pool_t *scratch_pool);
+
+
 /* Record a work item to revert LOCAL_ABSPATH.  */
 svn_error_t *
 svn_wc__wq_add_revert(svn_boolean_t *will_revert,



Mime
View raw message