subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1635169 - in /subversion/branches/move-tracking-2/subversion: include/private/svn_editor3.h libsvn_delta/compat3.c libsvn_delta/editor3.c
Date Wed, 29 Oct 2014 15:12:47 GMT
Author: julianfoad
Date: Wed Oct 29 15:12:47 2014
New Revision: 1635169

URL: http://svn.apache.org/r1635169
Log:
On the 'move-rtracking-2' branch: improve pool usage correctness and the
conversion of paths between internal style and storage style (the latter
using "." for the empty path).

* subversion/include/private/svn_editor3.h,
  subversion/libsvn_delta/editor3.c
  (svn_editor3_peg_path_dup,
   svn_editor3_txn_path_dup): New functions.
  (svn_editor3_node_content_dup): Duplicate the reference peg-path.

* subversion/libsvn_delta/compat3.c
  (svn_branch_instance_create): Duplicate the branch root path.
  (branch_map_update_as_subbranch_root): Correct the doc string.
  (svn_branch_instance_parse,
   svn_branch_instance_serialize): Don't use "local style" for storage, just
    convert between "" and "." directly.

Modified:
    subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h
    subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
    subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c

Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h?rev=1635169&r1=1635168&r2=1635169&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h Wed Oct 29
15:12:47 2014
@@ -535,6 +535,11 @@ typedef struct svn_editor3_peg_path_t
   const char *relpath;
 } svn_editor3_peg_path_t;
 
+/* Return a duplicate of OLD, allocated in RESULT_POOL. */
+svn_editor3_peg_path_t
+svn_editor3_peg_path_dup(svn_editor3_peg_path_t old,
+                         apr_pool_t *result_pool);
+
 /** A reference to a node in a txn.
  *
  * @a peg gives a pegged location and @a peg.rev shall not be
@@ -548,6 +553,11 @@ typedef struct svn_editor3_txn_path_t
   const char *relpath;
 } svn_editor3_txn_path_t;
 
+/* Return a duplicate of OLD, allocated in RESULT_POOL. */
+svn_editor3_txn_path_t
+svn_editor3_txn_path_dup(svn_editor3_txn_path_t old,
+                         apr_pool_t *result_pool);
+
 /** Element Identifier within a branch family.
  *
  * This does not contain an implied revision number or branch identifier.

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c?rev=1635169&r1=1635168&r2=1635169&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c Wed Oct 29 15:12:47
2014
@@ -1854,7 +1854,7 @@ svn_branch_instance_create(svn_branch_si
   b->sibling_defn = branch_sibling;
   b->rev_root = rev_root;
   b->e_map = apr_hash_make(result_pool);
-  b->branch_root_rrpath = branch_root_rrpath;
+  b->branch_root_rrpath = apr_pstrdup(result_pool, branch_root_rrpath);
   return b;
 }
 
@@ -2042,7 +2042,7 @@ branch_map_update(svn_branch_instance_t 
  * subbranch root node. This node has no content in this branch; the
  * corresponding element of the subbranch will define its content.
  *
- * Duplicate NEW_NAME and NEW_CONTENT into the branch mapping's pool.
+ * Duplicate NEW_NAME into the branch mapping's pool.
  */
 static void
 branch_map_update_as_subbranch_root(svn_branch_instance_t *branch,
@@ -2520,7 +2520,8 @@ svn_branch_instance_parse(svn_branch_ins
   SVN_ERR_ASSERT(n == 4);
 
   SVN_ERR_ASSERT(fid == family->fid);
-  branch_root_rrpath = svn_path_internal_style(branch_root_path, scratch_pool);
+  branch_root_rrpath
+    = strcmp(branch_root_path, ".") == 0 ? "" : branch_root_path;
   branch_sibling = svn_branch_sibling_create(family, bid, root_eid,
                                              result_pool);
   branch_instance = svn_branch_instance_create(branch_sibling, rev_root,
@@ -2539,8 +2540,8 @@ svn_branch_instance_parse(svn_branch_ins
       SVN_ERR_ASSERT(n == 6);
       if (strcmp(this_path, "(null)") != 0)
         {
-          const char *name = svn_path_internal_style(this_name, scratch_pool);
-          const char *path = svn_path_internal_style(this_path, scratch_pool);
+          const char *name = strcmp(this_name, ".") == 0 ? "" : this_name;
+          const char *path = strcmp(this_path, ".") == 0 ? "" : this_path;
           const char *rrpath = svn_relpath_join(branch_root_rrpath, path,
                                                 scratch_pool);
           svn_editor3_peg_path_t peg;
@@ -2673,8 +2674,7 @@ svn_branch_instance_serialize(svn_stream
                             "f%db%d: root-eid %d at %s\n",
                             family->fid, branch->sibling_defn->bid,
                             branch->sibling_defn->root_eid,
-                            svn_path_local_style(branch_root_rrpath,
-                                                 scratch_pool)));
+                            branch_root_rrpath[0] ? branch_root_rrpath : "."));
 
   branch_map_purge_orphans(branch, scratch_pool);
   for (eid = family->first_eid; eid < family->next_eid; eid++)
@@ -2689,8 +2689,8 @@ svn_branch_instance_serialize(svn_stream
           path = branch_map_get_path_by_eid(branch, eid, scratch_pool);
           SVN_ERR_ASSERT(path);
           parent_eid = node->parent_eid;
-          name = svn_path_local_style(node->name, scratch_pool);
-          path = svn_path_local_style(path, scratch_pool);
+          name = node->name[0] ? node->name : ".";
+          path = path[0] ? path : ".";
         }
       else
         {

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c?rev=1635169&r1=1635168&r2=1635169&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c Wed Oct 29 15:12:47
2014
@@ -442,6 +442,8 @@ svn_editor3_node_content_dup(const svn_e
     return NULL;
 
   new_content = apr_pmemdup(result_pool, old, sizeof(*new_content));
+  if (old->ref.relpath)
+    new_content->ref = svn_editor3_peg_path_dup(old->ref, result_pool);
   if (old->props)
     new_content->props = svn_prop_hash_dup(old->props, result_pool);
   if (old->kind == svn_node_file && old->text)
@@ -556,6 +558,32 @@ svn_editor3_node_content_create_symlink(
 }
 
 
+/*
+ * ===================================================================
+ * Minor data types
+ * ===================================================================
+ */
+
+svn_editor3_peg_path_t
+svn_editor3_peg_path_dup(svn_editor3_peg_path_t p,
+                         apr_pool_t *result_pool)
+{
+  /* The object P is passed by value so we can modify it in place */
+  p.relpath = apr_pstrdup(result_pool, p.relpath);
+  return p;
+}
+
+svn_editor3_txn_path_t
+svn_editor3_txn_path_dup(svn_editor3_txn_path_t p,
+                         apr_pool_t *result_pool)
+{
+  /* The object P is passed by value so we can modify it in place */
+  p.peg = svn_editor3_peg_path_dup(p.peg, result_pool);
+  p.relpath = apr_pstrdup(result_pool, p.relpath);
+  return p;
+}
+
+
 #ifdef SVN_DEBUG
 
 /*



Mime
View raw message