Author: philip
Date: Mon Mar  8 14:35:42 2010
New Revision: 920336

URL: http://svn.apache.org/viewvc?rev=920336&view=rev
Log:
Remove access baton from svn_client__harvest_committables.  Explicitly
use absolute paths in svn_client__copy_pair_t (they were mostly absolute
already). 

* subversion/libsvn_client/client.h
  (svn_client__harvest_committables): Change access baton parameter to an
   abspath.
  (svn_client__get_copy_source): Tweak docstring.
  (struct svn_client__copy_pair_t): Remove src_abs, rename dst_parent to 
   dst_parent_abspath, document that other paths are absolute.

* subversion/libsvn_client/commit_utils.c
  (harvest_committables): Rename parameter, remove p_path.
  (svn_client__harvest_committables): Change access baton parameter to an
   abspath.

* subversion/libsvn_client/commit.c
  (svn_client_commit4): Update svn_client__harvest_committables call.

* subversion/libsvn_client/copy.c
  (do_wc_to_wc_copies_with_write_lock): No need to convert to absolute.
  (do_wc_to_wc_moves_with_locks2): Don't use src_abs.
  (do_wc_to_wc_moves): No need to convert to absolute.
  (wc_to_wc_copy): Use dst_parent_abspath.
  (wc_to_repos_copy): Don't use src_abs.
  (try_copy): Always put abspaths into copy_pairs.

Modified:
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_client/copy.c

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=920336&r1=920335&r2=920336&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Mon Mar  8 14:35:42 2010
@@ -730,12 +730,9 @@
 */
 typedef struct
 {
-    /* The source path or url. */
+    /* The absolute source path or url. */
     const char *src;
 
-    /* The absolute path of the source. */
-    const char *src_abs;
-
     /* The base name of the object.  It should be the same for both src
        and dst. */
     const char *base_name;
@@ -756,11 +753,11 @@
     /* The source revision number. */
     svn_revnum_t src_revnum;
 
-    /* The destination path or url */
+    /* The absolute destination path or url */
     const char *dst;
 
-    /* The destination's parent path */
-    const char *dst_parent;
+    /* The absolute destination's parent path */
+    const char *dst_parent_abspath;
 } svn_client__copy_pair_t;
 
 /* ---------------------------------------------------------------- */
@@ -871,7 +868,7 @@
 svn_error_t *
 svn_client__harvest_committables(apr_hash_t **committables,
                                  apr_hash_t **lock_tokens,
-                                 svn_wc_adm_access_t *parent_dir,
+                                 const char *dir_abspath,
                                  apr_array_header_t *targets,
                                  svn_depth_t depth,
                                  svn_boolean_t just_locked,
@@ -880,8 +877,8 @@
                                  apr_pool_t *pool);
 
 
-/* Recursively crawl each working copy path SRC in COPY_PAIRS, harvesting
-   commit_items into a COMMITABLES hash (see the docstring for
+/* Recursively crawl each absolute working copy path SRC in COPY_PAIRS,
+   harvesting commit_items into a COMMITABLES hash (see the docstring for
    svn_client__harvest_committables for what that really means, and
    for the relevance of LOCKED_DIRS) as if every entry at or below
    the SRC was to be committed as a set of adds (mostly with history)

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=920336&r1=920335&r2=920336&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Mon Mar  8 14:35:42 2010
@@ -1192,7 +1192,7 @@
   /* Crawl the working copy for commit items. */
   if ((cmt_err = svn_client__harvest_committables(&committables,
                                                   &lock_tokens,
-                                                  base_dir_access,
+                                                  base_dir,
                                                   rel_targets,
                                                   depth,
                                                   ! keep_locks,

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=920336&r1=920335&r2=920336&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Mon Mar  8 14:35:42 
2010
@@ -357,7 +357,7 @@
 static svn_error_t *
 harvest_committables(apr_hash_t *committables,
                      apr_hash_t *lock_tokens,
-                     const char *path,
+                     const char *local_abspath,
                      const char *url,
                      const char *copyfrom_url,
                      const svn_wc_entry_t *entry,
@@ -373,19 +373,17 @@
   svn_boolean_t text_mod = FALSE, prop_mod = FALSE;
   apr_byte_t state_flags = 0;
   svn_node_kind_t kind;
-  const char *p_path;
   const char *cf_url = NULL;
   svn_revnum_t cf_rev = entry->copyfrom_rev;
   const svn_string_t *propval;
   svn_boolean_t is_special;
   apr_pool_t *token_pool = (lock_tokens ? apr_hash_pool_get(lock_tokens)
                             : NULL);
-  const char *local_abspath;
 
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
   /* Early out if the item is already marked as committable. */
-  if (look_up_committable(committables, path, scratch_pool))
+  if (look_up_committable(committables, local_abspath, scratch_pool))
     return SVN_NO_ERROR;
 
   SVN_ERR_ASSERT(entry);
@@ -394,18 +392,16 @@
   if (ctx->cancel_func)
     SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
 
-  /* Make P_PATH the parent dir. */
-  p_path = svn_dirent_dirname(path, scratch_pool);
-
   /* Return error on unknown path kinds.  We check both the entry and
      the node itself, since a path might have changed kind since its
      entry was written. */
   if ((entry->kind != svn_node_file) && (entry->kind != svn_node_dir))
     return svn_error_createf
       (SVN_ERR_NODE_UNKNOWN_KIND, NULL, _("Unknown entry kind for '%s'"),
-       svn_dirent_local_style(path, scratch_pool));
+       svn_dirent_local_style(local_abspath, scratch_pool));
 
-  SVN_ERR(svn_io_check_special_path(path, &kind, &is_special, scratch_pool));
+  SVN_ERR(svn_io_check_special_path(local_abspath, &kind, &is_special,
+                                    scratch_pool));
 
   if ((kind != svn_node_file)
       && (kind != svn_node_dir)
@@ -414,7 +410,7 @@
       return svn_error_createf
         (SVN_ERR_NODE_UNKNOWN_KIND, NULL,
          _("Unknown entry kind for '%s'"),
-         svn_dirent_local_style(path, scratch_pool));
+         svn_dirent_local_style(local_abspath, scratch_pool));
     }
 
   /* Verify that the node's type has not changed before attempting to
@@ -431,7 +427,7 @@
       return svn_error_createf
         (SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
          _("Entry '%s' has unexpectedly changed special status"),
-         svn_dirent_local_style(path, scratch_pool));
+         svn_dirent_local_style(local_abspath, scratch_pool));
     }
 
   if (entry->file_external_path && copy_mode)
@@ -470,7 +466,7 @@
           return svn_error_createf(
             SVN_ERR_WC_FOUND_CONFLICT, NULL,
             _("Aborting commit: '%s' remains in conflict"),
-            svn_dirent_local_style(path, scratch_pool));
+            svn_dirent_local_style(local_abspath, scratch_pool));
         }
     }
 
@@ -548,7 +544,7 @@
         return svn_error_createf
           (SVN_ERR_WC_CORRUPT, NULL,
            _("Did not expect '%s' to be a working copy root"),
-           svn_dirent_local_style(path, scratch_pool));
+           svn_dirent_local_style(local_abspath, scratch_pool));
 
       /* If the ENTRY's revision differs from that of its parent, we
          have to explicitly commit ENTRY as a copy. */
@@ -566,7 +562,7 @@
             return svn_error_createf
               (SVN_ERR_BAD_URL, NULL,
                _("Commit item '%s' has copy flag but no copyfrom URL"),
-               svn_dirent_local_style(path, scratch_pool));
+               svn_dirent_local_style(local_abspath, scratch_pool));
         }
     }
 
@@ -579,13 +575,13 @@
 
       /* First of all, the working file or directory must exist.
          See issue #3198. */
-      SVN_ERR(svn_io_check_path(path, &working_kind, scratch_pool));
+      SVN_ERR(svn_io_check_path(local_abspath, &working_kind, scratch_pool));
       if (working_kind == svn_node_none)
         {
           return svn_error_createf
             (SVN_ERR_WC_PATH_NOT_FOUND, NULL,
              _("'%s' is scheduled for addition, but is missing"),
-             svn_dirent_local_style(path, scratch_pool));
+             svn_dirent_local_style(local_abspath, scratch_pool));
         }
 
       /* See if there are property modifications to send. */
@@ -653,7 +649,7 @@
                                    scratch_pool))
         {
           /* Finally, add the committable item. */
-          add_committable(committables, path, entry->kind, url,
+          add_committable(committables, local_abspath, entry->kind, url,
                           entry->revision,
                           cf_url,
                           cf_rev,
@@ -771,9 +767,10 @@
               this_entry->schedule == svn_wc_schedule_delete)
             continue;
 
-          full_path = svn_dirent_join(path, name, iterpool);
+          full_path = svn_dirent_join(local_abspath, name, iterpool);
           if (this_cf_url)
-            this_cf_url = svn_path_url_add_component2(this_cf_url, name, 
iterpool);
+            this_cf_url = svn_path_url_add_component2(this_cf_url, name,
+                                                      iterpool);
 
           /* We'll use the entry's URL if it has one and if we aren't
              in copy_mode, else, we'll just extend the parent's URL
@@ -925,7 +922,7 @@
 svn_error_t *
 svn_client__harvest_committables(apr_hash_t **committables,
                                  apr_hash_t **lock_tokens,
-                                 svn_wc_adm_access_t *parent_adm,
+                                 const char *dir_abspath,
                                  apr_array_header_t *targets,
                                  svn_depth_t depth,
                                  svn_boolean_t just_locked,
@@ -961,6 +958,8 @@
    */
   apr_hash_t *danglers = apr_hash_make(pool);
 
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(dir_abspath));
+
   /* Create the COMMITTABLES hash. */
   *committables = apr_hash_make(pool);
 
@@ -975,7 +974,6 @@
   do
     {
       const svn_wc_entry_t *entry;
-      const char *target;
       const char *target_abspath;
       svn_error_t *err;
 
@@ -985,13 +983,12 @@
          relative paths, TARGET will just be PARENT_ADM for a single
          iteration). */
       if (targets->nelts)
-        target = svn_dirent_join(svn_wc_adm_access_path(parent_adm),
-                                 APR_ARRAY_IDX(targets, i, const char *),
-                                 subpool);
+        target_abspath = svn_dirent_join(dir_abspath,
+                                         APR_ARRAY_IDX(targets, i,
+                                         const char *),
+                                         subpool);
       else
-        target = svn_wc_adm_access_path(parent_adm);
-
-      SVN_ERR(svn_dirent_get_absolute(&target_abspath, target, subpool));
+        target_abspath = dir_abspath;
 
       /* No entry?  This TARGET isn't even under version control! */
       err = svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, target_abspath,
@@ -1019,7 +1016,7 @@
       if (! entry->url)
         return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
                                  _("Entry for '%s' has no URL"),
-                                 svn_dirent_local_style(target, pool));
+                                 svn_dirent_local_style(target_abspath, pool));
 
       /* We have to be especially careful around entries scheduled for
          addition or replacement. */
@@ -1038,7 +1035,7 @@
               return svn_error_createf(
                 SVN_ERR_WC_CORRUPT, NULL,
                 _("'%s' is scheduled for addition within unversioned parent"),
-                svn_dirent_local_style(target, pool));
+                svn_dirent_local_style(target_abspath, pool));
             }
           SVN_ERR(err);
 
@@ -1047,9 +1044,9 @@
               /* Copy the parent and target into pool; subpool
                  lasts only for this loop iteration, and we check
                  danglers after the loop is over. */
-              apr_hash_set(danglers, svn_dirent_dirname(target, pool),
+              apr_hash_set(danglers, svn_dirent_dirname(target_abspath, pool),
                            APR_HASH_KEY_STRING,
-                           apr_pstrdup(pool, target));
+                           apr_pstrdup(pool, target_abspath));
             }
         }
 
@@ -1062,7 +1059,7 @@
            _("Entry for '%s' is marked as 'copied' but is not itself scheduled"
              "\nfor addition.  Perhaps you're committing a target that is\n"
              "inside an unversioned (or not-yet-versioned) directory?"),
-           svn_dirent_local_style(target, pool));
+           svn_dirent_local_style(target_abspath, pool));
 
       /* Handle our TARGET. */
       /* Make sure this isn't inside a working copy subtree that is
@@ -1074,7 +1071,7 @@
                                                     target_abspath, subpool)),
                                                subpool));
 
-      SVN_ERR(harvest_committables(*committables, *lock_tokens, target,
+      SVN_ERR(harvest_committables(*committables, *lock_tokens, target_abspath,
                                    entry->url, NULL,
                                    entry, NULL, FALSE, FALSE, depth,
                                    just_locked, changelist_hash,

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=920336&r1=920335&r2=920336&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Mon Mar  8 14:35:42 2010
@@ -277,7 +277,6 @@
 
   for (i = 0; i < b->copy_pairs->nelts; i++)
     {
-      const char *dst_parent_abspath;
       const char *dst_abspath;
       svn_client__copy_pair_t *pair = APR_ARRAY_IDX(b->copy_pairs, i,
                                                     svn_client__copy_pair_t *);
@@ -288,12 +287,9 @@
         SVN_ERR(b->ctx->cancel_func(b->ctx->cancel_baton));
 
       /* Perform the copy */
-      SVN_ERR(svn_dirent_get_absolute(&pair->src_abs, pair->src, 
scratch_pool));
-      SVN_ERR(svn_dirent_get_absolute(&dst_parent_abspath, pair->dst_parent,
-                                      scratch_pool));
-      dst_abspath = svn_dirent_join(dst_parent_abspath, pair->base_name,
+      dst_abspath = svn_dirent_join(pair->dst_parent_abspath, pair->base_name,
                                     iterpool);
-      err = svn_wc_copy3(b->ctx->wc_ctx, pair->src_abs, dst_abspath,
+      err = svn_wc_copy3(b->ctx->wc_ctx, pair->src, dst_abspath,
                          b->ctx->cancel_func, b->ctx->cancel_baton,
                          b->ctx->notify_func2, b->ctx->notify_baton2, 
iterpool);
       if (err)
@@ -352,12 +348,12 @@
   dst_abspath = svn_dirent_join(b->dst_parent_abspath, b->pair->base_name,
                                 scratch_pool);
 
-  SVN_ERR(svn_wc_copy3(b->ctx->wc_ctx, b->pair->src_abs, dst_abspath,
+  SVN_ERR(svn_wc_copy3(b->ctx->wc_ctx, b->pair->src, dst_abspath,
                        b->ctx->cancel_func, b->ctx->cancel_baton,
                        b->ctx->notify_func2, b->ctx->notify_baton2,
                        scratch_pool));
 
-  SVN_ERR(svn_wc_delete4(b->ctx->wc_ctx, b->pair->src_abs, FALSE, FALSE,
+  SVN_ERR(svn_wc_delete4(b->ctx->wc_ctx, b->pair->src, FALSE, FALSE,
                          b->ctx->cancel_func, b->ctx->cancel_baton,
                          b->ctx->notify_func2, b->ctx->notify_baton2,
                          scratch_pool));
@@ -397,9 +393,7 @@
 
   for (i = 0; i < copy_pairs->nelts; i++)
     {
-      const char *src_parent;
       const char *src_parent_abspath;
-      const char *dst_parent_abspath;
       struct do_wc_to_wc_moves_with_locks_baton baton;
 
       svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
@@ -410,13 +404,7 @@
       if (ctx->cancel_func)
         SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
 
-      src_parent = svn_dirent_dirname(pair->src, iterpool);
-      SVN_ERR(svn_dirent_get_absolute(&src_parent_abspath, src_parent,
-                                      iterpool));
-      SVN_ERR(svn_dirent_get_absolute(&dst_parent_abspath, pair->dst_parent,
-                                      iterpool));
-
-      SVN_ERR(svn_dirent_get_absolute(&pair->src_abs, pair->src, pool));
+      src_parent_abspath = svn_dirent_dirname(pair->src, iterpool);
 
       /* We now need to lock the right combination of batons.
          Four cases:
@@ -425,14 +413,14 @@
            3) dst_parent is parent of src_parent
            4) src_parent and dst_parent are disjoint
          We can handle 1) as either 2) or 3) */
-      if (strcmp(src_parent_abspath, dst_parent_abspath) == 0
-          || svn_dirent_is_child(src_parent_abspath, dst_parent_abspath,
+      if (strcmp(src_parent_abspath, pair->dst_parent_abspath) == 0
+          || svn_dirent_is_child(src_parent_abspath, pair->dst_parent_abspath,
                                  iterpool))
         {
           baton.lock_src = TRUE;
           baton.lock_dst = FALSE;
         }
-      else if (svn_dirent_is_child(dst_parent_abspath, src_parent_abspath,
+      else if (svn_dirent_is_child(pair->dst_parent_abspath, 
src_parent_abspath,
                                    iterpool))
         {
           baton.lock_src = FALSE;
@@ -447,7 +435,7 @@
       /* Perform the copy and then the delete. */
       baton.ctx = ctx;
       baton.pair = pair;
-      baton.dst_parent_abspath = dst_parent_abspath;
+      baton.dst_parent_abspath = pair->dst_parent_abspath;
       if (baton.lock_src)
         SVN_ERR(svn_wc__call_with_write_lock(do_wc_to_wc_moves_with_locks1,
                                              &baton,
@@ -501,22 +489,24 @@
                                  _("Path '%s' already exists"),
                                  svn_dirent_local_style(pair->dst, pool));
 
-      svn_dirent_split(pair->dst, &pair->dst_parent, &pair->base_name, pool);
+      svn_dirent_split(pair->dst, &pair->dst_parent_abspath, &pair->base_name,
+                       pool);
 
       /* Make sure the destination parent is a directory and produce a clear
          error message if it is not. */
-      SVN_ERR(svn_io_check_path(pair->dst_parent, &dst_parent_kind, iterpool));
+      SVN_ERR(svn_io_check_path(pair->dst_parent_abspath, &dst_parent_kind,
+                                iterpool));
       if (make_parents && dst_parent_kind == svn_node_none)
         {
-          SVN_ERR(svn_client__make_local_parents(pair->dst_parent, TRUE, ctx,
-                                                 iterpool));
+          SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath,
+                                                 TRUE, ctx, iterpool));
         }
       else if (dst_parent_kind != svn_node_dir)
         {
           return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
                                    _("Path '%s' is not a directory"),
-                                   svn_dirent_local_style(pair->dst_parent,
-                                                        pool));
+                                   svn_dirent_local_style(
+                                     pair->dst_parent_abspath, pool));
         }
     }
 
@@ -1198,8 +1188,7 @@
                                                     svn_client__copy_pair_t *);
       svn_pool_clear(iterpool);
       /* Sanity check if the source path is versioned. */
-      SVN_ERR(svn_dirent_get_absolute(&pair->src_abs, pair->src, pool));
-      SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src_abs,
+      SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src,
                                           svn_node_unknown, FALSE, FALSE,
                                           iterpool, iterpool));
     }
@@ -1248,7 +1237,7 @@
 
       svn_pool_clear(iterpool);
 
-      SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src_abs,
+      SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src,
                                           svn_node_unknown, FALSE, FALSE,
                                           iterpool, iterpool));
       pair->src_revnum = entry->revision;
@@ -1370,7 +1359,7 @@
       SVN_ERR(calculate_target_mergeinfo(ra_session, &mergeinfo, adm_access,
                                          pair->src, pair->src_revnum,
                                          FALSE, ctx, iterpool));
-      SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src_abs,
+      SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, pair->src,
                                           svn_node_unknown, FALSE, FALSE,
                                           pool, pool));
       SVN_ERR(svn_client__parse_mergeinfo(&wc_mergeinfo, ctx->wc_ctx,
@@ -1832,6 +1821,8 @@
   srcs_are_urls = svn_path_is_url(APR_ARRAY_IDX(sources, 0,
                                   svn_client_copy_source_t *)->path);
   dst_is_url = svn_path_is_url(dst_path_in);
+  if (!dst_is_url)
+    SVN_ERR(svn_dirent_get_absolute(&dst_path_in, dst_path_in, pool));
 
   /* If we have multiple source paths, it implies the dst_path is a
      directory we are moving or copying into.  Populate the COPY_PAIRS
@@ -1850,7 +1841,10 @@
 
           svn_pool_clear(iterpool);
 
-          pair->src = apr_pstrdup(pool, source->path);
+          if (src_is_url)
+            pair->src = apr_pstrdup(pool, source->path);
+          else
+            SVN_ERR(svn_dirent_get_absolute(&pair->src, source->path, pool));
           pair->src_op_revision = *source->revision;
           pair->src_peg_revision = *source->peg_revision;
 
@@ -1885,8 +1879,12 @@
       svn_client__copy_pair_t *pair = apr_palloc(pool, sizeof(*pair));
       svn_client_copy_source_t *source =
         APR_ARRAY_IDX(sources, 0, svn_client_copy_source_t *);
+      svn_boolean_t src_is_url = svn_path_is_url(source->path);
 
-      pair->src = apr_pstrdup(pool, source->path);
+      if (src_is_url)
+        pair->src = apr_pstrdup(pool, source->path);
+      else
+        SVN_ERR(svn_dirent_get_absolute(&pair->src, source->path, pool));
       pair->src_op_revision = *source->revision;
       pair->src_peg_revision = *source->peg_revision;
 


Reply via email to