You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/08/01 20:37:44 UTC

svn commit: r981280 [1/2] - in /subversion/branches/atomic-revprop: ./ subversion/libsvn_client/ subversion/libsvn_diff/ subversion/libsvn_fs_fs/ subversion/libsvn_ra_neon/ subversion/libsvn_ra_serf/ subversion/libsvn_wc/ subversion/svnrdump/ subversio...

Author: danielsh
Date: Sun Aug  1 18:37:42 2010
New Revision: 981280

URL: http://svn.apache.org/viewvc?rev=981280&view=rev
Log:
On the 'atomic-revprop' branch, merge r980670 through r981279 from trunk.

Added:
    subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests_data/skeleton.dump
      - copied unchanged from r981279, subversion/trunk/subversion/tests/cmdline/svnrdump_tests_data/skeleton.dump
Removed:
    subversion/branches/atomic-revprop/subversion/svnrdump/dumpfile_parser.c
Modified:
    subversion/branches/atomic-revprop/   (props changed)
    subversion/branches/atomic-revprop/subversion/libsvn_client/diff.c
    subversion/branches/atomic-revprop/subversion/libsvn_client/export.c
    subversion/branches/atomic-revprop/subversion/libsvn_client/patch.c
    subversion/branches/atomic-revprop/subversion/libsvn_diff/diff_memory.c
    subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs.h
    subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/props.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/blame.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocations.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocationsegments.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/mergeinfo.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/options.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/property.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/update.c
    subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/util.c
    subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_files.c
    subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_ops.c
    subversion/branches/atomic-revprop/subversion/libsvn_wc/node.c
    subversion/branches/atomic-revprop/subversion/libsvn_wc/status.c
    subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.c
    subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.h
    subversion/branches/atomic-revprop/subversion/libsvn_wc/workqueue.c
    subversion/branches/atomic-revprop/subversion/svnrdump/dump_editor.c   (props changed)
    subversion/branches/atomic-revprop/subversion/svnrdump/dump_editor.h   (props changed)
    subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.c   (contents, props changed)
    subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.h   (contents, props changed)
    subversion/branches/atomic-revprop/subversion/svnrdump/svnrdump.1   (props changed)
    subversion/branches/atomic-revprop/subversion/svnrdump/svnrdump.c
    subversion/branches/atomic-revprop/subversion/tests/cmdline/basic_tests.py
    subversion/branches/atomic-revprop/subversion/tests/cmdline/diff_tests.py
    subversion/branches/atomic-revprop/subversion/tests/cmdline/revert_tests.py
    subversion/branches/atomic-revprop/subversion/tests/cmdline/stat_tests.py
    subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests.py
    subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/actions.py
    subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/main.py
    subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/wc.py
    subversion/branches/atomic-revprop/tools/buildbot/slaves/win32-SharpSvn/svntest-bindings.cmd
    subversion/branches/atomic-revprop/tools/buildbot/slaves/win32-SharpSvn/svntest-cleanup.cmd

Propchange: subversion/branches/atomic-revprop/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Aug  1 18:37:42 2010
@@ -34,4 +34,4 @@
 /subversion/branches/tc_url_rev:874351-874483
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
-/subversion/trunk:965046-980669
+/subversion/trunk:965046-981279

Modified: subversion/branches/atomic-revprop/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_client/diff.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_client/diff.c Sun Aug  1 18:37:42 2010
@@ -1412,7 +1412,7 @@ diff_prepare_repos_repos(const struct di
   /* Do the same for the first target. */
   SVN_ERR(svn_ra_reparent(ra_session, drr->url1, pool));
   SVN_ERR(svn_client__get_revision_number(&drr->rev1, NULL, ctx->wc_ctx,
-           (params->path1 == drr->url1) ? NULL : params_path1_abspath,
+           (strcmp(params->path1, drr->url1) == 0) ? NULL : params_path1_abspath,
            ra_session, params->revision1, pool));
   SVN_ERR(svn_ra_check_path(ra_session, "", drr->rev1, &kind1, pool));
   if (kind1 == svn_node_none)
@@ -1735,7 +1735,7 @@ diff_repos_wc(const char *path1,
 
   /* Tell the RA layer we want a delta to change our txn to URL1 */
   SVN_ERR(svn_client__get_revision_number(&rev, NULL, ctx->wc_ctx,
-                                          (path1 == url1) ? NULL : abspath1,
+                                          (strcmp(path1, url1) == 0) ? NULL : abspath1,
                                           ra_session, revision1, pool));
 
   if (!reverse)

Modified: subversion/branches/atomic-revprop/subversion/libsvn_client/export.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_client/export.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_client/export.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_client/export.c Sun Aug  1 18:37:42 2010
@@ -349,21 +349,26 @@ copy_versioned_files(const char *from,
 
   if (from_kind == svn_node_dir)
     {
+      apr_fileperms_t perm = APR_OS_DEFAULT;
+
       /* Try to make the new directory.  If this fails because the
          directory already exists, check our FORCE flag to see if we
          care. */
 
-      /* Skip retrieving the umask on windows. Apr does not implement setting
+      /* Keep the source directory's permissions if applicable.
+         Skip retrieving the umask on windows. Apr does not implement setting
          filesystem privileges on Windows.
          Retrieving the file permissions with APR_FINFO_PROT | APR_FINFO_OWNER
          is documented to be 'incredibly expensive' */
-#ifdef WIN32
-      err = svn_io_dir_make(to, APR_OS_DEFAULT, pool);
-#else
-      apr_finfo_t finfo;
-      SVN_ERR(svn_io_stat(&finfo, from, APR_FINFO_PROT, pool));
-      err = svn_io_dir_make(to, finfo.protection, pool);
+#ifndef WIN32
+      if (revision->kind == svn_opt_revision_working)
+        {
+          apr_finfo_t finfo;
+          SVN_ERR(svn_io_stat(&finfo, from, APR_FINFO_PROT, pool));
+          perm = finfo.protection;
+        }
 #endif
+      err = svn_io_dir_make(to, perm, pool);
       if (err)
         {
           if (! APR_STATUS_IS_EEXIST(err->apr_err))

Modified: subversion/branches/atomic-revprop/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_client/patch.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_client/patch.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_client/patch.c Sun Aug  1 18:37:42 2010
@@ -1426,6 +1426,47 @@ apply_hunk(patch_target_t *target, targe
   return SVN_NO_ERROR;
 }
 
+/* Use client context CTX to send a suitable notification for hunk HI,
+ * using TARGET to determine the path. If the hunk is a property hunk,
+ * PROP_NAME is set, else NULL. Use POOL for temporary allocations. */
+static svn_error_t *
+send_hunk_notification(const hunk_info_t *hi, 
+                       const patch_target_t *target, 
+                       const char *prop_name, 
+                       const svn_client_ctx_t *ctx,
+                       apr_pool_t *pool)
+{
+  svn_wc_notify_t *notify;
+  svn_wc_notify_action_t action;
+
+  if (hi->already_applied)
+    action = svn_wc_notify_patch_hunk_already_applied;
+  else if (hi->rejected)
+    action = svn_wc_notify_patch_rejected_hunk;
+  else
+    action = svn_wc_notify_patch_applied_hunk;
+
+  notify = svn_wc_create_notify(target->local_abspath
+                                    ? target->local_abspath
+                                    : target->local_relpath,
+                                action, pool);
+  notify->hunk_original_start =
+    svn_diff_hunk_get_original_start(hi->hunk);
+  notify->hunk_original_length =
+    svn_diff_hunk_get_original_length(hi->hunk);
+  notify->hunk_modified_start =
+    svn_diff_hunk_get_modified_start(hi->hunk);
+  notify->hunk_modified_length =
+    svn_diff_hunk_get_modified_length(hi->hunk);
+  notify->hunk_matched_line = hi->matched_line;
+  notify->hunk_fuzz = hi->fuzz;
+  notify->prop_name = prop_name;
+
+  (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
+
+  return SVN_NO_ERROR;
+}
+
 /* Use client context CTX to send a suitable notification for a patch TARGET.
  * Use POOL for temporary allocations. */
 static svn_error_t *
@@ -1472,9 +1513,6 @@ send_patch_notification(const patch_targ
       else if (target->has_text_changes)
         notify->content_state = svn_wc_notify_state_changed;
 
-      /* ### We need to decide on how we want prop notifications to work. 
-       * ### At the moment we're not reporting property hunks and what about
-       * ### added paths with props and paths scheduled for deletion? */
       if (target->had_prop_rejects)
         notify->prop_state = svn_wc_notify_state_conflicted;
       else if (target->has_prop_changes)
@@ -1492,36 +1530,14 @@ send_patch_notification(const patch_targ
       iterpool = svn_pool_create(pool);
       for (i = 0; i < target->content_info->hunks->nelts; i++)
         {
-          hunk_info_t *hi;
+          const hunk_info_t *hi;
 
           svn_pool_clear(iterpool);
 
           hi = APR_ARRAY_IDX(target->content_info->hunks, i, hunk_info_t *);
 
-          if (hi->already_applied)
-            action = svn_wc_notify_patch_hunk_already_applied;
-          else if (hi->rejected)
-            action = svn_wc_notify_patch_rejected_hunk;
-          else
-            action = svn_wc_notify_patch_applied_hunk;
-
-          notify = svn_wc_create_notify(target->local_abspath
-                                            ? target->local_abspath
-                                            : target->local_relpath,
-                                        action, pool);
-          notify->hunk_original_start =
-            svn_diff_hunk_get_original_start(hi->hunk);
-          notify->hunk_original_length =
-            svn_diff_hunk_get_original_length(hi->hunk);
-          notify->hunk_modified_start =
-            svn_diff_hunk_get_modified_start(hi->hunk);
-          notify->hunk_modified_length =
-            svn_diff_hunk_get_modified_length(hi->hunk);
-          notify->hunk_matched_line = hi->matched_line;
-          notify->hunk_fuzz = hi->fuzz;
-          notify->prop_name = NULL;
-
-          (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
+          SVN_ERR(send_hunk_notification(hi, target, NULL /* prop_name */, 
+                                         ctx, iterpool));
         }
 
       for (hash_index = apr_hash_first(pool, target->prop_targets);
@@ -1534,37 +1550,14 @@ send_patch_notification(const patch_targ
 
           for (i = 0; i < prop_target->content_info->hunks->nelts; i++)
             {
-              hunk_info_t *hi;
+              const hunk_info_t *hi;
 
               svn_pool_clear(iterpool);
 
               hi = APR_ARRAY_IDX(prop_target->content_info->hunks, i,
                                  hunk_info_t *);
-
-              if (hi->already_applied)
-                action = svn_wc_notify_patch_hunk_already_applied;
-              else if (hi->rejected)
-                action = svn_wc_notify_patch_rejected_hunk;
-              else
-                action = svn_wc_notify_patch_applied_hunk;
-
-              notify = svn_wc_create_notify(target->local_abspath
-                                                ? target->local_abspath
-                                                : target->local_relpath,
-                                            action, pool);
-              notify->hunk_original_start =
-                svn_diff_hunk_get_original_start(hi->hunk);
-              notify->hunk_original_length =
-                svn_diff_hunk_get_original_length(hi->hunk);
-              notify->hunk_modified_start =
-                svn_diff_hunk_get_modified_start(hi->hunk);
-              notify->hunk_modified_length =
-                svn_diff_hunk_get_modified_length(hi->hunk);
-              notify->hunk_matched_line = hi->matched_line;
-              notify->hunk_fuzz = hi->fuzz;
-              notify->prop_name = apr_pstrdup(pool, prop_target->name);
-
-              (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
+              SVN_ERR(send_hunk_notification(hi, target, prop_target->name, 
+                                             ctx, iterpool));
             }
         }
       svn_pool_destroy(iterpool);

Modified: subversion/branches/atomic-revprop/subversion/libsvn_diff/diff_memory.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_diff/diff_memory.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_diff/diff_memory.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_diff/diff_memory.c Sun Aug  1 18:37:42 2010
@@ -353,6 +353,10 @@ typedef struct unified_output_baton_t
   apr_off_t hunk_length[2]; /* 0 == original; 1 == modified */
   apr_off_t hunk_start[2];  /* 0 == original; 1 == modified */
 
+  /* The delimiters of the hunk header, '@@' for text hunks and '##' for
+   * property hunks. */
+  const char *hunk_delimiter;
+
   /* Pool for allocation of temporary memory in the callbacks
      Should be cleared on entry of each iteration of a callback */
   apr_pool_t *pool;
@@ -516,7 +520,7 @@ output_unified_diff_modified(void *baton
   targ_mod = modified_start;
 
   if (btn->next_token + SVN_DIFF__UNIFIED_CONTEXT_SIZE < targ_orig)
-    SVN_ERR(output_unified_flush_hunk(btn, NULL));
+    SVN_ERR(output_unified_flush_hunk(btn, btn->hunk_delimiter));
 
   if (btn->hunk_length[0] == 0
       && btn->hunk_length[1] == 0)
@@ -569,6 +573,7 @@ svn_diff_mem_string_output_unified2(svn_
       baton.pool = svn_pool_create(pool);
       baton.header_encoding = header_encoding;
       baton.hunk = svn_stringbuf_create("", pool);
+      baton.hunk_delimiter = hunk_delimiter;
 
       SVN_ERR(svn_utf_cstring_from_utf8_ex2
               (&(baton.prefix_str[unified_output_context]), " ",

Modified: subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs.h?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs.h Sun Aug  1 18:37:42 2010
@@ -125,6 +125,9 @@ extern "C" {
 /* The minimum format number that supports packed revprop shards. */
 #define SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT 5
 
+/* The minimum format number that supports a configuration file (fsfs.conf) */
+#define SVN_FS_FS__MIN_CONFIG_FILE 4
+
 /* Private FSFS-specific data shared between all svn_txn_t objects that
    relate to a particular transaction in a filesystem (as identified
    by transaction id and filesystem UUID).  Objects of this type are

Modified: subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs_fs.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_fs_fs/fs_fs.c Sun Aug  1 18:37:42 2010
@@ -1275,11 +1275,32 @@ upgrade_body(void *baton, apr_pool_t *po
   fs_fs_data_t *ffd = fs->fsap_data;
   int format, max_files_per_dir;
   const char *format_path = path_format(fs, pool);
+  svn_node_kind_t kind;
 
   /* Read the FS format number and max-files-per-dir setting. */
   SVN_ERR(read_format(&format, &max_files_per_dir, format_path, pool));
 
-  /* If we're already up-to-date, there's nothing to be done here. */
+  /* If the config file does not exist, create one. */
+  SVN_ERR(svn_io_check_path(svn_dirent_join(fs->path, PATH_CONFIG, pool),
+                            &kind, pool));
+  switch (kind)
+    {
+    case svn_node_none:
+      SVN_ERR(write_config(fs, pool));
+      break;
+    case svn_node_file:
+      break;
+    default:
+      return svn_error_return(svn_error_createf(SVN_ERR_FS_GENERAL, NULL,
+                                                _("'%s' is not a regular file."
+                                                  " Please move it out of "
+                                                  "the way and try again"),
+                                                svn_dirent_join(fs->path,
+                                                                PATH_CONFIG,
+                                                                pool)));
+    }
+
+  /* If we're already up-to-date, there's nothing else to be done here. */
   if (format == SVN_FS_FS__FORMAT_NUMBER)
     return SVN_NO_ERROR;
 
@@ -1496,15 +1517,64 @@ svn_fs_fs__hotcopy(const char *src_path,
                       pool));
   SVN_ERR(check_format(format));
 
+  /* Try to copy the config.
+   *
+   * ### We try copying the config file before doing anything else,
+   * ### because higher layers will abort the hotcopy if we throw
+   * ### an error from this function, and that renders the hotcopy
+   * ### unusable anyway. */
+  if (format >= SVN_FS_FS__MIN_CONFIG_FILE)
+    {
+      svn_error_t *err;
+
+      err = svn_io_dir_file_copy(src_path, dst_path, PATH_CONFIG, pool);
+      if (err)
+        {
+          if (APR_STATUS_IS_ENOENT(err->apr_err))
+            {
+              /* 1.6.0 to 1.6.11 did not copy the configuration file during
+               * hotcopy. So if we're hotcopying a repository which has been
+               * created as a hotcopy itself, it's possible that fsfs.conf
+               * does not exist. Ask the user to re-create it.
+               *
+               * ### It would be nice to make this a non-fatal error,
+               * ### but this function does not get an svn_fs_t object
+               * ### so we have no way of just printing a warning via
+               * ### the fs->warning() callback. */
+
+              const char *msg;
+              const char *src_abspath;
+              const char *dst_abspath;
+              const char *config_relpath;
+
+              config_relpath = svn_dirent_join(src_path, PATH_CONFIG, pool);
+              SVN_ERR(svn_dirent_get_absolute(&src_abspath, src_path, pool));
+              SVN_ERR(svn_dirent_get_absolute(&dst_abspath, dst_path, pool));
+              
+              /* ### hack: strip off the 'db/' directory from paths so
+               * ### they make sense to the user */
+              src_abspath = svn_dirent_dirname(src_abspath, pool);
+              dst_abspath = svn_dirent_dirname(dst_abspath, pool);
+
+              msg = apr_psprintf(pool,
+                                 _("Failed to create hotcopy at '%s'. "
+                                   "The file '%s' is missing from the source "
+                                   "repository. Please create this file, for "
+                                   "instance by running 'svnadmin upgrade %s'"),
+                                 dst_abspath, config_relpath, src_abspath);
+              return svn_error_return(svn_error_quick_wrap(err, msg));
+            }
+          else
+            return svn_error_return(err);
+        }
+    }
+
   /* Copy the 'current' file. */
   SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, PATH_CURRENT, pool));
 
   /* Copy the uuid. */
   SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, PATH_UUID, pool));
 
-  /* Copy the config. */
-  SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, PATH_CONFIG, pool));
-
   /* Copy the rep cache before copying the rev files to make sure all
      cached references will be present in the copy. */
   src_subdir = svn_dirent_join(src_path, REP_CACHE_DB_NAME, pool);

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/props.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/props.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/props.c Sun Aug  1 18:37:42 2010
@@ -1031,36 +1031,22 @@ svn_error_t *svn_ra_neon__get_baseline_i
 }
 
 
-/* Helper function for svn_ra_neon__do_proppatch() below. */
-static void
-append_setprop(svn_stringbuf_t *body,
-               const char *name,
-               const svn_string_t *value,
-               apr_pool_t *pool)
+/* Helper function for append_setprop() below. */
+static svn_error_t *
+get_encoding_and_cdata(const char **encoding_p,
+                       const char **cdata_p,
+                       const svn_string_t *value,
+                       apr_pool_t *pool)
 {
-  const char *encoding = "";
+  const char *encoding;
   const char *xml_safe;
-  const char *xml_tag_name;
 
-  /* Map property names to namespaces */
-#define NSLEN (sizeof(SVN_PROP_PREFIX) - 1)
-  if (strncmp(name, SVN_PROP_PREFIX, NSLEN) == 0)
-    {
-      xml_tag_name = apr_pstrcat(pool, "S:", name + NSLEN, NULL);
-    }
-#undef NSLEN
-  else
+  /* Easy out. */
+  if (value == NULL)
     {
-      xml_tag_name = apr_pstrcat(pool, "C:", name, NULL);
-    }
-
-  /* If there is no value, just generate an empty tag and get outta
-     here. */
-  if (! value)
-    {
-      svn_stringbuf_appendcstr(body,
-                               apr_psprintf(pool, "<%s />", xml_tag_name));
-      return;
+      *encoding_p = "";
+      *cdata_p = "";
+      return SVN_NO_ERROR;
     }
 
   /* If a property is XML-safe, XML-encode it.  Else, base64-encode
@@ -1070,6 +1056,7 @@ append_setprop(svn_stringbuf_t *body,
       svn_stringbuf_t *xml_esc = NULL;
       svn_xml_escape_cdata_string(&xml_esc, value, pool);
       xml_safe = xml_esc->data;
+      encoding = "";
     }
   else
     {
@@ -1079,11 +1066,41 @@ append_setprop(svn_stringbuf_t *body,
       xml_safe = base64ed->data;
     }
 
+  *encoding_p = encoding;
+  *cdata_p = xml_safe;
+  return SVN_NO_ERROR;
+}
+
+/* Helper function for svn_ra_neon__do_proppatch() below. */
+static svn_error_t *
+append_setprop(svn_stringbuf_t *body,
+               const char *name,
+               const svn_string_t *value,
+               apr_pool_t *pool)
+{
+  const char *encoding;
+  const char *xml_safe;
+  const char *xml_tag_name;
+
+  /* Map property names to namespaces */
+#define NSLEN (sizeof(SVN_PROP_PREFIX) - 1)
+  if (strncmp(name, SVN_PROP_PREFIX, NSLEN) == 0)
+    {
+      xml_tag_name = apr_pstrcat(pool, "S:", name + NSLEN, NULL);
+    }
+#undef NSLEN
+  else
+    {
+      xml_tag_name = apr_pstrcat(pool, "C:", name, NULL);
+    }
+
+  SVN_ERR(get_encoding_and_cdata(&encoding, &xml_safe, value, pool));
+
   svn_stringbuf_appendcstr(body,
                            apr_psprintf(pool,"<%s %s>%s</%s>",
                                         xml_tag_name, encoding,
                                         xml_safe, xml_tag_name));
-  return;
+  return SVN_NO_ERROR;
 }
 
 
@@ -1124,7 +1141,7 @@ svn_ra_neon__do_proppatch(svn_ra_neon__s
           void *val;
           svn_pool_clear(subpool);
           apr_hash_this(hi, &key, NULL, &val);
-          append_setprop(body, key, val, subpool);
+          SVN_ERR(append_setprop(body, key, val, subpool));
         }
       svn_stringbuf_appendcstr(body, "</D:prop></D:set>");
     }
@@ -1138,7 +1155,7 @@ svn_ra_neon__do_proppatch(svn_ra_neon__s
         {
           const char *name = APR_ARRAY_IDX(prop_deletes, n, const char *);
           svn_pool_clear(subpool);
-          append_setprop(body, name, NULL, subpool);
+          SVN_ERR(append_setprop(body, name, NULL, subpool));
         }
       svn_stringbuf_appendcstr(body, "</D:prop></D:remove>");
     }

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/blame.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/blame.c Sun Aug  1 18:37:42 2010
@@ -483,8 +483,10 @@ svn_ra_serf__get_file_revs(svn_ra_sessio
   err = svn_ra_serf__context_run_wait(&blame_ctx->done, session, pool);
 
   err = svn_error_compose_create(
-                svn_ra_serf__error_on_status(status_code, handler->path),
-                err);
+            svn_ra_serf__error_on_status(status_code,
+                                         handler->path,
+                                         parser_ctx->location),
+            err);
 
   return svn_error_return(err);
 }

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c Sun Aug  1 18:37:42 2010
@@ -220,16 +220,22 @@ static svn_error_t *
 return_response_err(svn_ra_serf__handler_t *handler,
                     svn_ra_serf__simple_request_context_t *ctx)
 {
+  svn_error_t *err;
+
+  /* Ye Olde Fallback Error */
+  err = svn_error_compose_create(
+            ctx->server_error.error,
+            svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+                              "%s of '%s': %d %s",
+                              handler->method, handler->path,
+                              ctx->status, ctx->reason));
+
   /* Try to return one of the standard errors for 301, 404, etc.,
      then look for an error embedded in the response.  */
-  return svn_error_compose_create(
-    svn_ra_serf__error_on_status(ctx->status, handler->path),
-    svn_error_compose_create(
-      ctx->server_error.error,
-      svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
-                        "%s of '%s': %d %s",
-                        handler->method, handler->path,
-                        ctx->status, ctx->reason)));
+  return svn_error_compose_create(svn_ra_serf__error_on_status(ctx->status,
+                                                               handler->path,
+                                                               ctx->location),
+                                  err);
 }
 
 static serf_bucket_t *
@@ -627,6 +633,46 @@ checkout_file(file_context_t *file)
   return SVN_NO_ERROR;
 }
 
+/* Helper function for proppatch_walker() below. */
+static svn_error_t *
+get_encoding_and_cdata(const char **encoding_p,
+                       serf_bucket_t **cdata_bkt_p,
+                       serf_bucket_alloc_t *alloc,
+                       const svn_string_t *value,
+                       apr_pool_t *pool)
+{
+  const char *encoding;
+  const char *cdata;
+  apr_size_t len; /* of cdata */
+
+  SVN_ERR_ASSERT(value);
+
+  /* If a property is XML-safe, XML-encode it.  Else, base64-encode
+     it. */
+  if (svn_xml_is_xml_safe(value->data, value->len))
+    {
+      svn_stringbuf_t *xml_esc = NULL;
+      svn_xml_escape_cdata_string(&xml_esc, value, pool);
+      encoding = NULL;
+      cdata = xml_esc->data;
+      len = xml_esc->len;
+    }
+  else
+    {
+      const svn_string_t *base64ed = svn_base64_encode_string2(value, TRUE,
+                                                               pool);
+      encoding = "base64";
+      cdata = base64ed->data;
+      len = base64ed->len;
+    }
+
+  /* ENCODING, CDATA, and LEN are now set. */
+
+  *encoding_p = encoding;
+  *cdata_bkt_p = SERF_BUCKET_SIMPLE_STRING_LEN(cdata, len, alloc);
+  return SVN_NO_ERROR;
+}
+
 static svn_error_t *
 proppatch_walker(void *baton,
                  const char *ns, apr_ssize_t ns_len,
@@ -635,15 +681,11 @@ proppatch_walker(void *baton,
                  apr_pool_t *pool)
 {
   serf_bucket_t *body_bkt = baton;
+  serf_bucket_t *cdata_bkt;
   serf_bucket_alloc_t *alloc;
-  svn_boolean_t binary_prop;
+  const char *encoding;
   char *prop_name;
 
-  if (svn_xml_is_xml_safe(val->data, val->len))
-    binary_prop = FALSE;
-  else
-    binary_prop = TRUE;
-
   /* Use the namespace prefix instead of adding the xmlns attribute to support
      property names containing ':' */
   if (strcmp(ns, SVN_DAV_PROP_NS_SVN) == 0)
@@ -654,24 +696,14 @@ proppatch_walker(void *baton,
 
   alloc = body_bkt->allocator;
 
+  SVN_ERR(get_encoding_and_cdata(&encoding, &cdata_bkt, alloc, val, pool));
+
   svn_ra_serf__add_open_tag_buckets(body_bkt, alloc, prop_name,
-                                    "V:encoding", binary_prop ? "base64" : NULL,
+                                    "V:encoding", encoding,
                                     NULL);
-
-  if (binary_prop)
-    {
-      serf_bucket_t *tmp_bkt;
-      val = svn_base64_encode_string2(val, TRUE, pool);
-      tmp_bkt = SERF_BUCKET_SIMPLE_STRING_LEN(val->data, val->len, alloc);
-      serf_bucket_aggregate_append(body_bkt, tmp_bkt);
-    }
-  else
-    {
-      svn_ra_serf__add_cdata_len_buckets(body_bkt, alloc, val->data, val->len);
-    }
-
-
+  serf_bucket_aggregate_append(body_bkt, cdata_bkt);
   svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, prop_name);
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocations.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocations.c Sun Aug  1 18:37:42 2010
@@ -277,7 +277,9 @@ svn_ra_serf__get_locations(svn_ra_sessio
   err = svn_ra_serf__context_run_wait(&loc_ctx->done, session, pool);
 
   SVN_ERR(svn_error_compose_create(
-              svn_ra_serf__error_on_status(loc_ctx->status_code, req_url),
+              svn_ra_serf__error_on_status(loc_ctx->status_code,
+                                           req_url,
+                                           parser_ctx->location),
               err));
 
   return SVN_NO_ERROR;

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocationsegments.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/getlocationsegments.c Sun Aug  1 18:37:42 2010
@@ -181,7 +181,7 @@ svn_ra_serf__get_location_segments(svn_r
   svn_ra_serf__handler_t *handler;
   svn_ra_serf__xml_parser_t *parser_ctx;
   const char *relative_url, *basecoll_url, *req_url;
-  svn_error_t *err;
+  svn_error_t *err, *err2;
 
   gls_ctx = apr_pcalloc(pool, sizeof(*gls_ctx));
   gls_ctx->path = path;
@@ -230,8 +230,15 @@ svn_ra_serf__get_location_segments(svn_r
                             _("Location segment report failed on '%s'@'%ld'"),
                               path, peg_revision);
 
-  /* ### Leaks err */
-  SVN_ERR(svn_ra_serf__error_on_status(gls_ctx->status_code, handler->path));
+  err2 = svn_ra_serf__error_on_status(gls_ctx->status_code,
+                                      handler->path,
+                                      parser_ctx->location);
+  if (err2)
+    {
+      /* Prefer err2 to err. */
+      svn_error_clear(err);
+      return err2;
+    }
 
   svn_pool_destroy(gls_ctx->subpool);
 

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/mergeinfo.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/mergeinfo.c Sun Aug  1 18:37:42 2010
@@ -290,12 +290,12 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
 
   err = svn_ra_serf__context_run_wait(&mergeinfo_ctx->done, session, pool);
 
-  err2 = svn_ra_serf__error_on_status(status_code, handler->path);
-
+  err2 = svn_ra_serf__error_on_status(status_code, handler->path,
+                                      parser_ctx->location);
   if (err2)
     {
       svn_error_clear(err);
-      SVN_ERR(err2);
+      return err2;
     }
 
   SVN_ERR(err);

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/options.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/options.c Sun Aug  1 18:37:42 2010
@@ -490,15 +490,20 @@ svn_ra_serf__exchange_capabilities(svn_r
                                    apr_pool_t *pool)
 {
   svn_ra_serf__options_context_t *opt_ctx;
+  svn_error_t *err;
 
   /* This routine automatically fills in serf_sess->capabilities */
   svn_ra_serf__create_options_req(&opt_ctx, serf_sess, serf_sess->conns[0],
                                   serf_sess->repos_url.path, pool);
 
-  SVN_ERR(svn_ra_serf__context_run_wait(
-    svn_ra_serf__get_options_done_ptr(opt_ctx), serf_sess, pool));
+  err = svn_ra_serf__context_run_wait(
+            svn_ra_serf__get_options_done_ptr(opt_ctx), serf_sess, pool);
 
-  return SVN_NO_ERROR;
+  return svn_error_compose_create(
+             svn_ra_serf__error_on_status(opt_ctx->status_code,
+                                          serf_sess->repos_url.path,
+                                          opt_ctx->parser_ctx->location),
+             err);
 }
 
 

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/property.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/property.c Sun Aug  1 18:37:42 2010
@@ -700,7 +700,8 @@ svn_ra_serf__wait_for_props(svn_ra_serf_
 
   err = svn_ra_serf__context_run_wait(&prop_ctx->done, sess, pool);
 
-  err2 = svn_ra_serf__error_on_status(prop_ctx->status_code, prop_ctx->path);
+  err2 = svn_ra_serf__error_on_status(prop_ctx->status_code,
+                                      prop_ctx->path, NULL);
   if (err2)
     {
       svn_error_clear(err);

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h Sun Aug  1 18:37:42 2010
@@ -623,6 +623,10 @@ struct svn_ra_serf__xml_parser_t {
    */
   int *status_code;
 
+  /* If non-NULL, this is the value of the response's Location header.
+   */
+  const char *location;
+
   /* If non-NULL, this value will be set to TRUE when the response is
    * completed.
    */
@@ -686,6 +690,10 @@ typedef struct svn_ra_serf__simple_reque
   /* The HTTP status line of the response */
   const char *reason;
 
+  /* The Location header value of the response, or NULL if there
+     wasn't one. */
+  const char *location;
+
   /* This value is set to TRUE when the response is completed. */
   svn_boolean_t done;
 
@@ -775,6 +783,13 @@ svn_ra_serf__response_discard_handler(se
                                       void *baton,
                                       apr_pool_t *pool);
 
+/* Return the value of the RESPONSE's Location header if any, or NULL
+ * otherwise.  All allocations will be made in POOL.
+ */
+const char *
+svn_ra_serf__response_get_location(serf_bucket_t *response,
+                                   apr_pool_t *pool);
+
 /** XML helper functions. **/
 
 /*
@@ -1499,11 +1514,14 @@ svn_ra_serf__encode_auth_header(const ch
 /*** General utility functions ***/
 
 /**
- * Convert an HTTP status code resulting from a WebDAV request to the relevant
- * error code.
+ * Convert an HTTP STATUS_CODE resulting from a WebDAV request against
+ * PATH to the relevant error code.  Use the response-supplied LOCATION
+ * where it necessary.
  */
 svn_error_t *
-svn_ra_serf__error_on_status(int status_code, const char *path);
+svn_ra_serf__error_on_status(int status_code,
+                             const char *path,
+                             const char *location);
 
 #ifdef __cplusplus
 }

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/update.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/update.c Sun Aug  1 18:37:42 2010
@@ -995,11 +995,15 @@ handle_stream(serf_request_t *request,
 {
   report_fetch_t *fetch_ctx = handler_baton;
   serf_status_line sl;
+  const char *location;
 
   serf_bucket_response_status(response, &sl);
 
   /* Woo-hoo.  Nothing here to see.  */
-  fetch_ctx->err = svn_ra_serf__error_on_status(sl.code, fetch_ctx->info->name);
+  location = svn_ra_serf__response_get_location(response, pool);
+  fetch_ctx->err = svn_ra_serf__error_on_status(sl.code,
+                                                fetch_ctx->info->name,
+                                                location);
   if (fetch_ctx->err)
     {
       fetch_ctx->done = TRUE;

Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/util.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/util.c Sun Aug  1 18:37:42 2010
@@ -804,6 +804,18 @@ svn_ra_serf__response_discard_handler(se
     }
 }
 
+const char *
+svn_ra_serf__response_get_location(serf_bucket_t *response,
+                                   apr_pool_t *pool)
+{
+  serf_bucket_t *headers;
+  const char *val;
+
+  headers = serf_bucket_response_get_headers(response);
+  val = serf_bucket_headers_get(headers, "Location");
+  return val ? svn_uri_canonicalize(val, pool) : NULL;
+}
+
 /* Implements svn_ra_serf__response_handler_t */
 svn_error_t *
 svn_ra_serf__handle_status_only(serf_request_t *request,
@@ -826,7 +838,7 @@ svn_ra_serf__handle_status_only(serf_req
 
       ctx->status = sl.code;
       ctx->reason = sl.reason;
-
+      ctx->location = svn_ra_serf__response_get_location(response, pool);
       ctx->done = TRUE;
     }
 
@@ -986,6 +998,7 @@ svn_ra_serf__handle_multistatus_only(ser
 
       ctx->status = sl.code;
       ctx->reason = sl.reason;
+      ctx->location = svn_ra_serf__response_get_location(response, pool);
     }
 
   return svn_error_return(err);
@@ -1060,6 +1073,11 @@ svn_ra_serf__handle_xml_parser(serf_requ
       *ctx->status_code = sl.code;
     }
 
+  if (sl.code == 301 || sl.code == 302)
+    {
+      ctx->location = svn_ra_serf__response_get_location(response, pool);
+    }
+
   /* Woo-hoo.  Nothing here to see.  */
   if (sl.code == 404 && ctx->ignore_errors == FALSE)
     {
@@ -1702,18 +1720,20 @@ svn_ra_serf__report_resource(const char 
 }
 
 svn_error_t *
-svn_ra_serf__error_on_status(int status_code, const char *path)
+svn_ra_serf__error_on_status(int status_code,
+                             const char *path,
+                             const char *location)
 {
   switch(status_code)
     {
       case 301:
       case 302:
         return svn_error_createf(SVN_ERR_RA_DAV_RELOCATED, NULL,
-                        (status_code == 301)
-                        ? _("Repository moved permanently to '%s';"
-                            " please relocate")
-                        : _("Repository moved temporarily to '%s';"
-                            " please relocate"), path);
+                                 (status_code == 301)
+                                 ? _("Repository moved permanently to '%s';"
+                                     " please relocate")
+                                 : _("Repository moved temporarily to '%s';"
+                                     " please relocate"), location);
       case 404:
         return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
                                  _("'%s' path not found"), path);

Modified: subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_files.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_files.c Sun Aug  1 18:37:42 2010
@@ -597,9 +597,11 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
                             svn_depth_t depth,
                             apr_pool_t *scratch_pool)
 {
-  const svn_wc_entry_t *entry;
   int format;
   const char *repos_relpath;
+  svn_wc__db_status_t status;
+  const char *db_repos_relpath, *db_repos_root_url, *db_repos_uuid;
+  svn_revnum_t db_revision;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(url != NULL);
@@ -622,40 +624,60 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
                                      repos_relpath, repos_root_url, repos_uuid,
                                      revision, depth, scratch_pool));
 
-  /* Now, get the existing url and repos for PATH. */
-  SVN_ERR(svn_wc__get_entry(&entry, db, local_abspath, FALSE, svn_node_unknown,
-                            FALSE, scratch_pool, scratch_pool));
+  SVN_ERR(svn_wc__db_read_info(&status, NULL,
+                               &db_revision, &db_repos_relpath,
+                               &db_repos_root_url, &db_repos_uuid,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL,
+                               db, local_abspath, scratch_pool, scratch_pool));
 
-  /* When the directory exists and is scheduled for deletion do not
-   * check the revision or the URL.  The revision can be any
+  /* When the directory exists and is scheduled for deletion or is not-present
+   * do not check the revision or the URL.  The revision can be any
    * arbitrary revision and the URL may differ if the add is
    * being driven from a merge which will have a different URL. */
-  if (entry->schedule != svn_wc_schedule_delete)
+  if (status != svn_wc__db_status_deleted
+      && status != svn_wc__db_status_obstructed_delete
+      && status != svn_wc__db_status_not_present)
     {
-      if (entry->revision != revision)
+      /* ### Should we match copyfrom_revision? */
+      if (db_revision != revision)
         return
           svn_error_createf(SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
                             _("Revision %ld doesn't match existing "
                               "revision %ld in '%s'"),
-                            revision, entry->revision, local_abspath);
+                            revision, db_revision, local_abspath);
 
       /* The caller gives us a URL which should match the entry. However,
          some callers compensate for an old problem in entry->url and pass
          the copyfrom_url instead. See ^/notes/api-errata/wc002.txt. As
          a result, we allow the passed URL to match copyfrom_url if it
-         does match the entry's primary URL.  */
-      /** ### comparing URLs, should they be canonicalized first? */
-      if (strcmp(entry->url, url) != 0
-          && (entry->copyfrom_url == NULL
-              || strcmp(entry->copyfrom_url, url) != 0)
-          && (!svn_uri_is_ancestor(repos_root_url, entry->url)
-              || strcmp(entry->uuid, repos_uuid) != 0))
+         does not match the entry's primary URL.  */
+      /* ### comparing URLs, should they be canonicalized first? */
+      if (strcmp(db_repos_uuid, repos_uuid)
+          || strcmp(db_repos_root_url, repos_root_url)
+          || !svn_relpath_is_ancestor(db_repos_relpath, repos_relpath))
         {
-          return
-            svn_error_createf(SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
-                              _("URL '%s' doesn't match existing "
-                                "URL '%s' in '%s'"),
-                              url, entry->url, local_abspath);
+          const char *copyfrom_root_url, *copyfrom_repos_relpath;
+
+          SVN_ERR(svn_wc__internal_get_copyfrom_info(&copyfrom_root_url,
+                                                     &copyfrom_repos_relpath,
+                                                     NULL, NULL, NULL,
+                                                     db, local_abspath,
+                                                     scratch_pool,
+                                                     scratch_pool));
+
+          if (copyfrom_root_url == NULL
+              || strcmp(copyfrom_root_url, repos_root_url)
+              || strcmp(copyfrom_repos_relpath, repos_relpath))
+            return
+              svn_error_createf(SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
+                                _("URL '%s' doesn't match existing "
+                                  "URL '%s' in '%s'"),
+                                url,
+                                svn_uri_join(db_repos_root_url,
+                                             db_repos_relpath, scratch_pool),
+                                local_abspath);
         }
     }
 

Modified: subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_ops.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_wc/adm_ops.c Sun Aug  1 18:37:42 2010
@@ -1653,7 +1653,17 @@ revert_internal(svn_wc__db_t *db,
   else if (err)
     return svn_error_return(err);
   else
-    unversioned = FALSE;
+    switch (status)
+      {
+        case svn_wc__db_status_not_present:
+        case svn_wc__db_status_absent:
+        case svn_wc__db_status_excluded:
+          unversioned = TRUE;
+          break;
+        default:
+          unversioned = FALSE;
+          break;
+      }
 
   SVN_ERR(svn_wc__db_op_read_tree_conflict(&tree_conflict, db, local_abspath,
                                            pool, pool));
@@ -1666,9 +1676,13 @@ revert_internal(svn_wc__db_t *db,
   SVN_ERR(svn_io_check_path(local_abspath, &disk_kind, pool));
   if (!unversioned && (db_kind == svn_wc__db_kind_dir))
     {
+#ifndef SVN_WC__SINGLE_DB
       if ((disk_kind != svn_node_dir)
           && (status != svn_wc__db_status_added)
           && (status != svn_wc__db_status_obstructed_add))
+#else
+      if (disk_kind == svn_node_file)
+#endif
         {
           /* When the directory itself is missing, we can't revert without
              hitting the network.  Someday a '--force' option will
@@ -1687,7 +1701,9 @@ revert_internal(svn_wc__db_t *db,
 
   /* Safeguard 2:  can we handle this entry's recorded kind? */
   if (!unversioned
-      && (db_kind != svn_wc__db_kind_file) && (db_kind != svn_wc__db_kind_dir))
+      && (db_kind != svn_wc__db_kind_file)
+      && (db_kind != svn_wc__db_kind_dir)
+      && (db_kind != svn_wc__db_kind_symlink))
     return svn_error_createf
       (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
        _("Cannot revert '%s': unsupported entry node kind"),

Modified: subversion/branches/atomic-revprop/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_wc/node.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_wc/node.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_wc/node.c Sun Aug  1 18:37:42 2010
@@ -467,17 +467,16 @@ svn_wc__node_get_repos_relpath(const cha
 }
 
 svn_error_t *
-svn_wc__node_get_copyfrom_info(const char **copyfrom_root_url,
-                               const char **copyfrom_repos_relpath,
-                               const char **copyfrom_url,
-                               svn_revnum_t *copyfrom_rev,
-                               svn_boolean_t *is_copy_target,
-                               svn_wc_context_t *wc_ctx,
-                               const char *local_abspath,
-                               apr_pool_t *result_pool,
-                               apr_pool_t *scratch_pool)
+svn_wc__internal_get_copyfrom_info(const char **copyfrom_root_url,
+                                   const char **copyfrom_repos_relpath,
+                                   const char **copyfrom_url,
+                                   svn_revnum_t *copyfrom_rev,
+                                   svn_boolean_t *is_copy_target,
+                                   svn_wc__db_t *db,
+                                   const char *local_abspath,
+                                   apr_pool_t *result_pool,
+                                   apr_pool_t *scratch_pool)
 {
-  svn_wc__db_t *db = wc_ctx->db;
   const char *original_root_url;
   const char *original_repos_relpath;
   svn_revnum_t original_revision;
@@ -544,11 +543,12 @@ svn_wc__node_get_copyfrom_info(const cha
 
           /* This is a copied node, so we should never fall off the top of a
            * working copy here. */
-          SVN_ERR(svn_wc__node_get_copyfrom_info(NULL, NULL,
-                                                 &parent_copyfrom_url,
-                                                 NULL, NULL,
-                                                 wc_ctx, parent_abspath,
-                                                 scratch_pool, scratch_pool));
+          SVN_ERR(svn_wc__internal_get_copyfrom_info(NULL, NULL,
+                                                     &parent_copyfrom_url,
+                                                     NULL, NULL,
+                                                     db, parent_abspath,
+                                                     scratch_pool,
+                                                     scratch_pool));
 
           /* So, count this as a separate copy target only if the URLs
            * don't match up, or if the parent isn't copied at all. */
@@ -607,8 +607,39 @@ svn_wc__node_get_copyfrom_info(const cha
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc__node_get_copyfrom_info(const char **copyfrom_root_url,
+                               const char **copyfrom_repos_relpath,
+                               const char **copyfrom_url,
+                               svn_revnum_t *copyfrom_rev,
+                               svn_boolean_t *is_copy_target,
+                               svn_wc_context_t *wc_ctx,
+                               const char *local_abspath,
+                               apr_pool_t *result_pool,
+                               apr_pool_t *scratch_pool)
+{
+  return
+    svn_error_return(svn_wc__internal_get_copyfrom_info(copyfrom_root_url,
+                                                        copyfrom_repos_relpath,
+                                                        copyfrom_url,
+                                                        copyfrom_rev,
+                                                        is_copy_target,
+                                                        wc_ctx->db,
+                                                        local_abspath,
+                                                        result_pool,
+                                                        scratch_pool));
+}
 
-/* A recursive node-walker, helper for svn_wc__node_walk_children(). */
+/* A recursive node-walker, helper for svn_wc__node_walk_children().
+ *
+ * Call WALK_CALLBACK with WALK_BATON on all children (recursively) of
+ * DIR_ABSPATH in DB, but not on DIR_ABSPATH itself. DIR_ABSPATH must be a
+ * versioned directory. If SHOW_HIDDEN is true, visit hidden nodes, else
+ * ignore them. Restrict the depth of the walk to DEPTH.
+ *
+ * ### Is it possible for a subdirectory to be hidden and known to be a
+ *     directory?  If so, and if show_hidden is true, this will try to
+ *     recurse into it.  */
 static svn_error_t *
 walker_helper(svn_wc__db_t *db,
               const char *dir_abspath,

Modified: subversion/branches/atomic-revprop/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_wc/status.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_wc/status.c Sun Aug  1 18:37:42 2010
@@ -1786,7 +1786,6 @@ mark_deleted(void *baton,
    a deletion.  Use POOL for all allocations. */
 static svn_error_t *
 handle_statii(struct edit_baton *eb,
-              const char *local_abspath,
               const char *dir_repos_root_url,
               const char *dir_repos_relpath,
               apr_hash_t *statii,
@@ -1809,7 +1808,7 @@ handle_statii(struct edit_baton *eb,
       status_baton = &sb;
     }
 
-  /* Loop over all the statuses still in our hash, handling each one. */
+  /* Loop over all the statii still in our hash, handling each one. */
   for (hi = apr_hash_first(pool, statii); hi; hi = apr_hash_next(hi))
     {
       const char *local_abspath = svn__apr_hash_index_key(hi);
@@ -2070,7 +2069,7 @@ close_directory(void *dir_baton,
         was_deleted = TRUE;
 
       /* Now do the status reporting. */
-      SVN_ERR(handle_statii(eb, db->local_abspath,
+      SVN_ERR(handle_statii(eb,
                             dir_status ? dir_status->repos_root_url : NULL,
                             dir_status ? dir_status->repos_relpath : NULL,
                             db->statii, was_deleted, db->depth, pool));
@@ -2116,7 +2115,7 @@ close_directory(void *dir_baton,
           /* Otherwise, we report on all our children and ourself.
              Note that our directory couldn't have been deleted,
              because it is the root of the edit drive. */
-          SVN_ERR(handle_statii(eb, eb->anchor_abspath,
+          SVN_ERR(handle_statii(eb,
                                 eb->anchor_status->repos_root_url,
                                 eb->anchor_status->repos_relpath,
                                 db->statii, FALSE, eb->default_depth, pool));
@@ -2430,7 +2429,7 @@ svn_wc_walk_status(svn_wc_context_t *wc_
 {
   svn_node_kind_t kind;
   struct walk_status_baton wb;
-  svn_io_dirent2_t *dirent;
+  const svn_io_dirent2_t *dirent;
   const char *anchor_abspath, *target_name;
   svn_boolean_t skip_root;
 

Modified: subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.c Sun Aug  1 18:37:42 2010
@@ -2676,6 +2676,32 @@ svn_wc__db_pristine_get_sha1(const svn_c
 }
 
 
+/* Delete the pristine text referenced by SHA1_CHECKSUM in the database
+ * referenced by PDH. */
+static svn_error_t *
+pristine_remove(svn_wc__db_pdh_t *pdh,
+                const svn_checksum_t *sha1_checksum,
+                apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+  const char *pristine_abspath;
+
+  /* Remove the DB row. */
+  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                    STMT_DELETE_PRISTINE));
+  SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
+  SVN_ERR(svn_sqlite__update(NULL, stmt));
+
+  /* Remove the file */
+  SVN_ERR(get_pristine_fname(&pristine_abspath, pdh->wcroot->abspath,
+                             sha1_checksum, TRUE /* create_subdir */,
+                             scratch_pool, scratch_pool));
+  SVN_ERR(svn_io_remove_file2(pristine_abspath, TRUE /* ignore_enoent */,
+                              scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_wc__db_pristine_remove(svn_wc__db_t *db,
                            const char *wri_abspath,
@@ -2701,6 +2727,21 @@ svn_wc__db_pristine_remove(svn_wc__db_t 
                               scratch_pool, scratch_pool));
   VERIFY_USABLE_PDH(pdh);
 
+  /* If the work queue is not empty, don't delete any pristine text because
+   * the work queue may contain a reference to it. */
+  {
+    svn_sqlite__stmt_t *stmt;
+    svn_boolean_t have_row;
+
+    SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                      STMT_LOOK_FOR_WORK));
+    SVN_ERR(svn_sqlite__step(&have_row, stmt));
+    SVN_ERR(svn_sqlite__reset(stmt));
+
+    if (have_row)
+      return SVN_NO_ERROR;
+  }
+
   /* Find whether the SHA-1 (or the MD-5) is referenced; set IS_REFERENCED. */
   {
     const svn_checksum_t *md5_checksum;
@@ -2720,24 +2761,10 @@ svn_wc__db_pristine_remove(svn_wc__db_t 
     SVN_ERR(svn_sqlite__reset(stmt));
   }
 
-  /* If not referenced, remove first the PRISTINE table row, then the file. */
+  /* If not referenced, remove the PRISTINE table row and the file. */
   if (! is_referenced)
     {
-      svn_sqlite__stmt_t *stmt;
-      const char *pristine_abspath;
-
-      /* Remove the DB row. */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
-                                        STMT_DELETE_PRISTINE));
-      SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
-      SVN_ERR(svn_sqlite__update(NULL, stmt));
-
-      /* Remove the file */
-      SVN_ERR(get_pristine_fname(&pristine_abspath, pdh->wcroot->abspath,
-                                 sha1_checksum,
-                                 TRUE /* create_subdir */,
-                                 scratch_pool, scratch_pool));
-      SVN_ERR(svn_io_remove_file2(pristine_abspath, TRUE, scratch_pool));
+      SVN_ERR(pristine_remove(pdh, sha1_checksum, scratch_pool));
     }
 
   return SVN_NO_ERROR;
@@ -8348,6 +8375,8 @@ svn_wc__db_wclock_release(svn_wc__db_t *
             case svn_wc__db_status_obstructed_delete:
               return SVN_NO_ERROR; /* Administrative area missing
                                       -> Lock gone */
+            default:
+              break;
           }
       SVN_ERR_ASSERT(*local_relpath == '\0');
     }

Modified: subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.h?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_wc/wc_db.h Sun Aug  1 18:37:42 2010
@@ -2536,6 +2536,17 @@ svn_wc__db_drop_root(svn_wc__db_t *db,
                      const char *local_abspath,
                      apr_pool_t *scratch_pool);
 
+/* Internal version of svn_wc__node_get_copyfrom_info */
+svn_error_t *
+svn_wc__internal_get_copyfrom_info(const char **copyfrom_root_url,
+                                   const char **copyfrom_repos_relpath,
+                                   const char **copyfrom_url,
+                                   svn_revnum_t *copyfrom_rev,
+                                   svn_boolean_t *is_copy_target,
+                                   svn_wc__db_t *db,
+                                   const char *local_abspath,
+                                   apr_pool_t *result_pool,
+                                   apr_pool_t *scratch_pool);
 /* @} */
 
 

Modified: subversion/branches/atomic-revprop/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_wc/workqueue.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_wc/workqueue.c Sun Aug  1 18:37:42 2010
@@ -293,6 +293,16 @@ run_revert(svn_wc__db_t *db,
     {
       SVN__NOT_IMPLEMENTED();
     }
+#ifdef SVN_WC__SINGLE_DB
+  else if (kind == svn_wc__db_kind_dir)
+    {
+      svn_node_kind_t disk_kind;
+      SVN_ERR(svn_io_check_path(local_abspath, &disk_kind, scratch_pool));
+
+      if (disk_kind == svn_node_none)
+        SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
+    }
+#endif
 
   if (kind == svn_wc__db_kind_dir)
     parent_abspath = local_abspath;

Propchange: subversion/branches/atomic-revprop/subversion/svnrdump/dump_editor.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: subversion/branches/atomic-revprop/subversion/svnrdump/dump_editor.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.c (original)
+++ subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.c Sun Aug  1 18:37:42 2010
@@ -22,11 +22,14 @@
  * ====================================================================
  */
 
+#include "svn_dirent_uri.h"
+#include "svn_cmdline.h"
 #include "svn_pools.h"
 #include "svn_delta.h"
 #include "svn_repos.h"
+#include "svn_props.h"
 #include "svn_ra.h"
-#include "svn_cmdline.h"
+#include "svn_io.h"
 
 #include "load_editor.h"
 
@@ -35,61 +38,368 @@ commit_callback(const svn_commit_info_t 
                 void *baton,
                 apr_pool_t *pool)
 {
-  SVN_ERR(svn_cmdline_printf(pool, "r%ld committed by %s at %s\n",
-                             commit_info->revision,
-                             (commit_info->author
-                              ? commit_info->author : "(no author)"),
-                             commit_info->date));
+  SVN_ERR(svn_cmdline_printf(pool, "* Loaded revision %ld\n",
+                             commit_info->revision));
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+new_revision_record(void **revision_baton,
+		    apr_hash_t *headers,
+		    void *parse_baton,
+		    apr_pool_t *pool)
+{
+  struct revision_baton *rb;
+  struct parse_baton *pb;
+  apr_hash_index_t *hi;
+
+  rb = apr_pcalloc(pool, sizeof(*rb));
+  pb = parse_baton;
+  pb->pool = svn_pool_create(pool);
+  rb->pb = pb;
+
+  for (hi = apr_hash_first(pool, headers); hi; hi = apr_hash_next(hi))
+    {
+      const void *key;
+      void *val;
+      const char *hname, *hval;
+
+      apr_hash_this(hi, &key, NULL, &val);
+      hname = key;
+      hval = val;
+
+      if (strcmp(hname, SVN_REPOS_DUMPFILE_REVISION_NUMBER) == 0)
+        rb->rev = atoi(hval);
+    }
+  /* Set the commit_editor/ commit_edit_baton to NULL and wait for
+     them to be created in new_node_record */
+  
+  rb->pb->commit_editor = NULL;
+  rb->pb->commit_edit_baton = NULL;
+  rb->revprop_table = apr_hash_make(pb->pool);
+
+  *revision_baton = rb;
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+uuid_record(const char *uuid,
+            void *parse_baton,
+            apr_pool_t *pool)
+{
+  struct parse_baton *pb;
+  pb = parse_baton;
+  pb->uuid = apr_pstrdup(pool, uuid);
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+new_node_record(void **node_baton,
+                apr_hash_t *headers,
+                void *revision_baton,
+                apr_pool_t *pool)
+{
+  struct node_baton *nb;
+  struct revision_baton *rb;
+  apr_hash_index_t *hi;
+  void *file_baton;
+  void *child_baton;
+  const struct svn_delta_editor_t *commit_editor;
+  void *commit_edit_baton;
+  struct commit_edit_baton *eb;
+  void *root_baton;
+
+  rb = revision_baton;
+  nb = apr_pcalloc(rb->pb->pool, sizeof(*nb));
+  nb->rb = rb;
+
+  nb->copyfrom_path = NULL;
+  nb->copyfrom_rev = SVN_INVALID_REVNUM;
+
+  commit_editor = rb->pb->commit_editor;
+  commit_edit_baton = rb->pb->commit_edit_baton;
+
+  /* If the creation of commit_editor is pending, create it now and
+     open_root on it */
+  if (!commit_editor) {
+      SVN_ERR(svn_ra_get_commit_editor3(rb->pb->session, &commit_editor,
+                                        &commit_edit_baton, rb->revprop_table,
+                                        commit_callback, NULL, NULL, FALSE,
+                                        rb->pb->pool));
+
+      rb->pb->commit_editor = commit_editor;
+      rb->pb->commit_edit_baton = commit_edit_baton;
+
+      SVN_ERR(commit_editor->open_root(commit_edit_baton, rb->rev - 1,
+                                       rb->pb->pool, &root_baton));
+      rb->dir_baton = root_baton;
+
+  }
+
+  for (hi = apr_hash_first(rb->pb->pool, headers); hi; hi = apr_hash_next(hi))
+    {
+      const void *key;
+      void *val;
+      const char *hname, *hval;
+
+      apr_hash_this(hi, &key, NULL, &val);
+      hname = key;
+      hval = val;
+
+      /* Parse the different kinds of headers we can encounter and
+         stuff them into the node_baton for writing later */
+      if (strcmp(hname, SVN_REPOS_DUMPFILE_NODE_PATH) == 0)
+        nb->path = apr_pstrdup(rb->pb->pool, hval);
+      if (strcmp(hname, SVN_REPOS_DUMPFILE_NODE_KIND) == 0)
+        nb->kind = strcmp(hval, "file") == 0 ? svn_node_file : svn_node_dir;
+      if (strcmp(hname, SVN_REPOS_DUMPFILE_NODE_ACTION) == 0)
+        {
+          if (strcmp(hval, "add") == 0)
+            nb->action = svn_node_action_add;
+          if (strcmp(hval, "change") == 0)
+            nb->action = svn_node_action_change;
+          if (strcmp(hval, "delete") == 0)
+            nb->action = svn_node_action_delete;
+          if (strcmp(hval, "replace") == 0)
+            nb->action = svn_node_action_replace;
+        }
+      if (strcmp(hname, SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV) == 0)
+        nb->copyfrom_rev = atoi(hval);
+      if (strcmp(hname, SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH) == 0)
+        {
+          /* Due to a historical detail in the commit editor, it
+             demands that the copyfrom_path includes the URI to the
+             repository; to implement this, the edit_baton structure
+             from commit.c had to be imported as a commit_edit_baton
+             structure in load_editor.h */
+          eb = commit_edit_baton;
+          nb->copyfrom_path = svn_uri_join(eb->repos_url,
+                                           apr_pstrdup(rb->pb->pool, hval),
+                                           rb->pb->pool);
+        }
+    }
+
+  switch (nb->action)
+    {
+    case svn_node_action_add:
+      if (nb->kind == svn_node_file)
+        {
+          SVN_ERR(commit_editor->add_file(nb->path, nb->rb->dir_baton,
+                                          nb->copyfrom_path, nb->copyfrom_rev,
+                                          rb->pb->pool, &file_baton));
+          nb->file_baton = file_baton;
+        }
+      else if(nb->kind == svn_node_dir)
+        {
+          SVN_ERR(commit_editor->add_directory(nb->path, nb->rb->dir_baton,
+                                               nb->copyfrom_path, nb->copyfrom_rev,
+                                               rb->pb->pool, &child_baton));
+          nb->rb->dir_baton = child_baton;
+        }
+      break;
+    default:
+      break;
+    }
+
+  *node_baton = nb;
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+set_revision_property(void *baton,
+                      const char *name,
+                      const svn_string_t *value)
+{
+  struct revision_baton *rb;
+  rb = baton;
+
+  if (rb->rev > 0)
+    {
+      apr_hash_set(rb->revprop_table, apr_pstrdup(rb->pb->pool, name),
+                   APR_HASH_KEY_STRING, svn_string_dup(value, rb->pb->pool));
+    }
+  else
+    /* Special handling for revision 0; this is safe because the
+       commit_editor hasn't been created yet. */
+    svn_ra_change_rev_prop(rb->pb->session, rb->rev, name, value,
+                           rb->pb->pool);
+
+  /* Remember any datestamp/ author that passes through (see comment
+     in close_revision). */
+  if (!strcmp(name, SVN_PROP_REVISION_DATE))
+    rb->datestamp = svn_string_dup(value, rb->pb->pool);
+  if (!strcmp(name, SVN_PROP_REVISION_AUTHOR))
+    rb->author = svn_string_dup(value, rb->pb->pool);
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+set_node_property(void *baton,
+                  const char *name,
+                  const svn_string_t *value)
+{
+  struct node_baton *nb;
+  const struct svn_delta_editor_t *commit_editor;
+  apr_pool_t *pool;
+  nb = baton;
+  commit_editor = nb->rb->pb->commit_editor;
+  pool = nb->rb->pb->pool;
+
+  if (nb->kind == svn_node_file)
+    SVN_ERR(commit_editor->change_file_prop(nb->file_baton, name,
+                                            value, pool));
+  else
+    SVN_ERR(commit_editor->change_dir_prop(nb->rb->dir_baton, name,
+                                           value, pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+delete_node_property(void *baton,
+                     const char *name)
+{
+  struct node_baton *nb;
+  const struct svn_delta_editor_t *commit_editor;
+  apr_pool_t *pool;
+  nb = baton;
+  commit_editor = nb->rb->pb->commit_editor;
+  pool = nb->rb->pb->pool;
+
+  if (nb->kind == svn_node_file)
+    SVN_ERR(commit_editor->change_file_prop(nb->file_baton, name,
+                                            NULL, pool));
+  else
+    SVN_ERR(commit_editor->change_dir_prop(nb->rb->dir_baton, name,
+                                           NULL, pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+remove_node_props(void *baton)
+{
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+set_fulltext(svn_stream_t **stream,
+             void *node_baton)
+{
+  /* ### Not implemented */
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+apply_textdelta(svn_txdelta_window_handler_t *handler,
+                void **handler_baton,
+                void *node_baton)
+{
+  struct node_baton *nb;
+  const struct svn_delta_editor_t *commit_editor;
+  apr_pool_t *pool;
+  nb = node_baton;
+  commit_editor = nb->rb->pb->commit_editor;
+  pool = nb->rb->pb->pool;
+  return commit_editor->apply_textdelta(nb->file_baton, NULL, pool,
+                                        handler, handler_baton);
+}
+
+static svn_error_t *
+close_node(void *baton)
+{
+  struct node_baton *nb;
+  const struct svn_delta_editor_t *commit_editor;
+  apr_pool_t * pool;
+  nb = baton;
+  pool = nb->rb->pb->pool;
+  commit_editor = nb->rb->pb->commit_editor;
+  if (nb->kind == svn_node_file)
+    SVN_ERR(commit_editor->close_file(nb->file_baton, NULL,
+                                      pool));
+  else if (nb->kind == svn_node_dir)
+    SVN_ERR(commit_editor->close_directory(nb->rb->dir_baton,
+                                           pool));
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+close_revision(void *baton)
+{
+  struct revision_baton *rb;
+  const svn_delta_editor_t *commit_editor;
+  void *commit_edit_baton;
+  rb = baton;
+
+  commit_editor = rb->pb->commit_editor;
+  commit_edit_baton = rb->pb->commit_edit_baton;
+
+  /* r0 doesn't have a corresponding commit_editor; we fake it */
+  if (rb->rev == 0)
+    SVN_ERR(svn_cmdline_printf(rb->pb->pool, "* Loaded revision 0\n"));
+  else
+    SVN_ERR(commit_editor->close_edit(commit_edit_baton, rb->pb->pool));
+
+  /* svn_fs_commit_txn rewrites the datestamp/ author property-
+     rewrite it by hand after closing the commit_editor. */
+  SVN_ERR(svn_ra_change_rev_prop(rb->pb->session, rb->rev,
+                                 SVN_PROP_REVISION_DATE,
+                                 rb->datestamp, rb->pb->pool));
+  SVN_ERR(svn_ra_change_rev_prop(rb->pb->session, rb->rev,
+                                 SVN_PROP_REVISION_AUTHOR,
+                                 rb->author, rb->pb->pool));
+
+  svn_pool_destroy(rb->pb->pool);
+
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-drive_load_editor(const svn_delta_editor_t *editor,
-                  void *edit_baton,
-                  struct operation *operation,
-                  svn_stream_t *stream,
-                  apr_pool_t *pool)
+get_dumpstream_loader(const svn_repos_parse_fns2_t **parser,
+                      void **parse_baton,
+                      svn_ra_session_t *session,
+                      apr_pool_t *pool)
 {
-  const svn_repos_parse_fns2_t *parser;
-  void *pb;
-  SVN_ERR(build_dumpfile_parser(&parser, &pb, pool));
-  SVN_ERR(svn_repos_parse_dumpstream2(stream, parser, pb,
-                                      NULL, NULL, pool));
+  svn_repos_parse_fns2_t *pf;
+  struct parse_baton *pb;
+
+  pf = apr_pcalloc(pool, sizeof(*pf));
+  pf->new_revision_record = new_revision_record;
+  pf->uuid_record = uuid_record;
+  pf->new_node_record = new_node_record;
+  pf->set_revision_property = set_revision_property;
+  pf->set_node_property = set_node_property;
+  pf->delete_node_property = delete_node_property;
+  pf->remove_node_props = remove_node_props;
+  pf->set_fulltext = set_fulltext;
+  pf->apply_textdelta = apply_textdelta;
+  pf->close_node = close_node;
+  pf->close_revision = close_revision;
+
+  pb = apr_pcalloc(pool, sizeof(*pb));
+  pb->session = session;
+
+  *parser = pf;
+  *parse_baton = pb;
 
   return SVN_NO_ERROR;
 }
 
-/* The load editor is a essentially a dumpfile parser connected to a
-   commit editor. It can be driven using drive_load_editor(). */
 svn_error_t *
-get_load_editor(const svn_delta_editor_t **editor,
-                void **edit_baton,
-                struct operation **root_operation,
-                svn_ra_session_t *session,
-                apr_pool_t *pool)
+drive_dumpstream_loader(svn_stream_t *stream,
+                        const svn_repos_parse_fns2_t *parser,
+                        void *parse_baton,
+                        svn_ra_session_t *session,
+                        apr_pool_t *pool)
 {
-  const svn_delta_editor_t *de;
-  struct operation *root;
-  struct commit_dir_baton *db;
-  apr_hash_t *revprop_table;
-  void *cb;
-
-  root = apr_pcalloc(pool, sizeof(*root));
-  db = apr_pcalloc(pool, sizeof(*db));
-  root->baton = db;
-  revprop_table = apr_hash_make(pool);
-
-  SVN_ERR(svn_ra_get_latest_revnum(session, &(root->revision), pool));
- 
-  /* Call the commit editor and get back a delta_editor and
-     commit_baton to use for performing the actual commit */
-  SVN_ERR(svn_ra_get_commit_editor3(session, &de, &cb, revprop_table,
-                                    commit_callback, NULL, NULL, FALSE, pool));
-  SVN_ERR(de->open_root(cb, root->revision, pool, root->baton));
-
-  *editor = de;
-  *edit_baton = cb;
-  *root_operation = root;
+  void *pb;
+  pb = parse_baton;
+
+  SVN_ERR(svn_repos_parse_dumpstream2(stream, parser,parse_baton,
+                                      NULL, NULL, pool));
 
   return SVN_NO_ERROR;
 }

Propchange: subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.h
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.h?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.h (original)
+++ subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.h Sun Aug  1 18:37:42 2010
@@ -29,22 +29,15 @@
 #define LOAD_EDITOR_H_
 
 /**
- * Baton used by the txdelta applier.
- */
-struct apply_baton
-{
-  const char *source;
-  char *target;
-  apr_pool_t *pool;
-};
-
-/**
- * General baton used by the parser functions. Contains a link to
- * apply baton.
+ * General baton used by the parser functions.
  */
 struct parse_baton
 {
-  struct apply_baton *ab;
+  const svn_delta_editor_t *commit_editor;
+  void *commit_edit_baton;
+  svn_ra_session_t *session;
+  const char *uuid;
+  apr_pool_t *pool;
 };
 
 /**
@@ -55,12 +48,13 @@ struct node_baton
 {
   const char *path;
   svn_node_kind_t kind;
+  enum svn_node_action action;
 
   svn_revnum_t copyfrom_rev;
   const char *copyfrom_path;
 
+  void *file_baton;
   struct revision_baton *rb;
-  apr_pool_t *pool;
 };
 
 /**
@@ -70,56 +64,92 @@ struct node_baton
 struct revision_baton
 {
   svn_revnum_t rev;
-
-  svn_fs_txn_t *txn;
-  svn_fs_root_t *txn_root;
+  apr_hash_t *revprop_table;
 
   const svn_string_t *datestamp;
-
-  apr_int32_t rev_offset;
+  const svn_string_t *author;
 
   struct parse_baton *pb;
   apr_pool_t *pool;
+  void *dir_baton;                    /* Keep track of dirs */
 };
 
 /**
- * Used to represent an operation to perform while driving the load
- * editor.
+ * Imported from commit.c
+ * (see comment in new_node_record in load_editor.h)
  */
-struct operation {
-  enum {
-    OP_OPEN,
-    OP_DELETE,
-    OP_ADD,
-    OP_REPLACE,
-    OP_PROPSET
-  } operation;
+struct commit_edit_baton
+{
+  apr_pool_t *pool;
 
-  svn_revnum_t revision;        /* The revision on which the operation is being performed */
-  void *baton;                  /* Represents a commit_dir_baton object */
-};
+  /** Supplied when the editor is created: **/
 
-/**
- * A directory baton from commit.c.
- */
-struct commit_dir_baton
-{
-  struct commit_baton *edit_baton;
-  struct commit_dir_baton *parent;
-  const char *path; /* the -absolute- path to this dir in the fs */
-  svn_revnum_t base_rev;        /* the revision I'm based on  */
-  svn_boolean_t was_copied; /* was this directory added with history? */
-  apr_pool_t *pool; /* my personal pool, in which I am allocated. */
+  /* Revision properties to set for this commit. */
+  apr_hash_t *revprop_table;
+
+  /* Callback to run when the commit is done. */
+  svn_commit_callback2_t commit_callback;
+  void *commit_callback_baton;
+
+  /* Callback to check authorizations on paths. */
+  svn_repos_authz_callback_t authz_callback;
+  void *authz_baton;
+
+  /* The already-open svn repository to commit to. */
+  svn_repos_t *repos;
+
+  /* URL to the root of the open repository. */
+  const char *repos_url;
+
+  /* The name of the repository (here for convenience). */
+  const char *repos_name;
+
+  /* The filesystem associated with the REPOS above (here for
+     convenience). */
+  svn_fs_t *fs;
+
+  /* Location in fs where the edit will begin. */
+  const char *base_path;
+
+  /* Does this set of interfaces 'own' the commit transaction? */
+  svn_boolean_t txn_owner;
+
+  /* svn transaction associated with this edit (created in
+     open_root, or supplied by the public API caller). */
+  svn_fs_txn_t *txn;
+
+  /** Filled in during open_root: **/
+
+  /* The name of the transaction. */
+  const char *txn_name;
+
+  /* The object representing the root directory of the svn txn. */
+  svn_fs_root_t *txn_root;
+
+  /** Filled in when the edit is closed: **/
+
+  /* The new revision created by this commit. */
+  svn_revnum_t *new_rev;
+
+  /* The date (according to the repository) of this commit. */
+  const char **committed_date;
+
+  /* The author (also according to the repository) of this commit. */
+  const char **committed_author;
 };
 
+
 /**
- * Build up a @a parser for parsing a dumpfile stream from @a stream
+ * Build up a load editor @a parser for parsing a dumpfile stream from @a stream
  * set to fire the appropriate callbacks in load editor along with a
- * @a parser_baton, using @a pool for all memory allocations.
+ * @a parser_baton, using @a pool for all memory allocations. The
+ * @a editor/ @a edit_baton are central to the functionality of the
+ *  parser.
  */
 svn_error_t *
-build_dumpfile_parser(const svn_repos_parse_fns2_t **parser,
+get_dumpstream_loader(const svn_repos_parse_fns2_t **parser,
                       void **parse_baton,
+                      svn_ra_session_t *session,
                       apr_pool_t *pool);
 
 /**
@@ -127,23 +157,10 @@ build_dumpfile_parser(const svn_repos_pa
  * @a pool for all memory allocations.
  */
 svn_error_t *
-drive_load_editor(const svn_delta_editor_t *editor,
-                  void *edit_baton,
-                  struct operation *operation,
-                  svn_stream_t *stream,
-                  apr_pool_t *pool);
-
-/**
- * Get a load editor @a editor along with an @a edit_baton and an
- * operation @a root_operation corresponding to open_root, all
- * allocated in @a pool. The load editor will commit revisions to @a
- * session when driven using drive_load_editor().
- */
-svn_error_t *
-get_load_editor(const svn_delta_editor_t **editor,
-                void **edit_baton,
-                struct operation **root_operation,
-                svn_ra_session_t *session,
-                apr_pool_t *pool);
+drive_dumpstream_loader(svn_stream_t *stream,
+                        const svn_repos_parse_fns2_t *parser,
+                        void *parse_baton,
+                        svn_ra_session_t *session,
+                        apr_pool_t *pool);
 
 #endif

Propchange: subversion/branches/atomic-revprop/subversion/svnrdump/load_editor.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: subversion/branches/atomic-revprop/subversion/svnrdump/svnrdump.1
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/atomic-revprop/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/svnrdump/svnrdump.c?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/svnrdump/svnrdump.c (original)
+++ subversion/branches/atomic-revprop/subversion/svnrdump/svnrdump.c Sun Aug  1 18:37:42 2010
@@ -289,19 +289,16 @@ static svn_error_t *
 load_revisions(svn_ra_session_t *session, const char *url,
                svn_boolean_t quiet, apr_pool_t *pool)
 {
-  const svn_delta_editor_t *load_editor;
-  void *load_baton;
   apr_file_t *stdin_file;
   svn_stream_t *stdin_stream;
-  struct operation *root_operation;
+  const svn_repos_parse_fns2_t *parser;
+  void *parse_baton;
 
   apr_file_open_stdin(&stdin_file, pool);
   stdin_stream = svn_stream_from_aprfile2(stdin_file, FALSE, pool);
 
-  SVN_ERR(get_load_editor(&load_editor, &load_baton, &root_operation,
-                          session, pool));
-  SVN_ERR(drive_load_editor(load_editor, load_baton, root_operation,
-                            stdin_stream, pool));
+  SVN_ERR(get_dumpstream_loader(&parser, &parse_baton, session, pool));
+  SVN_ERR(drive_dumpstream_loader(stdin_stream, parser, parse_baton, session, pool));
 
   svn_stream_close(stdin_stream);
 

Modified: subversion/branches/atomic-revprop/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/basic_tests.py?rev=981280&r1=981279&r2=981280&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/branches/atomic-revprop/subversion/tests/cmdline/basic_tests.py Sun Aug  1 18:37:42 2010
@@ -2520,6 +2520,37 @@ def meta_correct_library_being_used(sbox
   svntest.actions.run_and_verify_svn("is $http_library available",
                                      expected_output, [], '--version')
 
+def delete_and_add_same_file(sbox):
+  "commit deletes a file and adds one with same text"
+  sbox.build()
+
+  wc_dir = sbox.wc_dir
+
+  iota = os.path.join(wc_dir, 'iota')
+  iota2 = os.path.join(wc_dir, 'iota2')
+
+  shutil.copyfile(iota, iota2)
+
+  svntest.main.run_svn(None, 'rm', iota)
+  svntest.main.run_svn(None, 'add', iota2)
+
+  expected_output = wc.State(wc_dir, {
+    'iota' : Item(verb='Deleting'),
+    'iota2' : Item(verb='Adding'),
+    })
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.remove('iota')
+  expected_status.add({ 'iota2':  Item(status='  ', wc_rev='2')})
+
+  # At one time the commit post-processing used to fail with "Pristine text
+  # not found".
+  svntest.actions.run_and_verify_commit(wc_dir,
+                                        expected_output,
+                                        expected_status,
+                                        None,
+                                        wc_dir)
+
 #----------------------------------------------------------------------
 
 ########################################################################
@@ -2579,6 +2610,7 @@ test_list = [ None,
               delete_from_url_with_spaces,
               SkipUnless(meta_correct_library_being_used,
                          svntest.main.is_ra_type_dav),
+              delete_and_add_same_file,
              ]
 
 if __name__ == '__main__':