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 2010/08/09 16:57:17 UTC

svn commit: r983668 - in /subversion/trunk/subversion/libsvn_wc: log.c log.h workqueue.c workqueue.h

Author: rhuijben
Date: Mon Aug  9 14:57:17 2010
New Revision: 983668

URL: http://svn.apache.org/viewvc?rev=983668&view=rev
Log:

* subversion/libsvn_wc/log.c
  (includes): Remove log.h
  (SVN_WC__LOG_DELETE_ENTRY,
   SVN_WC__LOG_ATTR_REVISION,
   SVN_WC__LOG_ATTR_KIND,
   SVN_WC__LOG_ATTR_NAME,
   SVN_WC__LOG_ATTR_DATA): Remove unused defines.
  (log_runner): Remove struct.
  (LOG_START,
   LOG_END,
   SIGNAL_ERROR): Remove defines.
  (basic_delete_entry): Move this function to workqueue.c
  (log_do_delete_entry,
   start_handler,
   svn_wc__run_xml_log,
   loggy_path,
   svn_wc__loggy_delete_entry): Remove functions.

* subversion/libsvn_wc/log.h
  Delete file

* subversion/libsvn_wc/workqueue.c
  (includes): Remove log.h
  (OP_LOGGY): Remove define.
  (run_loggy): Remove function.
  (svn_wc__wq_build_loggy): Remove function.
  (dispatch_table): Remove OP_LOGGY.

* subversion/libsvn_wc/workqueue.h
  (svn_wc__wq_build_loggy): Remove function.

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

Modified: subversion/trunk/subversion/libsvn_wc/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.c?rev=983668&r1=983667&r2=983668&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.c (original)
+++ subversion/trunk/subversion/libsvn_wc/log.c Mon Aug  9 14:57:17 2010
@@ -40,7 +40,6 @@
 #include "svn_iter.h"
 
 #include "wc.h"
-#include "log.h"
 #include "props.h"
 #include "adm_files.h"
 #include "lock.h"
@@ -53,342 +52,6 @@
 #include "svn_private_config.h"
 
 
-/*** Constant definitions for xml generation/parsing ***/
-
-/* Note: every entry in the logfile is either idempotent or atomic.
- * This allows us to remove the entire logfile when every entry in it
- * has been completed -- if you crash in the middle of running a
- * logfile, and then later are running over it again as part of the
- * recovery, a given entry is "safe" in the sense that you can either
- * tell it has already been done (in which case, ignore it) or you can
- * do it again without ill effect.
- *
- * All log commands are self-closing tags with attributes.
- */
-
-
-/** Log actions. **/
-
-/* Delete the entry SVN_WC__LOG_ATTR_NAME. */
-#define SVN_WC__LOG_DELETE_ENTRY        "delete-entry"
-#define SVN_WC__LOG_ATTR_REVISION       "revision"
-#define SVN_WC__LOG_ATTR_KIND           "kind"
-
-
-/** Log attributes.  See the documentation above for log actions for
-    how these are used. **/
-
-#define SVN_WC__LOG_ATTR_NAME           "name"
-#define SVN_WC__LOG_ATTR_DATA           "data"
-
-
-/*** Userdata for the callbacks. ***/
-struct log_runner
-{
-  svn_wc__db_t *db;
-  const char *adm_abspath;
-
-  apr_pool_t *pool; /* cleared before processing each log element */
-
-  svn_xml_parser_t *parser;
-};
-
-
-/* The log body needs to be wrapped in a single, root element to satisfy
-   the Expat parser. These two macros provide the start/end wrapprs.  */
-#define LOG_START "<wc-log xmlns=\"http://subversion.tigris.org/xmlns\">\n"
-#define LOG_END "</wc-log>\n"
-
-/* For log debugging. Generates output about its operation.  */
-/* #define DEBUG_LOG */
-
-
-/* Helper macro for erroring out while running a logfile.
-
-   This is implemented as a macro so that the error created has a useful
-   line number associated with it. */
-#define SIGNAL_ERROR(loggy, err)                                        \
-  svn_xml_signal_bailout(svn_error_createf(                             \
-                           SVN_ERR_WC_BAD_ADM_LOG, err,                 \
-                           _("In directory '%s'"),                      \
-                           svn_dirent_local_style(loggy->adm_abspath,   \
-                                                  loggy->pool)),        \
-                         loggy->parser)
-
-
-
-/* Ben sez:  this log command is (at the moment) only executed by the
-   update editor.  It attempts to forcefully remove working data. */
-/* Delete a node from version control, and from disk if unmodified.
- * LOCAL_ABSPATH is the name of the file or directory to be deleted.
- * If it is unversioned,
- * do nothing and return no error. Otherwise, delete its WC entry and, if
- * the working version is unmodified, delete it from disk. */
-static svn_error_t *
-basic_delete_entry(svn_wc__db_t *db,
-                   const char *local_abspath,
-                   apr_pool_t *scratch_pool)
-{
-  svn_wc__db_kind_t kind;
-  svn_boolean_t hidden;
-  svn_error_t *err;
-
-  /* Figure out if 'name' is a dir or a file */
-  SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, TRUE, scratch_pool));
-  if (kind == svn_wc__db_kind_unknown)
-    return SVN_NO_ERROR; /* Already gone */
-
-  SVN_ERR(svn_wc__db_node_hidden(&hidden, db, local_abspath, scratch_pool));
-  if (hidden)
-    return SVN_NO_ERROR;
-
-  /* Remove the object from revision control -- whether it's a
-     single file or recursive directory removal.  Attempt
-     to destroy all working files & dirs too.
-
-     ### We pass NULL, NULL for cancel_func and cancel_baton below.
-     ### If they were available, it would be nice to use them. */
-  if (kind == svn_wc__db_kind_dir)
-    {
-      svn_wc__db_status_t status;
-
-      SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL,
-                                      NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                      NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                      NULL, NULL, NULL, NULL,
-                                   db, local_abspath,
-                                   scratch_pool, scratch_pool));
-      if (status == svn_wc__db_status_obstructed ||
-          status == svn_wc__db_status_obstructed_add ||
-          status == svn_wc__db_status_obstructed_delete)
-        {
-          /* Removing a missing wcroot is easy, just remove its parent entry
-             ### BH: I can't tell why we don't use this for adds.
-                     We might want to remove WC obstructions?
-
-             We don't have a missing status in the final version of WC-NG,
-             so why bother researching its history.
-          */
-          if (status != svn_wc__db_status_obstructed_add)
-            {
-              SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath,
-                                                      scratch_pool));
-
-              return SVN_NO_ERROR;
-            }
-        }
-    }
-
-  err = svn_wc__internal_remove_from_revision_control(db,
-                                                      local_abspath,
-                                                      TRUE, /* destroy */
-                                                      FALSE, /* instant_error*/
-                                                      NULL, NULL,
-                                                      scratch_pool);
-
-  if (err && err->apr_err == SVN_ERR_WC_LEFT_LOCAL_MOD)
-    {
-      svn_error_clear(err);
-      return SVN_NO_ERROR;
-    }
-  else
-    {
-      return svn_error_return(err);
-    }
-}
-
-
-static svn_error_t *
-log_do_delete_entry(struct log_runner *loggy,
-                    const char *name,
-                    svn_revnum_t revision,
-                    svn_node_kind_t kind)
-{
-  const char *local_abspath;
-  const char *repos_relpath, *repos_root, *repos_uuid;
-
-  local_abspath = svn_dirent_join(loggy->adm_abspath, name, loggy->pool);
-
-  if (SVN_IS_VALID_REVNUM(revision))
-    SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, &repos_root,
-                                       &repos_uuid, loggy->db, local_abspath,
-                                       loggy->pool, loggy->pool));
-
-  SVN_ERR(basic_delete_entry(loggy->db, local_abspath, loggy->pool));
-
-  if (SVN_IS_VALID_REVNUM(revision))
-    {
-      SVN_ERR(svn_wc__db_base_add_absent_node(loggy->db,
-                                              local_abspath,
-                                              repos_relpath,
-                                              repos_root,
-                                              repos_uuid,
-                                              revision,
-                                              kind == svn_node_dir 
-                                                   ? svn_wc__db_kind_dir
-                                                   : svn_wc__db_kind_file,
-                                              svn_wc__db_status_not_present,
-                                              NULL,
-                                              NULL,
-                                              loggy->pool));
-    }
-
-  return SVN_NO_ERROR;
-}
-
-/* */
-static void
-start_handler(void *userData, const char *eltname, const char **atts)
-{
-  svn_error_t *err = SVN_NO_ERROR;
-  struct log_runner *loggy = userData;
-
-  /* Most elements use the `name' attribute, so grab it now. */
-  const char *name = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_NAME, atts);
-
-  /* Clear the per-log-item pool. */
-  svn_pool_clear(loggy->pool);
-
-  if (strcmp(eltname, "wc-log") == 0)   /* ignore expat pacifier */
-    return;
-
-  /* The NAME attribute should be present.  */
-  SVN_ERR_ASSERT_NO_RETURN(name != NULL);
-
-#ifdef DEBUG_LOG
-  SVN_DBG(("start_handler: name='%s'\n", eltname));
-#endif
-
-  /* Dispatch. */
-  if (strcmp(eltname, SVN_WC__LOG_DELETE_ENTRY) == 0) {
-    const char *attr;
-    svn_revnum_t revision;
-    svn_node_kind_t kind;
-
-    attr = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_REVISION, atts);
-    revision = SVN_STR_TO_REV(attr);
-    attr = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_KIND, atts);
-    if (strcmp(attr, "dir") == 0)
-      kind = svn_node_dir;
-    else
-      kind = svn_node_file;
-    err = log_do_delete_entry(loggy, name, revision, kind);
-  }
-  else
-    {
-      SIGNAL_ERROR
-        (loggy, svn_error_createf
-         (SVN_ERR_WC_BAD_ADM_LOG, NULL,
-          _("Unrecognized logfile element '%s' in '%s'"),
-          eltname,
-          svn_dirent_local_style(loggy->adm_abspath, loggy->pool)));
-      return;
-    }
-
-  if (err)
-    SIGNAL_ERROR
-      (loggy, svn_error_createf
-       (SVN_ERR_WC_BAD_ADM_LOG, err,
-        _("Error processing command '%s' in '%s'"),
-        eltname,
-        svn_dirent_local_style(loggy->adm_abspath, loggy->pool)));
-
-  return;
-}
-
-
-
-/*** Using the parser to run the log file. ***/
-
-
-/* Run a sequence of log files. */
-svn_error_t *
-svn_wc__run_xml_log(svn_wc__db_t *db,
-                    const char *adm_abspath,
-                    const char *log_contents,
-                    apr_size_t log_len,
-                    apr_pool_t *scratch_pool)
-{
-  svn_xml_parser_t *parser;
-  struct log_runner *loggy;
-
-  loggy = apr_pcalloc(scratch_pool, sizeof(*loggy));
-
-  parser = svn_xml_make_parser(loggy, start_handler, NULL, NULL,
-                               scratch_pool);
-
-  loggy->db = db;
-  loggy->adm_abspath = adm_abspath;
-  loggy->pool = svn_pool_create(scratch_pool);
-  loggy->parser = parser;
-
-  /* Expat wants everything wrapped in a top-level form, so start with
-     a ghost open tag. */
-  SVN_ERR(svn_xml_parse(parser, LOG_START, strlen(LOG_START), 0));
-
-  SVN_ERR(svn_xml_parse(parser, log_contents, log_len, 0));
-
-  /* Pacify Expat with a pointless closing element tag. */
-  SVN_ERR(svn_xml_parse(parser, LOG_END, strlen(LOG_END), 1));
-
-  svn_xml_free_parser(parser);
-
-  return SVN_NO_ERROR;
-}
-
-
-/* Return (in *RELPATH) the portion of ABSPATH that is relative to the
-   working copy directory ADM_ABSPATH, or SVN_WC_ENTRY_THIS_DIR if ABSPATH
-   is that directory. ABSPATH must within ADM_ABSPATH.  */
-static svn_error_t *
-loggy_path(const char **relpath,
-           const char *abspath,
-           const char *adm_abspath,
-           apr_pool_t *scratch_pool)
-{
-  *relpath = svn_dirent_is_child(adm_abspath, abspath, NULL);
-
-  if (*relpath == NULL)
-    {
-      SVN_ERR_ASSERT(strcmp(abspath, adm_abspath) == 0);
-
-      *relpath = "";
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_wc__loggy_delete_entry(svn_skel_t **work_item,
-                           svn_wc__db_t *db,
-                           const char *adm_abspath,
-                           const char *local_abspath,
-                           svn_revnum_t revision,
-                           svn_wc__db_kind_t kind,
-                           apr_pool_t *result_pool)
-{
-  const char *loggy_path1;
-  svn_stringbuf_t *log_accum = NULL;
-
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-
-  SVN_ERR(loggy_path(&loggy_path1, local_abspath, adm_abspath, result_pool));
-  svn_xml_make_open_tag(&log_accum, result_pool, svn_xml_self_closing,
-                        SVN_WC__LOG_DELETE_ENTRY,
-                        SVN_WC__LOG_ATTR_NAME,
-                        loggy_path1,
-                        SVN_WC__LOG_ATTR_REVISION,
-                        apr_psprintf(result_pool, "%ld", revision),
-                        SVN_WC__LOG_ATTR_KIND,
-                        kind == svn_wc__db_kind_dir ? "dir" : "file",
-                        NULL);
-
-  return svn_error_return(svn_wc__wq_build_loggy(work_item,
-                                                 db, adm_abspath, log_accum,
-                                                 result_pool));
-}
-
 /*** Recursively do log things. ***/
 
 /* */

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=983668&r1=983667&r2=983668&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Mon Aug  9 14:57:17 2010
@@ -35,7 +35,6 @@
 #include "workqueue.h"
 #include "adm_files.h"
 #include "translate.h"
-#include "log.h"
 
 #include "svn_private_config.h"
 #include "private/svn_skel.h"
@@ -44,7 +43,6 @@
 /* Workqueue operation names.  */
 #define OP_REVERT "revert"
 #define OP_KILLME "killme"
-#define OP_LOGGY "loggy"
 #define OP_BASE_REMOVE "base-remove"
 #define OP_DELETION_POSTCOMMIT "deletion-postcommit"
 /* Arguments of OP_POSTCOMMIT:
@@ -813,57 +811,6 @@ svn_wc__wq_build_base_remove(svn_skel_t 
   return SVN_NO_ERROR;
 }
 
-/* OP_LOGGY  */
-
-/* Process the OP_LOGGY work item WORK_ITEM.
- * See svn_wc__wq_add_loggy() which generates this work item.
- * Implements (struct work_item_dispatch).func. */
-static svn_error_t *
-run_loggy(svn_wc__db_t *db,
-          const svn_skel_t *work_item,
-          const char *wri_abspath,
-          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 *adm_abspath;
-
-  /* We need a NUL-terminated path, so copy it out of the skel.  */
-  adm_abspath = apr_pstrmemdup(scratch_pool, arg1->data, arg1->len);
-
-  return svn_error_return(svn_wc__run_xml_log(
-                            db, adm_abspath,
-                            arg1->next->data, arg1->next->len,
-                            scratch_pool));
-}
-
-
-svn_error_t *
-svn_wc__wq_build_loggy(svn_skel_t **work_item,
-                       svn_wc__db_t *db,
-                       const char *adm_abspath,
-                       const svn_stringbuf_t *log_content,
-                       apr_pool_t *result_pool)
-{
-  if (log_content == NULL || svn_stringbuf_isempty(log_content))
-    {
-      *work_item = NULL;
-      return SVN_NO_ERROR;
-    }
-
-  *work_item = svn_skel__make_empty_list(result_pool);
-
-  /* NOTE: the skel still points at ADM_ABSPATH and LOG_CONTENT, but we
-     require these parameters to be allocated in RESULT_POOL.  */
-  svn_skel__prepend_str(log_content->data, *work_item, result_pool);
-  svn_skel__prepend_str(adm_abspath, *work_item, result_pool);
-  svn_skel__prepend_str(OP_LOGGY, *work_item, result_pool);
-
-  return SVN_NO_ERROR;
-}
-
-
 /* ------------------------------------------------------------------------ */
 
 /* OP_DELETION_POSTCOMMIT  */
@@ -2475,7 +2422,6 @@ svn_wc__wq_build_pristine_get_translated
 
 static const struct work_item_dispatch dispatch_table[] = {
   { OP_REVERT, run_revert },
-  { OP_LOGGY, run_loggy },
   { OP_DELETION_POSTCOMMIT, run_deletion_postcommit },
   { OP_POSTCOMMIT, run_postcommit },
   { OP_FILE_INSTALL, run_file_install },

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.h?rev=983668&r1=983667&r2=983668&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.h Mon Aug  9 14:57:17 2010
@@ -225,24 +225,6 @@ svn_wc__wq_add_killme(svn_wc__db_t *db,
 #endif
 
 
-/* ### temporary compat for mapping the old loggy into workqueue space.
-
-   Set *WORK_ITEM to a new work item ...
-
-   LOG_CONTENT may be NULL or reference an empty log.  Set *WORK_ITEM to
-   NULL in this case.
-
-   NOTE: ADM_ABSPATH and LOG_CONTENT must live at least as long as
-   RESULT_POOL (typically, they'll be allocated within RESULT_POOL).
-*/
-svn_error_t *
-svn_wc__wq_build_loggy(svn_skel_t **work_item,
-                       svn_wc__db_t *db,
-                       const char *adm_abspath,
-                       const svn_stringbuf_t *log_content,
-                       apr_pool_t *result_pool);
-
-
 /* ### Temporary helper to store text conflict marker locations as a wq
    ### operation. Eventually the data must be stored in the pristine store+db
    ### before the wq runs (within the operation transaction) and then a wq