You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/08/10 19:18:56 UTC

svn commit: r984136 [2/2] - in /subversion/branches/issue-2779-dev: ./ notes/ subversion/bindings/javahl/native/ subversion/bindings/swig/ subversion/bindings/swig/python/ subversion/bindings/swig/python/libsvn_swig_py/ subversion/bindings/swig/python/...

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_wc/upgrade.c?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_wc/upgrade.c Tue Aug 10 17:18:54 2010
@@ -31,8 +31,6 @@
 
 #include "wc.h"
 #include "adm_files.h"
-#include "lock.h"
-#include "log.h"
 #include "entries.h"
 #include "wc_db.h"
 #include "tree_conflicts.h"

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc.h?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc.h Tue Aug 10 17:18:54 2010
@@ -656,6 +656,15 @@ svn_wc__check_wc_root(svn_boolean_t *wc_
                       const char *local_abspath,
                       apr_pool_t *scratch_pool);
 
+/* Ensure LOCAL_ABSPATH is still locked in DB.  Returns the error
+ * SVN_ERR_WC_NOT_LOCKED if this is not the case.
+ */
+svn_error_t *
+svn_wc__write_check(svn_wc__db_t *db,
+                    const char *local_abspath,
+                    apr_pool_t *scratch_pool);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc_db.c?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc_db.c Tue Aug 10 17:18:54 2010
@@ -3773,6 +3773,7 @@ svn_wc__db_op_set_props(svn_wc__db_t *db
                                          scratch_pool));
 }
 
+#ifdef SVN__SUPPORT_BASE_MERGE
 
 /* Set properties in a given table. The row must exist.  */
 static svn_error_t *
@@ -3804,7 +3805,6 @@ set_properties(svn_wc__db_t *db,
   return SVN_NO_ERROR;
 }
 
-#ifdef SVN__SUPPORT_BASE_MERGE
 
 svn_error_t *
 svn_wc__db_temp_base_set_props(svn_wc__db_t *db,
@@ -8912,9 +8912,6 @@ make_copy_txn(void *baton,
   /* Remove the BASE_NODE if the caller asked us to do that */
   if (mcb->remove_base)
     {
-      const char *local_relpath;
-      svn_wc__db_pdh_t *pdh;
-
       SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
                                         STMT_DELETE_BASE_NODE));
       SVN_ERR(svn_sqlite__bindf(stmt, "is",
@@ -8935,6 +8932,9 @@ make_copy_txn(void *baton,
       /* Remove BASE_NODE_STUB */
       if (*mcb->local_relpath == '\0')
         {
+          const char *local_relpath;
+          svn_wc__db_pdh_t *pdh;
+
           SVN_ERR(navigate_to_parent(&pdh, mcb->db, mcb->pdh,
                                      svn_sqlite__mode_readwrite,
                                      FALSE, iterpool));
@@ -9426,9 +9426,11 @@ svn_wc__db_temp_set_parent_stub_to_norma
 {
   svn_wc__db_pdh_t *pdh;
   const char *local_relpath;
-  svn_sqlite__stmt_t *stmt;
   const char *parent_abspath, *base;
+#ifndef SINGLE_DB
+  svn_sqlite__stmt_t *stmt;
   int affected_rows;
+#endif
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)
                  && !svn_dirent_is_root(local_abspath, strlen(local_abspath)));

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc_db.h?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_wc/wc_db.h Tue Aug 10 17:18:54 2010
@@ -347,13 +347,17 @@ svn_wc__db_close(svn_wc__db_t *db);
    A REPOSITORY row will be constructed for the repository identified by
    REPOS_ROOT_URL and REPOS_UUID. Neither of these may be NULL.
 
-   A node will be created for the directory at REPOS_RELPATH will be added.
+   A BASE_NODE row will be created for the directory at REPOS_RELPATH at
+   revision INITIAL_REV.
    If INITIAL_REV is greater than zero, then the node will be marked as
    "incomplete" because we don't know its children. Contrary, if the
    INITIAL_REV is zero, then this directory should represent the root and
    we know it has no children, so the node is complete.
 
-   DEPTH is the initial depth of the working copy, it must be a definite
+   ### Is there any benefit to marking it 'complete' if rev==0?  Seems like
+   ### an unnecessary special case.
+
+   DEPTH is the initial depth of the working copy; it must be a definite
    depth, not svn_depth_unknown.
 
    Use SCRATCH_POOL for temporary allocations.

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_wc/workqueue.c?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_wc/workqueue.c Tue Aug 10 17:18:54 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,13 +43,12 @@
 /* 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:
  *   (local_abspath, revnum, date, [author], [checksum],
  *    [dav_cache/wc_props], keep_changelist, [tmp_text_base_abspath]). */
 #define OP_POSTCOMMIT "postcommit"
-#define OP_INSTALL_PROPERTIES "install-properties-2"
 #define OP_FILE_INSTALL "file-install"
 #define OP_FILE_REMOVE "file-remove"
 #define OP_FILE_MOVE "file-move"
@@ -640,58 +638,229 @@ svn_wc__wq_add_killme(svn_wc__db_t *db,
 #endif
 
 /* ------------------------------------------------------------------------ */
+/* OP_REMOVE_BASE  */
 
-/* OP_LOGGY  */
+/* Removes a BASE_NODE and all it's data, leaving any adds and copies as is.
+   Do this as a depth first traversal to make sure than any parent still exists
+   on error conditions. 
+   
+   ### This function needs review for 4th tree behavior.*/
+static svn_error_t *
+remove_base_node(svn_wc__db_t *db,
+                 const char *local_abspath,
+                 svn_cancel_func_t cancel_func,
+                 void *cancel_baton,
+                 apr_pool_t *scratch_pool)
+{
+  svn_wc__db_status_t base_status, wrk_status;
+  svn_wc__db_kind_t base_kind, wrk_kind;
+  svn_boolean_t have_base, have_work;
+
+  if (cancel_func)
+    SVN_ERR(cancel_func(cancel_baton));
+
+  SVN_ERR(svn_wc__db_read_info(&wrk_status, &wrk_kind, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL, &have_base,
+                               &have_work, NULL, NULL,
+                               db, local_abspath, scratch_pool, scratch_pool));
+
+#ifndef SVN_WC__SINGLE_DB
+  if (!have_base)
+    return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                             _("Node '%s' not found."),
+                             svn_dirent_local_style(local_abspath,
+                                                    scratch_pool));
+#else
+  SVN_ERR_ASSERT(have_base); /* Verified in caller and _base_get_children() */
+#endif
+
+  if (wrk_status == svn_wc__db_status_normal
+      || wrk_status == svn_wc__db_status_not_present
+      || wrk_status == svn_wc__db_status_absent)
+    {
+      base_status = wrk_status;
+      base_kind = wrk_kind;
+    }
+  else
+    SVN_ERR(svn_wc__db_base_get_info(&base_status, &base_kind, NULL, NULL,
+                                     NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                     NULL, NULL, NULL, NULL,
+                                     db, local_abspath,
+                                     scratch_pool, scratch_pool));
+
+  /* Children first */
+  if (base_kind == svn_wc__db_kind_dir
+      && base_status == svn_wc__db_status_normal)
+    {
+      const apr_array_header_t *children;
+      apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+      int i;
+
+      SVN_ERR(svn_wc__db_base_get_children(&children, db, local_abspath,
+                                           scratch_pool, iterpool));
+
+      for (i = 0; i < children->nelts; i++)
+        {
+          const char *child_name = APR_ARRAY_IDX(children, i, const char *);
+          const char *child_abspath;
+
+          svn_pool_clear(iterpool);
+
+          child_abspath = svn_dirent_join(local_abspath, child_name, iterpool);
+
+          SVN_ERR(remove_base_node(db, child_abspath, cancel_func, cancel_baton,
+                                   iterpool));
+        }
+
+      svn_pool_destroy(iterpool);
+    }
+
+  if (base_status == svn_wc__db_status_normal
+      && wrk_status != svn_wc__db_status_added
+      && wrk_status != svn_wc__db_status_obstructed_add
+      && wrk_status != svn_wc__db_status_excluded)
+    {
+#ifndef SVN_WC__SINGLE_DB
+      if (base_kind == svn_wc__db_kind_dir)
+        SVN_ERR(svn_wc__adm_destroy(db, local_abspath, cancel_func, cancel_baton,
+                                    scratch_pool));
+#endif
+
+      if (wrk_status != svn_wc__db_status_deleted
+          && (base_kind == svn_wc__db_kind_file
+              || base_kind == svn_wc__db_kind_symlink))
+        {
+          SVN_ERR(svn_io_remove_file2(local_abspath, TRUE, scratch_pool));
+        }
+      else if (base_kind == svn_wc__db_kind_dir
+#ifdef SVN_WC__SINGLE_DB
+               && wrk_status != svn_wc__db_status_deleted
+#endif
+              )
+        {
+          svn_error_t *err = svn_io_dir_remove_nonrecursive(local_abspath,
+                                                            scratch_pool);
 
-/* Process the OP_LOGGY work item WORK_ITEM.
- * See svn_wc__wq_add_loggy() which generates this work item.
+          if (err && (APR_STATUS_IS_ENOENT(err->apr_err)
+                      || SVN__APR_STATUS_IS_ENOTDIR(err->apr_err)
+                      || APR_STATUS_IS_ENOTEMPTY(err->apr_err)))
+            svn_error_clear(err);
+          else
+            SVN_ERR(err);
+        }
+
+      /* This should remove just BASE and ACTUAL, but for now also remove
+         not existing WORKING_NODE data. */
+      SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath, scratch_pool));
+    }
+  else if (wrk_status == svn_wc__db_status_added
+           || wrk_status == svn_wc__db_status_obstructed_add
+           || (have_work && wrk_status == svn_wc__db_status_excluded))
+    /* ### deletes of working additions should fall in this case, but
+       ### we can't express these without the 4th tree */
+    {
+      /* Just remove the BASE_NODE data */
+      SVN_ERR(svn_wc__db_base_remove(db, local_abspath, scratch_pool));
+    }
+  else
+    SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+/* Process the OP_REMOVE_BASE work item WORK_ITEM.
+ * See svn_wc__wq_build_remove_base() 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)
+run_base_remove(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;
+  const char *local_abspath;
+  svn_boolean_t keep_not_present;
+  svn_revnum_t revision;
+  const char *repos_relpath, *repos_root_url, *repos_uuid;
+  svn_wc__db_kind_t kind;
 
-  /* We need a NUL-terminated path, so copy it out of the skel.  */
-  adm_abspath = apr_pstrmemdup(scratch_pool, arg1->data, arg1->len);
+  local_abspath = apr_pstrmemdup(scratch_pool, arg1->data, arg1->len);
+  keep_not_present = svn_skel__parse_int(arg1->next, scratch_pool) != 0;
 
-  return svn_error_return(svn_wc__run_xml_log(
-                            db, adm_abspath,
-                            arg1->next->data, arg1->next->len,
-                            scratch_pool));
-}
+  if (keep_not_present)
+    {
+      SVN_ERR(svn_wc__db_base_get_info(NULL, &kind, &revision, &repos_relpath,
+                                       &repos_root_url, &repos_uuid, NULL,
+                                       NULL, NULL, NULL, NULL, NULL, NULL,
+                                       NULL, NULL,
+                                       db, local_abspath,
+                                       scratch_pool, scratch_pool));
 
+      if (!repos_relpath)
+        SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, &repos_root_url,
+                                           &repos_uuid,
+                                           db, local_abspath, scratch_pool,
+                                           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))
+#ifndef SVN_WC__SINGLE_DB
+      /* ### When LOCAL_ABSPATH is obstructed, we might not receive a valid
+         ### revision here. For the small time that is left until Single-DB
+         ### just mark the not-present node as revision 0, as we are not
+         ### interested in the revision of not-present nodes anyway.
+
+         ### Triggered by update_tests.py 15: issue #919, updates that delete
+       */
+      if (!SVN_IS_VALID_REVNUM(revision))
+        revision = 0;
+#endif
+    }
+
+  SVN_ERR(remove_base_node(db, local_abspath,
+                           cancel_func, cancel_baton,
+                           scratch_pool));
+
+  if (keep_not_present)
     {
-      *work_item = NULL;
-      return SVN_NO_ERROR;
+      SVN_ERR(svn_wc__db_base_add_absent_node(db, local_abspath,
+                                              repos_relpath,
+                                              repos_root_url,
+                                              repos_uuid,
+                                              revision,
+                                              kind,
+                                              svn_wc__db_status_not_present,
+                                              NULL,
+                                              NULL,
+                                              scratch_pool));
     }
 
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__wq_build_base_remove(svn_skel_t **work_item,
+                             svn_wc__db_t *db,
+                             const char *local_abspath,
+                             svn_boolean_t keep_not_present,
+                             apr_pool_t *result_pool,
+                             apr_pool_t *scratch_pool)
+{
   *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);
+  /* If a SOURCE_ABSPATH was provided, then put it into the skel. If this
+     value is not provided, then the file's pristine contents will be used.  */
+
+  svn_skel__prepend_int(keep_not_present, *work_item, result_pool);
+  svn_skel__prepend_str(apr_pstrdup(result_pool, local_abspath),
+                        *work_item, result_pool);
+  svn_skel__prepend_str(OP_BASE_REMOVE, *work_item, result_pool);
 
   return SVN_NO_ERROR;
 }
 
-
 /* ------------------------------------------------------------------------ */
 
 /* OP_DELETION_POSTCOMMIT  */
@@ -1151,9 +1320,6 @@ log_do_committed(svn_wc__db_t *db,
                 set_read_write = TRUE;
             }
         }
-
-      /* Install LOCAL_ABSPATHs working props as base props. */
-      SVN_ERR(svn_wc__working_props_committed(db, local_abspath, pool));
     }
 
   /* If it's a file, install the tree changes and the file's text. */
@@ -1421,119 +1587,6 @@ svn_wc__wq_add_postcommit(svn_wc__db_t *
 
 /* ------------------------------------------------------------------------ */
 
-/* OP_INSTALL_PROPERTIES */
-
-/* See props.h  */
-#ifdef SVN__SUPPORT_BASE_MERGE
-
-/* Process the OP_INSTALL_PROPERTIES work item WORK_ITEM.
- * See svn_wc__wq_add_install_properties() which generates this work item.
- * Implements (struct work_item_dispatch).func. */
-static svn_error_t *
-run_install_properties(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 *arg = work_item->children->next;
-  const char *local_abspath;
-  apr_hash_t *base_props;
-  apr_hash_t *actual_props;
-
-  /* We need a NUL-terminated path, so copy it out of the skel.  */
-  local_abspath = apr_pstrmemdup(scratch_pool, arg->data, arg->len);
-
-  arg = arg->next;
-  if (arg->is_atom)
-    base_props = NULL;
-  else
-    SVN_ERR(svn_skel__parse_proplist(&base_props, arg, scratch_pool));
-
-  arg = arg->next;
-  if (arg->is_atom)
-    actual_props = NULL;
-  else
-    SVN_ERR(svn_skel__parse_proplist(&actual_props, arg, scratch_pool));
-
-  if (base_props != NULL)
-    {
-        svn_boolean_t written = FALSE;
-
-          {
-            svn_error_t *err;
-
-            /* Try writing to the WORKING tree first.  */
-            err = svn_wc__db_temp_working_set_props(db, local_abspath,
-                                                    base_props,
-                                                    scratch_pool);
-            if (err)
-              {
-                if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
-                  return svn_error_return(err);
-                svn_error_clear(err);
-                /* The WORKING node is not present.  */
-              }
-            else
-              {
-                /* The WORKING node is present, and we wrote the props.  */
-                written = TRUE;
-              }
-          }
-
-        if (!written)
-          SVN_ERR(svn_wc__db_temp_base_set_props(db, local_abspath,
-                                                 base_props, scratch_pool));
-    }
-
-  /* Okay. It's time to save the ACTUAL props.  */
-  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, actual_props,
-                                  NULL, NULL, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_wc__wq_add_install_properties(svn_wc__db_t *db,
-                                  const char *local_abspath,
-                                  apr_hash_t *base_props,
-                                  apr_hash_t *actual_props,
-                                  apr_pool_t *scratch_pool)
-{
-  svn_skel_t *work_item = svn_skel__make_empty_list(scratch_pool);
-  svn_skel_t *props;
-
-  if (actual_props != NULL)
-    {
-      SVN_ERR(svn_skel__unparse_proplist(&props, actual_props, scratch_pool));
-      svn_skel__prepend(props, work_item);
-    }
-  else
-    svn_skel__prepend_str("", work_item, scratch_pool);
-
-  if (base_props != NULL)
-    {
-      SVN_ERR(svn_skel__unparse_proplist(&props, base_props, scratch_pool));
-      svn_skel__prepend(props, work_item);
-    }
-  else
-    svn_skel__prepend_str("", work_item, scratch_pool);
-
-  svn_skel__prepend_str(local_abspath, work_item, scratch_pool);
-  svn_skel__prepend_str(OP_INSTALL_PROPERTIES, work_item, scratch_pool);
-
-  SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
-#endif /* SVN__SUPPORT_BASE_MERGE  */
-
-
-/* ------------------------------------------------------------------------ */
-
 /* OP_FILE_INSTALL */
 
 /* Process the OP_FILE_INSTALL work item WORK_ITEM.
@@ -2303,7 +2356,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 },
@@ -2313,6 +2365,7 @@ static const struct work_item_dispatch d
   { OP_SYNC_FILE_FLAGS, run_sync_file_flags },
   { OP_PREJ_INSTALL, run_prej_install },
   { OP_RECORD_FILEINFO, run_record_fileinfo },
+  { OP_BASE_REMOVE, run_base_remove },
   { OP_TMP_SET_TEXT_CONFLICT_MARKERS, run_set_text_conflict_markers },
   { OP_TMP_SET_PROPERTY_CONFLICT_MARKER, run_set_property_conflict_marker },
   { OP_PRISTINE_GET_TRANSLATED, run_pristine_get_translated },
@@ -2321,11 +2374,6 @@ static const struct work_item_dispatch d
   { OP_KILLME, run_killme },
 #endif
 
-/* See props.h  */
-#ifdef SVN__SUPPORT_BASE_MERGE
-  { OP_INSTALL_PROPERTIES, run_install_properties },
-#endif
-
   /* Sentinel.  */
   { NULL }
 };

Modified: subversion/branches/issue-2779-dev/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/libsvn_wc/workqueue.h?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/branches/issue-2779-dev/subversion/libsvn_wc/workqueue.h Tue Aug 10 17:18:54 2010
@@ -196,6 +196,23 @@ svn_wc__wq_add_revert(svn_boolean_t *wil
                       svn_boolean_t use_commit_times,
                       apr_pool_t *scratch_pool);
 
+/* Set *WORK_ITEM to a new work item that will remove all the data of
+   the BASE_NODE of LOCAL_ABSPATH and all it's descendants, but keeping
+   any WORKING_NODE data.
+
+   This function doesn't check for local modifications of the text files
+   as these would have triggered a tree conflict before.
+
+   ### This is only used from update_editor.c's do_entry_deletion().
+ */
+svn_error_t *
+svn_wc__wq_build_base_remove(svn_skel_t **work_item,
+                             svn_wc__db_t *db,
+                             const char *local_abspath,
+                             svn_boolean_t keep_not_present,
+                             apr_pool_t *result_pool,
+                             apr_pool_t *scratch_pool);
+
 #ifndef SVN_WC__SINGLE_DB
 /* Handle the old "KILLME" concept -- perform the actual deletion of a
    subdir (or just its admin area) during post-commit processing of a
@@ -208,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
@@ -302,18 +301,6 @@ svn_wc__wq_add_postcommit(svn_wc__db_t *
                           svn_boolean_t no_unlock,
                           apr_pool_t *scratch_pool);
 
-
-/* See props.h  */
-#ifdef SVN__SUPPORT_BASE_MERGE
-svn_error_t *
-svn_wc__wq_add_install_properties(svn_wc__db_t *db,
-                                  const char *local_abspath,
-                                  apr_hash_t *pristine_props,
-                                  apr_hash_t *actual_props,
-                                  apr_pool_t *scratch_pool);
-#endif
-
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/issue-2779-dev/subversion/svn/propedit-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/svn/propedit-cmd.c?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/svn/propedit-cmd.c (original)
+++ subversion/branches/issue-2779-dev/subversion/svn/propedit-cmd.c Tue Aug 10 17:18:54 2010
@@ -98,6 +98,9 @@ svn_cl__propedit(apr_getopt_t *os,
                                                       opt_state->targets,
                                                       ctx, pool));
 
+  /* We do our own notifications */
+  ctx->notify_func2 = NULL;
+
   if (opt_state->revprop)  /* operate on a revprop */
     {
       svn_revnum_t rev;

Modified: subversion/branches/issue-2779-dev/subversion/svnrdump/load_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/svnrdump/load_editor.c?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/svnrdump/load_editor.c (original)
+++ subversion/branches/issue-2779-dev/subversion/svnrdump/load_editor.c Tue Aug 10 17:18:54 2010
@@ -114,7 +114,9 @@ new_node_record(void **node_baton,
   void *child_baton;
   void *commit_edit_baton;
   char *ancestor_path;
-  apr_array_header_t *residual_path;
+  apr_array_header_t *residual_open_path;
+  const char *nb_dirname;
+  apr_size_t residual_close_count;
   int i;
 
   rb = revision_baton;
@@ -157,8 +159,8 @@ new_node_record(void **node_baton,
       child_db = apr_pcalloc(rb->pool, sizeof(*child_db));
       child_db->baton = child_baton;
       child_db->depth = 0;
-      child_db->parent = NULL;
       child_db->relpath = svn_relpath_canonicalize("/", rb->pool);
+      child_db->parent = NULL;
       rb->db = child_db;
   }
 
@@ -189,32 +191,37 @@ new_node_record(void **node_baton,
           if (strcmp(hval, "replace") == 0)
             nb->action = svn_node_action_replace;
         }
+      if (strcmp(hname, SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5) == 0)
+        nb->base_checksum = apr_pstrdup(rb->pool, hval);
       if (strcmp(hname, SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV) == 0)
         nb->copyfrom_rev = atoi(hval);
       if (strcmp(hname, SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH) == 0)
-          nb->copyfrom_path =
-            svn_path_url_add_component2(rb->pb->root_url,
-                                        apr_pstrdup(rb->pool, hval),
-                                        rb->pool);
+        nb->copyfrom_path =
+          svn_path_url_add_component2(rb->pb->root_url,
+                                      apr_pstrdup(rb->pool, hval),
+                                      rb->pool);
     }
 
-  if (svn_path_compare_paths(svn_relpath_dirname(nb->path, pool),
-                             rb->db->baton) != 0)
+  nb_dirname = svn_relpath_dirname(nb->path, pool);
+  if (svn_path_compare_paths(nb_dirname,
+                             rb->db->relpath) != 0)
     {
       /* Before attempting to handle the action, call open_directory
          for all the path components and set the directory baton
          accordingly */
       ancestor_path =
-        svn_relpath_get_longest_ancestor(nb->path,
+        svn_relpath_get_longest_ancestor(nb_dirname,
                                          rb->db->relpath, pool);
-      residual_path =
-        svn_path_decompose(svn_relpath_skip_ancestor(nb->path,
-                                                     ancestor_path),
-                           rb->pool);
+      residual_close_count =
+        svn_path_component_count(svn_relpath_skip_ancestor(ancestor_path,
+                                                           rb->db->relpath));
+      residual_open_path =
+        svn_path_decompose(svn_relpath_skip_ancestor(ancestor_path,
+                                                     nb_dirname), pool);
 
       /* First close all as many directories as there are after
          skip_ancestor, and then open fresh directories */
-      for (i = 0; i < residual_path->nelts; i ++)
+      for (i = 0; i < residual_close_count; i ++)
         {
           /* Don't worry about destroying the actual rb->db object,
              since the pool we're using has the lifetime of one
@@ -224,9 +231,10 @@ new_node_record(void **node_baton,
           rb->db = rb->db->parent;
         }
         
-      for (i = 0; i < residual_path->nelts; i ++)
+      for (i = 0; i < residual_open_path->nelts; i ++)
         {
-          SVN_ERR(commit_editor->open_directory(residual_path->elts + i,
+          SVN_ERR(commit_editor->open_directory(APR_ARRAY_IDX(residual_open_path,
+                                                              i, const char *),
                                                 rb->db->baton,
                                                 rb->rev - 1,
                                                 rb->pool, &child_baton));
@@ -235,11 +243,12 @@ new_node_record(void **node_baton,
           child_db->baton = child_baton;
           child_db->depth = rb->db->depth + 1;
           child_db->relpath = svn_relpath_join(rb->db->relpath,
-                                               residual_path->elts + i,
+                                               APR_ARRAY_IDX(residual_open_path,
+                                                             i, const char *),
                                                rb->pool);
+          child_db->parent = rb->db;
           rb->db = child_db;
         }
-
     }
 
   switch (nb->action)
@@ -252,20 +261,19 @@ new_node_record(void **node_baton,
                                           nb->copyfrom_path,
                                           nb->copyfrom_rev,
                                           rb->pool, &(nb->file_baton)));
-          LDR_DBG(("Adding file %s to dir %p as %p\n", nb->path, rb->db->baton, nb->file_baton));
+          LDR_DBG(("Added file %s to dir %p as %p\n", nb->path, rb->db->baton, nb->file_baton));
           break;
         case svn_node_dir:
           SVN_ERR(commit_editor->add_directory(nb->path, rb->db->baton,
                                                nb->copyfrom_path,
                                                nb->copyfrom_rev,
                                                rb->pool, &child_baton));
-          LDR_DBG(("Adding dir %s to dir %p as %p\n", nb->path, rb->db->baton, child_baton));
+          LDR_DBG(("Added dir %s to dir %p as %p\n", nb->path, rb->db->baton, child_baton));
           child_db = apr_pcalloc(rb->pool, sizeof(*child_db));
           child_db->baton = child_baton;
           child_db->depth = rb->db->depth + 1;
-          child_db->relpath = svn_relpath_join(rb->db->relpath,
-                                               residual_path->elts + i,
-                                               rb->pool);
+          child_db->relpath = apr_pstrdup(rb->pool, nb->path);
+          child_db->parent = rb->db;
           rb->db = child_db;
           break;
         default:
@@ -288,21 +296,9 @@ new_node_record(void **node_baton,
         }
       break;
     case svn_node_action_delete:
-      switch (nb->kind)
-        {
-        case svn_node_file:
-          LDR_DBG(("Deleting file %s in %p\n", nb->path, rb->db->baton));
-          SVN_ERR(commit_editor->delete_entry(nb->path, rb->rev,
-                                              rb->db->baton, rb->pool));
-          break;
-        case svn_node_dir:
-          LDR_DBG(("Deleting dir %s in %p\n", nb->path, rb->db->baton));
-          SVN_ERR(commit_editor->delete_entry(nb->path, rb->rev,
-                                              rb->db->baton, rb->pool));
-          break;
-        default:
-          break;
-        }
+      LDR_DBG(("Deleting entry %s in %p\n", nb->path, rb->db->baton));
+      SVN_ERR(commit_editor->delete_entry(nb->path, rb->rev,
+                                          rb->db->baton, rb->pool));
       break;
     case svn_node_action_replace:
       /* Absent in dumpstream; represented as a delete + add */
@@ -327,8 +323,8 @@ set_revision_property(void *baton,
   else
     /* Special handling for revision 0; this is safe because the
        commit_editor hasn't been created yet. */
-    svn_ra_change_rev_prop(rb->pb->session, rb->rev, name, value,
-                           rb->pool);
+    SVN_ERR(svn_ra_change_rev_prop(rb->pb->session, rb->rev, name, value,
+                                   rb->pool));
 
   /* Remember any datestamp/ author that passes through (see comment
      in close_revision). */
@@ -411,9 +407,9 @@ apply_textdelta(svn_txdelta_window_handl
   nb = node_baton;
   commit_editor = nb->rb->pb->commit_editor;
   pool = nb->rb->pool;
-  SVN_ERR(commit_editor->apply_textdelta(nb->file_baton, NULL /* base_checksum */, 
-                                         pool, handler, handler_baton));
   LDR_DBG(("Applying textdelta to %p\n", nb->file_baton));
+  SVN_ERR(commit_editor->apply_textdelta(nb->file_baton, nb->base_checksum,
+                                         pool, handler, handler_baton));
 
   return SVN_NO_ERROR;
 }
@@ -429,8 +425,8 @@ close_node(void *baton)
 
   if (nb->kind == svn_node_file)
     {
-      SVN_ERR(commit_editor->close_file(nb->file_baton, NULL, nb->rb->pool));
       LDR_DBG(("Closing file %p\n", nb->file_baton));
+      SVN_ERR(commit_editor->close_file(nb->file_baton, NULL, nb->rb->pool));
     }
 
   /* The svn_node_dir case is handled in close_revision */
@@ -444,26 +440,43 @@ close_revision(void *baton)
   struct revision_baton *rb;
   const svn_delta_editor_t *commit_editor;
   void *commit_edit_baton;
+  void *child_baton;
   rb = baton;
 
   commit_editor = rb->pb->commit_editor;
   commit_edit_baton = rb->pb->commit_edit_baton;
 
-  /* r0 doesn't have a corresponding commit_editor; we fake it */
+  /* Fake revision 0 */
   if (rb->rev == 0)
     SVN_ERR(svn_cmdline_printf(rb->pool, "* Loaded revision 0\n"));
-  else {
-    /* Close all pending open directories, and then close the edit
-       session itself */
-    while (rb->db && rb->db->parent)
-      {
-        LDR_DBG(("Closing dir %p\n", rb->db->baton));
-        SVN_ERR(commit_editor->close_directory(rb->db->baton, rb->pool));
-        rb->db = rb->db->parent;
-      }
-    LDR_DBG(("Closing edit on %p\n", commit_edit_baton));
-    SVN_ERR(commit_editor->close_edit(commit_edit_baton, rb->pool));
-  }
+  else if (commit_editor)
+    {
+      /* Close all pending open directories, and then close the edit
+         session itself */
+      while (rb->db && rb->db->parent)
+        {
+          LDR_DBG(("Closing dir %p\n", rb->db->baton));
+          SVN_ERR(commit_editor->close_directory(rb->db->baton, rb->pool));
+          rb->db = rb->db->parent;
+        }
+      LDR_DBG(("Closing edit on %p\n", commit_edit_baton));
+      SVN_ERR(commit_editor->close_edit(commit_edit_baton, rb->pool));
+    }
+  else
+    {
+      /* Legitimate revision with no node information */
+      SVN_ERR(svn_ra_get_commit_editor3(rb->pb->session, &commit_editor,
+                                        &commit_edit_baton, rb->revprop_table,
+                                        commit_callback, NULL, NULL, FALSE,
+                                        rb->pool));
+
+      SVN_ERR(commit_editor->open_root(commit_edit_baton, rb->rev - 1,
+                                       rb->pool, &child_baton));
+
+      LDR_DBG(("Opened root %p\n", child_baton));
+      LDR_DBG(("Closing edit on %p\n", commit_edit_baton));
+      SVN_ERR(commit_editor->close_edit(commit_edit_baton, rb->pool));
+    }
 
   /* svn_fs_commit_txn rewrites the datestamp/ author property-
      rewrite it by hand after closing the commit_editor. */

Modified: subversion/branches/issue-2779-dev/subversion/svnrdump/load_editor.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/svnrdump/load_editor.h?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/svnrdump/load_editor.h (original)
+++ subversion/branches/issue-2779-dev/subversion/svnrdump/load_editor.h Tue Aug 10 17:18:54 2010
@@ -66,6 +66,8 @@ struct node_baton
   const char *copyfrom_path;
 
   void *file_baton;
+  const char *base_checksum;
+
   struct revision_baton *rb;
 };
 

Modified: subversion/branches/issue-2779-dev/subversion/svnsync/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/svnsync/main.c?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/svnsync/main.c (original)
+++ subversion/branches/issue-2779-dev/subversion/svnsync/main.c Tue Aug 10 17:18:54 2010
@@ -338,8 +338,8 @@ get_lock(svn_ra_session_t *session, apr_
     }
 
   return svn_error_createf(APR_EINVAL, NULL,
-                           "Couldn't get lock on destination repos "
-                           "after %d attempts\n", i);
+                           _("Couldn't get lock on destination repos "
+                             "after %d attempts"), i);
 }
 
 
@@ -387,20 +387,8 @@ with_locked(svn_ra_session_t *session,
   err = func(session, baton, pool);
 
   err2 = svn_ra_change_rev_prop(session, 0, SVNSYNC_PROP_LOCK, NULL, pool);
-  if (err2 && err)
-    {
-      svn_error_clear(err2); /* XXX what to do here? */
 
-      return err;
-    }
-  else if (err2)
-    {
-      return err2;
-    }
-  else
-    {
-      return err;
-    }
+  return svn_error_compose_create(err, svn_error_return(err2));
 }
 
 

Modified: subversion/branches/issue-2779-dev/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/cmdline/diff_tests.py?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/cmdline/diff_tests.py Tue Aug 10 17:18:54 2010
@@ -565,8 +565,7 @@ def diff_multiple_reverse(sbox):
   repo_diff(wc_dir, 4, 1, check_add_a_file_in_a_subdir)
   repo_diff(wc_dir, 4, 1, check_add_a_file)
   repo_diff(wc_dir, 1, 4, check_update_a_file)
-### TODO: directory delete doesn't work yet
-#  repo_diff(wc_dir, 1, 4, check_add_a_file_in_a_subdir_reverse)
+  repo_diff(wc_dir, 1, 4, check_add_a_file_in_a_subdir_reverse)
   repo_diff(wc_dir, 1, 4, check_add_a_file_reverse)
 
 # test 6
@@ -1921,6 +1920,7 @@ def diff_renamed_dir(sbox):
                        'A') :
     raise svntest.Failure
 
+  # Commit
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'ci', '-m', 'log msg')
 
@@ -1949,20 +1949,62 @@ def diff_renamed_dir(sbox):
                        'A') :
     raise svntest.Failure
 
-  # Test the diff while within the moved directory
-  os.chdir(os.path.join('A','D','I'))
+  # repos->repos with explicit URL arg
+  exit_code, diff_output, err_output = svntest.main.run_svn(None, 'diff',
+                                                            '-r', '1:2',
+                                                            '^/A')
+  if check_diff_output(diff_output,
+                       os.path.join('D', 'G', 'pi'),
+                       'D') :
+    raise svntest.Failure
+  if check_diff_output(diff_output,
+                       os.path.join('D', 'I', 'pi'),
+                       'A') :
+    raise svntest.Failure
 
+  # Go to the parent of the moved directory
+  os.chdir(os.path.join('A','D'))
+
+  # repos->wc diff in the parent
   exit_code, diff_output, err_output = svntest.main.run_svn(None, 'diff',
                                                             '-r', '1')
 
-  if check_diff_output(diff_output, 'pi', 'A') :
+  if check_diff_output(diff_output, 
+                       os.path.join('G', 'pi'),
+                       'D') :
+    raise svntest.Failure
+  if check_diff_output(diff_output, 
+                       os.path.join('I', 'pi'),
+                       'A') :
     raise svntest.Failure
 
-  # Test a repos->repos diff while within the moved directory
+  # repos->repos diff in the parent
+  exit_code, diff_output, err_output = svntest.main.run_svn(None, 'diff',
+                                                            '-r', '1:2')
+
+  if check_diff_output(diff_output, 
+                       os.path.join('G', 'pi'),
+                       'D') :
+    raise svntest.Failure
+  if check_diff_output(diff_output, 
+                       os.path.join('I', 'pi'),
+                       'A') :
+    raise svntest.Failure
+
+  # Go to the move target directory
+  os.chdir('I')
+
+  # repos->wc diff while within the moved directory (should be empty)
+  exit_code, diff_output, err_output = svntest.main.run_svn(None, 'diff',
+                                                            '-r', '1')
+  if diff_output:
+    raise svntest.Failure
+
+  # repos->repos diff while within the moved directory (should be empty)
   exit_code, diff_output, err_output = svntest.main.run_svn(None, 'diff',
                                                             '-r', '1:2')
 
-  if check_diff_output(diff_output, 'pi', 'A') :
+  if diff_output:
     raise svntest.Failure
 
 
@@ -3584,7 +3626,7 @@ test_list = [ None,
               diff_keywords,
               diff_force,
               diff_schedule_delete,
-              XFail(diff_renamed_dir),
+              diff_renamed_dir,
               diff_property_changes_to_base,
               diff_mime_type_changes,
               diff_prop_change_local_propmod,

Modified: subversion/branches/issue-2779-dev/subversion/tests/cmdline/schedule_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/cmdline/schedule_tests.py?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/cmdline/schedule_tests.py (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/cmdline/schedule_tests.py Tue Aug 10 17:18:54 2010
@@ -35,6 +35,7 @@ import svntest
 Skip = svntest.testcase.Skip
 SkipUnless = svntest.testcase.SkipUnless
 XFail = svntest.testcase.XFail
+Wimp = svntest.testcase.Wimp
 Item = svntest.wc.StateItem
 
 
@@ -705,7 +706,7 @@ test_list = [ None,
               SkipUnless(revert_add_executable, svntest.main.is_posix_os),
               revert_delete_files,
               revert_delete_dirs,
-              XFail(unschedule_missing_added),
+              Wimp('Needs single-db', unschedule_missing_added),
               delete_missing,
               revert_inside_newly_added_dir,
               status_add_deleted_directory,

Modified: subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/actions.py?rev=984136&r1=984135&r2=984136&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/actions.py Tue Aug 10 17:18:54 2010
@@ -1559,16 +1559,15 @@ def run_and_verify_resolved(expected_pat
 def make_repo_and_wc(sbox, create_wc = True, read_only = False):
   """Create a fresh 'Greek Tree' repository and check out a WC from it.
 
-  If read_only is False, a dedicated repository will be created, named
-  TEST_NAME. The repository will live in the global dir 'general_repo_dir'.
-  If read_only is True the pristine repository will be used.
+  If READ_ONLY is False, a dedicated repository will be created, at the path
+  SBOX.repo_dir.  If READ_ONLY is True, the pristine repository will be used.
+  In either case, SBOX.repo_url is assumed to point to the repository that
+  will be used.
 
   If create_wc is True, a dedicated working copy will be checked out from
-  the repository, named TEST_NAME. The wc directory will live in the global
-  dir 'general_wc_dir'.
+  the repository, at the path SBOX.wc_dir.
 
-  Both variables 'general_repo_dir' and 'general_wc_dir' are defined at the
-  top of this test suite.)  Returns on success, raises on failure."""
+  Returns on success, raises on failure."""
 
   # Create (or copy afresh) a new repos with a greek tree in it.
   if not read_only: