You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/10/05 18:42:05 UTC

svn commit: r1004705 - in /subversion/trunk/subversion: libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c tests/libsvn_wc/db-test.c

Author: philip
Date: Tue Oct  5 16:42:05 2010
New Revision: 1004705

URL: http://svn.apache.org/viewvc?rev=1004705&view=rev
Log:
Relocate should only change repository IDs that match the old
repository ID, not all non-null repository IDs.  This makes the
BASE/WORKING implementation behave like the NODES implementation.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_UPDATE_BASE_RECURSIVE_REPO,
   STMT_UPDATE_WORKING_RECURSIVE_COPYFROM_REPO): Only update matching
    repos_id.

* subversion/libsvn_wc/wc_db.c
  (relocate_txn): Bind old repos_id.

* subversion/tests/libsvn_wc/db-test.c
  (test_global_relocate):  Stop expecting an alternate repository to
   be relocated.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/libsvn_wc/db-test.c

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1004705&r1=1004704&r2=1004705&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Oct  5 16:42:05 2010
@@ -259,14 +259,14 @@ WHERE dav_cache IS NOT NULL AND wc_id = 
    local_relpath LIKE ?3 ESCAPE '#');
 
 -- STMT_UPDATE_BASE_RECURSIVE_REPO
-UPDATE base_node SET repos_id = ?4
-WHERE repos_id IS NOT NULL AND wc_id = ?1 AND
+UPDATE base_node SET repos_id = ?5
+WHERE repos_id = ?4 AND wc_id = ?1 AND
   (local_relpath = ?2 OR
    local_relpath LIKE ?3 ESCAPE '#');
 
 -- STMT_UPDATE_WORKING_RECURSIVE_COPYFROM_REPO
-UPDATE working_node SET copyfrom_repos_id = ?4
-WHERE copyfrom_repos_id IS NOT NULL AND wc_id = ?1 AND
+UPDATE working_node SET copyfrom_repos_id = ?5
+WHERE copyfrom_repos_id = ?4 AND wc_id = ?1 AND
   (local_relpath = ?2 OR
    local_relpath LIKE ?3 ESCAPE '#');
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1004705&r1=1004704&r2=1004705&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Oct  5 16:42:05 2010
@@ -5567,8 +5567,8 @@ relocate_txn(void *baton, svn_sqlite__db
   /* Update non-NULL WORKING_NODE.copyfrom_repos_id. */
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
                                STMT_UPDATE_WORKING_RECURSIVE_COPYFROM_REPO));
-  SVN_ERR(svn_sqlite__bindf(stmt, "issi", rb->wc_id, rb->local_relpath,
-                            like_arg, new_repos_id));
+  SVN_ERR(svn_sqlite__bindf(stmt, "issii", rb->wc_id, rb->local_relpath,
+                            like_arg, rb->old_repos_id, new_repos_id));
   SVN_ERR(svn_sqlite__step_done(stmt));
 #endif
 
@@ -5598,8 +5598,8 @@ relocate_txn(void *baton, svn_sqlite__db
       /* Update any BASE which have non-NULL repos_id's */
       SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
                                         STMT_UPDATE_BASE_RECURSIVE_REPO));
-      SVN_ERR(svn_sqlite__bindf(stmt, "issi", rb->wc_id, rb->local_relpath,
-                                like_arg, new_repos_id));
+      SVN_ERR(svn_sqlite__bindf(stmt, "issii", rb->wc_id, rb->local_relpath,
+                                like_arg, rb->old_repos_id, new_repos_id));
       SVN_ERR(svn_sqlite__step_done(stmt));
 #endif
 

Modified: subversion/trunk/subversion/tests/libsvn_wc/db-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/db-test.c?rev=1004705&r1=1004704&r2=1004705&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Tue Oct  5 16:42:05 2010
@@ -1491,7 +1491,26 @@ test_global_relocate(apr_pool_t *pool)
   /* The UUID should still be the same. */
   SVN_TEST_STRING_ASSERT(repos_uuid, UUID_ONE);
 
-  /* While we're at it, let's see if the children have been relocated, too. */
+  /* While we're at it, let's see if the children have been relocated, too.
+
+     ### Relocate doesn't change anything in the child since the
+         repos_id is inherited (null).  Should we have some children
+         where the repos_id is not null but equal to the parent or
+         root? */
+  SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL,
+                               &repos_relpath, &repos_root_url, &repos_uuid,
+                               NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL,
+                               db, svn_dirent_join(local_abspath, "F",
+                                                   pool),
+                               pool, pool));
+  SVN_TEST_STRING_ASSERT(repos_relpath, NULL);
+  SVN_TEST_STRING_ASSERT(repos_root_url, NULL);
+  SVN_TEST_STRING_ASSERT(repos_uuid, NULL);
+
+  /* Alternate repository is not relocated. */
   SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL,
                                &repos_relpath, &repos_root_url, &repos_uuid,
                                NULL, NULL, NULL, NULL,
@@ -1502,9 +1521,8 @@ test_global_relocate(apr_pool_t *pool)
                                                    pool),
                                pool, pool));
   SVN_TEST_STRING_ASSERT(repos_relpath, "G-alt");
-  SVN_TEST_STRING_ASSERT(repos_root_url, ROOT_THREE);
-  /* The UUID should still be the same. */
-  SVN_TEST_STRING_ASSERT(repos_uuid, UUID_ONE);
+  SVN_TEST_STRING_ASSERT(repos_root_url, ROOT_TWO);
+  SVN_TEST_STRING_ASSERT(repos_uuid, UUID_TWO);
 
   return SVN_NO_ERROR;
 }