You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/09/22 22:37:23 UTC

svn commit: r1525442 - in /subversion/trunk/subversion: include/svn_fs.h libsvn_fs/fs-loader.c libsvn_fs/fs-loader.h libsvn_fs_base/tree.c libsvn_fs_fs/tree.c libsvn_fs_x/tree.c

Author: stefan2
Date: Sun Sep 22 20:37:22 2013
New Revision: 1525442

URL: http://svn.apache.org/r1525442
Log:
Add svn_fs_move() to the FS API and support it in all backends.
Once at it, slightly reorder the FS vtable.

* subversion/include/svn_fs.h
  (svn_fs_move): declare new API

* subversion/libsvn_fs/fs-loader.h
  (root_vtable_t): add move() entry; shift generic copy functions
                   up to the generic node operations section

* subversion/libsvn_fs/fs-loader.c
  (svn_fs_move): implement by forwarding to the vtable

* subversion/libsvn_fs_base/tree.c
  (root_vtable): update vtable

* subversion/libsvn_fs_fs/tree.c
  (root_vtable): update vtable

* subversion/libsvn_fs_x/tree.c
  (root_vtable): update vtable

Modified:
    subversion/trunk/subversion/include/svn_fs.h
    subversion/trunk/subversion/libsvn_fs/fs-loader.c
    subversion/trunk/subversion/libsvn_fs/fs-loader.h
    subversion/trunk/subversion/libsvn_fs_base/tree.c
    subversion/trunk/subversion/libsvn_fs_fs/tree.c
    subversion/trunk/subversion/libsvn_fs_x/tree.c

Modified: subversion/trunk/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=1525442&r1=1525441&r2=1525442&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_fs.h (original)
+++ subversion/trunk/subversion/include/svn_fs.h Sun Sep 22 20:37:22 2013
@@ -1924,6 +1924,34 @@ svn_fs_revision_link(svn_fs_root_t *from
                      svn_fs_root_t *to_root,
                      const char *path,
                      apr_pool_t *pool);
+
+/** Create a copy of @a from_path in @a from_root named @a to_path in
+ * @a to_root and record it as a Move.  If @a from_path in @a from_root is
+ * a directory, copy the tree it refers to recursively.  @a from_root must
+ * be @a to_root's base revision.
+ *
+ * The move will remember its source; use svn_fs_copied_from() to
+ * access this information.
+ *
+ * @a from_root must be the root of a revision; @a to_root must be the root
+ * of a transaction based on that revision. Further, @a to_root and
+ * @a from_root must represent the same filesystem.
+ *
+ * Do any necessary temporary allocation in @a pool.
+ *
+ * @note This will not implicitly delete the @a from_path in @a to_root
+ *       but the deletion must be reported just as if this was a
+ *       #svn_fs_copy call.
+ *
+ * @since New in 1.9.
+ */
+svn_error_t *
+svn_fs_move(svn_fs_root_t *from_root,
+            const char *from_path,
+            svn_fs_root_t *to_root,
+            const char *to_path,
+            apr_pool_t *pool);
+
 
 /* Files.  */
 

Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1525442&r1=1525441&r2=1525442&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Sun Sep 22 20:37:22 2013
@@ -1236,6 +1236,15 @@ svn_fs_revision_link(svn_fs_root_t *from
 }
 
 svn_error_t *
+svn_fs_move(svn_fs_root_t *from_root, const char *from_path,
+            svn_fs_root_t *to_root, const char *to_path, apr_pool_t *pool)
+{
+  SVN_ERR(svn_fs__path_valid(to_path, pool));
+  return svn_error_trace(to_root->vtable->move(from_root, from_path,
+                                               to_root, to_path, pool));
+}
+
+svn_error_t *
 svn_fs_file_length(svn_filesize_t *length_p, svn_fs_root_t *root,
                    const char *path, apr_pool_t *pool)
 {

Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.h?rev=1525442&r1=1525441&r2=1525442&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.h Sun Sep 22 20:37:22 2013
@@ -310,6 +310,16 @@ typedef struct root_vtable_t
                                     apr_pool_t *pool);
   svn_error_t *(*delete_node)(svn_fs_root_t *root, const char *path,
                               apr_pool_t *pool);
+  svn_error_t *(*copy)(svn_fs_root_t *from_root, const char *from_path,
+                       svn_fs_root_t *to_root, const char *to_path,
+                       apr_pool_t *pool);
+  svn_error_t *(*revision_link)(svn_fs_root_t *from_root,
+                                svn_fs_root_t *to_root,
+                                const char *path,
+                                apr_pool_t *pool);
+  svn_error_t *(*move)(svn_fs_root_t *from_root, const char *from_path,
+                       svn_fs_root_t *to_root, const char *to_path,
+                       apr_pool_t *pool);
   svn_error_t *(*copied_from)(svn_revnum_t *rev_p, const char **path_p,
                               svn_fs_root_t *root, const char *path,
                               apr_pool_t *pool);
@@ -340,13 +350,6 @@ typedef struct root_vtable_t
                                     apr_pool_t *pool);
   svn_error_t *(*make_dir)(svn_fs_root_t *root, const char *path,
                            apr_pool_t *pool);
-  svn_error_t *(*copy)(svn_fs_root_t *from_root, const char *from_path,
-                       svn_fs_root_t *to_root, const char *to_path,
-                       apr_pool_t *pool);
-  svn_error_t *(*revision_link)(svn_fs_root_t *from_root,
-                                svn_fs_root_t *to_root,
-                                const char *path,
-                                apr_pool_t *pool);
 
   /* Files */
   svn_error_t *(*file_length)(svn_filesize_t *length_p, svn_fs_root_t *root,

Modified: subversion/trunk/subversion/libsvn_fs_base/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/tree.c?rev=1525442&r1=1525441&r2=1525442&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/tree.c Sun Sep 22 20:37:22 2013
@@ -5407,6 +5407,9 @@ static root_vtable_t root_vtable = {
   base_node_origin_rev,
   base_node_created_path,
   base_delete_node,
+  base_copy,
+  base_revision_link,
+  base_move,
   base_copied_from,
   base_closest_copy,
   base_node_prop,
@@ -5416,8 +5419,6 @@ static root_vtable_t root_vtable = {
   base_dir_entries,
   base_dir_optimal_order,
   base_make_dir,
-  base_copy,
-  base_revision_link,
   base_file_length,
   base_file_checksum,
   base_file_contents,

Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1525442&r1=1525441&r2=1525442&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Sun Sep 22 20:37:22 2013
@@ -4185,6 +4185,9 @@ static root_vtable_t root_vtable = {
   fs_node_origin_rev,
   fs_node_created_path,
   fs_delete_node,
+  fs_copy,
+  fs_revision_link,
+  fs_move,
   fs_copied_from,
   fs_closest_copy,
   fs_node_prop,
@@ -4194,8 +4197,6 @@ static root_vtable_t root_vtable = {
   fs_dir_entries,
   fs_dir_optimal_order,
   fs_make_dir,
-  fs_copy,
-  fs_revision_link,
   fs_file_length,
   fs_file_checksum,
   fs_file_contents,

Modified: subversion/trunk/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/tree.c?rev=1525442&r1=1525441&r2=1525442&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/tree.c Sun Sep 22 20:37:22 2013
@@ -4113,6 +4113,9 @@ static root_vtable_t root_vtable = {
   x_node_origin_rev,
   x_node_created_path,
   x_delete_node,
+  x_copy,
+  x_revision_link,
+  x_move,
   x_copied_from,
   x_closest_copy,
   x_node_prop,
@@ -4122,8 +4125,6 @@ static root_vtable_t root_vtable = {
   x_dir_entries,
   x_dir_optimal_order,
   x_make_dir,
-  x_copy,
-  x_revision_link,
   x_file_length,
   x_file_checksum,
   x_file_contents,