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 2013/05/10 16:58:56 UTC

svn commit: r1481041 [27/38] - in /subversion/branches/master-passphrase: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ contrib/client-side/svncopy/ contrib/hook-scripts/ contrib/server-side/fsfsfixer/ contrib/server-side/fsfsf...

Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_pristine.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_pristine.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_pristine.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_pristine.c Fri May 10 14:58:47 2013
@@ -122,7 +122,10 @@ svn_wc__db_pristine_get_path(const char 
                                     scratch_pool));
   if (! present)
     return svn_error_createf(SVN_ERR_WC_DB_ERROR, NULL,
-                             _("Pristine text not found"));
+                             _("The pristine text with checksum '%s' was "
+                               "not found"),
+                             svn_checksum_to_cstring_display(sha1_checksum,
+                                                             scratch_pool));
 
   SVN_ERR(get_pristine_fname(pristine_abspath, wcroot->abspath,
                              sha1_checksum,
@@ -820,6 +823,37 @@ svn_wc__db_pristine_remove(svn_wc__db_t 
 }
 
 
+/* Remove all unreferenced pristines in the WC DB in WCROOT.
+ *
+ * Look for pristine texts whose 'refcount' in the DB is zero, and remove
+ * them from the 'pristine' table and from disk.
+ *
+ * TODO: At least check that any zero refcount is really correct, before
+ *       using it.  See dev@ email thread "Pristine text missing - cleanup
+ *       doesn't work", <http://svn.haxx.se/dev/archive-2013-04/0426.shtml>.
+ *
+ * TODO: Ideas for possible extra clean-up operations:
+ *
+ *       * Check and correct all the refcounts.  Identify any rows missing
+ *         from the 'pristine' table.  (Create a temporary index for speed
+ *         if necessary?)
+ *
+ *       * Check the checksums.  (Very expensive to check them all, so find
+ *         a way to not check them all.)
+ *
+ *       * Check for pristine files missing from disk but referenced in the
+ *         'pristine' table.
+ *
+ *       * Repair any pristine files missing from disk and/or rows missing
+ *         from the 'pristine' table and/or bad checksums.  Generally
+ *         requires contacting the server, so requires support at a higher
+ *         level than this function.
+ *
+ *       * Identify any pristine text files on disk that are not referenced
+ *         in the DB, and delete them.
+ *
+ * TODO: Provide feedback about any errors found and any corrections made.
+ */
 static svn_error_t *
 pristine_cleanup_wcroot(svn_wc__db_wcroot_t *wcroot,
                         apr_pool_t *scratch_pool)

Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_private.h?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_private.h Fri May 10 14:58:47 2013
@@ -57,7 +57,7 @@ struct svn_wc__db_t {
   struct
   {
     svn_stringbuf_t *abspath;
-    svn_kind_t kind;
+    svn_node_kind_t kind;
   } parse_cache;
 
   /* As we grow the state of this DB, allocate that state here. */
@@ -213,7 +213,7 @@ svn_wc__db_util_open_db(svn_sqlite__db_t
    DB+LOCAL_ABSPATH, and outputting repos ids instead of URL+UUID. */
 svn_error_t *
 svn_wc__db_read_info_internal(svn_wc__db_status_t *status,
-                              svn_kind_t *kind,
+                              svn_node_kind_t *kind,
                               svn_revnum_t *revision,
                               const char **repos_relpath,
                               apr_int64_t *repos_id,
@@ -246,7 +246,7 @@ svn_wc__db_read_info_internal(svn_wc__db
    DB+LOCAL_ABSPATH and outputting REPOS_ID instead of URL+UUID. */
 svn_error_t *
 svn_wc__db_base_get_info_internal(svn_wc__db_status_t *status,
-                                  svn_kind_t *kind,
+                                  svn_node_kind_t *kind,
                                   svn_revnum_t *revision,
                                   const char **repos_relpath,
                                   apr_int64_t *repos_id,
@@ -265,7 +265,7 @@ svn_wc__db_base_get_info_internal(svn_wc
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool);
 
-/* Similar to svn_wc__db_base_get_info(), but taking WCROOT+LOCAL_RELPATH 
+/* Similar to svn_wc__db_base_get_info(), but taking WCROOT+LOCAL_RELPATH
  * instead of DB+LOCAL_ABSPATH, an explicit op-depth of the node to get
  * information about, and outputting REPOS_ID instead of URL+UUID, and
  * without the LOCK or UPDATE_ROOT outputs.
@@ -281,7 +281,7 @@ svn_wc__db_base_get_info_internal(svn_wc
  */
 svn_error_t *
 svn_wc__db_depth_get_info(svn_wc__db_status_t *status,
-                          svn_kind_t *kind,
+                          svn_node_kind_t *kind,
                           svn_revnum_t *revision,
                           const char **repos_relpath,
                           apr_int64_t *repos_id,
@@ -358,7 +358,7 @@ svn_wc__db_with_txn(svn_wc__db_wcroot_t 
   SVN_SQLITE__WITH_LOCK(expr, (wcroot)->sdb)
 
 
-/* Return CHILDREN mapping const char * names to svn_kind_t * for the
+/* Return CHILDREN mapping const char * names to svn_node_kind_t * for the
    children of LOCAL_RELPATH at OP_DEPTH. */
 svn_error_t *
 svn_wc__db_get_children_op_depth(apr_hash_t **children,
@@ -410,7 +410,7 @@ svn_wc__db_get_children_op_depth(apr_has
 svn_error_t *
 svn_wc__db_extend_parent_delete(svn_wc__db_wcroot_t *wcroot,
                                 const char *local_relpath,
-                                svn_kind_t kind,
+                                svn_node_kind_t kind,
                                 int op_depth,
                                 apr_pool_t *scratch_pool);
 

Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_update_move.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_update_move.c Fri May 10 14:58:47 2013
@@ -114,7 +114,6 @@
  */
 
 struct tc_editor_baton {
-  svn_skel_t **work_items;
   svn_wc__db_t *db;
   svn_wc__db_wcroot_t *wcroot;
   const char *move_root_dst_relpath;
@@ -126,10 +125,10 @@ struct tc_editor_baton {
   svn_wc_operation_t operation;
   svn_wc_conflict_version_t *old_version;
   svn_wc_conflict_version_t *new_version;
-  apr_pool_t *result_pool;
+  apr_pool_t *result_pool;  /* For things that live as long as the baton. */
 };
 
-/* 
+/*
  * Notifications are delayed until the entire update-move transaction
  * completes. These functions provide the necessary support by storing
  * notification information in a temporary db table (the "update_move_list")
@@ -325,7 +324,8 @@ mark_tree_conflict(const char *local_rel
                      scratch_pool,
                      scratch_pool));
 
-  if (reason != svn_wc_conflict_reason_unversioned)
+  if (reason != svn_wc_conflict_reason_unversioned
+      && old_repos_relpath != NULL /* no local additions */)
     {
       conflict_old_version = svn_wc_conflict_version_create2(
                                old_version->repos_url, old_version->repos_uuid,
@@ -461,7 +461,7 @@ tc_editor_add_directory(void *baton,
   struct tc_editor_baton *b = baton;
   int op_depth = relpath_depth(b->move_root_dst_relpath);
   const char *move_dst_repos_relpath;
-  svn_kind_t move_dst_kind;
+  svn_node_kind_t move_dst_kind;
   svn_boolean_t is_conflicted;
   const char *abspath;
   svn_node_kind_t old_kind;
@@ -471,7 +471,7 @@ tc_editor_add_directory(void *baton,
 
   /* Update NODES, only the bits not covered by the later call to
      replace_moved_layer. */
-  SVN_ERR(svn_wc__db_extend_parent_delete(b->wcroot, relpath, svn_kind_dir,
+  SVN_ERR(svn_wc__db_extend_parent_delete(b->wcroot, relpath, svn_node_dir,
                                           op_depth, scratch_pool));
 
   err = svn_wc__db_depth_get_info(NULL, &move_dst_kind, NULL,
@@ -483,13 +483,13 @@ tc_editor_add_directory(void *baton,
   if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
     {
       svn_error_clear(err);
-      old_kind = svn_kind_none;
+      old_kind = svn_node_none;
       move_dst_repos_relpath = NULL;
     }
   else
     {
       SVN_ERR(err);
-      old_kind = svn__node_kind_from_kind(move_dst_kind);
+      old_kind = move_dst_kind;
     }
 
   /* Check for NODES tree-conflict. */
@@ -523,7 +523,7 @@ tc_editor_add_directory(void *baton,
 
     case svn_node_none:
       SVN_ERR(svn_wc__wq_build_dir_install(&work_item, b->db, abspath,
-                                           scratch_pool, b->result_pool));
+                                           scratch_pool, scratch_pool));
 
       SVN_ERR(svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_item,
                                 scratch_pool));
@@ -553,7 +553,7 @@ tc_editor_add_file(void *baton,
   struct tc_editor_baton *b = baton;
   int op_depth = relpath_depth(b->move_root_dst_relpath);
   const char *move_dst_repos_relpath;
-  svn_kind_t move_dst_kind;
+  svn_node_kind_t move_dst_kind;
   svn_node_kind_t old_kind;
   svn_boolean_t is_conflicted;
   const char *abspath;
@@ -562,7 +562,7 @@ tc_editor_add_file(void *baton,
 
   /* Update NODES, only the bits not covered by the later call to
      replace_moved_layer. */
-  SVN_ERR(svn_wc__db_extend_parent_delete(b->wcroot, relpath, svn_kind_file,
+  SVN_ERR(svn_wc__db_extend_parent_delete(b->wcroot, relpath, svn_node_file,
                                           op_depth, scratch_pool));
 
   err = svn_wc__db_depth_get_info(NULL, &move_dst_kind, NULL,
@@ -580,9 +580,9 @@ tc_editor_add_file(void *baton,
   else
     {
       SVN_ERR(err);
-      old_kind = svn__node_kind_from_kind(move_dst_kind);
+      old_kind = move_dst_kind;
     }
-  
+
   /* Check for NODES tree-conflict. */
   SVN_ERR(check_tree_conflict(&is_conflicted, b, relpath,
                               old_kind, svn_node_file, move_dst_repos_relpath,
@@ -616,7 +616,7 @@ tc_editor_add_file(void *baton,
                                         NULL,
                                         FALSE /* FIXME: use_commit_times? */,
                                         TRUE  /* record_file_info */,
-                                        scratch_pool, b->result_pool));
+                                        scratch_pool, scratch_pool));
 
   SVN_ERR(svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_item,
                             scratch_pool));
@@ -643,7 +643,7 @@ tc_editor_add_symlink(void *baton,
 static svn_error_t *
 tc_editor_add_absent(void *baton,
                      const char *relpath,
-                     svn_kind_t kind,
+                     svn_node_kind_t kind,
                      svn_revnum_t replaces_rev,
                      apr_pool_t *scratch_pool)
 {
@@ -658,6 +658,7 @@ typedef struct working_node_version_t
   const svn_checksum_t *checksum; /* for files only */
 } working_node_version_t;
 
+/* Return *WORK_ITEMS to create a conflict on LOCAL_ABSPATH. */
 static svn_error_t *
 create_conflict_markers(svn_skel_t **work_items,
                         const char *local_abspath,
@@ -667,21 +668,26 @@ create_conflict_markers(svn_skel_t **wor
                         svn_wc_operation_t operation,
                         const working_node_version_t *old_version,
                         const working_node_version_t *new_version,
-                        svn_kind_t local_kind,
+                        svn_node_kind_t kind,
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
-  svn_skel_t *work_item;
   svn_wc_conflict_version_t *original_version;
   svn_wc_conflict_version_t *conflicted_version;
+  const char *part;
 
   original_version = svn_wc_conflict_version_dup(
                        old_version->location_and_kind, scratch_pool);
-  original_version->path_in_repos = repos_relpath;
-
+  original_version->node_kind = kind;
   conflicted_version = svn_wc_conflict_version_dup(
                          new_version->location_and_kind, scratch_pool);
-  conflicted_version->node_kind = svn__node_kind_from_kind(local_kind);
+  conflicted_version->node_kind = kind;
+
+  part = svn_relpath_skip_ancestor(original_version->path_in_repos,
+                                   repos_relpath);
+  conflicted_version->path_in_repos
+    = svn_relpath_join(conflicted_version->path_in_repos, part, scratch_pool);
+  original_version->path_in_repos = repos_relpath;
 
   if (operation == svn_wc_operation_update)
     {
@@ -700,12 +706,11 @@ create_conflict_markers(svn_skel_t **wor
 
   /* According to this func's doc string, it is "Currently only used for
    * property conflicts as text conflict markers are just in-wc files." */
-  SVN_ERR(svn_wc__conflict_create_markers(&work_item, db,
+  SVN_ERR(svn_wc__conflict_create_markers(work_items, db,
                                           local_abspath,
                                           conflict_skel,
                                           result_pool,
                                           scratch_pool));
-  *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
 
   return SVN_NO_ERROR;
 }
@@ -776,7 +781,7 @@ tc_editor_alter_directory(void *baton,
   struct tc_editor_baton *b = baton;
   const char *move_dst_repos_relpath;
   svn_revnum_t move_dst_revision;
-  svn_kind_t move_dst_kind;
+  svn_node_kind_t move_dst_kind;
   working_node_version_t old_version, new_version;
   svn_wc__db_status_t status;
   svn_boolean_t is_conflicted;
@@ -790,11 +795,22 @@ tc_editor_alter_directory(void *baton,
                                     b->wcroot, dst_relpath,
                                     relpath_depth(b->move_root_dst_relpath),
                                     scratch_pool, scratch_pool));
-  SVN_ERR_ASSERT(move_dst_revision == expected_move_dst_revision);
-  SVN_ERR_ASSERT(move_dst_kind == svn_kind_dir);
+
+  /* If the node would be recorded as svn_wc__db_status_base_deleted it
+     wouldn't have a repos_relpath */
+  /* ### Can svn_wc__db_depth_get_info() do this for us without this hint? */
+  if (status == svn_wc__db_status_deleted && move_dst_repos_relpath)
+    status = svn_wc__db_status_not_present;
+
+  /* There might be not-present nodes of a different revision as the same
+     depth as a copy. This is commonly caused by copying/moving mixed revision
+     directories */
+  SVN_ERR_ASSERT(move_dst_revision == expected_move_dst_revision
+                 || status == svn_wc__db_status_not_present);
+  SVN_ERR_ASSERT(move_dst_kind == svn_node_dir);
 
   SVN_ERR(check_tree_conflict(&is_conflicted, b, dst_relpath,
-                              svn__node_kind_from_kind(move_dst_kind),
+                              move_dst_kind,
                               svn_node_dir,
                               move_dst_repos_relpath,
                               svn_wc_conflict_action_edit,
@@ -822,19 +838,23 @@ tc_editor_alter_directory(void *baton,
                                    &propchanges, &actual_props,
                                    b->db, dst_abspath,
                                    &old_version, &new_version,
-                                   b->result_pool, scratch_pool));
+                                   scratch_pool, scratch_pool));
 
       if (conflict_skel)
         {
-          SVN_ERR(create_conflict_markers(b->work_items, dst_abspath,
+          svn_skel_t *work_items;
+
+          SVN_ERR(create_conflict_markers(&work_items, dst_abspath,
                                           b->db, move_dst_repos_relpath,
                                           conflict_skel, b->operation,
                                           &old_version, &new_version,
-                                          move_dst_kind,
-                                          b->result_pool, scratch_pool));
+                                          svn_node_dir,
+                                          scratch_pool, scratch_pool));
           SVN_ERR(svn_wc__db_mark_conflict_internal(b->wcroot, dst_relpath,
                                                     conflict_skel,
                                                     scratch_pool));
+          SVN_ERR(svn_wc__db_wq_add(b->db, b->wcroot->abspath, work_items,
+                                    scratch_pool));
         }
 
     SVN_ERR(update_move_list_add(b->wcroot, dst_relpath,
@@ -863,15 +883,13 @@ tc_editor_alter_directory(void *baton,
  * Set *WORK_ITEMS to any required work items, allocated in RESULT_POOL.
  * Use SCRATCH_POOL for temporary allocations. */
 static svn_error_t *
-update_working_file(svn_skel_t **work_items,
-                    const char *local_relpath,
+update_working_file(const char *local_relpath,
                     const char *repos_relpath,
                     svn_wc_operation_t operation,
                     const working_node_version_t *old_version,
                     const working_node_version_t *new_version,
                     svn_wc__db_wcroot_t *wcroot,
                     svn_wc__db_t *db,
-                    apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool)
 {
   const char *local_abspath = svn_dirent_join(wcroot->abspath,
@@ -884,64 +902,71 @@ update_working_file(svn_skel_t **work_it
   apr_array_header_t *propchanges;
   enum svn_wc_merge_outcome_t merge_outcome;
   svn_wc_notify_state_t prop_state, content_state;
-  svn_skel_t *work_item;
-
-  *work_items = NULL;
+  svn_skel_t *work_item, *work_items = NULL;
 
   SVN_ERR(update_working_props(&prop_state, &conflict_skel, &propchanges,
                                &actual_props, db, local_abspath,
                                old_version, new_version,
-                               result_pool, scratch_pool));
+                               scratch_pool, scratch_pool));
 
   if (!svn_checksum_match(new_version->checksum, old_version->checksum))
     {
-      /*
-       * Run a 3-way merge to update the file, using the pre-update
-       * pristine text as the merge base, the post-update pristine
-       * text as the merge-left version, and the current content of the
-       * moved-here working file as the merge-right version.
-       */
-      SVN_ERR(svn_wc__db_pristine_get_path(&old_pristine_abspath,
-                                           db, wcroot->abspath,
-                                           old_version->checksum,
-                                           scratch_pool, scratch_pool));
-      SVN_ERR(svn_wc__db_pristine_get_path(&new_pristine_abspath,
-                                           db, wcroot->abspath,
-                                           new_version->checksum,
-                                           scratch_pool, scratch_pool));
-      SVN_ERR(svn_wc__internal_merge(&work_item, &conflict_skel,
-                                     &merge_outcome, db,
-                                     old_pristine_abspath,
-                                     new_pristine_abspath,
-                                     local_abspath,
-                                     local_abspath,
-                                     NULL, NULL, NULL, /* diff labels */
-                                     actual_props,
-                                     FALSE, /* dry-run */
-                                     NULL, /* diff3-cmd */
-                                     NULL, /* merge options */
-                                     propchanges,
-                                     NULL, NULL, /* cancel_func + baton */
-                                     result_pool, scratch_pool));
-
-      *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
+      svn_boolean_t is_locally_modified;
 
-      if (merge_outcome == svn_wc_merge_conflict)
+      SVN_ERR(svn_wc__internal_file_modified_p(&is_locally_modified,
+                                               db, local_abspath,
+                                               FALSE /* exact_comparison */,
+                                               scratch_pool));
+      if (!is_locally_modified)
         {
-          content_state = svn_wc_notify_state_conflicted;
+          SVN_ERR(svn_wc__wq_build_file_install(&work_item, db,
+                                                local_abspath,
+                                                NULL,
+                                                FALSE /* FIXME: use_commit_times? */,
+                                                TRUE  /* record_file_info */,
+                                                scratch_pool, scratch_pool));
+
+          work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
+
+          content_state = svn_wc_notify_state_changed;
         }
       else
         {
-          svn_boolean_t is_locally_modified;
-          
-          SVN_ERR(svn_wc__internal_file_modified_p(&is_locally_modified,
-                                                   db, local_abspath,
-                                                   FALSE /* exact_comparison */,
-                                                   scratch_pool));
-          if (is_locally_modified)
-            content_state = svn_wc_notify_state_merged;
+          /*
+           * Run a 3-way merge to update the file, using the pre-update
+           * pristine text as the merge base, the post-update pristine
+           * text as the merge-left version, and the current content of the
+           * moved-here working file as the merge-right version.
+           */
+          SVN_ERR(svn_wc__db_pristine_get_path(&old_pristine_abspath,
+                                               db, wcroot->abspath,
+                                               old_version->checksum,
+                                               scratch_pool, scratch_pool));
+          SVN_ERR(svn_wc__db_pristine_get_path(&new_pristine_abspath,
+                                               db, wcroot->abspath,
+                                               new_version->checksum,
+                                               scratch_pool, scratch_pool));
+          SVN_ERR(svn_wc__internal_merge(&work_item, &conflict_skel,
+                                         &merge_outcome, db,
+                                         old_pristine_abspath,
+                                         new_pristine_abspath,
+                                         local_abspath,
+                                         local_abspath,
+                                         NULL, NULL, NULL, /* diff labels */
+                                         actual_props,
+                                         FALSE, /* dry-run */
+                                         NULL, /* diff3-cmd */
+                                         NULL, /* merge options */
+                                         propchanges,
+                                         NULL, NULL, /* cancel_func + baton */
+                                         scratch_pool, scratch_pool));
+
+          work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
+
+          if (merge_outcome == svn_wc_merge_conflict)
+            content_state = svn_wc_notify_state_conflicted;
           else
-            content_state = svn_wc_notify_state_changed;
+            content_state = svn_wc_notify_state_merged;
         }
     }
   else
@@ -951,16 +976,21 @@ update_working_file(svn_skel_t **work_it
    * too. */
   if (conflict_skel)
     {
-      SVN_ERR(create_conflict_markers(work_items, local_abspath, db,
+      SVN_ERR(create_conflict_markers(&work_item, local_abspath, db,
                                       repos_relpath, conflict_skel,
                                       operation, old_version, new_version,
-                                      svn_kind_file,
-                                      result_pool, scratch_pool));
+                                      svn_node_file,
+                                      scratch_pool, scratch_pool));
+
       SVN_ERR(svn_wc__db_mark_conflict_internal(wcroot, local_relpath,
                                                 conflict_skel,
                                                 scratch_pool));
+
+      work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
     }
 
+  SVN_ERR(svn_wc__db_wq_add(db, wcroot->abspath, work_items, scratch_pool));
+
   SVN_ERR(update_move_list_add(wcroot, local_relpath,
                                svn_wc_notify_update_update,
                                svn_node_file,
@@ -986,22 +1016,31 @@ tc_editor_alter_file(void *baton,
   struct tc_editor_baton *b = baton;
   const char *move_dst_repos_relpath;
   svn_revnum_t move_dst_revision;
-  svn_kind_t move_dst_kind;
+  svn_node_kind_t move_dst_kind;
   working_node_version_t old_version, new_version;
   svn_boolean_t is_conflicted;
+  svn_wc__db_status_t status;
 
-  SVN_ERR(svn_wc__db_depth_get_info(NULL, &move_dst_kind, &move_dst_revision,
+  SVN_ERR(svn_wc__db_depth_get_info(&status, &move_dst_kind, &move_dst_revision,
                                     &move_dst_repos_relpath, NULL, NULL, NULL,
                                     NULL, NULL, &old_version.checksum, NULL,
                                     NULL, &old_version.props,
                                     b->wcroot, dst_relpath,
                                     relpath_depth(b->move_root_dst_relpath),
                                     scratch_pool, scratch_pool));
-  SVN_ERR_ASSERT(move_dst_revision == expected_move_dst_revision);
-  SVN_ERR_ASSERT(move_dst_kind == svn_kind_file);
+
+  /* If the node would be recorded as svn_wc__db_status_base_deleted it
+     wouldn't have a repos_relpath */
+  /* ### Can svn_wc__db_depth_get_info() do this for us without this hint? */
+  if (status == svn_wc__db_status_deleted && move_dst_repos_relpath)
+    status = svn_wc__db_status_not_present;
+
+  SVN_ERR_ASSERT(move_dst_revision == expected_move_dst_revision
+                 || status == svn_wc__db_status_not_present);
+  SVN_ERR_ASSERT(move_dst_kind == svn_node_file);
 
   SVN_ERR(check_tree_conflict(&is_conflicted, b, dst_relpath,
-                              svn__node_kind_from_kind(move_dst_kind),
+                              move_dst_kind,
                               svn_node_file,
                               move_dst_repos_relpath,
                               svn_wc_conflict_action_edit,
@@ -1019,15 +1058,10 @@ tc_editor_alter_file(void *baton,
   /* Update file and prop contents if the update has changed them. */
   if (!svn_checksum_match(new_checksum, old_version.checksum) || new_props)
     {
-      svn_skel_t *work_items;
-
-      SVN_ERR(update_working_file(&work_items, dst_relpath,
-                                  move_dst_repos_relpath,
+      SVN_ERR(update_working_file(dst_relpath, move_dst_repos_relpath,
                                   b->operation, &old_version, &new_version,
                                   b->wcroot, b->db,
-                                  b->result_pool, scratch_pool));
-      *b->work_items = svn_wc__wq_merge(*b->work_items, work_items,
-                                        b->result_pool);
+                                  scratch_pool));
     }
 
   return SVN_NO_ERROR;
@@ -1054,11 +1088,14 @@ tc_editor_delete(void *baton,
   svn_sqlite__stmt_t *stmt;
   int op_depth = relpath_depth(b->move_root_dst_relpath);
   const char *move_dst_repos_relpath;
-  svn_kind_t move_dst_kind;
+  svn_node_kind_t move_dst_kind;
   svn_boolean_t is_conflicted;
   svn_boolean_t must_delete_working_nodes = FALSE;
   const char *local_abspath = svn_dirent_join(b->wcroot->abspath, relpath,
                                               scratch_pool);
+  const char *parent_relpath = svn_relpath_dirname(relpath, scratch_pool);
+  int op_depth_below;
+  svn_boolean_t have_row;
 
   SVN_ERR(svn_wc__db_depth_get_info(NULL, &move_dst_kind, NULL,
                                     &move_dst_repos_relpath, NULL, NULL, NULL,
@@ -1071,7 +1108,7 @@ tc_editor_delete(void *baton,
      conflicts. This catches conflicts on the node itself; deleted
      children are caught as local modifications below.*/
   SVN_ERR(check_tree_conflict(&is_conflicted, b, relpath,
-                              svn__node_kind_from_kind(move_dst_kind),
+                              move_dst_kind,
                               svn_node_unknown,
                               move_dst_repos_relpath,
                               svn_wc_conflict_action_delete,
@@ -1116,7 +1153,7 @@ tc_editor_delete(void *baton,
           SVN_ERR(mark_tree_conflict(relpath, b->wcroot, b->db, b->old_version,
                                      b->new_version, b->move_root_dst_relpath,
                                      b->operation,
-                                     svn__node_kind_from_kind(move_dst_kind),
+                                     move_dst_kind,
                                      svn_node_none,
                                      move_dst_repos_relpath, reason,
                                      svn_wc_conflict_action_delete, NULL,
@@ -1127,10 +1164,9 @@ tc_editor_delete(void *baton,
 
   if (!is_conflicted || must_delete_working_nodes)
     {
-      svn_boolean_t have_row;
       apr_pool_t *iterpool = svn_pool_create(scratch_pool);
       svn_skel_t *work_item;
-      svn_kind_t del_kind;
+      svn_node_kind_t del_kind;
       const char *del_abspath;
 
       SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
@@ -1148,7 +1184,7 @@ tc_editor_delete(void *baton,
           del_abspath = svn_dirent_join(b->wcroot->abspath,
                                         svn_sqlite__column_text(stmt, 0, NULL),
                                         iterpool);
-          if (del_kind == svn_kind_dir)
+          if (del_kind == svn_node_dir)
             err = svn_wc__wq_build_dir_remove(&work_item, b->db,
                                               b->wcroot->abspath, del_abspath,
                                               FALSE /* recursive */,
@@ -1172,7 +1208,7 @@ tc_editor_delete(void *baton,
                                         NULL, NULL,
                                         b->wcroot, relpath, op_depth,
                                         iterpool, iterpool));
-      if (del_kind == svn_kind_dir)
+      if (del_kind == svn_node_dir)
         SVN_ERR(svn_wc__wq_build_dir_remove(&work_item, b->db,
                                             b->wcroot->abspath, local_abspath,
                                             FALSE /* recursive */,
@@ -1187,18 +1223,48 @@ tc_editor_delete(void *baton,
       if (!is_conflicted)
         SVN_ERR(update_move_list_add(b->wcroot, relpath,
                                      svn_wc_notify_update_delete,
-                                     svn__node_kind_from_kind(del_kind),
+                                     del_kind,
                                      svn_wc_notify_state_inapplicable,
                                      svn_wc_notify_state_inapplicable));
       svn_pool_destroy(iterpool);
     }
 
   /* Deleting the ROWS is valid so long as we update the parent before
-     committing the transaction. */
+     committing the transaction.  The removed rows could have been
+     replacing a lower layer in which case we need to add base-deleted
+     rows. */
   SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
-                                    STMT_DELETE_WORKING_OP_DEPTH));
-  SVN_ERR(svn_sqlite__bindf(stmt, "isd", b->wcroot->wc_id, relpath, op_depth));
-  SVN_ERR(svn_sqlite__step_done(stmt));
+                                    STMT_SELECT_HIGHEST_WORKING_NODE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "isd", b->wcroot->wc_id, parent_relpath,
+                            op_depth));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  if (have_row)
+    op_depth_below = svn_sqlite__column_int(stmt, 0);
+  SVN_ERR(svn_sqlite__reset(stmt));
+  if (have_row)
+    {
+      /* Remove non-shadowing nodes. */
+      SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                        STMT_DELETE_NO_LOWER_LAYER));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isdd", b->wcroot->wc_id, relpath,
+                                op_depth, op_depth_below));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+
+      /* Convert remaining shadowing nodes to presence='base-deleted'. */
+      SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                        STMT_REPLACE_WITH_BASE_DELETED));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isd", b->wcroot->wc_id, relpath,
+                                op_depth));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+    }
+  else
+    {
+      SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb,
+                                        STMT_DELETE_WORKING_OP_DEPTH));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isd", b->wcroot->wc_id, relpath,
+                                op_depth));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+    }
 
   /* Retract any base-delete. */
   SVN_ERR(svn_wc__db_retract_parent_delete(b->wcroot, relpath, op_depth,
@@ -1307,8 +1373,6 @@ get_tc_info(svn_wc_operation_t *operatio
   svn_boolean_t tree_conflicted;
   svn_skel_t *conflict_skel;
 
-  /* ### Check for mixed-rev src or dst? */
-
   /* Check for tree conflict on src. */
   SVN_ERR(svn_wc__db_read_conflict(&conflict_skel, db,
                                    src_abspath,
@@ -1351,7 +1415,7 @@ get_tc_info(svn_wc_operation_t *operatio
 }
 
 /* Return *PROPS, *CHECKSUM, *CHILDREN and *KIND for LOCAL_RELPATH at
-   OP_DEPTH provided the row exists.  Return *KIND of svn_kind_none if
+   OP_DEPTH provided the row exists.  Return *KIND of svn_node_none if
    the row does not exist. *CHILDREN is a sorted array of basenames of
    type 'const char *', rather than a hash, to allow the driver to
    process children in a defined order. */
@@ -1359,7 +1423,7 @@ static svn_error_t *
 get_info(apr_hash_t **props,
          const svn_checksum_t **checksum,
          apr_array_header_t **children,
-         svn_kind_t *kind,
+         svn_node_kind_t *kind,
          const char *local_relpath,
          int op_depth,
          svn_wc__db_wcroot_t *wcroot,
@@ -1378,12 +1442,12 @@ get_info(apr_hash_t **props,
   if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
     {
       svn_error_clear(err);
-      *kind = svn_kind_none;
+      *kind = svn_node_none;
     }
   else
     SVN_ERR(err);
 
-  
+
   SVN_ERR(svn_wc__db_get_children_op_depth(&hash_children, wcroot,
                                            local_relpath, op_depth,
                                            scratch_pool, scratch_pool));
@@ -1398,7 +1462,7 @@ get_info(apr_hash_t **props,
     APR_ARRAY_PUSH(*children, const char *)
       = apr_pstrdup(result_pool, APR_ARRAY_IDX(sorted_children, i,
                                                svn_sort__item_t).key);
-                                                           
+
   return SVN_NO_ERROR;
 }
 
@@ -1462,7 +1526,7 @@ update_moved_away_node(svn_editor_t *tc_
                        svn_wc__db_wcroot_t *wcroot,
                        apr_pool_t *scratch_pool)
 {
-  svn_kind_t src_kind, dst_kind;
+  svn_node_kind_t src_kind, dst_kind;
   const svn_checksum_t *src_checksum, *dst_checksum;
   apr_hash_t *src_props, *dst_props;
   apr_array_header_t *src_children, *dst_children;
@@ -1476,16 +1540,16 @@ update_moved_away_node(svn_editor_t *tc_
                    dst_relpath, dst_op_depth,
                    wcroot, scratch_pool, scratch_pool));
 
-  if (src_kind == svn_kind_none
-      || (dst_kind != svn_kind_none && src_kind != dst_kind))
+  if (src_kind == svn_node_none
+      || (dst_kind != svn_node_none && src_kind != dst_kind))
     {
       SVN_ERR(svn_editor_delete(tc_editor, dst_relpath,
                                 move_root_dst_revision));
     }
- 
-  if (src_kind != svn_kind_none && src_kind != dst_kind)
+
+  if (src_kind != svn_node_none && src_kind != dst_kind)
     {
-      if (src_kind == svn_kind_file || src_kind == svn_kind_symlink)
+      if (src_kind == svn_node_file || src_kind == svn_node_symlink)
         {
           svn_stream_t *contents;
 
@@ -1496,14 +1560,14 @@ update_moved_away_node(svn_editor_t *tc_
                                       src_checksum, contents, src_props,
                                       move_root_dst_revision));
         }
-      else if (src_kind == svn_kind_dir)
+      else if (src_kind == svn_node_dir)
         {
           SVN_ERR(svn_editor_add_directory(tc_editor, dst_relpath,
                                            src_children, src_props,
                                            move_root_dst_revision));
         }
     }
-  else if (src_kind != svn_kind_none)
+  else if (src_kind != svn_node_none)
     {
       svn_boolean_t match;
       apr_hash_t *props;
@@ -1511,8 +1575,8 @@ update_moved_away_node(svn_editor_t *tc_
       SVN_ERR(props_match(&match, src_props, dst_props, scratch_pool));
       props = match ? NULL: src_props;
 
-      
-      if (src_kind == svn_kind_file || src_kind == svn_kind_symlink)
+
+      if (src_kind == svn_node_file || src_kind == svn_node_symlink)
         {
           svn_stream_t *contents;
 
@@ -1531,7 +1595,7 @@ update_moved_away_node(svn_editor_t *tc_
                                           move_root_dst_revision,
                                           props, src_checksum, contents));
         }
-      else if (src_kind == svn_kind_dir)
+      else if (src_kind == svn_node_dir)
         {
           apr_array_header_t *children
             = children_match(src_children, dst_children) ? NULL : src_children;
@@ -1543,7 +1607,7 @@ update_moved_away_node(svn_editor_t *tc_
         }
     }
 
-  if (src_kind == svn_kind_dir)
+  if (src_kind == svn_node_dir)
     {
       apr_pool_t *iterpool = svn_pool_create(scratch_pool);
       int i = 0, j = 0;
@@ -1645,7 +1709,7 @@ replace_moved_layer(const char *src_relp
         err = svn_sqlite__step_done(stmt2);
       if (err)
         return svn_error_compose_create(err, svn_sqlite__reset(stmt));
- 
+
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }
   SVN_ERR(svn_sqlite__reset(stmt));
@@ -1751,7 +1815,7 @@ suitable_for_move(svn_wc__db_wcroot_t *w
         return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
                                  svn_sqlite__reset(stmt),
                                  _("Cannot apply update because move source "
-                                   "%s' is a mixed-revision working copy"), 
+                                   "%s' is a mixed-revision working copy"),
                                  svn_dirent_local_style(svn_dirent_join(
                                                           wcroot->abspath,
                                                           local_relpath,
@@ -1762,7 +1826,7 @@ suitable_for_move(svn_wc__db_wcroot_t *w
         return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
                                  svn_sqlite__reset(stmt),
                                  _("Cannot apply update because move source "
-                                   "'%s' is a switched subtree"), 
+                                   "'%s' is a switched subtree"),
                                  svn_dirent_local_style(svn_dirent_join(
                                                           wcroot->abspath,
                                                           local_relpath,
@@ -1781,8 +1845,7 @@ suitable_for_move(svn_wc__db_wcroot_t *w
 /* The body of svn_wc__db_update_moved_away_conflict_victim(), which see.
  */
 static svn_error_t *
-update_moved_away_conflict_victim(svn_skel_t **work_items,
-                                  svn_wc__db_t *db,
+update_moved_away_conflict_victim(svn_wc__db_t *db,
                                   svn_wc__db_wcroot_t *wcroot,
                                   const char *victim_relpath,
                                   svn_wc_operation_t operation,
@@ -1793,7 +1856,6 @@ update_moved_away_conflict_victim(svn_sk
                                   svn_wc_conflict_version_t *new_version,
                                   svn_cancel_func_t cancel_func,
                                   void *cancel_baton,
-                                  apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool)
 {
   svn_editor_t *tc_editor;
@@ -1830,8 +1892,7 @@ update_moved_away_conflict_victim(svn_sk
   tc_editor_baton->new_version= new_version;
   tc_editor_baton->db = db;
   tc_editor_baton->wcroot = wcroot;
-  tc_editor_baton->work_items = work_items;
-  tc_editor_baton->result_pool = result_pool;
+  tc_editor_baton->result_pool = scratch_pool;
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_HIGHEST_WORKING_NODE));
@@ -1880,14 +1941,12 @@ update_moved_away_conflict_victim(svn_sk
 
 
 svn_error_t *
-svn_wc__db_update_moved_away_conflict_victim(svn_skel_t **work_items,
-                                             svn_wc__db_t *db,
+svn_wc__db_update_moved_away_conflict_victim(svn_wc__db_t *db,
                                              const char *victim_abspath,
                                              svn_wc_notify_func2_t notify_func,
                                              void *notify_baton,
                                              svn_cancel_func_t cancel_func,
                                              void *cancel_baton,
-                                             apr_pool_t *result_pool,
                                              apr_pool_t *scratch_pool)
 {
   svn_wc__db_wcroot_t *wcroot;
@@ -1899,6 +1958,8 @@ svn_wc__db_update_moved_away_conflict_vi
   svn_wc_conflict_version_t *new_version;
   const char *move_src_op_root_abspath, *move_src_op_root_relpath;
 
+  /* ### Check for mixed-rev src or dst? */
+
   SVN_ERR(get_tc_info(&operation, &local_change, &incoming_change,
                       &move_src_op_root_abspath,
                       &old_version, &new_version,
@@ -1917,12 +1978,12 @@ svn_wc__db_update_moved_away_conflict_vi
 
   SVN_WC__DB_WITH_TXN(
     update_moved_away_conflict_victim(
-      work_items, db, wcroot, local_relpath,
+      db, wcroot, local_relpath,
       operation, local_change, incoming_change,
       move_src_op_root_relpath,
       old_version, new_version,
       cancel_func, cancel_baton,
-      result_pool, scratch_pool),
+      scratch_pool),
     wcroot);
 
   /* Send all queued up notifications. */
@@ -1962,7 +2023,7 @@ depth_sufficient_to_bump(svn_boolean_t *
 {
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
-          
+
   switch (depth)
     {
     case svn_depth_infinity:
@@ -2015,10 +2076,8 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
   const char *new_repos_relpath;
   svn_revnum_t old_rev;
   svn_revnum_t new_rev;
-  const char *old_repos_url;
-  const char *new_repos_url;
-  svn_kind_t old_kind;
-  svn_kind_t new_kind;
+  svn_node_kind_t old_kind;
+  svn_node_kind_t new_kind;
   svn_wc_conflict_version_t *old_version;
   svn_wc_conflict_version_t *new_version;
 
@@ -2031,11 +2090,6 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
                                             scratch_pool, scratch_pool));
   SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid,
                                       wcroot->sdb, repos_id, scratch_pool));
-  new_repos_url = svn_uri_canonicalize(apr_pstrcat(scratch_pool,
-                                                   repos_root_url, "/",
-                                                   new_repos_relpath,
-                                                   (const char *)NULL),
-                                       scratch_pool);
 
   /* Read old (pre-update) information from the move destination node. */
   SVN_ERR(svn_wc__db_depth_get_info(NULL, &old_kind, &old_rev,
@@ -2044,25 +2098,19 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
                                     wcroot, move_dst_op_root_relpath,
                                     relpath_depth(move_dst_op_root_relpath),
                                     scratch_pool, scratch_pool));
-  old_repos_url = svn_uri_canonicalize(apr_pstrcat(scratch_pool,
-                                                   repos_root_url, "/",
-                                                   old_repos_relpath,
-                                                   (const char *)NULL),
-                                       scratch_pool);
 
   old_version = svn_wc_conflict_version_create2(
-                  old_repos_url, repos_uuid, old_repos_relpath, old_rev,
-                  svn__node_kind_from_kind(old_kind), scratch_pool);
+                  repos_root_url, repos_uuid, old_repos_relpath, old_rev,
+                  old_kind, scratch_pool);
   new_version = svn_wc_conflict_version_create2(
-                  new_repos_url, repos_uuid, new_repos_relpath, new_rev,
-                  svn__node_kind_from_kind(new_kind), scratch_pool);
+                  repos_root_url, repos_uuid, new_repos_relpath, new_rev,
+                  new_kind, scratch_pool);
 
   SVN_ERR(mark_tree_conflict(move_src_root_relpath,
                              wcroot, db, old_version, new_version,
                              move_dst_op_root_relpath,
                              svn_wc_operation_update,
-                             svn__node_kind_from_kind(old_kind),
-                             svn__node_kind_from_kind(new_kind),
+                             old_kind, new_kind,
                              old_repos_relpath,
                              svn_wc_conflict_reason_moved_away,
                              svn_wc_conflict_action_edit,
@@ -2114,7 +2162,7 @@ bump_moved_away(svn_wc__db_wcroot_t *wcr
       if (depth != svn_depth_infinity)
         {
           svn_boolean_t skip_this_src = FALSE;
-          svn_kind_t src_kind;
+          svn_node_kind_t src_kind;
 
           if (strcmp(src_relpath, local_relpath))
             {
@@ -2125,7 +2173,7 @@ bump_moved_away(svn_wc__db_wcroot_t *wcr
                   break;
                 case svn_depth_files:
                   src_kind = svn_sqlite__column_token(stmt, 3, kind_map);
-                  if (src_kind != svn_kind_file)
+                  if (src_kind != svn_node_file)
                     {
                       skip_this_src = TRUE;
                       break;
@@ -2189,10 +2237,10 @@ bump_moved_away(svn_wc__db_wcroot_t *wcr
                 src_root_relpath = svn_relpath_dirname(src_root_relpath,
                                                        iterpool);
 
-              if (!apr_hash_get(src_done, src_relpath, APR_HASH_KEY_STRING))
+              if (!svn_hash_gets(src_done, src_relpath))
                 {
-                  apr_hash_set(src_done, apr_pstrdup(result_pool, src_relpath),
-                               APR_HASH_KEY_STRING, "");
+                  svn_hash_sets(src_done,
+                                apr_pstrdup(result_pool, src_relpath), "");
                   err = svn_wc__db_read_conflict_internal(&conflict, wcroot,
                                                           src_root_relpath,
                                                           iterpool, iterpool);
@@ -2279,7 +2327,7 @@ resolve_delete_raise_moved_away(svn_wc__
   svn_boolean_t have_row;
   int op_depth = relpath_depth(local_relpath);
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-  
+
   SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
                                       STMT_CREATE_UPDATE_MOVE_LIST));
 
@@ -2348,7 +2396,7 @@ svn_wc__db_resolve_delete_raise_moved_aw
 
   SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,
                                              old_version->peg_rev,
-                                             (new_version 
+                                             (new_version
                                               ? new_version->peg_rev
                                               : SVN_INVALID_REVNUM),
                                              notify_func, notify_baton,
@@ -2429,7 +2477,7 @@ break_moved_away_children_internal(svn_w
       const char *src_relpath = svn_sqlite__column_text(stmt, 0, iterpool);
       const char *dst_relpath = svn_sqlite__column_text(stmt, 1, iterpool);
       int src_op_depth = svn_sqlite__column_int(stmt, 2);
-      
+
       svn_pool_clear(iterpool);
 
       SVN_ERR(break_move(wcroot, src_relpath, src_op_depth, dst_relpath,
@@ -2535,12 +2583,12 @@ required_lock_for_resolve(const char **r
                                     STMT_SELECT_MOVED_OUTSIDE));
   SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, 0));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
-  
+
   while (have_row)
     {
       const char *move_dst_relpath = svn_sqlite__column_text(stmt, 1,
                                                              NULL);
-      
+
       *required_relpath
         = svn_relpath_get_longest_ancestor(*required_relpath,
                                            move_dst_relpath,

Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_wcroot.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/wc_db_wcroot.c Fri May 10 14:58:47 2013
@@ -26,6 +26,7 @@
 #include <assert.h>
 
 #include "svn_dirent_uri.h"
+#include "svn_hash.h"
 #include "svn_path.h"
 #include "svn_version.h"
 
@@ -104,7 +105,7 @@ get_old_version(int *version,
    This function may do strange things, but at long as it comes up with the
    Right Answer, we should be happy. */
 static svn_error_t *
-get_path_kind(svn_kind_t *kind,
+get_path_kind(svn_node_kind_t *kind,
               svn_wc__db_t *db,
               const char *local_abspath,
               apr_pool_t *scratch_pool)
@@ -137,7 +138,7 @@ get_path_kind(svn_kind_t *kind,
   SVN_ERR(svn_io_check_special_path(local_abspath, &node_kind,
                                     &special, scratch_pool));
 
-  db->parse_cache.kind = svn__kind_from_node_kind(node_kind, special);
+  db->parse_cache.kind = (special ? svn_node_symlink : node_kind);
   *kind = db->parse_cache.kind;
 
   return SVN_NO_ERROR;
@@ -239,9 +240,9 @@ svn_wc__db_close(svn_wc__db_t *db)
       const char *local_abspath = svn__apr_hash_index_key(hi);
 
       if (wcroot->sdb)
-        apr_hash_set(roots, wcroot->abspath, APR_HASH_KEY_STRING, wcroot);
+        svn_hash_sets(roots, wcroot->abspath, wcroot);
 
-      apr_hash_set(db->dir_data, local_abspath, APR_HASH_KEY_STRING, NULL);
+      svn_hash_sets(db->dir_data, local_abspath, NULL);
     }
 
   /* Run the cleanup for each WCROOT.  */
@@ -396,7 +397,7 @@ read_link_target(const char **link_targe
                              svn_dirent_local_style(local_abspath, pool));
 
   canon_link_target = svn_dirent_canonicalize(link_target->data, pool);
-                
+
   /* Treat relative symlinks as relative to LOCAL_ABSPATH's parent. */
   if (!svn_dirent_is_absolute(canon_link_target))
     canon_link_target = svn_dirent_join(svn_dirent_dirname(local_abspath,
@@ -423,7 +424,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
 {
   const char *local_dir_abspath;
   const char *original_abspath = local_abspath;
-  svn_kind_t kind;
+  svn_node_kind_t kind;
   const char *build_relpath;
   svn_wc__db_wcroot_t *probe_wcroot;
   svn_wc__db_wcroot_t *found_wcroot = NULL;
@@ -438,8 +439,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
      ### outside of the wcroot) and then managing all of that within DB.
      ### for now: play quick & dirty. */
 
-  probe_wcroot = apr_hash_get(db->dir_data, local_abspath,
-                              APR_HASH_KEY_STRING);
+  probe_wcroot = svn_hash_gets(db->dir_data, local_abspath);
   if (probe_wcroot != NULL)
     {
       *wcroot = probe_wcroot;
@@ -460,7 +460,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
      ### into wc_db which references a file. calls for directories could
      ### get an early-exit in the hash lookup just above.  */
   SVN_ERR(get_path_kind(&kind, db, local_abspath, scratch_pool));
-  if (kind != svn_kind_dir)
+  if (kind != svn_node_dir)
     {
       /* If the node specified by the path is NOT present, then it cannot
          possibly be a directory containing ".svn/wc.db".
@@ -474,8 +474,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
                        scratch_pool);
 
       /* Is this directory in our hash?  */
-      probe_wcroot = apr_hash_get(db->dir_data, local_dir_abspath,
-                                  APR_HASH_KEY_STRING);
+      probe_wcroot = svn_hash_gets(db->dir_data, local_dir_abspath);
       if (probe_wcroot != NULL)
         {
           const char *dir_relpath;
@@ -495,7 +494,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
          many ancestors need to be scanned until we start hitting content
          on the disk. Set ALWAYS_CHECK to keep looking for .svn/entries
          rather than bailing out after the first check.  */
-      if (kind == svn_kind_none)
+      if (kind == svn_node_none)
         always_check = TRUE;
 
       /* Start the scanning at LOCAL_DIR_ABSPATH.  */
@@ -549,8 +548,17 @@ svn_wc__db_wcroot_parse_local_abspath(sv
             {
 #ifdef SVN_DEBUG
               /* Install self-verification trigger statements. */
-              SVN_ERR(svn_sqlite__exec_statements(sdb,
-                                                  STMT_VERIFICATION_TRIGGERS));
+              err = svn_sqlite__exec_statements(sdb,
+                                                STMT_VERIFICATION_TRIGGERS);
+              if (err && err->apr_err == SVN_ERR_SQLITE_ERROR)
+                {
+                  /* Verification triggers can fail to install on old 1.7-dev
+                   * formats which didn't have a NODES table yet. Ignore sqlite
+                   * errors so such working copies can be upgraded. */
+                  svn_error_clear(err);
+                }
+              else
+                SVN_ERR(err);
 #endif
               break;
             }
@@ -587,7 +595,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
            * (Issue #2557, #3987). If so, try again, this time scanning
            * for a db within the directory the symlink points to,
            * rather than within the symlink's parent directory. */
-          if (kind == svn_kind_symlink)
+          if (kind == svn_node_symlink)
             {
               svn_node_kind_t resolved_kind;
 
@@ -599,15 +607,14 @@ svn_wc__db_wcroot_parse_local_abspath(sv
               if (resolved_kind == svn_node_dir)
                 {
                   /* Is this directory recorded in our hash?  */
-                  found_wcroot = apr_hash_get(db->dir_data, local_abspath,
-                                              APR_HASH_KEY_STRING);
+                  found_wcroot = svn_hash_gets(db->dir_data, local_abspath);
                   if (found_wcroot)
                     break;
 
                   SVN_ERR(read_link_target(&local_abspath, local_abspath,
                                            scratch_pool));
 try_symlink_as_dir:
-                  kind = svn_kind_dir;
+                  kind = svn_node_dir;
                   moved_upwards = FALSE;
                   local_dir_abspath = local_abspath;
                   build_relpath = "";
@@ -627,8 +634,7 @@ try_symlink_as_dir:
       moved_upwards = TRUE;
 
       /* Is the parent directory recorded in our hash?  */
-      found_wcroot = apr_hash_get(db->dir_data, local_abspath,
-                                  APR_HASH_KEY_STRING);
+      found_wcroot = svn_hash_gets(db->dir_data, local_abspath);
       if (found_wcroot != NULL)
         break;
     }
@@ -669,7 +675,7 @@ try_symlink_as_dir:
                             db->state_pool, scratch_pool);
       if (err && (err->apr_err == SVN_ERR_WC_UNSUPPORTED_FORMAT ||
                   err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED) &&
-          kind == svn_kind_symlink)
+          kind == svn_node_symlink)
         {
           /* We found an unsupported WC after traversing upwards from a
            * symlink. Fall through to code below to check if the symlink
@@ -749,7 +755,7 @@ try_symlink_as_dir:
       *local_relpath = svn_relpath_join(dir_relpath, build_relpath, result_pool);
     }
 
-  if (kind == svn_kind_symlink)
+  if (kind == svn_node_symlink)
     {
       svn_boolean_t retry_if_dir = FALSE;
       svn_wc__db_status_t status;
@@ -816,10 +822,9 @@ try_symlink_as_dir:
 
   /* We've found the appropriate WCROOT for the requested path. Stash
      it into that path's directory.  */
-  apr_hash_set(db->dir_data,
-               apr_pstrdup(db->state_pool, local_dir_abspath),
-               APR_HASH_KEY_STRING,
-               *wcroot);
+  svn_hash_sets(db->dir_data,
+                apr_pstrdup(db->state_pool, local_dir_abspath),
+                *wcroot);
 
   /* Did we traverse up to parent directories?  */
   if (!moved_upwards)
@@ -842,12 +847,11 @@ try_symlink_as_dir:
       const char *parent_dir = svn_dirent_dirname(scan_abspath, scratch_pool);
       svn_wc__db_wcroot_t *parent_wcroot;
 
-      parent_wcroot = apr_hash_get(db->dir_data, parent_dir,
-                                   APR_HASH_KEY_STRING);
+      parent_wcroot = svn_hash_gets(db->dir_data, parent_dir);
       if (parent_wcroot == NULL)
         {
-          apr_hash_set(db->dir_data, apr_pstrdup(db->state_pool, parent_dir),
-                       APR_HASH_KEY_STRING, *wcroot);
+          svn_hash_sets(db->dir_data, apr_pstrdup(db->state_pool, parent_dir),
+                        *wcroot);
         }
 
       /* Move up a directory, stopping when we reach the directory where
@@ -865,8 +869,7 @@ svn_wc__db_drop_root(svn_wc__db_t *db,
                      const char *local_abspath,
                      apr_pool_t *scratch_pool)
 {
-  svn_wc__db_wcroot_t *root_wcroot = apr_hash_get(db->dir_data, local_abspath,
-                                                  APR_HASH_KEY_STRING);
+  svn_wc__db_wcroot_t *root_wcroot = svn_hash_gets(db->dir_data, local_abspath);
   apr_hash_index_t *hi;
   apr_status_t result;
 
@@ -886,8 +889,7 @@ svn_wc__db_drop_root(svn_wc__db_t *db,
       svn_wc__db_wcroot_t *wcroot = svn__apr_hash_index_val(hi);
 
       if (wcroot == root_wcroot)
-        apr_hash_set(db->dir_data,
-                     svn__apr_hash_index_key(hi), APR_HASH_KEY_STRING, NULL);
+        svn_hash_sets(db->dir_data, svn__apr_hash_index_key(hi), NULL);
     }
 
   result = apr_pool_cleanup_run(db->state_pool, root_wcroot, close_wcroot);

Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/wcroot_anchor.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/wcroot_anchor.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/wcroot_anchor.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/wcroot_anchor.c Fri May 10 14:58:47 2013
@@ -145,7 +145,7 @@
 svn_error_t *
 svn_wc_check_root(svn_boolean_t *is_wcroot,
                   svn_boolean_t *is_switched,
-                  svn_kind_t *kind,
+                  svn_node_kind_t *kind,
                   svn_wc_context_t *wc_ctx,
                   const char *local_abspath,
                   apr_pool_t *scratch_pool)
@@ -191,7 +191,7 @@ svn_wc_get_actual_target2(const char **a
                           apr_pool_t *scratch_pool)
 {
   svn_boolean_t is_wc_root, is_switched;
-  svn_kind_t kind;
+  svn_node_kind_t kind;
   const char *local_abspath;
   svn_error_t *err;
 
@@ -213,7 +213,7 @@ svn_wc_get_actual_target2(const char **a
     }
 
   /* If PATH is not a WC root, or if it is a file, lop off a basename. */
-  if (!(is_wc_root || is_switched) || (kind != svn_kind_dir))
+  if (!(is_wc_root || is_switched) || (kind != svn_node_dir))
     {
       svn_dirent_split(anchor, target, path, result_pool);
     }

Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/workqueue.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/workqueue.c Fri May 10 14:58:47 2013
@@ -620,14 +620,14 @@ run_file_install(work_item_baton_t *wqb,
 
   /* Tweak the on-disk file according to its properties.  */
 #ifndef WIN32
-  if (props && apr_hash_get(props, SVN_PROP_EXECUTABLE, APR_HASH_KEY_STRING))
+  if (props && svn_hash_gets(props, SVN_PROP_EXECUTABLE))
     SVN_ERR(svn_io_set_file_executable(local_abspath, TRUE, FALSE,
                                        scratch_pool));
 #endif
 
   /* Note that this explicitly checks the pristine properties, to make sure
      that when the lock is locally set (=modification) it is not read only */
-  if (props && apr_hash_get(props, SVN_PROP_NEEDS_LOCK, APR_HASH_KEY_STRING))
+  if (props && svn_hash_gets(props, SVN_PROP_NEEDS_LOCK))
     {
       svn_wc__db_status_t status;
       svn_wc__db_lock_t *lock;
@@ -673,19 +673,25 @@ svn_wc__wq_build_file_install(svn_skel_t
                               apr_pool_t *scratch_pool)
 {
   const char *local_relpath;
+  const char *wri_abspath;
   *work_item = svn_skel__make_empty_list(result_pool);
 
+  /* Use the directory of the file to install as wri_abspath to avoid
+     filestats on just obtaining the wc-root */
+  wri_abspath = svn_dirent_dirname(local_abspath, scratch_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.  */
+     value is not provided, then the file's pristine contents will be used. */
   if (source_abspath != NULL)
     {
-      SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, local_abspath,
-                                    source_abspath, result_pool, scratch_pool));
+      SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, wri_abspath,
+                                    source_abspath,
+                                    result_pool, scratch_pool));
 
       svn_skel__prepend_str(local_relpath, *work_item, result_pool);
     }
 
-  SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, local_abspath,
+  SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, wri_abspath,
                                 local_abspath, result_pool, scratch_pool));
 
   svn_skel__prepend_int(record_fileinfo, *work_item, result_pool);

Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/workqueue.h?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/workqueue.h Fri May 10 14:58:47 2013
@@ -73,7 +73,11 @@ extern "C" {
    These will be combined as appropriate, and returned in one of the
    above three styles.
 
-   The resulting list will be ordered: WORK_ITEM1 first, then WORK_ITEM2  */
+   The resulting list will be ordered: WORK_ITEM1 first, then WORK_ITEM2.
+
+   The result contains a shallow copy of the inputs.  Allocate any
+   additional storage needed in RESULT_POOL.
+ */
 svn_skel_t *
 svn_wc__wq_merge(svn_skel_t *work_item1,
                  svn_skel_t *work_item2,

Modified: subversion/branches/master-passphrase/subversion/mod_authz_svn/INSTALL
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_authz_svn/INSTALL?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_authz_svn/INSTALL (original)
+++ subversion/branches/master-passphrase/subversion/mod_authz_svn/INSTALL Fri May 10 14:58:47 2013
@@ -171,7 +171,7 @@ II.   Configuration
            AuthUserFile /path/to/htpasswd/file
 
            AuthzSVNAccessFile /path/to/access/file
-           # Implicit Satisfy All
+           # implicit Satisfy All
            Require valid-user
          </Location>
          

Modified: subversion/branches/master-passphrase/subversion/mod_authz_svn/mod_authz_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_authz_svn/mod_authz_svn.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_authz_svn/mod_authz_svn.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_authz_svn/mod_authz_svn.c Fri May 10 14:58:47 2013
@@ -110,7 +110,7 @@ canonicalize_access_file(const char *acc
     }
 
   /* We don't canonicalize repos relative urls since they get
-   * canonicalized inside svn_repos_authz_read2() when they
+   * canonicalized before calling svn_repos_authz_read2() when they
    * are resolved. */
 
   return access_file;
@@ -289,7 +289,7 @@ log_svn_error(LOG_ARGS_SIGNATURE,
       else
         {
           char strerr[256];
-          
+
           svn_stringbuf_appendcstr(buff, svn_strerror(err->apr_err, strerr,
                                                        sizeof(strerr)));
         }
@@ -309,6 +309,28 @@ log_svn_error(LOG_ARGS_SIGNATURE,
   svn_error_clear(err);
 }
 
+/* Resolve *PATH into an absolute canonical URL iff *PATH is a repos-relative
+ * URL.  If *REPOS_URL is NULL convert REPOS_PATH into a file URL stored
+ * in *REPOS_URL, if *REPOS_URL is not null REPOS_PATH is ignored.  The
+ * resulting *REPOS_URL will be used as the root of the repos-relative URL.
+ * The result will be stored in *PATH. */
+static svn_error_t *
+resolve_repos_relative_url(const char **path, const char **repos_url,
+                           const char *repos_path, apr_pool_t *pool)
+{
+  if (svn_path_is_repos_relative_url(*path))
+    {
+      if (!*repos_url)
+        SVN_ERR(svn_uri_get_file_url_from_dirent(repos_url, repos_path, pool));
+
+      SVN_ERR(svn_path_resolve_repos_relative_url(path, *path,
+                                                  *repos_url, pool));
+      *path = svn_uri_canonicalize(*path, pool);
+    }
+
+  return SVN_NO_ERROR;
+}
+
 /*
  * Get the, possibly cached, svn_authz_t for this request.
  */
@@ -318,10 +340,12 @@ get_access_conf(request_rec *r, authz_sv
 {
   const char *cache_key = NULL;
   const char *access_file;
+  const char *groups_file;
   const char *repos_path;
+  const char *repos_url = NULL;
   void *user_data = NULL;
   svn_authz_t *access_conf = NULL;
-  svn_error_t *svn_err;
+  svn_error_t *svn_err = SVN_NO_ERROR;
   dav_error *dav_err;
 
   dav_err = dav_svn_get_repos_path(r, conf->base_path, &repos_path);
@@ -346,29 +370,54 @@ get_access_conf(request_rec *r, authz_sv
     {
       access_file = conf->access_file;
     }
+  groups_file = conf->groups_file;
+
+  svn_err = resolve_repos_relative_url(&access_file, &repos_url, repos_path,
+                                       scratch_pool);
+  if (svn_err)
+    {
+      log_svn_error(APLOG_MARK, r,
+                    conf->repo_relative_access_file ?
+                    "Failed to load the AuthzSVNReposRelativeAccessFile:" :
+                    "Failed to load the AuthzSVNAccessFile:",
+                    svn_err, scratch_pool);
+      return NULL;
+    }
 
   ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                 "Path to authz file is %s", access_file);
 
-  if (conf->groups_file)
+  if (groups_file)
     {
+      svn_err = resolve_repos_relative_url(&groups_file, &repos_url, repos_path,
+                                           scratch_pool);
+      if (svn_err)
+        {
+          log_svn_error(APLOG_MARK, r,
+                        "Failed to load the AuthzSVNGroupsFile:",
+                        svn_err, scratch_pool);
+          return NULL;
+        }
+
       ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
-                    "Path to groups file is %s", conf->groups_file);
+                    "Path to groups file is %s", groups_file);
     }
 
   cache_key = apr_pstrcat(scratch_pool, "mod_authz_svn:",
-                          access_file, (char *)NULL);
+                          access_file, groups_file, (char *)NULL);
   apr_pool_userdata_get(&user_data, cache_key, r->connection->pool);
   access_conf = user_data;
   if (access_conf == NULL)
     {
+
       svn_err = svn_repos_authz_read2(&access_conf, access_file,
-                                      conf->groups_file, TRUE, repos_path,
+                                      groups_file, TRUE,
                                       r->connection->pool);
+
       if (svn_err)
         {
           log_svn_error(APLOG_MARK, r,
-                        "Failed to load the AuthzSVNAccessFile:",
+                        "Failed to load the mod_authz_svn config:",
                         svn_err, scratch_pool);
           access_conf = NULL;
         }

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/activity.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/activity.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/activity.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/activity.c Fri May 10 14:58:47 2013
@@ -28,6 +28,7 @@
 #include <httpd.h>
 #include <mod_dav.h>
 
+#include "svn_hash.h"
 #include "svn_checksum.h"
 #include "svn_error.h"
 #include "svn_io.h"
@@ -254,8 +255,9 @@ dav_svn__create_txn(const dav_svn_repos 
 
   if (repos->username)
     {
-      apr_hash_set(revprops, SVN_PROP_REVISION_AUTHOR, APR_HASH_KEY_STRING,
-                   svn_string_create(repos->username, pool));
+      svn_hash_sets(revprops,
+                    SVN_PROP_REVISION_AUTHOR,
+                    svn_string_create(repos->username, pool));
     }
 
   serr = svn_fs_youngest_rev(&rev, repos->fs, pool);

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/dav_svn.h?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/dav_svn.h Fri May 10 14:58:47 2013
@@ -284,11 +284,15 @@ struct dav_resource_private {
   svn_boolean_t auto_checked_out;
 
   /* was this resource fetched using our public peg-/working-rev CGI
-     interface (ie: /path/to/item?p=PEGREV]? */
+     interface (ie: /path/to/item?p=PEGREV)? */
   svn_boolean_t pegged;
 
   /* Cache any revprop change error */
   svn_error_t *revprop_error;
+
+  /* was keyword substitution requested using our public CGI interface
+     (ie: /path/to/item?kw=1)? */
+  svn_boolean_t keyword_subst;
 };
 
 

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/deadprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/deadprops.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/deadprops.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/deadprops.c Fri May 10 14:58:47 2013
@@ -28,6 +28,7 @@
 #include <httpd.h>
 #include <mod_dav.h>
 
+#include "svn_hash.h"
 #include "svn_xml.h"
 #include "svn_pools.h"
 #include "svn_dav.h"
@@ -177,7 +178,7 @@ save_value(dav_db *db, const dav_prop_na
 
   if (propname == NULL)
     {
-      if (db->resource->info->repos->autoversioning)
+      if (resource->info->repos->autoversioning)
         /* ignore the unknown namespace of the incoming prop. */
         propname = name->name;
       else
@@ -207,10 +208,10 @@ save_value(dav_db *db, const dav_prop_na
 
   /* A subpool to cope with mod_dav making multiple calls, e.g. during
      PROPPATCH with multiple values. */
-  subpool = svn_pool_create(db->resource->pool);
-  if (db->resource->baselined)
+  subpool = svn_pool_create(resource->pool);
+  if (resource->baselined)
     {
-      if (db->resource->working)
+      if (resource->working)
         {
           serr = svn_repos_fs_change_txn_prop(resource->info->root.txn,
                                               propname, value,

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/liveprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/liveprops.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/liveprops.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/liveprops.c Fri May 10 14:58:47 2013
@@ -436,7 +436,8 @@ insert_prop_internal(const dav_resource 
         svn_filesize_t len = 0;
 
         /* our property, but not defined on collection resources */
-        if (resource->collection || resource->baselined)
+        if (resource->type == DAV_RESOURCE_TYPE_ACTIVITY
+            || resource->collection || resource->baselined)
           return DAV_PROP_INSERT_NOTSUPP;
 
         serr = svn_fs_file_length(&len, resource->info->root.root,
@@ -466,7 +467,9 @@ insert_prop_internal(const dav_resource 
         svn_string_t *pval;
         const char *mime_type = NULL;
 
-        if (resource->baselined && resource->type == DAV_RESOURCE_TYPE_VERSION)
+        if (resource->type == DAV_RESOURCE_TYPE_ACTIVITY
+            || (resource->baselined
+                && resource->type == DAV_RESOURCE_TYPE_VERSION))
           return DAV_PROP_INSERT_NOTSUPP;
 
         if (resource->type == DAV_RESOURCE_TYPE_PRIVATE
@@ -831,10 +834,10 @@ insert_prop(const dav_resource *resource
 static int
 is_writable(const dav_resource *resource, int propid)
 {
-  const dav_liveprop_spec *info;
+  const dav_liveprop_spec *info = NULL;
 
   (void) dav_get_liveprop_info(propid, &dav_svn__liveprop_group, &info);
-  return info->is_writable;
+  return info ? info->is_writable : FALSE;
 }
 
 

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/lock.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/lock.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/lock.c Fri May 10 14:58:47 2013
@@ -28,6 +28,7 @@
 #include <http_log.h>
 #include <mod_dav.h>
 
+#include "svn_hash.h"
 #include "svn_fs.h"
 #include "svn_repos.h"
 #include "svn_dav.h"
@@ -142,6 +143,8 @@ unescape_xml(const char **output,
   if (apr_err)
     {
       char errbuf[1024];
+
+      errbuf[0] = '\0';
       (void)apr_xml_parser_geterror(xml_parser, errbuf, sizeof(errbuf));
       return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR,
                                 DAV_ERR_LOCK_SAVE_LOCK, errbuf);
@@ -640,6 +643,19 @@ append_locks(dav_lockdb *lockdb,
   svn_lock_t *slock;
   svn_error_t *serr;
   dav_error *derr;
+  dav_svn_repos *repos = resource->info->repos;
+
+  /* We don't allow anonymous locks */
+  if (! repos->username)
+    return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
+                              DAV_ERR_LOCK_SAVE_LOCK,
+                              "Anonymous lock creation is not allowed.");
+
+  /* Not a path in the repository so can't lock it. */
+  if (! resource->info->repos_path)
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
+                              DAV_ERR_LOCK_SAVE_LOCK,
+                              "Attempted to lock path not in repository.");
 
   /* If the resource's fs path is unreadable, we don't allow a lock to
      be created on it. */
@@ -663,11 +679,10 @@ append_locks(dav_lockdb *lockdb,
       svn_fs_txn_t *txn;
       svn_fs_root_t *txn_root;
       const char *conflict_msg;
-      dav_svn_repos *repos = resource->info->repos;
       apr_hash_t *revprop_table = apr_hash_make(resource->pool);
-      apr_hash_set(revprop_table, SVN_PROP_REVISION_AUTHOR,
-                   APR_HASH_KEY_STRING, svn_string_create(repos->username,
-                                                          resource->pool));
+      svn_hash_sets(revprop_table,
+                    SVN_PROP_REVISION_AUTHOR,
+                    svn_string_create(repos->username, resource->pool));
 
       if (resource->info->repos->is_svn_client)
         return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
@@ -741,14 +756,14 @@ append_locks(dav_lockdb *lockdb,
 
   /* Convert the dav_lock into an svn_lock_t. */
   derr = dav_lock_to_svn_lock(&slock, lock, resource->info->repos_path,
-                              info, resource->info->repos->is_svn_client,
+                              info, repos->is_svn_client,
                               resource->pool);
   if (derr)
     return derr;
 
   /* Now use the svn_lock_t to actually perform the lock. */
   serr = svn_repos_fs_lock(&slock,
-                           resource->info->repos->repos,
+                           repos->repos,
                            slock->path,
                            slock->token,
                            slock->comment,

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/merge.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/merge.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/merge.c Fri May 10 14:58:47 2013
@@ -29,6 +29,7 @@
 #include <httpd.h>
 #include <util_filter.h>
 
+#include "svn_hash.h"
 #include "svn_pools.h"
 #include "svn_fs.h"
 #include "svn_props.h"
@@ -169,14 +170,14 @@ do_resources(const dav_svn_repos *repos,
         {
           /* If we haven't already sent this path, send it (and then
              remember that we sent it). */
-          if (! apr_hash_get(sent, path, APR_HASH_KEY_STRING))
+          if (! svn_hash_gets(sent, path))
             {
               svn_node_kind_t kind;
               SVN_ERR(svn_fs_check_path(&kind, root, path, subpool));
               SVN_ERR(send_response(repos, root, path,
                                     kind == svn_node_dir,
                                     output, bb, subpool));
-              apr_hash_set(sent, path, APR_HASH_KEY_STRING, (void *)1);
+              svn_hash_sets(sent, path, (void *)1);
             }
         }
       if (send_parent)
@@ -186,11 +187,11 @@ do_resources(const dav_svn_repos *repos,
              pool, not subpool, because it stays in the sent hash
              afterwards. */
           const char *parent = svn_fspath__dirname(path, pool);
-          if (! apr_hash_get(sent, parent, APR_HASH_KEY_STRING))
+          if (! svn_hash_gets(sent, parent))
             {
               SVN_ERR(send_response(repos, root, parent,
                                     TRUE, output, bb, subpool));
-              apr_hash_set(sent, parent, APR_HASH_KEY_STRING, (void *)1);
+              svn_hash_sets(sent, parent, (void *)1);
             }
         }
     }
@@ -223,6 +224,7 @@ dav_svn__merge_response(ap_filter_t *out
   svn_string_t *creationdate, *creator_displayname;
   const char *post_commit_err_elem = NULL,
              *post_commit_header_info = NULL;
+  apr_status_t status;
 
   serr = svn_fs_revision_root(&root, repos->fs, new_rev, pool);
   if (serr != NULL)
@@ -283,7 +285,7 @@ dav_svn__merge_response(ap_filter_t *out
     }
 
 
-  (void) ap_fputstrs(output, bb,
+  status = ap_fputstrs(output, bb,
                      DAV_XML_HEADER DEBUG_CR
                      "<D:merge-response xmlns:D=\"DAV:\"",
                      post_commit_header_info,
@@ -303,30 +305,43 @@ dav_svn__merge_response(ap_filter_t *out
                      post_commit_err_elem, DEBUG_CR
                      "<D:version-name>", rev, "</D:version-name>" DEBUG_CR,
                      NULL);
+  if (status != APR_SUCCESS)
+    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+                              "Could not write output");
+
   if (creationdate)
     {
-      (void) ap_fputstrs(output, bb,
+      status = ap_fputstrs(output, bb,
                          "<D:creationdate>",
                          apr_xml_quote_string(pool, creationdate->data, 1),
                          "</D:creationdate>" DEBUG_CR,
                          NULL);
+      if (status != APR_SUCCESS)
+        return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+                                  "Could not write output");
     }
   if (creator_displayname)
     {
-      (void) ap_fputstrs(output, bb,
+      status = ap_fputstrs(output, bb,
                          "<D:creator-displayname>",
                          apr_xml_quote_string(pool,
                                               creator_displayname->data, 1),
                          "</D:creator-displayname>" DEBUG_CR,
                          NULL);
+      if (status != APR_SUCCESS)
+        return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+                                  "Could not write output");
     }
-  (void) ap_fputstrs(output, bb,
+  status = ap_fputstrs(output, bb,
                      "</D:prop>" DEBUG_CR
                      "<D:status>HTTP/1.1 200 OK</D:status>" DEBUG_CR
                      "</D:propstat>" DEBUG_CR
                      "</D:response>" DEBUG_CR,
 
                      NULL);
+  if (status != APR_SUCCESS)
+    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+                              "Could not write output");
 
   /* ONLY have dir_delta drive the editor if the caller asked us to
      generate a full MERGE response.  svn clients can ask us to
@@ -355,12 +370,18 @@ dav_svn__merge_response(ap_filter_t *out
     }
 
   /* wrap up the merge response */
-  (void) ap_fputs(output, bb,
+  status = ap_fputs(output, bb,
                   "</D:updated-set>" DEBUG_CR
                   "</D:merge-response>" DEBUG_CR);
+  if (status != APR_SUCCESS)
+    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+                              "Could not write output");
 
   /* send whatever is left in the brigade */
-  (void) ap_pass_brigade(output, bb);
+  status = ap_pass_brigade(output, bb);
+  if (status != APR_SUCCESS)
+    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+                              "Could not write output");
 
   return NULL;
 }

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/mod_dav_svn.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/mod_dav_svn.c Fri May 10 14:58:47 2013
@@ -34,6 +34,7 @@
 #include <ap_provider.h>
 #include <mod_dav.h>
 
+#include "svn_hash.h"
 #include "svn_version.h"
 #include "svn_cache_config.h"
 #include "svn_utf.h"
@@ -314,7 +315,7 @@ SVNMasterVersion_cmd(cmd_parms *cmd, voi
       svn_error_clear(err);
       return "Malformed master server version string.";
     }
-  
+
   conf->master_version = version;
   return NULL;
 }
@@ -1149,7 +1150,7 @@ static const command_rec cmds[] =
   AP_INIT_TAKE1("SVNMasterVersion", SVNMasterVersion_cmd, NULL, ACCESS_CONF,
                 "specifies the Subversion release version of a master "
                 "Subversion server "),
-  
+
   /* per directory/location */
   AP_INIT_TAKE1("SVNActivitiesDB", SVNActivitiesDB_cmd, NULL, ACCESS_CONF,
                 "specifies the location in the filesystem in which the "

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/posts/create_txn.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/posts/create_txn.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/posts/create_txn.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/posts/create_txn.c Fri May 10 14:58:47 2013
@@ -91,7 +91,7 @@ dav_svn__post_create_txn_with_props(cons
       return dav_svn__convert_err(err, HTTP_BAD_REQUEST,
                                   "Malformatted request skel", resource->pool);
     }
-  
+
   /* Create a Subversion repository transaction based on HEAD. */
   if ((derr = dav_svn__create_txn(resource->info->repos, &txn_name,
                                   revprops, resource->pool)))

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/inherited-props.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/inherited-props.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/inherited-props.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/inherited-props.c Fri May 10 14:58:47 2013
@@ -194,7 +194,7 @@ dav_svn__get_inherited_props_report(cons
                 }
 
               if (serr)
-                break;              
+                break;
             }
           if (!serr)
             serr = dav_svn__brigade_printf(bb, output,

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/log.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/log.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/log.c Fri May 10 14:58:47 2013
@@ -341,10 +341,9 @@ dav_svn__log_report(const dav_resource *
                                   dav_xml_get_cdata(child, resource->pool, 1));
           if (serr)
             {
-              derr = dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+              return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
                                           "Malformed CDATA in element "
                                           "\"limit\"", resource->pool);
-              goto cleanup;
             }
         }
       else if (strcmp(child->name, "discover-changed-paths") == 0)

Modified: subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/replay.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/replay.c (original)
+++ subversion/branches/master-passphrase/subversion/mod_dav_svn/reports/replay.c Fri May 10 14:58:47 2013
@@ -450,7 +450,7 @@ dav_svn__replay_report(const dav_resourc
       rev = SVN_INVALID_REVNUM;
       base_dir = resource->info->repos_path;
     }
-  
+
   arb.r = resource->info->r;
   arb.repos = resource->info->repos;