You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/10/15 10:52:18 UTC

svn commit: r1532250 [25/37] - in /subversion/branches/cache-server: ./ build/ build/ac-macros/ build/generator/ build/generator/swig/ build/generator/templates/ contrib/client-side/emacs/ contrib/hook-scripts/ contrib/server-side/fsfsfixer/ contrib/se...

Modified: subversion/branches/cache-server/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_wc/wc_db_update_move.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_wc/wc_db_update_move.c Tue Oct 15 08:52:06 2013
@@ -78,6 +78,7 @@
 
 #include <assert.h>
 
+#include "svn_private_config.h"
 #include "svn_checksum.h"
 #include "svn_dirent_uri.h"
 #include "svn_error.h"
@@ -1008,9 +1009,9 @@ static svn_error_t *
 tc_editor_alter_file(void *baton,
                      const char *dst_relpath,
                      svn_revnum_t expected_move_dst_revision,
-                     apr_hash_t *new_props,
                      const svn_checksum_t *new_checksum,
                      svn_stream_t *new_contents,
+                     apr_hash_t *new_props,
                      apr_pool_t *scratch_pool)
 {
   struct tc_editor_baton *b = baton;
@@ -1071,8 +1072,8 @@ static svn_error_t *
 tc_editor_alter_symlink(void *baton,
                         const char *relpath,
                         svn_revnum_t revision,
-                        apr_hash_t *props,
                         const char *target,
+                        apr_hash_t *props,
                         apr_pool_t *scratch_pool)
 {
   return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, NULL);
@@ -1296,15 +1297,6 @@ tc_editor_move(void *baton,
 }
 
 static svn_error_t *
-tc_editor_rotate(void *baton,
-                 const apr_array_header_t *relpaths,
-                 const apr_array_header_t *revisions,
-                 apr_pool_t *scratch_pool)
-{
-  return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, NULL);
-}
-
-static svn_error_t *
 tc_editor_complete(void *baton,
                    apr_pool_t *scratch_pool)
 {
@@ -1330,7 +1322,6 @@ static const svn_editor_cb_many_t editor
   tc_editor_delete,
   tc_editor_copy,
   tc_editor_move,
-  tc_editor_rotate,
   tc_editor_complete,
   tc_editor_abort
 };
@@ -1593,7 +1584,7 @@ update_moved_away_node(svn_editor_t *tc_
           if (props || src_checksum)
             SVN_ERR(svn_editor_alter_file(tc_editor, dst_relpath,
                                           move_root_dst_revision,
-                                          props, src_checksum, contents));
+                                          src_checksum, contents, props));
         }
       else if (src_kind == svn_node_dir)
         {
@@ -1988,8 +1979,12 @@ svn_wc__db_update_moved_away_conflict_vi
 
   /* Send all queued up notifications. */
   SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,
-                                             old_version->peg_rev,
-                                             new_version->peg_rev,
+                                             (old_version
+                                              ? old_version->peg_rev
+                                              : SVN_INVALID_REVNUM),
+                                             (new_version
+                                              ? new_version->peg_rev
+                                              : SVN_INVALID_REVNUM),
                                              notify_func, notify_baton,
                                              scratch_pool));
   if (notify_func)
@@ -2280,30 +2275,34 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
                            svn_wc__db_t *db,
                            apr_pool_t *scratch_pool)
 {
-  const char *dummy1, *move_dst_op_root_relpath;
-  const char *move_src_root_relpath, *move_src_op_root_relpath;
   apr_hash_t *src_done;
 
   SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
                                       STMT_CREATE_UPDATE_MOVE_LIST));
 
-  SVN_ERR(svn_wc__db_op_depth_moved_to(&dummy1, &move_dst_op_root_relpath,
-                                       &move_src_root_relpath,
-                                       &move_src_op_root_relpath, 0,
-                                       wcroot, local_relpath,
-                                       scratch_pool, scratch_pool));
-
-  if (move_src_root_relpath)
+  if (local_relpath[0] != '\0')
     {
-      if (strcmp(move_src_root_relpath, local_relpath))
+      const char *dummy1, *move_dst_op_root_relpath;
+      const char *move_src_root_relpath, *move_src_op_root_relpath;
+
+      /* Is the root of the update moved away? (Impossible for the wcroot) */
+      SVN_ERR(svn_wc__db_op_depth_moved_to(&dummy1, &move_dst_op_root_relpath,
+                                           &move_src_root_relpath,
+                                           &move_src_op_root_relpath, 0,
+                                           wcroot, local_relpath,
+                                           scratch_pool, scratch_pool));
+
+      if (move_src_root_relpath)
         {
-          SVN_ERR(bump_mark_tree_conflict(wcroot, move_src_root_relpath,
-                                          move_src_op_root_relpath,
-                                          move_dst_op_root_relpath,
-                                          db, scratch_pool));
-          return SVN_NO_ERROR;
+          if (strcmp(move_src_root_relpath, local_relpath))
+            {
+              SVN_ERR(bump_mark_tree_conflict(wcroot, move_src_root_relpath,
+                                              move_src_op_root_relpath,
+                                              move_dst_op_root_relpath,
+                                              db, scratch_pool));
+              return SVN_NO_ERROR;
+            }
         }
-
     }
 
   src_done = apr_hash_make(scratch_pool);
@@ -2395,7 +2394,9 @@ svn_wc__db_resolve_delete_raise_moved_aw
     wcroot);
 
   SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,
-                                             old_version->peg_rev,
+                                             (old_version
+                                              ? old_version->peg_rev
+                                              : SVN_INVALID_REVNUM),
                                              (new_version
                                               ? new_version->peg_rev
                                               : SVN_INVALID_REVNUM),
@@ -2434,17 +2435,23 @@ break_move(svn_wc__db_wcroot_t *wcroot,
 svn_error_t *
 svn_wc__db_resolve_break_moved_away_internal(svn_wc__db_wcroot_t *wcroot,
                                              const char *local_relpath,
+                                             int op_depth,
                                              apr_pool_t *scratch_pool)
 {
   const char *dummy1, *move_dst_op_root_relpath;
   const char *dummy2, *move_src_op_root_relpath;
 
+  /* We want to include the passed op-depth, but the function does a > check */
   SVN_ERR(svn_wc__db_op_depth_moved_to(&dummy1, &move_dst_op_root_relpath,
                                        &dummy2,
                                        &move_src_op_root_relpath,
-                                       relpath_depth(local_relpath) - 1,
+                                       op_depth - 1,
                                        wcroot, local_relpath,
                                        scratch_pool, scratch_pool));
+
+  SVN_ERR_ASSERT(move_src_op_root_relpath != NULL
+                 && move_dst_op_root_relpath != NULL);
+
   SVN_ERR(break_move(wcroot, local_relpath,
                      relpath_depth(move_src_op_root_relpath),
                      move_dst_op_root_relpath,
@@ -2513,6 +2520,7 @@ svn_wc__db_resolve_break_moved_away(svn_
 
   SVN_WC__DB_WITH_TXN(
     svn_wc__db_resolve_break_moved_away_internal(wcroot, local_relpath,
+                                                 relpath_depth(local_relpath),
                                                  scratch_pool),
     wcroot);
 

Modified: subversion/branches/cache-server/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_wc/wc_db_wcroot.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_wc/wc_db_wcroot.c Tue Oct 15 08:52:06 2013
@@ -25,6 +25,7 @@
 
 #include <assert.h>
 
+#include "svn_private_config.h"
 #include "svn_dirent_uri.h"
 #include "svn_hash.h"
 #include "svn_path.h"
@@ -35,8 +36,6 @@
 #include "wc_db_private.h"
 #include "wc-queries.h"
 
-#include "svn_private_config.h"
-
 /* ### Same values as wc_db.c */
 #define SDB_FILE  "wc.db"
 #define UNKNOWN_WC_ID ((apr_int64_t) -1)
@@ -145,9 +144,8 @@ get_path_kind(svn_node_kind_t *kind,
 }
 
 
-/* Return an error if the work queue in SDB is non-empty. */
-static svn_error_t *
-verify_no_work(svn_sqlite__db_t *sdb)
+svn_error_t *
+svn_wc__db_verify_no_work(svn_sqlite__db_t *sdb)
 {
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
@@ -258,7 +256,6 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
                              apr_int64_t wc_id,
                              int format,
                              svn_boolean_t verify_format,
-                             svn_boolean_t enforce_empty_wq,
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_pool)
 {
@@ -293,11 +290,11 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
     }
 
   /* Verify that no work items exists. If they do, then our integrity is
-     suspect and, thus, we cannot use this database.  */
-  if (format >= SVN_WC__HAS_WORK_QUEUE
-      && (enforce_empty_wq || (format < SVN_WC__VERSION && verify_format)))
+     suspect and, thus, we cannot upgrade this database.  */
+  if (format >= SVN_WC__HAS_WORK_QUEUE &&
+      format < SVN_WC__VERSION && verify_format)
     {
-      svn_error_t *err = verify_no_work(sdb);
+      svn_error_t *err = svn_wc__db_verify_no_work(sdb);
       if (err)
         {
           /* Special message for attempts to upgrade a 1.7-dev wc with
@@ -434,6 +431,8 @@ svn_wc__db_wcroot_parse_local_abspath(sv
   svn_boolean_t always_check = FALSE;
   int wc_format = 0;
   const char *adm_relpath;
+  /* Non-NULL if WCROOT is found through a symlink: */
+  const char *symlink_wcroot_abspath = NULL;
 
   /* ### we need more logic for finding the database (if it is located
      ### outside of the wcroot) and then managing all of that within DB.
@@ -611,6 +610,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
                   if (found_wcroot)
                     break;
 
+                  symlink_wcroot_abspath = local_abspath;
                   SVN_ERR(read_link_target(&local_abspath, local_abspath,
                                            scratch_pool));
 try_symlink_as_dir:
@@ -632,6 +632,7 @@ try_symlink_as_dir:
       local_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
 
       moved_upwards = TRUE;
+      symlink_wcroot_abspath = NULL;
 
       /* Is the parent directory recorded in our hash?  */
       found_wcroot = svn_hash_gets(db->dir_data, local_abspath);
@@ -669,9 +670,12 @@ try_symlink_as_dir:
          (ie. where we found it).  */
 
       err = svn_wc__db_pdh_create_wcroot(wcroot,
-                            apr_pstrdup(db->state_pool, local_abspath),
+                            apr_pstrdup(db->state_pool,
+                                        symlink_wcroot_abspath
+                                          ? symlink_wcroot_abspath
+                                          : local_abspath),
                             sdb, wc_id, FORMAT_FROM_SDB,
-                            db->verify_format, db->enforce_empty_wq,
+                            db->verify_format,
                             db->state_pool, scratch_pool);
       if (err && (err->apr_err == SVN_ERR_WC_UNSUPPORTED_FORMAT ||
                   err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED) &&
@@ -737,9 +741,12 @@ try_symlink_as_dir:
         }
 
       SVN_ERR(svn_wc__db_pdh_create_wcroot(wcroot,
-                            apr_pstrdup(db->state_pool, local_abspath),
+                            apr_pstrdup(db->state_pool,
+                                        symlink_wcroot_abspath
+                                          ? symlink_wcroot_abspath
+                                          : local_abspath),
                             NULL, UNKNOWN_WC_ID, wc_format,
-                            db->verify_format, db->enforce_empty_wq,
+                            db->verify_format,
                             db->state_pool, scratch_pool));
     }
 
@@ -747,6 +754,13 @@ try_symlink_as_dir:
     {
       const char *dir_relpath;
 
+      if (symlink_wcroot_abspath)
+        {
+          /* The WCROOT was found through a symlink pointing at the root of
+           * the WC. Cache the WCROOT under the symlink's path. */
+          local_dir_abspath = symlink_wcroot_abspath;
+        }
+
       /* The subdirectory's relpath is easily computed relative to the
          wcroot that we just found.  */
       dir_relpath = compute_relpath(*wcroot, local_dir_abspath, NULL);
@@ -809,6 +823,7 @@ try_symlink_as_dir:
                                              scratch_pool));
           if (resolved_kind == svn_node_dir)
             {
+              symlink_wcroot_abspath = original_abspath;
               SVN_ERR(read_link_target(&local_abspath, original_abspath,
                                        scratch_pool));
               /* This handle was opened in this function but is not going

Modified: subversion/branches/cache-server/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_wc/workqueue.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_wc/workqueue.c Tue Oct 15 08:52:06 2013
@@ -23,6 +23,7 @@
 
 #include <apr_pools.h>
 
+#include "svn_private_config.h"
 #include "svn_types.h"
 #include "svn_pools.h"
 #include "svn_dirent_uri.h"
@@ -37,7 +38,6 @@
 #include "conflicts.h"
 #include "translate.h"
 
-#include "svn_private_config.h"
 #include "private/svn_skel.h"
 
 
@@ -143,6 +143,7 @@ run_base_remove(work_item_baton_t *wqb,
   SVN_ERR(svn_wc__db_base_remove(db, local_abspath,
                                  FALSE /* keep_as_working */,
                                  TRUE /* queue_deletes */,
+                                 FALSE /* remove_locks */,
                                  not_present_rev,
                                  NULL, NULL, scratch_pool));
 
@@ -394,8 +395,6 @@ run_postupgrade(work_item_baton_t *wqb,
   const char *entries_path;
   const char *format_path;
   const char *wcroot_abspath;
-  const char *adm_path;
-  const char *temp_path;
   svn_error_t *err;
 
   err = svn_wc__wipe_postupgrade(wri_abspath, FALSE,
@@ -409,7 +408,6 @@ run_postupgrade(work_item_baton_t *wqb,
   SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath, db, wri_abspath,
                                 scratch_pool, scratch_pool));
 
-  adm_path = svn_wc__adm_child(wcroot_abspath, NULL, scratch_pool);
   entries_path = svn_wc__adm_child(wcroot_abspath, SVN_WC__ADM_ENTRIES,
                                    scratch_pool);
   format_path = svn_wc__adm_child(wcroot_abspath, SVN_WC__ADM_FORMAT,
@@ -420,15 +418,13 @@ run_postupgrade(work_item_baton_t *wqb,
      ### The order may matter for some sufficiently old clients.. but
      ### this code only runs during upgrade after the files had been
      ### removed earlier during the upgrade. */
-  SVN_ERR(svn_io_write_unique(&temp_path, adm_path, SVN_WC__NON_ENTRIES_STRING,
+  SVN_ERR(svn_io_write_atomic(format_path, SVN_WC__NON_ENTRIES_STRING,
                               sizeof(SVN_WC__NON_ENTRIES_STRING) - 1,
-                              svn_io_file_del_none, scratch_pool));
-  SVN_ERR(svn_io_file_rename(temp_path, format_path, scratch_pool));
+                              NULL, scratch_pool));
 
-  SVN_ERR(svn_io_write_unique(&temp_path, adm_path, SVN_WC__NON_ENTRIES_STRING,
+  SVN_ERR(svn_io_write_atomic(entries_path, SVN_WC__NON_ENTRIES_STRING,
                               sizeof(SVN_WC__NON_ENTRIES_STRING) - 1,
-                              svn_io_file_del_none, scratch_pool));
-  SVN_ERR(svn_io_file_rename(temp_path, entries_path, scratch_pool));
+                              NULL, scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/cache-server/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_wc/workqueue.h?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/branches/cache-server/subversion/libsvn_wc/workqueue.h Tue Oct 15 08:52:06 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/cache-server/subversion/mod_authz_svn/mod_authz_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/mod_authz_svn/mod_authz_svn.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/mod_authz_svn/mod_authz_svn.c (original)
+++ subversion/branches/cache-server/subversion/mod_authz_svn/mod_authz_svn.c Tue Oct 15 08:52:06 2013
@@ -806,14 +806,15 @@ access_checker(request_rec *r)
                                                     &authz_svn_module);
   const char *repos_path = NULL;
   const char *dest_repos_path = NULL;
-  int status;
+  int status, authn_required;
 
   /* We are not configured to run */
   if (!conf->anonymous
       || (! (conf->access_file || conf->repo_relative_access_file)))
     return DECLINED;
 
-  if (ap_some_auth_required(r))
+  authn_required = ap_some_auth_required(r);
+  if (authn_required)
     {
       /* It makes no sense to check if a location is both accessible
        * anonymous and by an authenticated user (in the same request!).
@@ -843,7 +844,7 @@ access_checker(request_rec *r)
       if (!conf->authoritative)
         return DECLINED;
 
-      if (!ap_some_auth_required(r))
+      if (!authn_required)
         log_access_verdict(APLOG_MARK, r, 0, repos_path, dest_repos_path);
 
       return HTTP_FORBIDDEN;

Modified: subversion/branches/cache-server/subversion/mod_dav_svn/activity.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/mod_dav_svn/activity.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/mod_dav_svn/activity.c (original)
+++ subversion/branches/cache-server/subversion/mod_dav_svn/activity.c Tue Oct 15 08:52:06 2013
@@ -193,7 +193,6 @@ dav_svn__store_activity(const dav_svn_re
                         const char *txn_name)
 {
   const char *final_path;
-  const char *tmp_path;
   const char *activity_contents;
   svn_error_t *err;
 
@@ -209,11 +208,9 @@ dav_svn__store_activity(const dav_svn_re
   activity_contents = apr_psprintf(repos->pool, "%s\n%s\n",
                                    txn_name, activity_id);
 
-  /* ### is there another directory we already have and can write to? */
-  err = svn_io_write_unique(&tmp_path,
-                            svn_dirent_dirname(final_path, repos->pool),
+  err = svn_io_write_atomic(final_path,
                             activity_contents, strlen(activity_contents),
-                            svn_io_file_del_none, repos->pool);
+                            NULL /* copy_perms path */, repos->pool);
   if (err)
     {
       svn_error_t *serr = svn_error_quick_wrap(err,
@@ -225,15 +222,6 @@ dav_svn__store_activity(const dav_svn_re
                                   repos->pool);
     }
 
-  err = svn_io_file_rename(tmp_path, final_path, repos->pool);
-  if (err)
-    {
-      svn_error_clear(svn_io_remove_file2(tmp_path, TRUE, repos->pool));
-      return dav_svn__convert_err(err, HTTP_INTERNAL_SERVER_ERROR,
-                                  "could not replace files.",
-                                  repos->pool);
-    }
-
   return NULL;
 }
 

Modified: subversion/branches/cache-server/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/mod_dav_svn/lock.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/mod_dav_svn/lock.c (original)
+++ subversion/branches/cache-server/subversion/mod_dav_svn/lock.c Tue Oct 15 08:52:06 2013
@@ -647,7 +647,7 @@ append_locks(dav_lockdb *lockdb,
 
   /* We don't allow anonymous locks */
   if (! repos->username)
-    return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
+    return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
                               DAV_ERR_LOCK_SAVE_LOCK,
                               "Anonymous lock creation is not allowed.");
 
@@ -776,7 +776,7 @@ append_locks(dav_lockdb *lockdb,
   if (serr && serr->apr_err == SVN_ERR_FS_NO_USER)
     {
       svn_error_clear(serr);
-      return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
+      return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
                                 DAV_ERR_LOCK_SAVE_LOCK,
                                 "Anonymous lock creation is not allowed.");
     }
@@ -886,7 +886,7 @@ remove_lock(dav_lockdb *lockdb,
       if (serr && serr->apr_err == SVN_ERR_FS_NO_USER)
         {
           svn_error_clear(serr);
-          return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
+          return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
                                     DAV_ERR_LOCK_SAVE_LOCK,
                                     "Anonymous lock removal is not allowed.");
         }
@@ -953,7 +953,7 @@ refresh_locks(dav_lockdb *lockdb,
      current lock on the incoming resource? */
   if ((! slock)
       || (strcmp(token->uuid_str, slock->token) != 0))
-    return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
+    return dav_svn__new_error(resource->pool, HTTP_PRECONDITION_FAILED,
                               DAV_ERR_LOCK_SAVE_LOCK,
                               "Lock refresh request doesn't match existing "
                               "lock.");
@@ -974,7 +974,7 @@ refresh_locks(dav_lockdb *lockdb,
   if (serr && serr->apr_err == SVN_ERR_FS_NO_USER)
     {
       svn_error_clear(serr);
-      return dav_svn__new_error(resource->pool, HTTP_UNAUTHORIZED,
+      return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
                                 DAV_ERR_LOCK_SAVE_LOCK,
                                 "Anonymous lock refreshing is not allowed.");
     }

Modified: subversion/branches/cache-server/subversion/mod_dav_svn/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/mod_dav_svn/merge.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/mod_dav_svn/merge.c (original)
+++ subversion/branches/cache-server/subversion/mod_dav_svn/merge.c Tue Oct 15 08:52:06 2013
@@ -115,6 +115,7 @@ static svn_error_t *
 do_resources(const dav_svn_repos *repos,
              svn_fs_root_t *root,
              svn_revnum_t revision,
+             svn_move_behavior_t move_behavior,
              ap_filter_t *output,
              apr_bucket_brigade *bb,
              apr_pool_t *pool)
@@ -129,7 +130,7 @@ do_resources(const dav_svn_repos *repos,
      and deleted things.  Also, note that deleted things don't merit
      responses of their own -- they are considered modifications to
      their parent.  */
-  SVN_ERR(svn_fs_paths_changed2(&changes, root, pool));
+  SVN_ERR(svn_fs_paths_changed3(&changes, root, move_behavior, pool));
 
   for (hi = apr_hash_first(pool, changes); hi; hi = apr_hash_next(hi))
     {
@@ -155,6 +156,8 @@ do_resources(const dav_svn_repos *repos,
 
         case svn_fs_path_change_add:
         case svn_fs_path_change_replace:
+        case svn_fs_path_change_move:
+        case svn_fs_path_change_movereplace:
           send_self = TRUE;
           send_parent = TRUE;
           break;
@@ -360,7 +363,10 @@ dav_svn__merge_response(ap_filter_t *out
          ### we can pass back the new version URL */
 
       /* and go make me proud, boy! */
-      serr = do_resources(repos, root, new_rev, output, bb, pool);
+      serr = do_resources(repos, root, new_rev,
+                          /* report changes with no further interpretation */
+                          svn_move_behavior_explicit_moves,
+                          output, bb, pool);
       if (serr != NULL)
         {
           return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,

Modified: subversion/branches/cache-server/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/mod_dav_svn/mod_dav_svn.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/cache-server/subversion/mod_dav_svn/mod_dav_svn.c Tue Oct 15 08:52:06 2013
@@ -137,7 +137,7 @@ init(apr_pool_t *p, apr_pool_t *plog, ap
 
   /* This returns void, so we can't check for error. */
   conf = ap_get_module_config(s->module_config, &dav_svn_module);
-  svn_utf_initialize2(p, conf->use_utf8);
+  svn_utf_initialize2(conf->use_utf8, p);
 
   return OK;
 }
@@ -217,6 +217,7 @@ create_dir_config(apr_pool_t *p, char *d
   conf->bulk_updates = CONF_BULKUPD_ON;
   conf->v2_protocol = CONF_FLAG_ON;
   conf->hooks_env = NULL;
+  conf->txdelta_cache = CONF_FLAG_ON;
 
   return conf;
 }
@@ -979,7 +980,6 @@ merge_xml_filter_insert(request_rec *r)
 typedef struct merge_ctx_t {
   apr_bucket_brigade *bb;
   apr_xml_parser *parser;
-  apr_pool_t *pool;
 } merge_ctx_t;
 
 
@@ -1009,7 +1009,6 @@ merge_xml_in_filter(ap_filter_t *f,
       f->ctx = ctx = apr_palloc(r->pool, sizeof(*ctx));
       ctx->parser = apr_xml_parser_create(r->pool);
       ctx->bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
-      apr_pool_create(&ctx->pool, r->pool);
     }
 
   rv = ap_get_brigade(f->next, ctx->bb, mode, block, readbytes);
@@ -1094,7 +1093,41 @@ static int dav_svn__handler(request_rec 
   return DECLINED;
 }
 
+#define NO_MAP_TO_STORAGE_NOTE "dav_svn-no-map-to-storage"
 
+/* Prevent filename on the request from being set since we aren't serving a
+ * file off the disk.  This means that <Directory> blocks will not match and
+ * that * %f in logging formats will show as "-". */
+static int dav_svn__translate_name(request_rec *r)
+{
+  dir_conf_t *conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+
+  /* module is not configured, bail out early */
+  if (!conf->fs_path && !conf->fs_parent_path)
+    return DECLINED;
+
+  /* Be paranoid and set it to NULL just in case some other module set it
+   * before we got called. */ 
+  r->filename = NULL;
+
+  /* Leave a note to ourselves so that we know not to decline in the 
+   * map_to_storage hook. */
+  apr_table_setn(r->notes, NO_MAP_TO_STORAGE_NOTE, (const char*)1); 
+  return OK;
+}
+
+/* Prevent core_map_to_storage from running if we prevented the r->filename
+ * from being set since core_map_to_storage doesn't like r->filename being
+ * NULL. */
+static int dav_svn__map_to_storage(request_rec *r)
+{
+  /* Check a note we left in translate_name since map_to_storage doesn't
+   * have access to our configuration. */
+  if (apr_table_get(r->notes, NO_MAP_TO_STORAGE_NOTE))
+    return OK;
+
+  return DECLINED;
+}
 
 
 
@@ -1175,7 +1208,7 @@ static const command_rec cmds[] =
                ACCESS_CONF|RSRC_CONF,
                "speeds up data access to older revisions by caching "
                "delta information if sufficient in-memory cache is "
-               "available (default is Off)."),
+               "available (default is On)."),
 
   /* per directory/location */
   AP_INIT_FLAG("SVNCacheFullTexts", SVNCacheFullTexts_cmd, NULL,
@@ -1268,6 +1301,12 @@ register_hooks(apr_pool_t *pconf)
   ap_register_input_filter("IncomingRewrite", dav_svn__location_in_filter,
                            NULL, AP_FTYPE_CONTENT_SET);
   ap_hook_fixups(dav_svn__proxy_request_fixup, NULL, NULL, APR_HOOK_MIDDLE);
+  /* translate_name hook is LAST so that it doesn't interfere with modules
+   * like mod_alias that are MIDDLE. */
+  ap_hook_translate_name(dav_svn__translate_name, NULL, NULL, APR_HOOK_LAST);
+  /* map_to_storage hook is LAST to avoid interferring with mod_http's
+   * handling of OPTIONS and TRACE. */
+  ap_hook_map_to_storage(dav_svn__map_to_storage, NULL, NULL, APR_HOOK_LAST);
 }
 
 

Modified: subversion/branches/cache-server/subversion/mod_dav_svn/reports/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/mod_dav_svn/reports/log.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/mod_dav_svn/reports/log.c (original)
+++ subversion/branches/cache-server/subversion/mod_dav_svn/reports/log.c Tue Oct 15 08:52:06 2013
@@ -301,6 +301,9 @@ dav_svn__log_report(const dav_resource *
   svn_boolean_t discover_changed_paths = FALSE;      /* off by default */
   svn_boolean_t strict_node_history = FALSE;         /* off by default */
   svn_boolean_t include_merged_revisions = FALSE;    /* off by default */
+  svn_move_behavior_t move_behavior = svn_move_behavior_no_moves;
+                                             /* no moves by default */
+  
   apr_array_header_t *revprops = apr_array_make(resource->pool, 3,
                                                 sizeof(const char *));
   apr_array_header_t *paths
@@ -395,6 +398,24 @@ dav_svn__log_report(const dav_resource *
                                     resource->pool);
           APR_ARRAY_PUSH(paths, const char *) = target;
         }
+      else if (strcmp(child->name, "move-behavior") == 0)
+        {
+          int move_behavior_param;
+          serr = svn_cstring_atoi(&move_behavior_param,
+                                  dav_xml_get_cdata(child, resource->pool, 1));
+          if (serr)
+            return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+                                        "Malformed CDATA in element "
+                                        "\"move-behavior\"", resource->pool);
+
+          if (   move_behavior_param < 0
+              || move_behavior_param > svn_move_behavior_auto_moves)
+            return dav_svn__convert_err(serr, HTTP_BAD_REQUEST,
+                                        "Invalid CDATA in element "
+                                        "\"move-behavior\"", resource->pool);
+
+          move_behavior = (svn_move_behavior_t) move_behavior_param;
+        }
       /* else unknown element; skip it */
     }
 
@@ -424,7 +445,7 @@ dav_svn__log_report(const dav_resource *
      flag in our log_receiver_baton structure). */
 
   /* Send zero or more log items. */
-  serr = svn_repos_get_logs4(repos->repos,
+  serr = svn_repos_get_logs5(repos->repos,
                              paths,
                              start,
                              end,
@@ -432,6 +453,7 @@ dav_svn__log_report(const dav_resource *
                              discover_changed_paths,
                              strict_node_history,
                              include_merged_revisions,
+                             move_behavior,
                              revprops,
                              dav_svn__authz_read_func(&arb),
                              &arb,

Modified: subversion/branches/cache-server/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/mod_dav_svn/repos.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/cache-server/subversion/mod_dav_svn/repos.c Tue Oct 15 08:52:06 2013
@@ -53,6 +53,7 @@
 #include "mod_dav_svn.h"
 #include "svn_ra.h"  /* for SVN_RA_CAPABILITY_* */
 #include "svn_dirent_uri.h"
+
 #include "private/svn_log.h"
 #include "private/svn_fspath.h"
 #include "private/svn_repos_private.h"
@@ -2408,21 +2409,12 @@ get_parent_path(const char *path,
                 svn_boolean_t is_urlpath,
                 apr_pool_t *pool)
 {
-  apr_size_t len;
-  char *tmp = apr_pstrdup(pool, path);
-
-  len = strlen(tmp);
-
-  if (len > 0)
+  if (*path != '\0') /* not an empty string */
     {
-      /* Remove any trailing slash; else svn_path_dirname() asserts. */
-      if (tmp[len-1] == '/')
-        tmp[len-1] = '\0';
-
       if (is_urlpath)
-        return svn_urlpath__dirname(tmp, pool);
+        return svn_urlpath__dirname(path, pool);
       else
-        return svn_fspath__dirname(tmp, pool);
+        return svn_fspath__dirname(path, pool);
     }
 
   return path;
@@ -2458,7 +2450,9 @@ get_parent_resource(const dav_resource *
       parent->versioned = 1;
       parent->hooks = resource->hooks;
       parent->pool = resource->pool;
-      parent->uri = get_parent_path(resource->uri, TRUE, resource->pool);
+      parent->uri = get_parent_path(svn_urlpath__canonicalize(resource->uri,
+                                                              resource->pool),
+                                    TRUE, resource->pool);
       parent->info = parentinfo;
 
       parentinfo->uri_path =

Modified: subversion/branches/cache-server/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/mod_dav_svn/version.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/mod_dav_svn/version.c (original)
+++ subversion/branches/cache-server/subversion/mod_dav_svn/version.c Tue Oct 15 08:52:06 2013
@@ -39,6 +39,7 @@
 #include "svn_dav.h"
 #include "svn_base64.h"
 #include "svn_version.h"
+
 #include "private/svn_repos_private.h"
 #include "private/svn_subr_private.h"
 #include "private/svn_dav_protocol.h"
@@ -1033,8 +1034,11 @@ dav_svn__checkin(dav_resource *resource,
 
           if (serr)
             {
+              int status;
+
               if (serr->apr_err == SVN_ERR_FS_CONFLICT)
                 {
+                  status = HTTP_CONFLICT;
                   msg = apr_psprintf(resource->pool,
                                      "A conflict occurred during the CHECKIN "
                                      "processing. The problem occurred with  "
@@ -1042,10 +1046,12 @@ dav_svn__checkin(dav_resource *resource,
                                      conflict_msg);
                 }
               else
-                msg = "An error occurred while committing the transaction.";
+                {
+                  status = HTTP_INTERNAL_SERVER_ERROR;
+                  msg = "An error occurred while committing the transaction.";
+                }
 
-              return dav_svn__convert_err(serr, HTTP_CONFLICT, msg,
-                                          resource->pool);
+              return dav_svn__convert_err(serr, status, msg, resource->pool);
             }
           else
             {
@@ -1540,8 +1546,11 @@ merge(dav_resource *target,
       if (serr)
         {
           const char *msg;
+          int status;
+
           if (serr->apr_err == SVN_ERR_FS_CONFLICT)
             {
+              status = HTTP_CONFLICT;
               /* ### we need to convert the conflict path into a URI */
               msg = apr_psprintf(pool,
                                  "A conflict occurred during the MERGE "
@@ -1550,9 +1559,12 @@ merge(dav_resource *target,
                                  conflict);
             }
           else
-            msg = "An error occurred while committing the transaction.";
+            {
+              status = HTTP_INTERNAL_SERVER_ERROR;
+              msg = "An error occurred while committing the transaction.";
+            }
 
-          return dav_svn__convert_err(serr, HTTP_CONFLICT, msg, pool);
+          return dav_svn__convert_err(serr, status, msg, pool);
         }
       else
         {