[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Testing equality between svnrdump and svnadmin dump

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 15 Jan 2015 14:12:18 +0000

I found in another bug in 'svnrdump load'.

When my additional testing runs 'svnrdump load' on a dumpfile produced by 'svnadmin dump' (non-deltas mode), some tests including copy_tests.py 7 and 11 fail.

When loading an add-with-history froma non-deltas dumpfile, on reading the new properties, the dumpfile parser first calls the rdump load editor's 'remove_node_props' method. This method was attempting to issue property delete instructions for each existing property, but it was always trying to fetch the existing props from PATH_at_HEAD. In a copy situation, it needs to look at COPYFROM_PATH_at_COPYFROM_REV instead. If PATH_at_HEAD didn't exist it would error out, and if it did exist it would then proceed to delete each of the props found there, which may not include all of the props that the new node will inherit from its copy source.

A patch like the following fixes it. (I know there's bad indentation there at the moment.)

I'm currently writing regression tests for it.

[[[
Index: subversion/svnrdump/load_editor.c
===================================================================
--- subversion/svnrdump/load_editor.c    (revision 1652027)
+++ subversion/svnrdump/load_editor.c    (working copy)
@@ -121,6 +121,7 @@ struct node_baton

   svn_revnum_t copyfrom_rev;
   const char *copyfrom_path;
+  const char *copyfrom_url;

   void *file_baton;
   const char *base_checksum;
@@ -767,9 +768,9 @@ new_node_record(void **node_baton,
       if (rb->pb->parent_dir)
         nb->copyfrom_path = svn_relpath_join(rb->pb->parent_dir,
                                              nb->copyfrom_path, rb->pool);
-      nb->copyfrom_path = svn_path_url_add_component2(rb->pb->root_url,
-                                                      nb->copyfrom_path,
-                                                      rb->pool);
+      nb->copyfrom_url = svn_path_url_add_component2(rb->pb->root_url,
+                                                     nb->copyfrom_path,
+                                                     rb->pool);
     }

@@ -789,7 +790,7 @@ new_node_record(void **node_baton,
         {
         case svn_node_file:
           SVN_ERR(commit_editor->add_file(nb->path, rb->db->baton,
-                                          nb->copyfrom_path,
+                                          nb->copyfrom_url,
                                           nb->copyfrom_rev,
                                           rb->pool, &(nb->file_baton)));
           LDR_DBG(("Added file %s to dir %p as %p\n",
@@ -797,7 +798,7 @@ new_node_record(void **node_baton,
           break;
         case svn_node_dir:
           SVN_ERR(commit_editor->add_directory(nb->path, rb->db->baton,
-                                               nb->copyfrom_path,
+                                               nb->copyfrom_url,
                                                nb->copyfrom_rev,
                                                rb->pool, &child_baton));
           LDR_DBG(("Added dir %s to dir %p as %p\n",
@@ -1003,11 +1004,19 @@ remove_node_props(void *baton)

   if (nb->kind == svn_node_file)
     {
+      if (nb->copyfrom_path)
+        SVN_ERR(svn_ra_get_file(nb->rb->pb->aux_session, nb->copyfrom_path,
+                                nb->copyfrom_rev, NULL, NULL, &props, pool));
+      else
       SVN_ERR(svn_ra_get_file(nb->rb->pb->aux_session, nb->path,
                               SVN_INVALID_REVNUM, NULL, NULL, &props, pool));
     }
   else  /* nb->kind == svn_node_dir */
     {
+      if (nb->copyfrom_path)
+        SVN_ERR(svn_ra_get_dir2(nb->rb->pb->aux_session, NULL, NULL, &props,
+                                nb->copyfrom_path, nb->copyfrom_rev, 0, pool));
+      else
       SVN_ERR(svn_ra_get_dir2(nb->rb->pb->aux_session, NULL, NULL, &props,
                               nb->path, SVN_INVALID_REVNUM, 0, pool));
     }

]]]

- Julian
Received on 2015-01-15 15:14:14 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.