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/04/14 08:51:03 UTC

svn commit: r933863 [2/5] - in /subversion/branches/svn-patch-improvements: ./ notes/commit-access-templates/ notes/wc-ng/ subversion/bindings/javahl/native/ subversion/bindings/swig/ruby/svn/ subversion/bindings/swig/ruby/test/ subversion/include/ sub...

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/deprecated.c?rev=933863&r1=933862&r2=933863&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/deprecated.c Wed Apr 14 06:51:00 2010
@@ -2230,13 +2230,15 @@ struct status4_wrapper_baton
 static svn_error_t *
 status4_wrapper_func(void *baton,
                      const char *local_abspath,
-                     const svn_wc_status2_t *status,
+                     const svn_wc_status3_t *status,
                      apr_pool_t *scratch_pool)
 {
   struct status4_wrapper_baton *swb = baton;
-  svn_wc_status2_t *dup = svn_wc_dup_status2(status, scratch_pool);
+  svn_wc_status2_t *dup;
   const char *path = local_abspath;
 
+  dup = svn_wc__status2_from_3(status, scratch_pool);
+
   if (swb->anchor_abspath != NULL)
     {
       path = svn_dirent_join(
@@ -2468,6 +2470,37 @@ svn_wc_status(svn_wc_status_t **status,
   return SVN_NO_ERROR;
 }
 
+svn_wc_status2_t *
+svn_wc_dup_status2(const svn_wc_status2_t *orig_stat,
+                   apr_pool_t *pool)
+{
+  svn_wc_status2_t *new_stat = apr_palloc(pool, sizeof(*new_stat));
+
+  /* Shallow copy all members. */
+  *new_stat = *orig_stat;
+
+  /* Now go back and dup the deep items into this pool. */
+  if (orig_stat->entry)
+    new_stat->entry = svn_wc_entry_dup(orig_stat->entry, pool);
+
+  if (orig_stat->repos_lock)
+    new_stat->repos_lock = svn_lock_dup(orig_stat->repos_lock, pool);
+
+  if (orig_stat->url)
+    new_stat->url = apr_pstrdup(pool, orig_stat->url);
+
+  if (orig_stat->ood_last_cmt_author)
+    new_stat->ood_last_cmt_author
+      = apr_pstrdup(pool, orig_stat->ood_last_cmt_author);
+
+  if (orig_stat->tree_conflict)
+    new_stat->tree_conflict
+      = svn_wc__conflict_description_dup(orig_stat->tree_conflict, pool);
+
+  /* Return the new hotness. */
+  return new_stat;
+}
+
 svn_wc_status_t *
 svn_wc_dup_status(const svn_wc_status_t *orig_stat,
                   apr_pool_t *pool)
@@ -2515,13 +2548,15 @@ svn_wc_status2(svn_wc_status2_t **status
 {
   const char *local_abspath;
   svn_wc_context_t *wc_ctx;
+  svn_wc_status3_t *stat3;
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
   SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
                                          svn_wc__adm_get_db(adm_access),
                                          pool));
 
-  SVN_ERR(svn_wc_status3(status, wc_ctx, local_abspath, pool, pool));
+  SVN_ERR(svn_wc_status3(&stat3, wc_ctx, local_abspath, pool, pool));
+  *status = svn_wc__status2_from_3(stat3, pool);
 
   return svn_error_return(svn_wc_context_destroy(wc_ctx));
 }

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c?rev=933863&r1=933862&r2=933863&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c Wed Apr 14 06:51:00 2010
@@ -198,31 +198,27 @@ fetch_wc_id(apr_int64_t *wc_id, svn_sqli
    entry.  The entry will be modified in place. */
 static svn_error_t *
 check_file_external(svn_wc_entry_t *entry,
-                    svn_sqlite__db_t *sdb,
-                    apr_pool_t *result_pool)
+                    svn_wc__db_t *db,
+                    const char *local_abspath,
+                    apr_pool_t *result_pool,
+                    apr_pool_t *scratch_pool)
 {
-  svn_sqlite__stmt_t *stmt;
-  svn_boolean_t have_row;
-
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                    STMT_SELECT_FILE_EXTERNAL));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is",
-                            (apr_uint64_t)1 /* wc_id */,
-                            entry->name));
-  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  const char *serialized;
 
-  if (!svn_sqlite__column_is_null(stmt, 0))
+  SVN_ERR(svn_wc__db_temp_get_file_external(&serialized,
+                                            db, local_abspath,
+                                            scratch_pool, scratch_pool));
+  if (serialized != NULL)
     {
       SVN_ERR(svn_wc__unserialize_file_external(
                     &entry->file_external_path,
                     &entry->file_external_peg_rev,
                     &entry->file_external_rev,
-                    svn_sqlite__column_text(stmt, 0, NULL),
+                    serialized,
                     result_pool));
-
     }
 
-  return svn_error_return(svn_sqlite__reset(stmt));
+  return SVN_NO_ERROR;
 }
 
 
@@ -271,6 +267,10 @@ get_base_info_for_deleted(svn_wc_entry_t
                                  entry_abspath,
                                  result_pool,
                                  scratch_pool);
+#ifdef SVN_EXPERIMENTAL
+  /* ### *checksum is originally MD-5 but will later be SHA-1... */
+#endif
+
   if (err)
     {
       const char *work_del_abspath;
@@ -1063,7 +1063,18 @@ read_entries_new(apr_hash_t **result_ent
                                                  result_pool);
 
       if (checksum)
-        entry->checksum = svn_checksum_to_cstring(checksum, result_pool);
+        {
+#ifdef SVN_EXPERIMENTAL
+          /* If we get a SHA-1, as expected in WC-NG, convert it to MD-5. */
+          if (checksum->kind == svn_checksum_sha1)
+            SVN_ERR(svn_wc__db_get_pristine_md5(&checksum, db,
+                                                entry_abspath, checksum,
+                                                scratch_pool, scratch_pool));
+#endif
+
+          SVN_ERR_ASSERT(checksum->kind == svn_checksum_md5);
+          entry->checksum = svn_checksum_to_cstring(checksum, result_pool);
+        }
 
       if (conflicted)
         {
@@ -1110,7 +1121,8 @@ read_entries_new(apr_hash_t **result_ent
          ### right now this is ugly, since we have no good way querying
          ### for a file external OR retrieving properties.  ugh.  */
       if (entry->kind == svn_node_file)
-        SVN_ERR(check_file_external(entry, sdb, result_pool));
+        SVN_ERR(check_file_external(entry, db, entry_abspath, result_pool,
+                                    iterpool));
 
       entry->working_size = translated_size;
 
@@ -1593,65 +1605,6 @@ svn_wc_entries_read(apr_hash_t **entries
 }
 
 
-svn_error_t *
-svn_wc__set_depth(svn_wc__db_t *db,
-                  const char *local_dir_abspath,
-                  svn_depth_t depth,
-                  apr_pool_t *scratch_pool)
-{
-  const char *parent_abspath;
-  const char *base_name;
-  svn_wc_adm_access_t *adm_access;
-  svn_wc_entry_t *entry;
-
-  SVN_ERR_ASSERT(depth >= svn_depth_empty && depth <= svn_depth_infinity);
-
-  svn_dirent_split(local_dir_abspath, &parent_abspath, &base_name,
-                   scratch_pool);
-
-  /* Update the entry cache */
-  adm_access = svn_wc__adm_retrieve_internal2(db, parent_abspath,
-                                              scratch_pool);
-
-  /* Update parent? */
-  if (adm_access != NULL)
-    {
-      apr_hash_t *entries = svn_wc__adm_access_entries(adm_access);
-
-      entry = (entries != NULL)
-                       ? apr_hash_get(entries, base_name, APR_HASH_KEY_STRING)
-                       : NULL;
-
-      if (entry != NULL)
-        {
-          /* The entries in the parent stub only store excluded vs infinity. */
-          entry->depth = (depth == svn_depth_exclude) ? svn_depth_exclude
-                                                      : svn_depth_infinity;
-        }
-    }
-
-   /* Fetch the entries for the directory, and write our depth there. */
-  adm_access = svn_wc__adm_retrieve_internal2(db, local_dir_abspath,
-                                              scratch_pool);
-  if (adm_access != NULL)
-    {
-      apr_hash_t *entries = svn_wc__adm_access_entries(adm_access);
-
-      entry = (entries != NULL)
-                       ? apr_hash_get(entries, "", APR_HASH_KEY_STRING)
-                       : NULL;
-
-      if (entry != NULL)
-        entry->depth = depth;
-    }
-
-  return svn_error_return(svn_wc__db_temp_op_set_dir_depth(db,
-                                                           local_dir_abspath,
-                                                           depth,
-                                                           FALSE,
-                                                           scratch_pool));
-}
-
 /* */
 static svn_error_t *
 insert_base_node(svn_sqlite__db_t *sdb,
@@ -2432,6 +2385,10 @@ write_one_entry_cb(void *baton,
                                            scratch_pool);
 
       err = svn_sqlite__column_checksum(&base_checksum, stmt, 5, scratch_pool);
+#ifdef SVN_EXPERIMENTAL
+      /* ### base_checksum is originally MD-5 but will later be SHA-1... */
+#endif
+
       SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
     }
   else

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.h?rev=933863&r1=933862&r2=933863&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.h Wed Apr 14 06:51:00 2010
@@ -255,14 +255,6 @@ svn_error_t *
 svn_wc__entry_is_hidden(svn_boolean_t *hidden, const svn_wc_entry_t *entry);
 
 
-/* Set the depth of a directory.  */
-svn_error_t *
-svn_wc__set_depth(svn_wc__db_t *db,
-                  const char *local_dir_abspath,
-                  svn_depth_t depth,
-                  apr_pool_t *scratch_pool);
-
-
 /* For internal use by entries.c to read/write old-format working copies. */
 svn_error_t *
 svn_wc__read_entries_old(apr_hash_t **entries,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/lock.c?rev=933863&r1=933862&r2=933863&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/lock.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/lock.c Wed Apr 14 06:51:00 2010
@@ -859,6 +859,7 @@ svn_wc__adm_retrieve_internal2(svn_wc__d
 }
 
 
+/* SVN_DEPRECATED */
 svn_error_t *
 svn_wc_adm_retrieve(svn_wc_adm_access_t **adm_access,
                     svn_wc_adm_access_t *associated,
@@ -946,6 +947,7 @@ svn_wc_adm_retrieve(svn_wc_adm_access_t 
 }
 
 
+/* SVN_DEPRECATED */
 svn_error_t *
 svn_wc_adm_probe_retrieve(svn_wc_adm_access_t **adm_access,
                           svn_wc_adm_access_t *associated,
@@ -988,6 +990,8 @@ svn_wc_adm_probe_retrieve(svn_wc_adm_acc
   return SVN_NO_ERROR;
 }
 
+
+/* SVN_DEPRECATED */
 svn_error_t *
 svn_wc_adm_probe_try3(svn_wc_adm_access_t **adm_access,
                       svn_wc_adm_access_t *associated,
@@ -1409,12 +1413,16 @@ do_close(svn_wc_adm_access_t *adm_access
                                        scratch_pool));
 }
 
+
+/* SVN_DEPRECATED */
 svn_error_t *
 svn_wc_adm_close2(svn_wc_adm_access_t *adm_access, apr_pool_t *scratch_pool)
 {
   return svn_error_return(do_close(adm_access, FALSE, scratch_pool));
 }
 
+
+/* SVN_DEPRECATED */
 svn_boolean_t
 svn_wc_adm_locked(const svn_wc_adm_access_t *adm_access)
 {
@@ -1472,6 +1480,7 @@ svn_wc_locked2(svn_boolean_t *locked_her
 }
 
 
+/* SVN_DEPRECATED */
 const char *
 svn_wc_adm_access_path(const svn_wc_adm_access_t *adm_access)
 {
@@ -1486,6 +1495,7 @@ svn_wc__adm_access_abspath(const svn_wc_
 }
 
 
+/* SVN_DEPRECATED */
 apr_pool_t *
 svn_wc_adm_access_pool(const svn_wc_adm_access_t *adm_access)
 {

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.c?rev=933863&r1=933862&r2=933863&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.c Wed Apr 14 06:51:00 2010
@@ -94,14 +94,6 @@
 /* Make file SVN_WC__LOG_ATTR_NAME readonly */
 #define SVN_WC__LOG_READONLY            "readonly"
 
-/* Make file SVN_WC__LOG_ATTR_NAME readonly if needs-lock property is set
-   and there is no lock token for the file in the working copy. */
-#define SVN_WC__LOG_MAYBE_READONLY "maybe-readonly"
-
-/* Make file SVN_WC__LOG_ATTR_NAME executable if the
-   executable property is set. */
-#define SVN_WC__LOG_MAYBE_EXECUTABLE "maybe-executable"
-
 /* Set SVN_WC__LOG_ATTR_NAME to have timestamp SVN_WC__LOG_ATTR_TIMESTAMP. */
 #define SVN_WC__LOG_SET_TIMESTAMP       "set-timestamp"
 
@@ -146,163 +138,100 @@ struct log_runner
 /* #define DEBUG_LOG */
 
 
-
-/*** The XML handlers. ***/
-
-/* Used by file_xfer_under_path(). */
-enum svn_wc__xfer_action {
-  svn_wc__xfer_mv,
-  svn_wc__xfer_append,
-  svn_wc__xfer_cp_and_translate
-};
+/* Helper macro for erroring out while running a logfile.
 
+   This is implemented as a macro so that the error created has a useful
+   line number associated with it. */
+#define SIGNAL_ERROR(loggy, err)                                        \
+  svn_xml_signal_bailout(svn_error_createf(                             \
+                           SVN_ERR_WC_BAD_ADM_LOG, err,                 \
+                           _("In directory '%s'"),                      \
+                           svn_dirent_local_style(loggy->adm_abspath,   \
+                                                  loggy->pool)),        \
+                         loggy->parser)
 
-/* Perform some sort of copy-related ACTION on NAME and DEST:
 
-      svn_wc__xfer_mv:                 do a copy, then remove NAME.
-      svn_wc__xfer_append:             append contents of NAME to DEST
-      svn_wc__xfer_cp_and_translate:   copy NAME to DEST, doing any eol
-                                       and keyword expansion according to
-                                       the current property vals of VERSIONED
-                                       or, if that's NULL, those of DEST.
-*/
 static svn_error_t *
-file_xfer_under_path(svn_wc__db_t *db,
-                     const char *adm_abspath,
-                     const char *name,
-                     const char *dest,
-                     const char *versioned,
-                     enum svn_wc__xfer_action action,
-                     apr_pool_t *scratch_pool)
+log_do_file_append(const char *from_abspath,
+                   const char *dest_abspath,
+                   apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
-  const char *from_abspath;
-  const char *dest_abspath;
-
-  from_abspath = svn_dirent_join(adm_abspath, name, scratch_pool);
-  dest_abspath = svn_dirent_join(adm_abspath, dest, scratch_pool);
 
-  switch (action)
+  err = svn_io_append_file(from_abspath, dest_abspath, scratch_pool);
+  if (err)
     {
-    case svn_wc__xfer_append:
-      err = svn_io_append_file(from_abspath, dest_abspath, scratch_pool);
-      if (err)
-        {
-          if (!APR_STATUS_IS_ENOENT(err->apr_err))
-            return svn_error_return(err);
-          svn_error_clear(err);
-        }
-      break;
-
-    case svn_wc__xfer_cp_and_translate:
-      {
-        const char *versioned_abspath;
-        svn_subst_eol_style_t style;
-        const char *eol;
-        apr_hash_t *keywords;
-        svn_boolean_t special;
-
-        if (versioned)
-          versioned_abspath = svn_dirent_join(adm_abspath, versioned,
-                                              scratch_pool);
-        else
-          versioned_abspath = dest_abspath;
-
-          err = svn_wc__get_eol_style(&style, &eol, db, versioned_abspath,
-                                      scratch_pool, scratch_pool);
-        if (! err)
-          err = svn_wc__get_keywords(&keywords, db, versioned_abspath, NULL,
-                                     scratch_pool, scratch_pool);
-        if (! err)
-          err = svn_wc__get_special(&special, db, versioned_abspath,
-                                    scratch_pool);
-
-        if (! err)
-          err = svn_subst_copy_and_translate3
-                (from_abspath, dest_abspath,
-                 eol, TRUE,
-                 keywords, TRUE,
-                 special,
-                 scratch_pool);
-
-        if (err)
-          {
-            if (!APR_STATUS_IS_ENOENT(err->apr_err))
-              return svn_error_return(err);
-            svn_error_clear(err);
-          }
-
-        SVN_ERR(svn_wc__maybe_set_read_only(NULL, db, dest_abspath,
-                                            scratch_pool));
-
-        return svn_error_return(svn_wc__maybe_set_executable(
-                                              NULL, db, dest_abspath,
-                                              scratch_pool));
-      }
-
-    case svn_wc__xfer_mv:
-      err = svn_io_file_rename(from_abspath, dest_abspath, scratch_pool);
-
-      /* If we got an ENOENT, that's ok;  the move has probably
-         already completed in an earlier run of this log.  */
-      if (err)
-        {
-          if (!APR_STATUS_IS_ENOENT(err->apr_err))
-            return svn_error_quick_wrap(err, _("Can't move source to dest"));
-          svn_error_clear(err);
-        }
-      break;
+      if (!APR_STATUS_IS_ENOENT(err->apr_err))
+        return svn_error_return(err);
+      svn_error_clear(err);
     }
 
   return SVN_NO_ERROR;
 }
 
 
-/* Helper macro for erroring out while running a logfile.
+static svn_error_t *
+log_do_file_cp_and_translate(svn_wc__db_t *db,
+                             const char *from_abspath,
+                             const char *dest_abspath,
+                             const char *versioned_abspath,
+                             apr_pool_t *scratch_pool)
+{
+  svn_error_t *err;
+  svn_subst_eol_style_t style;
+  const char *eol;
+  apr_hash_t *keywords;
+  svn_boolean_t special;
+
+  err = svn_wc__get_eol_style(&style, &eol, db, versioned_abspath,
+                              scratch_pool, scratch_pool);
+  if (! err)
+    err = svn_wc__get_keywords(&keywords, db, versioned_abspath, NULL,
+                               scratch_pool, scratch_pool);
+  if (! err)
+    err = svn_wc__get_special(&special, db, versioned_abspath,
+                              scratch_pool);
+
+  if (! err)
+    err = svn_subst_copy_and_translate3(from_abspath, dest_abspath,
+                                        eol, TRUE /* repair */,
+                                        keywords, TRUE /* expand */,
+                                        special,
+                                        scratch_pool);
 
-   This is implemented as a macro so that the error created has a useful
-   line number associated with it. */
-#define SIGNAL_ERROR(loggy, err)                                   \
-  svn_xml_signal_bailout                                           \
-    (svn_error_createf(SVN_ERR_WC_BAD_ADM_LOG, err,                \
-                       _("In directory '%s'"),                     \
-                       svn_dirent_local_style(loggy->adm_abspath,  \
-                                              loggy->pool)),       \
-     loggy->parser)
+  if (err)
+    {
+      if (!APR_STATUS_IS_ENOENT(err->apr_err))
+        return svn_error_return(err);
+      svn_error_clear(err);
+    }
 
+  return SVN_NO_ERROR;
+}
 
-
-/*** Dispatch on the xml opening tag. ***/
 
-/* */
 static svn_error_t *
-log_do_file_xfer(struct log_runner *loggy,
-                 const char *name,
-                 enum svn_wc__xfer_action action,
-                 const char **atts)
+log_do_file_move(const char *from_abspath,
+                 const char *dest_abspath,
+                 apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
-  const char *dest = NULL;
-  const char *versioned;
 
-  /* We have the name (src), and the destination is absolutely required. */
-  dest = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_DEST, atts);
-  versioned = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_ARG_2, atts);
-
-  if (! dest)
-    return svn_error_createf(SVN_ERR_WC_BAD_ADM_LOG, NULL,
-                             _("Missing 'dest' attribute in '%s'"),
-                             svn_dirent_local_style(loggy->adm_abspath,
-                                                    loggy->pool));
+  err = svn_io_file_rename(from_abspath, dest_abspath, scratch_pool);
 
-  err = file_xfer_under_path(loggy->db, loggy->adm_abspath, name, dest,
-                             versioned, action, loggy->pool);
+  /* If we got an ENOENT, that's ok;  the move has probably
+     already completed in an earlier run of this log.  */
   if (err)
-    SIGNAL_ERROR(loggy, err);
+    {
+      if (!APR_STATUS_IS_ENOENT(err->apr_err))
+        return svn_error_quick_wrap(err, _("Can't move source to dest"));
+      svn_error_clear(err);
+    }
 
   return SVN_NO_ERROR;
 }
 
+
 /* Make file NAME in log's CWD readonly */
 static svn_error_t *
 log_do_file_readonly(struct log_runner *loggy,
@@ -322,29 +251,6 @@ log_do_file_readonly(struct log_runner *
   return SVN_NO_ERROR;
 }
 
-/* Maybe make file NAME in log's CWD executable */
-static svn_error_t *
-log_do_file_maybe_executable(struct log_runner *loggy,
-                             const char *name)
-{
-  const char *local_abspath
-    = svn_dirent_join(loggy->adm_abspath, name, loggy->pool);
-
-  return svn_error_return(svn_wc__maybe_set_executable(
-                                NULL, loggy->db, local_abspath, loggy->pool));
-}
-
-/* Maybe make file NAME in log's CWD readonly */
-static svn_error_t *
-log_do_file_maybe_readonly(struct log_runner *loggy,
-                           const char *name)
-{
-  const char *local_abspath
-    = svn_dirent_join(loggy->adm_abspath, name, loggy->pool);
-
-  return svn_wc__maybe_set_read_only(NULL, loggy->db, local_abspath,
-                                     loggy->pool);
-}
 
 /* Set file NAME in log's CWD to timestamp value in ATTS. */
 static svn_error_t *
@@ -632,17 +538,9 @@ start_handler(void *userData, const char
 
   if (strcmp(eltname, "wc-log") == 0)   /* ignore expat pacifier */
     return;
-  else if (! name)
-    {
-      SIGNAL_ERROR
-        (loggy, svn_error_createf
-         (SVN_ERR_WC_BAD_ADM_LOG, NULL,
-          _("Log entry missing 'name' attribute (entry '%s' "
-            "for directory '%s')"),
-          eltname,
-          svn_dirent_local_style(loggy->adm_abspath, loggy->pool)));
-      return;
-    }
+
+  /* The NAME attribute should be present.  */
+  SVN_ERR_ASSERT_NO_RETURN(name != NULL);
 
 #ifdef DEBUG_LOG
   SVN_DBG(("start_handler: name='%s'\n", eltname));
@@ -659,23 +557,45 @@ start_handler(void *userData, const char
     err = log_do_delete_entry(loggy, name);
   }
   else if (strcmp(eltname, SVN_WC__LOG_MV) == 0) {
-    err = log_do_file_xfer(loggy, name, svn_wc__xfer_mv, atts);
+    const char *dest = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_DEST, atts);
+    const char *from_abspath;
+    const char *dest_abspath;
+
+    SVN_ERR_ASSERT_NO_RETURN(dest != NULL);
+    from_abspath = svn_dirent_join(loggy->adm_abspath, name, loggy->pool);
+    dest_abspath = svn_dirent_join(loggy->adm_abspath, dest, loggy->pool);
+    err = log_do_file_move(from_abspath, dest_abspath, loggy->pool);
   }
   else if (strcmp(eltname, SVN_WC__LOG_CP_AND_TRANSLATE) == 0) {
-    err = log_do_file_xfer(loggy, name, svn_wc__xfer_cp_and_translate, atts);
+    const char *dest = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_DEST, atts);
+    const char *versioned = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_ARG_2,
+                                                   atts);
+    const char *from_abspath;
+    const char *dest_abspath;
+    const char *versioned_abspath;
+
+    SVN_ERR_ASSERT_NO_RETURN(dest != NULL);
+    SVN_ERR_ASSERT_NO_RETURN(versioned != NULL);
+    from_abspath = svn_dirent_join(loggy->adm_abspath, name, loggy->pool);
+    dest_abspath = svn_dirent_join(loggy->adm_abspath, dest, loggy->pool);
+    versioned_abspath = svn_dirent_join(loggy->adm_abspath, versioned,
+                                        loggy->pool);
+    err = log_do_file_cp_and_translate(loggy->db, from_abspath, dest_abspath,
+                                       versioned_abspath, loggy->pool);
   }
   else if (strcmp(eltname, SVN_WC__LOG_APPEND) == 0) {
-    err = log_do_file_xfer(loggy, name, svn_wc__xfer_append, atts);
+    const char *dest = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_DEST, atts);
+    const char *from_abspath;
+    const char *dest_abspath;
+
+    SVN_ERR_ASSERT_NO_RETURN(dest != NULL);
+    from_abspath = svn_dirent_join(loggy->adm_abspath, name, loggy->pool);
+    dest_abspath = svn_dirent_join(loggy->adm_abspath, dest, loggy->pool);
+    err = log_do_file_append(from_abspath, dest_abspath, loggy->pool);
   }
   else if (strcmp(eltname, SVN_WC__LOG_READONLY) == 0) {
     err = log_do_file_readonly(loggy, name);
   }
-  else if (strcmp(eltname, SVN_WC__LOG_MAYBE_READONLY) == 0) {
-    err = log_do_file_maybe_readonly(loggy, name);
-  }
-  else if (strcmp(eltname, SVN_WC__LOG_MAYBE_EXECUTABLE) == 0) {
-    err = log_do_file_maybe_executable(loggy, name);
-  }
   else if (strcmp(eltname, SVN_WC__LOG_SET_TIMESTAMP) == 0) {
     err = log_do_file_timestamp(loggy, name, atts);
   }
@@ -745,48 +665,6 @@ svn_wc__run_xml_log(svn_wc__db_t *db,
 }
 
 
-/*** Log file generation helpers ***/
-
-/* Extend LOG_ACCUM with log operations to do MOVE_COPY_OP to SRC_PATH and
- * DST_PATH.
- *
- * SRC_PATH and DST_PATH are relative to ADM_ABSPATH.
- */
-static svn_error_t *
-loggy_move_copy_internal(svn_stringbuf_t **log_accum,
-                         svn_boolean_t is_move,
-                         const char *adm_abspath,
-                         const char *src_path, const char *dst_path,
-                         apr_pool_t *result_pool,
-                         apr_pool_t *scratch_pool)
-{
-  svn_node_kind_t kind;
-  const char *src_abspath = svn_dirent_join(adm_abspath, src_path,
-                                            scratch_pool);
-
-  SVN_ERR(svn_io_check_path(src_abspath, &kind, scratch_pool));
-
-  /* Does this file exist? */
-  if (kind != svn_node_none)
-    {
-      svn_xml_make_open_tag(log_accum, result_pool,
-                            svn_xml_self_closing,
-                            is_move
-                              ? SVN_WC__LOG_MV
-                              : SVN_WC__LOG_CP_AND_TRANSLATE,
-                            SVN_WC__LOG_ATTR_NAME,
-                            src_path,
-                            SVN_WC__LOG_ATTR_DEST,
-                            dst_path,
-                            NULL);
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
-
-
 /* Return the portion of PATH that is relative to the working copy directory
  * ADM_ABSPATH, or SVN_WC_ENTRY_THIS_DIR if PATH is that directory. PATH must
  * not be outside that directory. */
@@ -816,6 +694,7 @@ loggy_path(const char **logy_path,
   return SVN_NO_ERROR;
 }
 
+
 svn_error_t *
 svn_wc__loggy_append(svn_wc__db_t *db,
                      const char *adm_abspath,
@@ -824,64 +703,54 @@ svn_wc__loggy_append(svn_wc__db_t *db,
 {
   const char *loggy_path1;
   const char *loggy_path2;
-  svn_stringbuf_t *buf = NULL;
+  svn_stringbuf_t *log_accum = NULL;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(adm_abspath));
 
   SVN_ERR(loggy_path(&loggy_path1, src, adm_abspath, scratch_pool));
   SVN_ERR(loggy_path(&loggy_path2, dst, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(&buf, scratch_pool,
+  svn_xml_make_open_tag(&log_accum, scratch_pool,
                         svn_xml_self_closing, SVN_WC__LOG_APPEND,
                         SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         SVN_WC__LOG_ATTR_DEST, loggy_path2,
                         NULL);
 
-  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, buf,
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
                                                scratch_pool));
 }
 
 
 svn_error_t *
-svn_wc__loggy_copy(svn_stringbuf_t **log_accum,
-                   const char *adm_abspath,
-                   const char *src_path, const char *dst_path,
-                   apr_pool_t *result_pool,
-                   apr_pool_t *scratch_pool)
-{
-  const char *loggy_path1;
-  const char *loggy_path2;
-
-  SVN_ERR(loggy_path(&loggy_path1, src_path, adm_abspath, scratch_pool));
-  SVN_ERR(loggy_path(&loggy_path2, dst_path, adm_abspath, scratch_pool));
-  return loggy_move_copy_internal(log_accum, FALSE, adm_abspath,
-                                  loggy_path1, loggy_path2,
-                                  result_pool, scratch_pool);
-}
-
-svn_error_t *
 svn_wc__loggy_translated_file(svn_wc__db_t *db,
                               const char *adm_abspath,
-                              const char *dst,
-                              const char *src,
-                              const char *versioned,
+                              const char *dst_abspath,
+                              const char *src_abspath,
+                              const char *versioned_abspath,
                               apr_pool_t *scratch_pool)
 {
   const char *loggy_path1;
   const char *loggy_path2;
   const char *loggy_path3;
-  svn_stringbuf_t *buf = NULL;
+  svn_stringbuf_t *log_accum = NULL;
 
-  SVN_ERR(loggy_path(&loggy_path1, src, adm_abspath, scratch_pool));
-  SVN_ERR(loggy_path(&loggy_path2, dst, adm_abspath, scratch_pool));
-  SVN_ERR(loggy_path(&loggy_path3, versioned, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(&buf, scratch_pool, svn_xml_self_closing,
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(adm_abspath));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(versioned_abspath));
+
+  SVN_ERR(loggy_path(&loggy_path1, src_abspath, adm_abspath, scratch_pool));
+  SVN_ERR(loggy_path(&loggy_path2, dst_abspath, adm_abspath, scratch_pool));
+  SVN_ERR(loggy_path(&loggy_path3, versioned_abspath, adm_abspath,
+                     scratch_pool));
+
+  svn_xml_make_open_tag(&log_accum, scratch_pool, svn_xml_self_closing,
                         SVN_WC__LOG_CP_AND_TRANSLATE,
                         SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         SVN_WC__LOG_ATTR_DEST, loggy_path2,
                         SVN_WC__LOG_ATTR_ARG_2, loggy_path3,
                         NULL);
 
-  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, buf,
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
                                                scratch_pool));
 }
 
@@ -892,15 +761,15 @@ svn_wc__loggy_delete_entry(svn_wc__db_t 
                            apr_pool_t *scratch_pool)
 {
   const char *loggy_path1;
-  svn_stringbuf_t *buf = NULL;
+  svn_stringbuf_t *log_accum = NULL;
 
   SVN_ERR(loggy_path(&loggy_path1, path, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(&buf, scratch_pool, svn_xml_self_closing,
+  svn_xml_make_open_tag(&log_accum, scratch_pool, svn_xml_self_closing,
                         SVN_WC__LOG_DELETE_ENTRY,
                         SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         NULL);
 
-  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, buf,
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
                                                scratch_pool));
 }
 
@@ -911,28 +780,28 @@ svn_wc__loggy_delete_lock(svn_wc__db_t *
                           apr_pool_t *scratch_pool)
 {
   const char *loggy_path1;
-  svn_stringbuf_t *buf = NULL;
+  svn_stringbuf_t *log_accum = NULL;
 
   SVN_ERR(loggy_path(&loggy_path1, path, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(&buf, scratch_pool, svn_xml_self_closing,
+  svn_xml_make_open_tag(&log_accum, scratch_pool, svn_xml_self_closing,
                         SVN_WC__LOG_DELETE_LOCK,
                         SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         NULL);
 
-  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, buf,
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
                                                scratch_pool));
 }
 
 
 svn_error_t *
-svn_wc__loggy_entry_modify(svn_stringbuf_t **log_accum,
+svn_wc__loggy_entry_modify(svn_wc__db_t *db,
                            const char *adm_abspath,
                            const char *path,
                            const svn_wc_entry_t *entry,
                            apr_uint64_t modify_flags,
-                           apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
+  svn_stringbuf_t *log_accum = NULL;
   const char *loggy_path1;
   apr_hash_t *prop_hash = apr_hash_make(scratch_pool);
   static const char *kind_str[] =
@@ -1042,87 +911,64 @@ svn_wc__loggy_entry_modify(svn_stringbuf
   apr_hash_set(prop_hash, SVN_WC__LOG_ATTR_NAME,
                APR_HASH_KEY_STRING, loggy_path1);
 
-  svn_xml_make_open_tag_hash(log_accum, result_pool,
+  svn_xml_make_open_tag_hash(&log_accum, scratch_pool,
                              svn_xml_self_closing,
                              SVN_WC__LOG_MODIFY_ENTRY,
                              prop_hash);
-
-  return SVN_NO_ERROR;
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
+                                               scratch_pool));
 }
 
 
 svn_error_t *
-svn_wc__loggy_move(svn_stringbuf_t **log_accum,
+svn_wc__loggy_move(svn_wc__db_t *db,
                    const char *adm_abspath,
-                   const char *src_path, const char *dst_path,
-                   apr_pool_t *result_pool,
+                   const char *src_path,
+                   const char *dst_path,
                    apr_pool_t *scratch_pool)
 {
+  svn_stringbuf_t *log_accum = NULL;
   const char *loggy_path1;
   const char *loggy_path2;
+  svn_node_kind_t kind;
+  const char *src_abspath = svn_dirent_join(adm_abspath, src_path,
+                                            scratch_pool);
 
   SVN_ERR(loggy_path(&loggy_path1, src_path, adm_abspath, scratch_pool));
   SVN_ERR(loggy_path(&loggy_path2, dst_path, adm_abspath, scratch_pool));
-  return loggy_move_copy_internal(log_accum, TRUE, adm_abspath,
-                                  loggy_path1, loggy_path2,
-                                  result_pool, scratch_pool);
-}
-
-svn_error_t *
-svn_wc__loggy_maybe_set_executable(svn_wc__db_t *db,
-                                   const char *adm_abspath,
-                                   const char *path,
-                                   apr_pool_t *scratch_pool)
-{
-  svn_stringbuf_t *log_accum = NULL;
-  const char *loggy_path1;
-
-  SVN_ERR(loggy_path(&loggy_path1, path, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(&log_accum,
-                        scratch_pool,
-                        svn_xml_self_closing,
-                        SVN_WC__LOG_MAYBE_EXECUTABLE,
-                        SVN_WC__LOG_ATTR_NAME, loggy_path1,
-                        NULL);
 
-  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
-                                               scratch_pool));
-}
+  SVN_ERR(svn_io_check_path(src_abspath, &kind, scratch_pool));
 
-svn_error_t *
-svn_wc__loggy_maybe_set_readonly(svn_wc__db_t *db,
-                                 const char *adm_abspath,
-                                 const char *path,
-                                 apr_pool_t *scratch_pool)
-{
-  svn_stringbuf_t *log_accum = NULL;
-  const char *loggy_path1;
+  /* ### idiocy of the old world. the file better exist, if we're asking
+     ### to do some work with it.  */
+  SVN_ERR_ASSERT(kind != svn_node_none);
 
-  SVN_ERR(loggy_path(&loggy_path1, path, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(&log_accum,
-                        scratch_pool,
+  svn_xml_make_open_tag(&log_accum, scratch_pool,
                         svn_xml_self_closing,
-                        SVN_WC__LOG_MAYBE_READONLY,
+                        SVN_WC__LOG_MV,
                         SVN_WC__LOG_ATTR_NAME,
                         loggy_path1,
+                        SVN_WC__LOG_ATTR_DEST,
+                        loggy_path2,
                         NULL);
 
   return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
                                                scratch_pool));
 }
 
+
 svn_error_t *
-svn_wc__loggy_set_entry_timestamp_from_wc(svn_stringbuf_t **log_accum,
+svn_wc__loggy_set_entry_timestamp_from_wc(svn_wc__db_t *db,
                                           const char *adm_abspath,
                                           const char *path,
-                                          apr_pool_t *result_pool,
                                           apr_pool_t *scratch_pool)
 {
+  svn_stringbuf_t *log_accum = NULL;
   const char *loggy_path1;
 
   SVN_ERR(loggy_path(&loggy_path1, path, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(log_accum,
-                        result_pool,
+  svn_xml_make_open_tag(&log_accum,
+                        scratch_pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_MODIFY_ENTRY,
                         SVN_WC__LOG_ATTR_NAME,
@@ -1131,21 +977,22 @@ svn_wc__loggy_set_entry_timestamp_from_w
                         SVN_WC__TIMESTAMP_WC,
                         NULL);
 
-  return SVN_NO_ERROR;
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
+                                               scratch_pool));
 }
 
 svn_error_t *
-svn_wc__loggy_set_entry_working_size_from_wc(svn_stringbuf_t **log_accum,
+svn_wc__loggy_set_entry_working_size_from_wc(svn_wc__db_t *db,
                                              const char *adm_abspath,
                                              const char *path,
-                                             apr_pool_t *result_pool,
                                              apr_pool_t *scratch_pool)
 {
+  svn_stringbuf_t *log_accum = NULL;
   const char *loggy_path1;
 
   SVN_ERR(loggy_path(&loggy_path1, path, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(log_accum,
-                        result_pool,
+  svn_xml_make_open_tag(&log_accum,
+                        scratch_pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_MODIFY_ENTRY,
                         SVN_WC__LOG_ATTR_NAME,
@@ -1154,43 +1001,45 @@ svn_wc__loggy_set_entry_working_size_fro
                         SVN_WC__WORKING_SIZE_WC,
                         NULL);
 
-  return SVN_NO_ERROR;
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
+                                               scratch_pool));
 }
 
 svn_error_t *
-svn_wc__loggy_set_readonly(svn_stringbuf_t **log_accum,
+svn_wc__loggy_set_readonly(svn_wc__db_t *db,
                            const char *adm_abspath,
                            const char *path,
-                           apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
+  svn_stringbuf_t *log_accum = NULL;
   const char *loggy_path1;
 
   SVN_ERR(loggy_path(&loggy_path1, path, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(log_accum,
-                        result_pool,
+  svn_xml_make_open_tag(&log_accum,
+                        scratch_pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_READONLY,
                         SVN_WC__LOG_ATTR_NAME,
                         loggy_path1,
                         NULL);
 
-  return SVN_NO_ERROR;
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
+                                               scratch_pool));
 }
 
 svn_error_t *
-svn_wc__loggy_set_timestamp(svn_stringbuf_t **log_accum,
+svn_wc__loggy_set_timestamp(svn_wc__db_t *db,
                             const char *adm_abspath,
                             const char *path,
                             const char *timestr,
-                            apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool)
 {
+  svn_stringbuf_t *log_accum = NULL;
   const char *loggy_path1;
 
   SVN_ERR(loggy_path(&loggy_path1, path, adm_abspath, scratch_pool));
-  svn_xml_make_open_tag(log_accum,
-                        result_pool,
+  svn_xml_make_open_tag(&log_accum,
+                        scratch_pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_SET_TIMESTAMP,
                         SVN_WC__LOG_ATTR_NAME,
@@ -1199,7 +1048,8 @@ svn_wc__loggy_set_timestamp(svn_stringbu
                         timestr,
                         NULL);
 
-  return SVN_NO_ERROR;
+  return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
+                                               scratch_pool));
 }
 
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.h?rev=933863&r1=933862&r2=933863&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.h Wed Apr 14 06:51:00 2010
@@ -37,33 +37,12 @@
 extern "C" {
 #endif /* __cplusplus */
 
-
-
-/* OVERVIEW OF THE LOGGY API
- *
- * NOTES
- *
- *  * When a doc string says "Extend **LOG_ACCUM", it means: "if *LOG_ACCUM is
- *    NULL then set *LOG_ACCUM to a new stringbuf allocated in RESULT_POOL,
- *    else append to the existing stringbuf there."
- */
 
 /* Each path argument to the svn_wc__loggy_* functions in this section can
    be either absolute or relative to the adm_abspath argument.
 */
 
 
-/* A macro to flush LOG_ACCUM using DB and ADM_ABSPATH.  This writes all
-   current items in LOG_ACCUM to the work queue, and then reinitializes
-   LOG_ACCUM to an empty buffer. */
-#define SVN_WC__FLUSH_LOG_ACCUM(db, adm_abspath, log_accum, scratch_pool)   \
-  if ((log_accum) && !svn_stringbuf_isempty(log_accum))                     \
-    {                                                                       \
-      SVN_ERR(svn_wc__wq_add_loggy(db, adm_abspath, log_accum, scratch_pool));\
-      svn_stringbuf_setempty(log_accum);                                    \
-    }                                                                       \
-  else {}
-
 
 /* Insert into DB a work queue instruction to append the contents
    of SRC to DST.
@@ -83,40 +62,16 @@ svn_wc__loggy_append(svn_wc__db_t *db,
                      apr_pool_t *scratch_pool);
 
 
-/* Extend **LOG_ACCUM with log instructions to copy (and translate!) the
-   file SRC_PATH to DST_PATH, if it exists. If it doesn't and
-   REMOVE_DST_IF_NO_SRC is TRUE the file at DST_PATH will be deleted if any.
-
-   The test for existence is made during this call, not at log running time.
-
-   ADM_ABSPATH is the absolute path for the admin directory for PATH.
-   SRC_PATH and DST_PATH are relative to ADM_ABSPATH.
-
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
-*/
-svn_error_t *
-svn_wc__loggy_copy(svn_stringbuf_t **log_accum,
-                   const char *adm_abspath,
-                   const char *src_path, const char *dst_path,
-                   apr_pool_t *result_pool,
-                   apr_pool_t *scratch_pool);
-
-
 /* Insert into DB a work queue instruction to generate a translated
    file from SRC to DST with translation settings from VERSIONED.
    ADM_ABSPATH is the absolute path for the admin directory for PATH.
-   DST and SRC and VERSIONED are relative to ADM_ABSPATH.
-
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
-*/
+   DST and SRC and VERSIONED are relative to ADM_ABSPATH.  */
 svn_error_t *
 svn_wc__loggy_translated_file(svn_wc__db_t *db,
                               const char *adm_abspath,
-                              const char *dst,
-                              const char *src,
-                              const char *versioned,
+                              const char *dst_abspath,
+                              const char *src_abspath,
+                              const char *versioned_abspath,
                               apr_pool_t *scratch_pool);
 
 /* Insert into DB a work queue instruction to delete the entry
@@ -145,31 +100,27 @@ svn_wc__loggy_delete_lock(svn_wc__db_t *
                           apr_pool_t *scratch_pool);
 
 
-/* Extend **LOG_ACCUM with commands to modify the entry associated with PATH
+/* Queue operations to modify the entry associated with PATH
    in ADM_ABSPATH according to the flags specified in MODIFY_FLAGS, based on
    the values supplied in *ENTRY.
+
    ADM_ABSPATH is the absolute path for the admin directory for PATH.
 
    The flags in MODIFY_FLAGS are to be taken from the svn_wc__entry_modify()
    parameter by the same name.
 
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
+   Use SCRATCH_POOL for temporary allocations.
 */
 svn_error_t *
-svn_wc__loggy_entry_modify(svn_stringbuf_t **log_accum,
+svn_wc__loggy_entry_modify(svn_wc__db_t *db,
                            const char *adm_abspath,
                            const char *path,
                            const svn_wc_entry_t *entry,
                            apr_uint64_t modify_flags,
-                           apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool);
 
 
-/* Extend **LOG_ACCUM with log instructions to move the file SRC_PATH to
-   DST_PATH, if it exists. If it doesn't and REMOVE_DST_IF_NO_SRC is TRUE
-   the file at DST_PATH will be deleted if any.
-   TODO ### There is no 'REMOVE_DST_IF_NO_SRC' arg; what will happen?
+/* Queue instructions to move the file SRC_PATH to DST_PATH.
 
    The test for existence is made now, not at log run time.
 
@@ -179,122 +130,58 @@ svn_wc__loggy_entry_modify(svn_stringbuf
    Set *DST_MODIFIED (if DST_MODIFIED isn't NULL) to indicate whether the
    destination path will have been modified after running the log: if either
    the move or the remove will have been carried out.
-
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
 */
 svn_error_t *
-svn_wc__loggy_move(svn_stringbuf_t **log_accum,
+svn_wc__loggy_move(svn_wc__db_t *db,
                    const char *adm_abspath,
-                   const char *src_path, const char *dst_path,
-                   apr_pool_t *result_pool,
+                   const char *src_path,
+                   const char *dst_path,
                    apr_pool_t *scratch_pool);
 
 
-
-/* Queue instructions to set permissions of PATH to 'executable' if it has
-   the 'executable' property set.
-
-   ADM_ABSPATH is the absolute path for the admin directory for PATH.
-
-   The property is tested at log run time, within this log instruction.
-
-   Use SCRATCH_POOL for temporary allocations.
-*/
-svn_error_t *
-svn_wc__loggy_maybe_set_executable(svn_wc__db_t *db,
-                                   const char *adm_abspath,
-                                   const char *path,
-                                   apr_pool_t *scratch_pool);
-
-/* Queue instructions to set permissions of PATH to 'readonly' if it has
-   the 'needs-lock' property set and there is no lock for the file in the
-   working copy.
-
-   ADM_ABSPATH is the absolute path for the admin directory for PATH.
-
-   The tests are made at log run time, within this log instruction.
-
-   Use SCRATCH_POOL for temporary allocations.
-*/
-svn_error_t *
-svn_wc__loggy_maybe_set_readonly(svn_wc__db_t *db,
-                                 const char *adm_abspath,
-                                 const char *path,
-                                 apr_pool_t *scratch_pool);
-
-
-/* Extend **LOG_ACCUM with log instructions to set the timestamp of PATH
-   in the entry field with name TIME_PROP.
-   TODO ### Huh? There is no 'TIME_PROP' argument.
-
-   Use one of the SVN_WC__ENTRY_ATTR_* values for TIME_PROP.
-
-   ADM_ABSPATH is the absolute path for the admin directory for PATH.
-
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
-*/
 svn_error_t *
-svn_wc__loggy_set_entry_timestamp_from_wc(svn_stringbuf_t **log_accum,
+svn_wc__loggy_set_entry_timestamp_from_wc(svn_wc__db_t *db,
                                           const char *adm_abspath,
                                           const char *path,
-                                          apr_pool_t *result_pool,
                                           apr_pool_t *scratch_pool);
 
 
-/* Extend **LOG_ACCUM with log instructions to set the file size of PATH
+/* Queue log instructions to set the file size of PATH
    in the entries' WORKING_SIZE field.
-   ADM_ABSPATH is the absolute path for the admin directory for PATH.
 
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
+   ADM_ABSPATH is the absolute path for the admin directory for PATH.
 */
 svn_error_t *
-svn_wc__loggy_set_entry_working_size_from_wc(svn_stringbuf_t **log_accum,
+svn_wc__loggy_set_entry_working_size_from_wc(svn_wc__db_t *db,
                                              const char *adm_abspath,
                                              const char *path,
-                                             apr_pool_t *result_pool,
                                              apr_pool_t *scratch_pool);
 
 
-/* Extend **LOG_ACCUM with log instructions to set permissions of PATH
+/* Queue instructions to set permissions of PATH
    to 'readonly'.
-   ADM_ABSPATH is the absolute path for the admin directory for PATH.
 
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
+   ADM_ABSPATH is the absolute path for the admin directory for PATH.
 */
 svn_error_t *
-svn_wc__loggy_set_readonly(svn_stringbuf_t **log_accum,
+svn_wc__loggy_set_readonly(svn_wc__db_t *db,
                            const char *adm_abspath,
                            const char *path,
-                           apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool);
 
-/* Extend **LOG_ACCUM with log instructions to set the timestamp of PATH to
+/* Queue instructions to set the timestamp of PATH to
    the time TIMESTR.
-   ADM_ABSPATH is the absolute path for the admin directory for PATH.
 
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
+   ADM_ABSPATH is the absolute path for the admin directory for PATH.
 */
 svn_error_t *
-svn_wc__loggy_set_timestamp(svn_stringbuf_t **log_accum,
+svn_wc__loggy_set_timestamp(svn_wc__db_t *db,
                             const char *adm_abspath,
                             const char *path,
                             const char *timestr,
-                            apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool);
 
-/* Like svn_wc__add_tree_conflict(), but append to the log accumulator
- * LOG_ACCUM a command to rewrite the entry field, and do not flush the log.
- * This function is meant to be used in the working copy library where
- * log accumulators are usually readily available.
- *
- * If *LOG_ACCUM is NULL then set *LOG_ACCUM to a new stringbug allocated in
- * POOL, else append to the existing stringbuf there.
- */
+/* */
 svn_error_t *
 svn_wc__loggy_add_tree_conflict(svn_wc__db_t *db,
                                 const char *adm_abspath,
@@ -302,17 +189,15 @@ svn_wc__loggy_add_tree_conflict(svn_wc__
                                 apr_pool_t *scratch_pool);
 
 
-/* Extend LOG_ACCUM with log entries to save the current baseprops of
+/* Queue work items to save the current baseprops of
    LOCAL_ABSPATH as revert props.
 
    Makes sure the baseprops are destroyed.
 */
 svn_error_t *
-svn_wc__loggy_revert_props_create(svn_stringbuf_t **log_accum,
-                                  svn_wc__db_t *db,
+svn_wc__loggy_revert_props_create(svn_wc__db_t *db,
                                   const char *local_abspath,
-                                  const char *adm_abspath,
-                                  apr_pool_t *pool);
+                                  apr_pool_t *scratch_pool);
 
 
 /* TODO ###

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/merge.c?rev=933863&r1=933862&r2=933863&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/merge.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/merge.c Wed Apr 14 06:51:00 2010
@@ -118,7 +118,7 @@ get_prop(const apr_array_header_t *prop_
 static svn_error_t *
 detranslate_wc_file(const char **detranslated_abspath,
                     svn_wc__db_t *db,
-                    const char *merge_abspath,
+                    const char *target_abspath,
                     svn_boolean_t force_copy,
                     const apr_array_header_t *prop_diff,
                     const char *source_abspath,
@@ -133,7 +133,7 @@ detranslate_wc_file(const char **detrans
   svn_boolean_t special;
 
   /* Decide if the merge target currently is a text or binary file. */
-  SVN_ERR(svn_wc__marked_as_binary(&is_binary, merge_abspath, db,
+  SVN_ERR(svn_wc__marked_as_binary(&is_binary, target_abspath, db,
                                    scratch_pool));
 
   /* See if we need to do a straight copy:
@@ -156,16 +156,16 @@ detranslate_wc_file(const char **detrans
     {
       /* Old props indicate texty, new props indicate binary:
          detranslate keywords and old eol-style */
-      SVN_ERR(svn_wc__get_keywords(&keywords, db, merge_abspath, NULL,
+      SVN_ERR(svn_wc__get_keywords(&keywords, db, target_abspath, NULL,
                                    scratch_pool, scratch_pool));
-      SVN_ERR(svn_wc__get_special(&special, db, merge_abspath, scratch_pool));
+      SVN_ERR(svn_wc__get_special(&special, db, target_abspath, scratch_pool));
     }
   else
     {
       /* New props indicate texty, regardless of old props */
 
       /* In case the file used to be special, detranslate specially */
-      SVN_ERR(svn_wc__get_special(&special, db, merge_abspath, scratch_pool));
+      SVN_ERR(svn_wc__get_special(&special, db, target_abspath, scratch_pool));
 
       if (special)
         {
@@ -182,7 +182,7 @@ detranslate_wc_file(const char **detrans
               svn_subst_eol_style_from_value(&style, &eol, prop->value->data);
             }
           else if (!is_binary)
-            SVN_ERR(svn_wc__get_eol_style(&style, &eol, db, merge_abspath,
+            SVN_ERR(svn_wc__get_eol_style(&style, &eol, db, target_abspath,
                                           scratch_pool, scratch_pool));
           else
             {
@@ -193,7 +193,7 @@ detranslate_wc_file(const char **detrans
           /* In case there were keywords, detranslate with keywords
              (iff we were texty) */
           if (!is_binary)
-            SVN_ERR(svn_wc__get_keywords(&keywords, db, merge_abspath, NULL,
+            SVN_ERR(svn_wc__get_keywords(&keywords, db, target_abspath, NULL,
                                          scratch_pool, scratch_pool));
           else
             keywords = NULL;
@@ -392,32 +392,37 @@ do_text_merge_external(svn_boolean_t *co
  * resolution to the file RESULT_TARGET. The merge result is expected
  * in the same directory as TARGET_ABSPATH the same basename as
  * TARGET_ABSPATH, but followed by ".edited".
- * Use LOG_ACCUM as log accumulator.  DB contains an access baton with
+ * DB contains an access baton with
  * a write lock for the directory containing RESULT_TARGET.
  * Do all allocations in POOL.
  */
 static svn_error_t*
-save_merge_result(svn_stringbuf_t **log_accum,
-                  svn_wc__db_t *db,
+save_merge_result(svn_wc__db_t *db,
                   const char *target_abspath,
                   const char *result_target,
                   apr_pool_t *pool)
 {
-  const char *edited_copy;
-  const char *merge_dirpath, *merge_filename;
+  const char *edited_copy_abspath;
+  const char *dir_abspath;
+  const char *merge_filename;
 
-  svn_dirent_split(target_abspath, &merge_dirpath, &merge_filename, pool);
+  svn_dirent_split(target_abspath, &dir_abspath, &merge_filename, pool);
 
   /* ### Should use preserved-conflict-file-exts. */
+  /* Create the .edited file within this file's DIR_ABSPATH  */
   SVN_ERR(svn_io_open_uniquely_named(NULL,
-                                     &edited_copy,
-                                     merge_dirpath,
+                                     &edited_copy_abspath,
+                                     dir_abspath,
                                      merge_filename,
                                      ".edited",
                                      svn_io_file_del_none,
                                      pool, pool));
-  SVN_ERR(svn_wc__loggy_copy(log_accum, merge_dirpath,
-                             result_target, edited_copy, pool, pool));
+  SVN_ERR(svn_wc__loggy_translated_file(db, dir_abspath,
+                                        edited_copy_abspath,
+                                        result_target,
+                                        target_abspath,
+                                        pool));
+
   return SVN_NO_ERROR;
 }
 
@@ -433,11 +438,10 @@ save_merge_result(svn_stringbuf_t **log_
 static svn_error_t*
 eval_conflict_func_result(enum svn_wc_merge_outcome_t *merge_outcome,
                           svn_wc_conflict_result_t *result,
-                          svn_stringbuf_t **log_accum,
                           svn_wc__db_t *db,
-                          const char *left,
-                          const char *right,
-                          const char *merge_target,
+                          const char *left_abspath,
+                          const char *right_abspath,
+                          const char *target_abspath,
                           const char *copyfrom_text,
                           const char *adm_abspath,
                           const char *result_target,
@@ -445,23 +449,24 @@ eval_conflict_func_result(enum svn_wc_me
                           svn_diff_file_options_t *options,
                           apr_pool_t *pool)
 {
+  const char *install_from = NULL;
+  svn_boolean_t remove_source = FALSE;
+
   switch (result->choice)
     {
       /* If the callback wants to use one of the fulltexts
          to resolve the conflict, so be it.*/
       case svn_wc_conflict_choose_base:
         {
-          SVN_ERR(svn_wc__loggy_copy(log_accum, adm_abspath,
-                                     left, merge_target, pool, pool));
+          install_from = left_abspath;
           *merge_outcome = svn_wc_merge_merged;
-          return SVN_NO_ERROR;
+          break;
         }
       case svn_wc_conflict_choose_theirs_full:
         {
-          SVN_ERR(svn_wc__loggy_copy(log_accum, adm_abspath,
-                                     right, merge_target, pool, pool));
+          install_from = right_abspath;
           *merge_outcome = svn_wc_merge_merged;
-          return SVN_NO_ERROR;
+          break;
         }
       case svn_wc_conflict_choose_mine_full:
         {
@@ -489,22 +494,24 @@ eval_conflict_func_result(enum svn_wc_me
                                          svn_io_file_del_none, pool, pool));
 
           SVN_ERR(svn_diff_file_diff3_2(&diff,
-                                        left, detranslated_target, right,
+                                        left_abspath,
+                                        detranslated_target, right_abspath,
                                         options, pool));
           SVN_ERR(svn_diff_file_output_merge2(chosen_stream, diff,
-                                              left,
+                                              left_abspath,
                                               detranslated_target,
-                                              right,
+                                              right_abspath,
                                               /* markers ignored */
                                               NULL, NULL,
                                               NULL, NULL,
                                               style,
                                               pool));
           SVN_ERR(svn_stream_close(chosen_stream));
-          SVN_ERR(svn_wc__loggy_copy(log_accum, adm_abspath,
-                                     chosen_path, merge_target, pool, pool));
+
+          install_from = chosen_path;
+          remove_source = TRUE;
           *merge_outcome = svn_wc_merge_merged;
-          return SVN_NO_ERROR;
+          break;
         }
 
         /* For the case of 3-way file merging, we don't
@@ -515,41 +522,65 @@ eval_conflict_func_result(enum svn_wc_me
            good to use". */
       case svn_wc_conflict_choose_merged:
         {
-          SVN_ERR(svn_wc__loggy_copy(log_accum, adm_abspath,
-                                     /* Look for callback's own
-                                        merged-file first: */
-                                     result->merged_file
-                                       ? result->merged_file
-                                       : result_target,
-                                     merge_target,
-                                     pool, pool));
+          /* Look for callback's own merged-file first:  */
+          install_from = (result->merged_file
+                            ? result->merged_file
+                            : result_target);
           *merge_outcome = svn_wc_merge_merged;
-          return SVN_NO_ERROR;
+          break;
         }
       case svn_wc_conflict_choose_postpone:
       default:
         {
+#if 0
+          /* ### what should this value be? no caller appears to initialize
+             ### it, so we really SHOULD be setting a value here.  */
+          *merge_outcome = svn_wc_merge_merged;
+#endif
+
           /* Issue #3354: We need to install the copyfrom_text,
            * which now carries conflicts, into ACTUAL, by copying
            * it to the merge target. */
           if (copyfrom_text)
             {
-              SVN_ERR(svn_wc__loggy_copy(log_accum, adm_abspath,
-                                     copyfrom_text, merge_target,
-                                     pool, pool));
+              install_from = copyfrom_text;
+              break;
             }
 
           /* Assume conflict remains. */
           return SVN_NO_ERROR;
         }
     }
+
+  SVN_ERR_ASSERT(install_from != NULL);
+
+  {
+    const svn_skel_t *work_item;
+
+    SVN_ERR(svn_wc__wq_build_file_install(&work_item,
+                                          db, target_abspath,
+                                          install_from,
+                                          FALSE /* use_commit_times */,
+                                          FALSE /* record_fileinfo */,
+                                          pool, pool));
+    SVN_ERR(svn_wc__db_wq_add(db, adm_abspath, work_item, pool));
+
+    if (remove_source)
+      {
+        SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
+                                             db, install_from,
+                                             pool, pool));
+        SVN_ERR(svn_wc__db_wq_add(db, adm_abspath, work_item, pool));
+      }
+  }
+
+  return SVN_NO_ERROR;
 }
 
 /* Preserve the three pre-merge files, and modify the
    entry (mark as conflicted, track the preserved files). */
 static svn_error_t*
-preserve_pre_merge_files(svn_stringbuf_t **log_accum,
-                         svn_wc__db_t *db,
+preserve_pre_merge_files(svn_wc__db_t *db,
                          const char *left_abspath,
                          const char *right_abspath,
                          const char *target_abspath,
@@ -641,9 +672,8 @@ preserve_pre_merge_files(svn_stringbuf_t
      are written, so everything should be fine.  Really.  */
 
   /* Create LEFT and RIGHT backup files, in expanded form.
-     We use merge_target's current properties to do the translation. */
+     We use TARGET_ABSPATH's current properties to do the translation. */
   /* Derive the basenames of the 3 backup files. */
-  SVN_WC__FLUSH_LOG_ACCUM(db, dir_abspath, *log_accum, pool);
   SVN_ERR(svn_wc__loggy_translated_file(db, dir_abspath,
                                         left_copy, tmp_left,
                                         target_abspath, pool));
@@ -651,7 +681,7 @@ preserve_pre_merge_files(svn_stringbuf_t
                                         right_copy, tmp_right,
                                         target_abspath, pool));
 
-  /* Back up MERGE_TARGET through detranslation/retranslation:
+  /* Back up TARGET_ABSPATH through detranslation/retranslation:
      the new translation properties may not match the current ones */
   SVN_ERR(svn_wc__internal_translated_file(
            &detranslated_target_copy, target_abspath, db, target_abspath,
@@ -665,23 +695,23 @@ preserve_pre_merge_files(svn_stringbuf_t
   tmp_entry.conflict_new = svn_dirent_is_child(dir_abspath, right_copy, pool);
   tmp_entry.conflict_wrk = svn_dirent_basename(target_copy, pool);
 
-  /* Mark merge_target's entry as "Conflicted", and start tracking
+  /* Mark TARGET_ABSPATH's entry as "Conflicted", and start tracking
      the backup files in the entry as well. */
-  SVN_ERR(svn_wc__loggy_entry_modify(log_accum, dir_abspath,
+  SVN_ERR(svn_wc__loggy_entry_modify(db, dir_abspath,
                                      target_abspath, &tmp_entry,
                                      SVN_WC__ENTRY_MODIFY_CONFLICT_OLD
                                        | SVN_WC__ENTRY_MODIFY_CONFLICT_NEW
                                        | SVN_WC__ENTRY_MODIFY_CONFLICT_WRK,
-                                     pool, pool));
+                                     pool));
 
   return SVN_NO_ERROR;
 }
 
 /* Helper for maybe_resolve_conflicts() below. */
 static const svn_wc_conflict_description_t *
-setup_text_conflict_desc(const char *left,
-                         const char *right,
-                         const char *merge_abspath,
+setup_text_conflict_desc(const char *left_abspath,
+                         const char *right_abspath,
+                         const char *target_abspath,
                          const svn_wc_conflict_version_t *left_version,
                          const svn_wc_conflict_version_t *right_version,
                          const char *result_target,
@@ -692,12 +722,12 @@ setup_text_conflict_desc(const char *lef
 {
   svn_wc_conflict_description2_t *cdesc;
 
-  cdesc = svn_wc_conflict_description_create_text2(merge_abspath, pool);
+  cdesc = svn_wc_conflict_description_create_text2(target_abspath, pool);
   cdesc->is_binary = FALSE;
   cdesc->mime_type = (mimeprop && mimeprop->value)
                      ? mimeprop->value->data : NULL,
-  cdesc->base_file = left;
-  cdesc->their_file = right;
+  cdesc->base_file = left_abspath;
+  cdesc->their_file = right_abspath;
   cdesc->my_file = detranslated_target;
   cdesc->merged_file = result_target;
 
@@ -709,11 +739,10 @@ setup_text_conflict_desc(const char *lef
 
 /* XXX Insane amount of parameters... */
 static svn_error_t*
-maybe_resolve_conflicts(svn_stringbuf_t **log_accum,
-                        svn_wc__db_t *db,
-                        const char *left,
-                        const char *right,
-                        const char *merge_target,
+maybe_resolve_conflicts(svn_wc__db_t *db,
+                        const char *left_abspath,
+                        const char *right_abspath,
+                        const char *target_abspath,
                         const char *copyfrom_text,
                         const char *left_label,
                         const char *right_label,
@@ -732,11 +761,7 @@ maybe_resolve_conflicts(svn_stringbuf_t 
                         apr_pool_t *pool)
 {
   svn_wc_conflict_result_t *result = NULL;
-  const char *left_abspath, *right_abspath, *target_abspath, *dir_abspath;
-
-  SVN_ERR(svn_dirent_get_absolute(&left_abspath, left, pool));
-  SVN_ERR(svn_dirent_get_absolute(&right_abspath, right, pool));
-  SVN_ERR(svn_dirent_get_absolute(&target_abspath, merge_target, pool));
+  const char *dir_abspath;
 
   dir_abspath = svn_dirent_dirname(target_abspath, pool);
 
@@ -769,9 +794,9 @@ maybe_resolve_conflicts(svn_stringbuf_t 
         return svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
                                 NULL, _("Conflict callback violated API:"
                                         " returned no results"));
+
       if (result->save_merged)
-        SVN_ERR(save_merge_result(log_accum,
-                                  db,
+        SVN_ERR(save_merge_result(db,
                                   target_abspath,
                                   /* Look for callback's own
                                      merged-file first: */
@@ -783,11 +808,10 @@ maybe_resolve_conflicts(svn_stringbuf_t 
 
   SVN_ERR(eval_conflict_func_result(merge_outcome,
                                     result,
-                                    log_accum,
                                     db,
-                                    left,
-                                    right,
-                                    merge_target,
+                                    left_abspath,
+                                    right_abspath,
+                                    target_abspath,
                                     copyfrom_text,
                                     dir_abspath,
                                     result_target,
@@ -801,8 +825,7 @@ maybe_resolve_conflicts(svn_stringbuf_t 
     return SVN_NO_ERROR;
 
   /* The conflicts have not been dealt with. */
-  SVN_ERR(preserve_pre_merge_files(log_accum,
-                                   db,
+  SVN_ERR(preserve_pre_merge_files(db,
                                    left_abspath,
                                    right_abspath,
                                    target_abspath,
@@ -818,8 +841,7 @@ maybe_resolve_conflicts(svn_stringbuf_t 
 
 /* XXX Insane amount of parameters... */
 static svn_error_t*
-merge_text_file(svn_stringbuf_t **log_accum,
-                enum svn_wc_merge_outcome_t *merge_outcome,
+merge_text_file(enum svn_wc_merge_outcome_t *merge_outcome,
                 svn_wc__db_t *db,
                 const char *left_abspath,
                 const char *right_abspath,
@@ -895,8 +917,7 @@ merge_text_file(svn_stringbuf_t **log_ac
 
   if (contains_conflicts && ! dry_run)
     {
-      SVN_ERR(maybe_resolve_conflicts(log_accum,
-                                      db,
+      SVN_ERR(maybe_resolve_conflicts(db,
                                       left_abspath,
                                       right_abspath,
                                       target_abspath,
@@ -914,6 +935,7 @@ merge_text_file(svn_stringbuf_t **log_ac
                                       conflict_func, conflict_baton,
                                       cancel_func, cancel_baton,
                                       pool));
+
       if (*merge_outcome == svn_wc_merge_merged)
         return SVN_NO_ERROR;
     }
@@ -940,21 +962,30 @@ merge_text_file(svn_stringbuf_t **log_ac
     }
 
   if (*merge_outcome != svn_wc_merge_unchanged && ! dry_run)
-    /* replace MERGE_TARGET with the new merged file, expanding. */
-    SVN_ERR(svn_wc__loggy_copy(log_accum, dir_abspath,
-                               result_target, target_abspath, pool, pool));
+    {
+      const svn_skel_t *work_item;
+
+      /* replace TARGET_ABSPATH with the new merged file, expanding. */
+      SVN_ERR(svn_wc__wq_build_file_install(&work_item,
+                                            db, target_abspath,
+                                            result_target,
+                                            FALSE /* use_commit_times */,
+                                            FALSE /* record_fileinfo */,
+                                            pool, pool));
+      SVN_ERR(svn_wc__db_wq_add(db, dir_abspath, work_item, pool));
+    }
+
   return SVN_NO_ERROR;
 }
 
 
 /* XXX Insane amount of parameters... */
-static svn_error_t*
-merge_binary_file(svn_stringbuf_t **log_accum,
-                  enum svn_wc_merge_outcome_t *merge_outcome,
+static svn_error_t *
+merge_binary_file(enum svn_wc_merge_outcome_t *merge_outcome,
                   svn_wc__db_t *db,
-                  const char *left,
-                  const char *right,
-                  const char *merge_target,
+                  const char *left_abspath,
+                  const char *right_abspath,
+                  const char *target_abspath,
                   const char *left_label,
                   const char *right_label,
                   const char *target_label,
@@ -972,13 +1003,12 @@ merge_binary_file(svn_stringbuf_t **log_
      keywords and eol stuff?   */
   const char *left_copy, *right_copy;
   const char *left_base, *right_base;
-  const char *merge_abspath;
   const char *merge_dirpath, *merge_filename;
   svn_wc_entry_t tmp_entry;
 
-  SVN_ERR(svn_dirent_get_absolute(&merge_abspath, merge_target, pool));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(target_abspath));
 
-  svn_dirent_split(merge_abspath, &merge_dirpath, &merge_filename, pool);
+  svn_dirent_split(target_abspath, &merge_dirpath, &merge_filename, pool);
 
   /* Give the conflict resolution callback a chance to clean
      up the conflict before we mark the file 'conflicted' */
@@ -986,8 +1016,10 @@ merge_binary_file(svn_stringbuf_t **log_
     {
       svn_wc_conflict_result_t *result = NULL;
       const svn_wc_conflict_description_t *cdesc;
+      const char *install_from = NULL;
 
-      cdesc = setup_text_conflict_desc(left, right, merge_abspath,
+      cdesc = setup_text_conflict_desc(left_abspath, right_abspath,
+                                       target_abspath,
                                        left_version, right_version,
                                        NULL /* result_target */,
                                        detranslated_target_abspath,
@@ -1005,19 +1037,15 @@ merge_binary_file(svn_stringbuf_t **log_
              unless the conflict-callback did the merging itself. */
           case svn_wc_conflict_choose_base:
             {
-              SVN_ERR(svn_wc__loggy_copy(log_accum,
-                                     merge_dirpath,
-                                     left, merge_target, pool, pool));
+              install_from = left_abspath;
               *merge_outcome = svn_wc_merge_merged;
-              return SVN_NO_ERROR;
+              break;
             }
           case svn_wc_conflict_choose_theirs_full:
             {
-              SVN_ERR(svn_wc__loggy_copy(log_accum,
-                                     merge_dirpath,
-                                     right, merge_target, pool, pool));
+              install_from = right_abspath;
               *merge_outcome = svn_wc_merge_merged;
-              return SVN_NO_ERROR;
+              break;
             }
             /* For a binary file, if the response is to use the
                user's file, we do nothing.  We also do nothing if
@@ -1041,12 +1069,9 @@ merge_binary_file(svn_stringbuf_t **log_
                 }
               else
                 {
-                  SVN_ERR(svn_wc__loggy_copy(log_accum,
-                                     merge_dirpath,
-                                     result->merged_file, merge_target,
-                                     pool, pool));
+                  install_from = result->merged_file;
                   *merge_outcome = svn_wc_merge_merged;
-                  return SVN_NO_ERROR;
+                  break;
                 }
             }
           case svn_wc_conflict_choose_postpone:
@@ -1055,6 +1080,22 @@ merge_binary_file(svn_stringbuf_t **log_
               /* Assume conflict remains, fall through to code below. */
             }
         }
+
+      if (install_from != NULL)
+        {
+          const svn_skel_t *work_item;
+
+          SVN_ERR(svn_wc__wq_build_file_install(&work_item,
+                                                db, target_abspath,
+                                                install_from,
+                                                FALSE /* use_commit_times */,
+                                                FALSE /* record_fileinfo */,
+                                                pool, pool));
+          SVN_ERR(svn_wc__db_wq_add(db, merge_dirpath, work_item, pool));
+
+          /* A merge choice was made, so we're done here.  */
+          return SVN_NO_ERROR;
+        }
     }
 
   /* reserve names for backups of left and right fulltexts */
@@ -1075,11 +1116,11 @@ merge_binary_file(svn_stringbuf_t **log_
                                      pool, pool));
 
   /* create the backup files */
-  SVN_ERR(svn_io_copy_file(left, left_copy, TRUE, pool));
-  SVN_ERR(svn_io_copy_file(right, right_copy, TRUE, pool));
+  SVN_ERR(svn_io_copy_file(left_abspath, left_copy, TRUE, pool));
+  SVN_ERR(svn_io_copy_file(right_abspath, right_copy, TRUE, pool));
 
   /* Was the merge target detranslated? */
-  if (strcmp(merge_abspath, detranslated_target_abspath) != 0)
+  if (strcmp(target_abspath, detranslated_target_abspath) != 0)
     {
       /* Create a .mine file too */
       const char *mine_copy;
@@ -1091,11 +1132,12 @@ merge_binary_file(svn_stringbuf_t **log_
                                          target_label,
                                          svn_io_file_del_none,
                                          pool, pool));
-      SVN_ERR(svn_wc__loggy_move(log_accum,
+      SVN_ERR(svn_wc__loggy_move(db,
                                  merge_dirpath,
                                  detranslated_target_abspath,
                                  mine_copy,
-                                 pool, pool));
+                                 pool));
+
       mine_copy = svn_dirent_is_child(merge_dirpath,
                                       mine_copy, pool);
       tmp_entry.conflict_wrk = mine_copy;
@@ -1107,18 +1149,17 @@ merge_binary_file(svn_stringbuf_t **log_
   left_base = svn_dirent_basename(left_copy, pool);
   right_base = svn_dirent_basename(right_copy, pool);
 
-  /* Mark merge_target's entry as "Conflicted", and start tracking
+  /* Mark target_abspath's entry as "Conflicted", and start tracking
      the backup files in the entry as well. */
   tmp_entry.conflict_old = left_base;
   tmp_entry.conflict_new = right_base;
   SVN_ERR(svn_wc__loggy_entry_modify(
-            log_accum,
-            merge_dirpath, merge_target,
+            db, merge_dirpath, target_abspath,
             &tmp_entry,
             SVN_WC__ENTRY_MODIFY_CONFLICT_OLD
               | SVN_WC__ENTRY_MODIFY_CONFLICT_NEW
               | SVN_WC__ENTRY_MODIFY_CONFLICT_WRK,
-            pool, pool));
+            pool));
 
   *merge_outcome = svn_wc_merge_conflict; /* a conflict happened */
 
@@ -1127,8 +1168,7 @@ merge_binary_file(svn_stringbuf_t **log_
 
 /* XXX Insane amount of parameters... */
 svn_error_t *
-svn_wc__internal_merge(svn_stringbuf_t **log_accum,
-                       enum svn_wc_merge_outcome_t *merge_outcome,
+svn_wc__internal_merge(enum svn_wc_merge_outcome_t *merge_outcome,
                        svn_wc__db_t *db,
                        const char *left_abspath,
                        const svn_wc_conflict_version_t *left_version,
@@ -1158,7 +1198,8 @@ svn_wc__internal_merge(svn_stringbuf_t *
   SVN_ERR_ASSERT(svn_dirent_is_absolute(left_abspath));
   SVN_ERR_ASSERT(svn_dirent_is_absolute(right_abspath));
   SVN_ERR_ASSERT(svn_dirent_is_absolute(target_abspath));
-  SVN_ERR_ASSERT(copyfrom_abspath == NULL || svn_dirent_is_absolute(copyfrom_abspath));
+  SVN_ERR_ASSERT(copyfrom_abspath == NULL
+                 || svn_dirent_is_absolute(copyfrom_abspath));
 
   dir_abspath = svn_dirent_dirname(target_abspath, pool);
 
@@ -1210,8 +1251,7 @@ svn_wc__internal_merge(svn_stringbuf_t *
         /* in dry-run mode, binary files always conflict */
         *merge_outcome = svn_wc_merge_conflict;
       else
-        SVN_ERR(merge_binary_file(log_accum,
-                                  merge_outcome,
+        SVN_ERR(merge_binary_file(merge_outcome,
                                   db,
                                   left_abspath,
                                   right_abspath,
@@ -1230,8 +1270,7 @@ svn_wc__internal_merge(svn_stringbuf_t *
                                   pool));
     }
   else
-    SVN_ERR(merge_text_file(log_accum,
-                            merge_outcome,
+    SVN_ERR(merge_text_file(merge_outcome,
                             db,
                             left_abspath,
                             right_abspath,
@@ -1253,28 +1292,17 @@ svn_wc__internal_merge(svn_stringbuf_t *
                             cancel_baton,
                             pool));
 
-  SVN_ERR_ASSERT(!dry_run
-                 || *log_accum == NULL
-                 || svn_stringbuf_isempty(*log_accum));
-
-  /* Queue everything that has been accumulated.  */
-  if (*log_accum != NULL)
-    {
-      SVN_ERR(svn_wc__wq_add_loggy(db, dir_abspath, *log_accum, pool));
-      svn_stringbuf_setempty(*log_accum);
-    }
-
   /* Merging is complete.  Regardless of text or binariness, we might
      need to tweak the executable bit on the new working file, and
      possibly make it read-only. */
   if (! dry_run)
     {
-      SVN_ERR(svn_wc__loggy_maybe_set_executable(db, dir_abspath,
-                                                 target_abspath,
-                                                 pool));
-      SVN_ERR(svn_wc__loggy_maybe_set_readonly(db, dir_abspath,
+      const svn_skel_t *work_item;
+
+      SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item, db,
                                                target_abspath,
-                                               pool));
+                                               pool, pool));
+      SVN_ERR(svn_wc__db_wq_add(db, dir_abspath, work_item, pool));
     }
 
   return SVN_NO_ERROR;
@@ -1302,15 +1330,18 @@ svn_wc_merge4(enum svn_wc_merge_outcome_
               void *cancel_baton,
               apr_pool_t *scratch_pool)
 {
-  svn_stringbuf_t *log_accum = NULL;
   const char *dir_abspath = svn_dirent_dirname(target_abspath, scratch_pool);
 
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(left_abspath));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(right_abspath));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(target_abspath));
+
   /* Before we do any work, make sure we hold a write lock.  */
   if (!dry_run)
     SVN_ERR(svn_wc__write_check(wc_ctx->db, dir_abspath, scratch_pool));
 
   /* Queue all the work.  */
-  SVN_ERR(svn_wc__internal_merge(&log_accum, merge_outcome,
+  SVN_ERR(svn_wc__internal_merge(merge_outcome,
                                  wc_ctx->db,
                                  left_abspath, left_version,
                                  right_abspath, right_version,
@@ -1325,9 +1356,6 @@ svn_wc_merge4(enum svn_wc_merge_outcome_
                                  cancel_func, cancel_baton,
                                  scratch_pool));
 
-  /* svn_wc__internal_merge() should have queued all of its work.  */
-  SVN_ERR_ASSERT(log_accum == NULL || svn_stringbuf_isempty(log_accum));
-
   /* If this isn't a dry run, then run the work!  */
   if (!dry_run)
     SVN_ERR(svn_wc__wq_run(wc_ctx->db, target_abspath,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/node.c?rev=933863&r1=933862&r2=933863&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/node.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/node.c Wed Apr 14 06:51:00 2010
@@ -645,3 +645,33 @@ svn_wc__node_get_lock_token(const char *
 
   return SVN_NO_ERROR;
 }
+
+
+svn_error_t *
+svn_wc__internal_is_file_external(svn_boolean_t *file_external,
+                                  svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  apr_pool_t *scratch_pool)
+{
+  const char *serialized;
+
+  SVN_ERR(svn_wc__db_temp_get_file_external(&serialized,
+                                            db, local_abspath,
+                                            scratch_pool, scratch_pool));
+  *file_external = (serialized != NULL);
+
+  return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_wc__node_is_file_external(svn_boolean_t *file_external,
+                              svn_wc_context_t *wc_ctx,
+                              const char *local_abspath,
+                              apr_pool_t *scratch_pool)
+{
+  return svn_error_return(svn_wc__internal_is_file_external(file_external,
+                                                            wc_ctx->db,
+                                                            local_abspath,
+                                                            scratch_pool));
+}