subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r1067295 - in /subversion/trunk/subversion/libsvn_repos: delta.c dump.c load-fs-vtable.c node_tree.c rev_hunt.c
Date Fri, 04 Feb 2011 21:40:01 GMT
Author: cmpilato
Date: Fri Feb  4 21:40:00 2011
New Revision: 1067295

URL: http://svn.apache.org/viewvc?rev=1067295&view=rev
Log:
Continue saving the Universe from deprecated svn_path_* API usage.

* subversion/libsvn_repos/delta.c
  (svn_repos_dir_delta2, delta_dirs): Replace uses of deprecated
    svn_path_* APIs.

* subversion/libsvn_repos/dump.c
  (struct edit_baton, struct dir_baton): Tweak comments to indicate
    some path types.
  (make_dir_baton, open_file, open_directory, verify_directory_entry,
   dump_node): Replace uses of deprecated svn_path_* API functions
    and other string manipulations in favor of svn_relpath_* work.

* subversion/libsvn_repos/load-fs-vtable.c
  (struct parse_baton): Document a path type.
  (prefix_mergeinfo_paths, make_node_baton): Replace uses of
    deprecated svn_path_* APIs.
  (set_node_property): Remove unnecessary convenience variable.
  (svn_repos_get_fs_build_parser3): Canonicalize 'parent_dir'.

* subversion/libsvn_repos/node_tree.c
  (find_real_base_location): Replace uses of deprecated svn_path_* APIs.

* subversion/libsvn_repos/rev_hunt.c
  (svn_repos__prev_location): Replace uses of deprecated svn_path_* APIs.

Modified:
    subversion/trunk/subversion/libsvn_repos/delta.c
    subversion/trunk/subversion/libsvn_repos/dump.c
    subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c
    subversion/trunk/subversion/libsvn_repos/node_tree.c
    subversion/trunk/subversion/libsvn_repos/rev_hunt.c

Modified: subversion/trunk/subversion/libsvn_repos/delta.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/delta.c?rev=1067295&r1=1067294&r2=1067295&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/delta.c (original)
+++ subversion/trunk/subversion/libsvn_repos/delta.c Fri Feb  4 21:40:00 2011
@@ -233,11 +233,15 @@ svn_repos_dir_delta2(svn_fs_root_t *src_
   const char *authz_root_path;
 
   /* SRC_PARENT_DIR must be valid. */
-  if (! src_parent_dir)
+  if (src_parent_dir)
+    src_parent_dir = svn_relpath_canonicalize(src_parent_dir, pool);
+  else
     return not_a_dir_error("source parent", src_parent_dir);
 
   /* TGT_FULLPATH must be valid. */
-  if (! tgt_fullpath)
+  if (tgt_fullpath)
+    tgt_fullpath = svn_relpath_canonicalize(tgt_fullpath, pool);
+  else
     return svn_error_create(SVN_ERR_FS_PATH_SYNTAX, 0,
                             _("Invalid target path"));
 
@@ -248,12 +252,12 @@ svn_repos_dir_delta2(svn_fs_root_t *src_
   /* Calculate the fs path implicitly used for editor->open_root, so
      we can do an authz check on that path first. */
   if (*src_entry)
-    authz_root_path = svn_dirent_dirname(tgt_fullpath, pool);
+    authz_root_path = svn_relpath_dirname(tgt_fullpath, pool);
   else
     authz_root_path = tgt_fullpath;
 
   /* Construct the full path of the source item. */
-  src_fullpath = svn_path_join(src_parent_dir, src_entry, pool);
+  src_fullpath = svn_relpath_join(src_parent_dir, src_entry, pool);
 
   /* Get the node kinds for the source and target paths.  */
   SVN_ERR(svn_fs_check_path(&tgt_kind, tgt_root, tgt_fullpath, pool));
@@ -958,8 +962,8 @@ delta_dirs(struct context *c,
       apr_hash_this(hi, &key, &klen, &val);
       t_entry = val;
       tgt_kind = t_entry->kind;
-      t_fullpath = svn_path_join(target_path, t_entry->name, subpool);
-      e_fullpath = svn_path_join(edit_path, t_entry->name, subpool);
+      t_fullpath = svn_relpath_join(target_path, t_entry->name, subpool);
+      e_fullpath = svn_relpath_join(edit_path, t_entry->name, subpool);
 
       /* Can we find something with the same name in the source
          entries hash? */
@@ -967,7 +971,7 @@ delta_dirs(struct context *c,
         {
           svn_node_kind_t src_kind;
 
-          s_fullpath = svn_path_join(source_path, t_entry->name, subpool);
+          s_fullpath = svn_relpath_join(source_path, t_entry->name, subpool);
           src_kind = s_entry->kind;
 
           if (depth == svn_depth_infinity
@@ -1043,7 +1047,7 @@ delta_dirs(struct context *c,
           apr_hash_this(hi, NULL, NULL, &val);
           s_entry = val;
           src_kind = s_entry->kind;
-          e_fullpath = svn_path_join(edit_path, s_entry->name, subpool);
+          e_fullpath = svn_relpath_join(edit_path, s_entry->name, subpool);
 
           /* Do we actually want to delete the dir if we're non-recursive? */
           if (depth == svn_depth_infinity

Modified: subversion/trunk/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/dump.c?rev=1067295&r1=1067294&r2=1067295&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/dump.c (original)
+++ subversion/trunk/subversion/libsvn_repos/dump.c Fri Feb  4 21:40:00 2011
@@ -89,8 +89,8 @@ store_delta(apr_file_t **tempfile, svn_f
 
 struct edit_baton
 {
-  /* The path which implicitly prepends all full paths coming into
-     this editor.  This will almost always be "" or "/".  */
+  /* The relpath which implicitly prepends all full paths coming into
+     this editor.  This will almost always be "".  */
   const char *path;
 
   /* The stream to dump to. */
@@ -137,13 +137,13 @@ struct dir_baton
   /* has this directory been written to the output stream? */
   svn_boolean_t written_out;
 
-  /* the absolute path to this directory */
+  /* the repository relpath associated with this directory */
   const char *path;
 
-  /* the comparison path and revision of this directory.  if both of
-     these are valid, use them as a source against which to compare
-     the directory instead of the default comparison source of PATH in
-     the previous revision. */
+  /* The comparison repository relpath and revision of this directory.
+     If both of these are valid, use them as a source against which to
+     compare the directory instead of the default comparison source of
+     PATH in the previous revision. */
   const char *cmp_path;
   svn_revnum_t cmp_rev;
 
@@ -189,18 +189,18 @@ make_dir_baton(const char *path,
 
   /* Construct the full path of this node. */
   if (pb)
-    full_path = svn_path_join(eb->path, path, pool);
+    full_path = svn_relpath_join(eb->path, path, pool);
   else
     full_path = apr_pstrdup(pool, eb->path);
 
   /* Remove leading slashes from copyfrom paths. */
   if (cmp_path)
-    cmp_path = ((*cmp_path == '/') ? cmp_path + 1 : cmp_path);
+    cmp_path = svn_relpath_canonicalize(cmp_path, pool);
 
   new_db->edit_baton = eb;
   new_db->parent_dir_baton = pb;
   new_db->path = full_path;
-  new_db->cmp_path = cmp_path ? apr_pstrdup(pool, cmp_path) : NULL;
+  new_db->cmp_path = cmp_path;
   new_db->cmp_rev = cmp_rev;
   new_db->added = added;
   new_db->written_out = FALSE;
@@ -225,7 +225,7 @@ make_dir_baton(const char *path,
   */
 static svn_error_t *
 dump_node(struct edit_baton *eb,
-          const char *path,    /* an absolute path. */
+          const char *path,
           svn_node_kind_t kind,
           enum svn_node_action action,
           svn_boolean_t is_copy,
@@ -245,7 +245,7 @@ dump_node(struct edit_baton *eb,
   /* Write out metadata headers for this file node. */
   SVN_ERR(svn_stream_printf(eb->stream, pool,
                             SVN_REPOS_DUMPFILE_NODE_PATH ": %s\n",
-                            (*path == '/') ? path + 1 : path));
+                            path));
   if (kind == svn_node_file)
     SVN_ERR(svn_stream_printf(eb->stream, pool,
                               SVN_REPOS_DUMPFILE_NODE_KIND ": file\n"));
@@ -255,7 +255,7 @@ dump_node(struct edit_baton *eb,
 
   /* Remove leading slashes from copyfrom paths. */
   if (cmp_path)
-    cmp_path = ((*cmp_path == '/') ? cmp_path + 1 : cmp_path);
+    cmp_path = svn_relpath_canonicalize(cmp_path, pool);
 
   /* Validate the comparison path/rev. */
   if (ARE_VALID_COPY_ARGS(cmp_path, cmp_rev))
@@ -682,8 +682,8 @@ open_directory(const char *path,
      record the same for this one. */
   if (pb && ARE_VALID_COPY_ARGS(pb->cmp_path, pb->cmp_rev))
     {
-      cmp_path = svn_path_join(pb->cmp_path,
-                               svn_dirent_basename(path, pool), pool);
+      cmp_path = svn_relpath_join(pb->cmp_path,
+                                  svn_relpath_basename(path, pool), pool);
       cmp_rev = pb->cmp_rev;
     }
 
@@ -779,8 +779,8 @@ open_file(const char *path,
      record the same for this one. */
   if (pb && ARE_VALID_COPY_ARGS(pb->cmp_path, pb->cmp_rev))
     {
-      cmp_path = svn_path_join(pb->cmp_path,
-                               svn_dirent_basename(path, pool), pool);
+      cmp_path = svn_relpath_join(pb->cmp_path,
+                                  svn_relpath_basename(path, pool), pool);
       cmp_rev = pb->cmp_rev;
     }
 
@@ -1059,7 +1059,7 @@ svn_repos_dump_fs3(svn_repos_t *repos,
          non-incremental dump. */
       use_deltas_for_rev = use_deltas && (incremental || i != start_rev);
       SVN_ERR(get_dump_editor(&dump_editor, &dump_edit_baton, fs, to_rev,
-                              "/", stream, notify_func, notify_baton,
+                              "", stream, notify_func, notify_baton,
                               start_rev, use_deltas_for_rev, FALSE, subpool));
 
       /* Drive the editor in one way or another. */
@@ -1072,8 +1072,8 @@ svn_repos_dump_fs3(svn_repos_t *repos,
         {
           svn_fs_root_t *from_root;
           SVN_ERR(svn_fs_revision_root(&from_root, fs, from_rev, subpool));
-          SVN_ERR(svn_repos_dir_delta2(from_root, "/", "",
-                                       to_root, "/",
+          SVN_ERR(svn_repos_dir_delta2(from_root, "", "",
+                                       to_root, "",
                                        dump_editor, dump_edit_baton,
                                        NULL,
                                        NULL,
@@ -1166,7 +1166,7 @@ verify_directory_entry(void *baton, cons
                        void *val, apr_pool_t *pool)
 {
   struct dir_baton *db = baton;
-  char *path = svn_path_join(db->path, (const char *)key, pool);
+  char *path = svn_relpath_join(db->path, (const char *)key, pool);
   svn_node_kind_t kind;
   apr_hash_t *dirents;
   svn_filesize_t len;

Modified: subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c?rev=1067295&r1=1067294&r2=1067295&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c Fri Feb  4 21:40:00 2011
@@ -28,7 +28,6 @@
 #include "svn_fs.h"
 #include "svn_repos.h"
 #include "svn_string.h"
-#include "svn_path.h"
 #include "svn_props.h"
 #include "repos.h"
 #include "svn_private_config.h"
@@ -36,9 +35,11 @@
 #include "svn_checksum.h"
 #include "svn_subst.h"
 #include "svn_ctype.h"
+#include "svn_dirent_uri.h"
 
 #include <apr_lib.h>
 
+#include "private/svn_fspath.h"
 #include "private/svn_dep_compat.h"
 #include "private/svn_mergeinfo_private.h"
 
@@ -56,7 +57,7 @@ struct parse_baton
   svn_boolean_t use_pre_commit_hook;
   svn_boolean_t use_post_commit_hook;
   enum svn_repos_load_uuid uuid_action;
-  const char *parent_dir;
+  const char *parent_dir; /* repository relpath, or NULL */
   svn_repos_notify_func_t notify_func;
   void *notify_baton;
   svn_repos_notify_t *notify;
@@ -170,16 +171,12 @@ prefix_mergeinfo_paths(svn_string_t **me
       const char *path, *merge_source;
 
       apr_hash_this(hi, &key, NULL, &rangelist);
-      merge_source = key;
-
-      /* The svn:mergeinfo property syntax demands absolute repository
-         paths, so prepend a leading slash if PARENT_DIR lacks one.  */
-      if (*parent_dir != '/')
-        path = svn_path_join_many(pool, "/", parent_dir,
-                                  merge_source + 1, NULL);
-      else
-        path = svn_path_join(parent_dir, merge_source + 1, pool);
+      merge_source = svn_relpath_canonicalize(key, pool);
 
+      /* The svn:mergeinfo property syntax demands a repos abspath */
+      path = svn_fspath__canonicalize(svn_relpath_join(parent_dir,
+                                                       merge_source, pool),
+                                      pool);
       apr_hash_set(prefixed_mergeinfo, path, APR_HASH_KEY_STRING, rangelist);
     }
   return svn_mergeinfo_to_string(mergeinfo_val, prefixed_mergeinfo, pool);
@@ -336,10 +333,11 @@ make_node_baton(struct node_baton **node
   if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_NODE_PATH,
                           APR_HASH_KEY_STRING)))
   {
+    val = svn_relpath_canonicalize(val, pool);
     if (rb->pb->parent_dir)
-      nb->path = svn_path_join(rb->pb->parent_dir, val, pool);
+      nb->path = svn_relpath_join(rb->pb->parent_dir, val, pool);
     else
-      nb->path = apr_pstrdup(pool, val);
+      nb->path = val;
   }
 
   if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_NODE_KIND,
@@ -374,11 +372,11 @@ make_node_baton(struct node_baton **node
   if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH,
                           APR_HASH_KEY_STRING)))
     {
+      val = svn_relpath_canonicalize(val, pool);
       if (rb->pb->parent_dir)
-        nb->copyfrom_path = svn_path_join(rb->pb->parent_dir,
-                                          (*val == '/' ? val + 1 : val), pool);
+        nb->copyfrom_path = svn_relpath_join(rb->pb->parent_dir, val, pool);
       else
-        nb->copyfrom_path = apr_pstrdup(pool, val);
+        nb->copyfrom_path = val;
     }
 
   if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM,
@@ -667,7 +665,6 @@ set_node_property(void *baton,
   struct node_baton *nb = baton;
   struct revision_baton *rb = nb->rb;
   struct parse_baton *pb = rb->pb;
-  const char *parent_dir = pb->parent_dir;
 
   if (strcmp(name, SVN_PROP_MERGEINFO) == 0)
     {
@@ -706,13 +703,13 @@ set_node_property(void *baton,
       SVN_ERR(renumber_mergeinfo_revs(&renumbered_mergeinfo, prop_val, rb,
                                       nb->pool));
       value = renumbered_mergeinfo;
-      if (parent_dir)
+      if (pb->parent_dir)
         {
-          /* Prefix the merge source paths with PARENT_DIR. */
+          /* Prefix the merge source paths with PB->parent_dir. */
           /* ASSUMPTION: All source paths are included in the dump stream. */
           svn_string_t *mergeinfo_val;
-          SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value, parent_dir,
-                                         nb->pool));
+          SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value,
+                                         pb->parent_dir, nb->pool));
           value = mergeinfo_val;
         }
     }
@@ -945,6 +942,9 @@ svn_repos_get_fs_build_parser3(const svn
   svn_repos_parse_fns2_t *parser = apr_pcalloc(pool, sizeof(*parser));
   struct parse_baton *pb = apr_pcalloc(pool, sizeof(*pb));
 
+  if (parent_dir)
+    parent_dir = svn_relpath_canonicalize(parent_dir, pool);
+
   parser->new_revision_record = new_revision_record;
   parser->new_node_record = new_node_record;
   parser->uuid_record = uuid_record;

Modified: subversion/trunk/subversion/libsvn_repos/node_tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/node_tree.c?rev=1067295&r1=1067294&r2=1067295&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/node_tree.c (original)
+++ subversion/trunk/subversion/libsvn_repos/node_tree.c Fri Feb  4 21:40:00 2011
@@ -41,6 +41,7 @@
 #include "svn_repos.h"
 #include "repos.h"
 #include "svn_private_config.h"
+#include "private/svn_fspath.h"
 
 /*** NOTE: This editor is unique in that it currently is hard-coded to
      be anchored at the root directory of the filesystem.  This
@@ -161,7 +162,7 @@ find_real_base_location(const char **pat
       svn_revnum_t rev;
 
       find_real_base_location(&path, &rev, node->parent, pool);
-      *path_p = svn_path_join(path, node->name, pool);
+      *path_p = svn_fspath__join(path, node->name, pool);
       *rev_p = rev;
       return;
     }

Modified: subversion/trunk/subversion/libsvn_repos/rev_hunt.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/rev_hunt.c?rev=1067295&r1=1067294&r2=1067295&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/trunk/subversion/libsvn_repos/rev_hunt.c Fri Feb  4 21:40:00 2011
@@ -37,6 +37,7 @@
 #include "svn_props.h"
 #include "svn_mergeinfo.h"
 #include "repos.h"
+#include "private/svn_fspath.h"
 
 
 /* Note:  this binary search assumes that the datestamp properties on
@@ -624,9 +625,9 @@ svn_repos__prev_location(svn_revnum_t *a
   SVN_ERR(svn_fs_copied_from(&copy_src_rev, &copy_src_path,
                              copy_root, copy_path, pool));
   if (! strcmp(copy_path, path) == 0)
-    remainder = svn_path_is_child(copy_path, path, pool);
+    remainder = svn_fspath__is_child(copy_path, path, pool);
   if (prev_path)
-    *prev_path = svn_path_join(copy_src_path, remainder, pool);
+    *prev_path = svn_fspath__join(copy_src_path, remainder, pool);
   if (appeared_rev)
     *appeared_rev = svn_fs_revision_root_revision(copy_root);
   if (prev_rev)



Mime
View raw message