subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1660928 - in /subversion/trunk/subversion: libsvn_wc/wc-checks.sql tests/libsvn_wc/db-test.c tests/libsvn_wc/entries-compat.c tests/libsvn_wc/utils.c tests/libsvn_wc/utils.h
Date Thu, 19 Feb 2015 16:33:35 GMT
Author: rhuijben
Date: Thu Feb 19 16:33:35 2015
New Revision: 1660928

URL: http://svn.apache.org/r1660928
Log:
Convert db-tests.c's initial state generation to a similar C struct as used
in op-depth-tests.c, to allow handling future database format updates
without rewriting all sql manually.

* subversion/libsvn_wc/wc-checks.sql
  (STMT_STATIC_VERIFY): Extend further. This time to fix some NULL cases
    caused by joining.

* subversion/tests/libsvn_wc/db-test.c
  (TESTING_DATA): Remove NODES and ACTUAL init.
  (NOT_MOVED,
   NO_COPY_FROM): New defines.
  (nodes_init_data,
   actual_init_data): New variables, manually extracted from TESTING_DATA.
  (create_open): Update caller.

* subversion/tests/libsvn_wc/entries-compat.c
  (create_fake_wc): Update caller.

* subversion/tests/libsvn_wc/utils.c
  (includes): Add token-map.h.
  (svn_test__create_fake_wc): Use db queries to fill wc.db if data
    provided.

* subversion/tests/libsvn_wc/utils.h
  (svn_test__nodes_data_t,
   svn_test__actual_data_t): New types.
  (svn_test__create_fake_wc): Add arguments to pass initial nodes and
    actual rows.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-checks.sql
    subversion/trunk/subversion/tests/libsvn_wc/db-test.c
    subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c
    subversion/trunk/subversion/tests/libsvn_wc/utils.c
    subversion/trunk/subversion/tests/libsvn_wc/utils.h

Modified: subversion/trunk/subversion/libsvn_wc/wc-checks.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-checks.sql?rev=1660928&r1=1660927&r2=1660928&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-checks.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-checks.sql Thu Feb 19 16:33:35 2015
@@ -112,7 +112,8 @@ LEFT JOIN nodes n on n.wc_id = a.wc_id A
    AND n.op_depth = (SELECT MAX(op_depth) from nodes i
                      WHERE i.wc_id=a.wc_id AND i.local_relpath=a.local_relpath)
 WHERE (a.properties IS NOT NULL
-       AND n.presence NOT IN (MAP_NORMAL, MAP_INCOMPLETE))
+       AND (n.presence IS NULL
+            OR n.presence NOT IN (MAP_NORMAL, MAP_INCOMPLETE)))
    OR (a.changelist IS NOT NULL AND (n.kind IS NOT NULL AND n.kind != MAP_FILE))
    OR (a.conflict_data IS NULL AND a.properties IS NULL AND a.changelist IS NULL)
  AND NOT EXISTS(SELECT 1 from nodes i
@@ -217,7 +218,7 @@ WHERE n.op_depth > 0 AND n.presence IN (
            RELPATH_SKIP_JOIN(n.parent_relpath, p.repos_path, n.local_relpath)
         OR n.revision != p.revision
         OR p.kind != MAP_DIR
-        OR n.moved_here != p.moved_here)
+        OR n.moved_here IS NOT p.moved_here)
 
 UNION ALL
 /* Only certain presence values are valid as op-root.
@@ -230,7 +231,7 @@ WHERE n.op_depth = relpath_depth(local_r
 UNION ALL
 /* If a node is shadowed, all its present op-depth descendants
    must be shadowed at the same op-depth as well */
-SELECT n.local_relpath, n.op_depth, 28, 'Incomplete shadowing'
+SELECT n.local_relpath, s.op_depth, 28, 'Incomplete shadowing'
 FROM nodes n
 JOIN nodes s ON s.wc_id=n.wc_id AND s.local_relpath=n.local_relpath
  AND s.op_depth = relpath_depth(s.local_relpath)
@@ -258,7 +259,9 @@ LEFT JOIN nodes n ON n.wc_id=s.wc_id AND
                    WHERE d.wc_id=s.wc_id AND d.local_relpath=s.local_relpath
                      AND d.op_depth < s.op_depth)
 WHERE s.presence = MAP_BASE_DELETED
-  AND n.presence NOT IN (MAP_NORMAL, MAP_INCOMPLETE)
+  AND (n.presence IS NULL
+       OR n.presence NOT IN (MAP_NORMAL, MAP_INCOMPLETE)
+       /*OR n.kind != s.kind*/)
 
 UNION ALL
 /* Moves are stored in the working layers, not in BASE */
@@ -273,7 +276,7 @@ UNION ALL
 SELECT d.local_relpath, d.op_depth, 60, 'Moved here without origin'
 FROM nodes d
 WHERE d.op_depth = relpath_depth(d.local_relpath)
-  AND d.moved_here = 1
+  AND d.moved_here IS NOT NULL
   AND NOT EXISTS(SELECT 1 FROM nodes s
                  WHERE s.wc_id = d.wc_id AND s.moved_to = d.local_relpath)
 

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=1660928&r1=1660927&r2=1660928&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Thu Feb 19 16:33:35 2015
@@ -88,254 +88,205 @@ static const char * const TESTING_DATA =
    "insert into wcroot values (1, null); "
 
    "insert into pristine values ('$sha1$" SHA1_1 "', NULL, 15, 1, '$md5 $" MD5_1 "'); "
+);
 
-   /* ### The file_externals column in NODES is temporary, and will be
-      ### removed.  However, to keep the tests passing, we need to add it
-      ### to the following insert statements.  *Be sure to remove it*. */
+#define NOT_MOVED FALSE, NULL
+#define NO_COPY_FROM 0, NULL, SVN_INVALID_REVNUM
 
+static const svn_test__nodes_data_t nodes_init_data[] = {
    /* load the base nodes into the nodes table */
-  "insert into nodes values ("
-  "  1, '', 0, null, 1, '', 1, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'A', 0, '', 1, 'A', 1, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1
"',"
-  "  10, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'B', 0, '', 1, 'B', null, 'excluded',"
-  "  null, null, 'symlink', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'C', 0, '', 1, 'C', null, 'server-excluded',"
-  "  null, null, 'unknown', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'D', 0, '', 1, 'D', null, 'not-present',"
-  "  null, null, 'unknown', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'E', 0, '', 1, 'E', null, 'incomplete',"
-  "  null, null, 'unknown', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'F', 0, '', 1, 'F', 1, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1
"',"
-  "  15, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'G', 0, '', 2, 'G-alt', 1, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2
"',"
-  "  15, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'H', 0, '', 1, 'H', 1, 'normal',"
-  "  null, null, 'symlink', '()', null, null, 'H-target', 1, " TIME_1s ", '" AUTHOR_1 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'I', 0, '', 1, 'I', 1, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J', 0, '', 1, 'J', 1, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e', 0, 'J', 1, 'J/J-e', 1, 'normal',"
-  "  null, null, 'dir', null, 'infinity', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e/J-e-a', 0, 'J/J-e', 1, 'J/J-e/J-e-a', 1, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1
"',"
-  "  15, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e/J-e-b', 0, 'J/J-e', 1, 'J/J-e/J-e-b', 1, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e/J-e-b/Jeba', 0, 'J/J-e/J-e-b', 1, 'J/J-e/J-e-b/Jeba', 1, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1
"',"
-  "  15, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-f', 0, 'J', 1, 'J/J-f', 1, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-f/J-f-a', 0, 'J/J-f', 1, 'J/J-f/J-f-a', 1, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'K', 0, '', 1, 'K', 1, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'K/K-a', 0, 'K', 1, 'K/K-a', 1, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1
"',"
-  "  15, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'K/K-b', 0, 'K', 1, 'K/K-b', 1, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1
"',"
-  "  15, null, null, null, null);"
-  ""
-   /* Load data into NODES table;
-      ### op_depths have not been calculated by me yet;
-      the value 1 is just 'good enough' to make the nodes WORKING nodes. */
-  "insert into nodes values ("
-  "  1, 'I', 1, '', 2, 'some/dir', 2, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, 2, " TIME_2s ", '" AUTHOR_2 "',"
-  "  null, null, null, null, null);"
+  { 0, "",            "normal",           1, "", 1,             NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "A",           "normal",           1, "A", 1,            NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1,
+    FALSE, NULL, 10, 10 },
+
+  { 0, "B",           "excluded",         1, "B", SVN_INVALID_REVNUM, NOT_MOVED,
+    svn_node_symlink},
+
+  { 0, "C",           "server-excluded",  1, "C", 0,            NOT_MOVED,
+    svn_node_unknown},
+
+  { 0, "D",           "not-present",      1, "D", 0,            NOT_MOVED,
+    svn_node_unknown},
+
+  { 0, "E",           "incomplete",       1, "E", 1,            NOT_MOVED,
+    svn_node_unknown},
+
+  { 0, "F",           "normal",           1, "F", 1,            NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2},
+
+  { 0, "G",           "normal",           2, "G-alt", 1,        NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 0, "H",           "normal",           1, "H", 1,            NOT_MOVED,
+    svn_node_symlink, "()", NULL, NULL, "H-target", 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "I",           "normal",           1, "I", 1,            NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "J",           "normal",           1, "J", 1,            NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "J/J-e",       "normal",           1, "J/J-e", 1,        NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "J/J-e/J-e-a", "normal",           1, "J/J-e/J-e-a", 1,  NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "J/J-e/J-e-b", "normal",           1, "J/J-e/J-e-b", 1,  NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "J/J-e/J-e-b/Jeba", "normal",      1, "J/J-e/J-e-b/Jeba", 1,  NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "J/J-f",       "normal",           1, "J/J-f", 1,        NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "J/J-f/J-f-a", "normal",           1, "J/J-f/J-f-a", 1,  NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "J",           "normal",           1, "J", 1,            NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "K",           "normal",           1, "K", 1,            NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "K/K-a",       "normal",           2, "K/K-a", 1,        NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2,
+    FALSE, NULL, 15, 14},
+
+  { 0, "K/K-b",       "normal",           2, "K/K-b", 1,        NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2,
+    FALSE, NULL, 15, 14},
+
+   /* Load data into the working layers of NODES */
+
+  { 1, "I",           "normal",           2, "some/dir", 2,     NOT_MOVED,
+    svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
 
    /* J was originally a local addition, but its descendants are replaced,
       so let's turn J in a copy */
-  "insert into nodes values ("
-  "  1, 'J', 1, '', 2, 'q', 2, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-a', 1, 'J', 2, 'q/J-a', 2, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-b', 1, 'J', 2, 'q/J-b', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 2, " TIME_2s ", '" AUTHOR_2 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-b/J-b-a', 3, 'J/J-b', 2, 'another/dir', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 2, " TIME_2s ", '" AUTHOR_2 "',"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-b/J-b-b', 1, 'J/J-b', 2, 'q/J-b/J-b-b', 2, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-c', 1, 'J', 2, 'q/J-c', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-c/J-c-a', 1, 'J/J-c', 2, 'q/J-c/J-c-a', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-c', 2, 'J', null, null, null, 'base-deleted',"
-  "  null, null, 'dir', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-c/J-c-a', 2, 'J/J-c', null, null, null, 'base-deleted',"
-  "  null, null, 'dir', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-d', 2, 'J', 2, 'moved/file', 2, 'normal',"
-  "  1, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "',"
-  "  10, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'moved', 0, '', 2, 'moved', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'moved/file', 0, 'moved', 2, 'moved/file', 2, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2
"',"
-  "  10, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'moved/file', 2, 'moved', null, null, null, 'base-deleted',"
-  "  null, 'J/J-d', 'file', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e', 1, 'J', 2, 'q/J-e', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e/J-e-a', 1, 'J/J-e', 2, 'q/J-e/J-e-a', 2, 'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e/J-e-b', 1, 'J/J-e', 2, 'q/J-e/J-e-b', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e', 2, 'J', null, null, null, 'base-deleted',"
-  "  null, 'other/place', 'dir', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e/J-e-a', 2, 'J/J-e', null, null, null, 'base-deleted',"
-  "  null, null, 'file', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e/J-e-b', 2, 'J/J-e', null, null, null, 'base-deleted',"
-  "  null, null, 'dir', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-e/J-e-b/Jeba', 1, 'J/J-e/J-e-b', null, null, null, 'base-deleted',"
-  "  null, null, 'file', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-f', 1, 'J', 2, 'q/J-f', 2, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'J/J-f/J-f-a', 1, 'J/J-f', null, null, null, 'base-deleted',"
-  "  null, null, 'dir', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'K', 1, '', null, null, null, 'base-deleted',"
-  "  null, null, 'dir', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'K/K-a', 1, 'K', null, null, null, 'base-deleted',"
-  "  null, null, 'file', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'K/K-b', 1, 'K', null, null, null, 'base-deleted',"
-  "  null, 'moved/away', 'file', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'L', 1, '', 2, 'from', 2, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'L/L-a', 1, 'L', 2, 'from/L-a', 2, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'L/L-a/L-a-a', 1, 'L/L-a', 2, 'from/L-a/L-a-a', 2, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'L/L-a', 2, 'L', null, null, null, 'base-deleted',"
-  "  null, null, 'dir', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'L/L-a/L-a-a', 2, 'L/L-a', null, null, null, 'base-deleted',"
-  "  null, null, 'dir', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'other', 0, '', 2, 'other', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'other/place', 2, 'other', null, null, null, 'normal',"
-  "  1, null, 'dir', null, 'immediates', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'other/place/J-e-a', 3, 'other/place', null, null, null, 'normal',"
-  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'other/place/J-e-b', 3, 'other/place', null, null, null, 'normal',"
-  "  null, null, 'dir', null, 'infinity', null, null, null, null, null,"
-  "  null, null, null, null, null);"
-  "insert into nodes values ("
-  "  1, 'other/place/J-e-b/Jeba', 4, 'other/place/J-e-b', null, null, null, 'normal',"
-  "  null, null, 'file', null, null, null, null, null, null, null,"
-  "  null, null, null, null, null);"
-   "insert into actual_node values ("
-   "  1, 'A', '', null, null, null, null, null, 'changelist', null, "
-   "  null, null, null, null, null);"
-   "insert into actual_node values ("
-   "  1, 'F', '', null, null, null, null, null, null, null, "
-   "  '" F_TC_DATA "', null, null, null, null);"
-   "insert into actual_node values ("
-   "  1, 'G', '', null, null, null, null, null, null, null, "
-   "  '" G_TC_DATA "', null, null, null, null);"
-   );
+  { 1, "J",           "normal",           2, "q", 2,            NOT_MOVED,
+    svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "J/J-a",       "normal",           2, "q/J-a", 2,        NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "J/J-b",       "normal",           2, "q/J-b", 2,        NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 3, "J/J-b/J-b-a", "normal",           2, "another/dir", 2,  NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "J/J-b/J-b-b", "normal",           2, "q/J-b/J-b-b", 2,  NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "J/J-c",       "normal",           2, "q/J-c", 2,        NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "J/J-c/J-c-a", "normal",           2, "q/J-c/J-c-a", 2,  NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 2, "J/J-c",       "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_dir},
+
+  { 2, "J/J-c/J-c-a", "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_dir},
+
+  { 2, "J/J-d",       "normal",           2, "moved/file", 2,   TRUE, NULL,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 0, "moved",       "normal",           2, "moved", 2,        NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  { 0, "moved/file",  "normal",           2, "moved/file", 2,   NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 2, "moved/file",  "base-deleted",     NO_COPY_FROM,         FALSE, "J/J-d",
+    svn_node_file},
+
+  { 1, "J/J-e",       "normal",           2, "q/J-e", 2,        NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "J/J-e/J-e-a", "normal",           2, "q/J-e/J-e-a", 2,  NOT_MOVED,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "J/J-e/J-e-b", "normal",           2, "q/J-e/J-e-b", 2,  NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 2, "J/J-e",       "base-deleted",     NO_COPY_FROM,         FALSE, "other/place",
+    svn_node_dir},
+
+  { 2, "J/J-e/J-e-a", "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_file},
+
+  { 2, "J/J-e/J-e-b", "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_dir},
+
+  { 1, "J/J-e/J-e-b/Jeba", "base-deleted", NO_COPY_FROM,        NOT_MOVED,
+    svn_node_file},
+
+  { 1, "J/J-f",       "normal",           2, "q/J-f", 2,        NOT_MOVED,
+    svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "J/J-f/J-f-a", "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_dir},
+
+  { 1, "K",           "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_dir},
+
+  { 1, "K/K-a",       "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_file},
+
+  { 1, "K/K-b",       "base-deleted",     NO_COPY_FROM,         FALSE, "moved/away",
+    svn_node_file},
+
+  { 1, "L",           "normal",           2, "from", 2,         NOT_MOVED,
+    svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "L/L-a",       "normal",           2, "from/L-a", 2,     NOT_MOVED,
+    svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 1, "L/L-a/L-a-a", "normal",           2, "from/L-a/L-a-a", 2, NOT_MOVED,
+    svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 2, "L/L-a",       "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_dir},
+
+  { 2, "L/L-a/L-a-a", "base-deleted",     NO_COPY_FROM,         NOT_MOVED,
+    svn_node_dir},
+
+  { 0, "other",       "normal",           2, "other", 2,        NOT_MOVED,
+    svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 2, "other/place", "normal",           2, "q/J-e", 2,        TRUE, NULL,
+    svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 2, "other/place/J-e-a", "normal",     2, "q/J-e/J-e-a", 2,  TRUE, NULL,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 2, "other/place/J-e-b", "normal",     2, "q/J-e/J-e-b", 2,  TRUE, NULL,
+    svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 },
+
+  { 2, "other/place/J-e-b/Jeba", "normal", 2, "q/J-e/J-e-b/Jeba", 2,  TRUE, NULL,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1 },
+
+  /*** NEW ****/
+  { 2, "moved/away",  "normal",           2, "K/K-b", 1,        TRUE, NULL,
+    svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2,
+    FALSE, NULL, 15, 14},
+  { 0 }
+};
+
+static const svn_test__actual_data_t actual_init_data[] = {
+  { "A", NULL, "changelist", NULL },
+  { "F", NULL, NULL, F_TC_DATA },
+  { "G", NULL, NULL, F_TC_DATA },
 
+  { 0 }
+};
 
 static svn_error_t *
 create_open(svn_wc__db_t **db,
@@ -352,7 +303,8 @@ create_open(svn_wc__db_t **db,
   SVN_ERR(svn_io_remove_dir2(*local_abspath, TRUE, NULL, NULL, pool));
 
   SVN_ERR(svn_wc__db_open(db, NULL, FALSE, TRUE, pool, pool));
-  SVN_ERR(svn_test__create_fake_wc(*local_abspath, TESTING_DATA, pool));
+  SVN_ERR(svn_test__create_fake_wc(*local_abspath, TESTING_DATA,
+                                   nodes_init_data, actual_init_data, pool));
 
   svn_test_add_dir_cleanup(*local_abspath);
 

Modified: subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c?rev=1660928&r1=1660927&r2=1660928&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c Thu Feb 19 16:33:35 2015
@@ -310,7 +310,8 @@ create_fake_wc(const char *subdir, apr_p
   SVN_ERR(svn_io_remove_dir2(root, TRUE, NULL, NULL, pool));
 
   SVN_ERR(svn_dirent_get_absolute(&wc_abspath, root, pool));
-  SVN_ERR(svn_test__create_fake_wc(wc_abspath, TESTING_DATA, pool));
+  SVN_ERR(svn_test__create_fake_wc(wc_abspath, TESTING_DATA, NULL, NULL,
+                                   pool));
 
   return SVN_NO_ERROR;
 }
@@ -406,7 +407,7 @@ test_stubs(apr_pool_t *pool)
   SVN_ERR(create_open(&db, &local_abspath, WC_NAME, pool));
 
   M_dir = svn_dirent_join(local_abspath, "M", pool);
-  SVN_ERR(svn_test__create_fake_wc(M_dir, M_TESTING_DATA, pool));
+  SVN_ERR(svn_test__create_fake_wc(M_dir, M_TESTING_DATA, NULL, NULL, pool));
 
   /* The "M" entry is a subdir. Let's ensure we can reach its stub,
      and the actual contents.  */

Modified: subversion/trunk/subversion/tests/libsvn_wc/utils.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/utils.c?rev=1660928&r1=1660927&r2=1660928&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.c Thu Feb 19 16:33:35 2015
@@ -33,7 +33,7 @@
 #include "../../libsvn_wc/wc-queries.h"
 #define SVN_WC__I_AM_WC_DB
 #include "../../libsvn_wc/wc_db_private.h"
-
+#include "../../libsvn_wc/token-map.h"
 svn_error_t *
 svn_test__create_client_ctx(svn_client_ctx_t **ctx,
                             svn_test__sandbox_t *sbox,
@@ -122,6 +122,9 @@ WC_QUERIES_SQL_DECLARE_STATEMENTS(statem
 svn_error_t *
 svn_test__create_fake_wc(const char *wc_abspath,
                          const char *extra_statements,
+                         const svn_test__nodes_data_t nodes[],
+                         const svn_test__actual_data_t actuals[],
+
                          apr_pool_t *scratch_pool)
 {
   const char *dotsvn_abspath = svn_dirent_join(wc_abspath, ".svn",
@@ -129,6 +132,8 @@ svn_test__create_fake_wc(const char *wc_
   svn_sqlite__db_t *sdb;
   const char **my_statements;
   int i;
+  svn_sqlite__stmt_t *stmt;
+  const apr_int64_t wc_id = 1;
 
   /* Allocate MY_STATEMENTS in RESULT_POOL because the SDB will continue to
    * refer to it over its lifetime. */
@@ -153,6 +158,110 @@ svn_test__create_fake_wc(const char *wc_
 
   SVN_ERR(svn_sqlite__close(sdb));
 
+  if (!nodes && !actuals)
+    return SVN_NO_ERROR;
+
+  /* Re-open with normal set of statements */
+  SVN_ERR(svn_wc__db_util_open_db(&sdb, wc_abspath, "wc.db",
+                                  svn_sqlite__mode_readwrite,
+                                  FALSE /* exclusive */, 0 /* timeout */,
+                                  statements,
+                                  scratch_pool, scratch_pool));
+
+  if (nodes)
+    {
+      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+                                        STMT_INSERT_NODE));
+
+      for (i = 0; nodes[i].local_relpath; i++)
+        {
+          SVN_ERR(svn_sqlite__bindf(stmt, "isdsnnns",
+                                wc_id,
+                                nodes[i].local_relpath,
+                                nodes[i].op_depth,
+                                nodes[i].local_relpath[0]
+                                  ? svn_relpath_dirname(nodes[i].local_relpath,
+                                                        scratch_pool)
+                                  : NULL,
+                                nodes[i].presence));
+
+          if (nodes[i].repos_relpath)
+            {
+                SVN_ERR(svn_sqlite__bind_int64(stmt, 5, nodes[i].repos_id));
+                SVN_ERR(svn_sqlite__bind_text(stmt, 6, nodes[i].repos_relpath));
+                SVN_ERR(svn_sqlite__bind_revnum(stmt, 7, nodes[i].revision));
+            }
+
+          if (nodes[i].depth)
+            SVN_ERR(svn_sqlite__bind_text(stmt, 9, nodes[i].depth));
+
+          if (nodes[i].kind != 0)
+            SVN_ERR(svn_sqlite__bind_token(stmt, 10, kind_map, nodes[i].kind));
+
+          if (nodes[i].last_author || nodes[i].last_date)
+            {
+              SVN_ERR(svn_sqlite__bind_revnum(stmt, 11, nodes[i].last_revision));
+              SVN_ERR(svn_sqlite__bind_int64(stmt, 12, nodes[i].last_date));
+              SVN_ERR(svn_sqlite__bind_text(stmt, 13, nodes[i].last_author));
+            }
+
+          if (nodes[i].checksum)
+            SVN_ERR(svn_sqlite__bind_text(stmt, 14, nodes[i].checksum));
+
+          if (nodes[i].properties)
+            SVN_ERR(svn_sqlite__bind_text(stmt, 15, nodes[i].properties));
+
+          if (nodes[i].recorded_size || nodes[i].recorded_time)
+            {
+              SVN_ERR(svn_sqlite__bind_int64(stmt, 16, nodes[i].recorded_size));
+              SVN_ERR(svn_sqlite__bind_int64(stmt, 17, nodes[i].recorded_time));
+            }
+
+          /* 18 is DAV cache */
+
+          if (nodes[i].symlink_target)
+            SVN_ERR(svn_sqlite__bind_text(stmt, 19, nodes[i].symlink_target));
+
+          if (nodes[i].file_external)
+            SVN_ERR(svn_sqlite__bind_int(stmt, 20, 1));
+
+          if (nodes[i].moved_to)
+            SVN_ERR(svn_sqlite__bind_text(stmt, 21, nodes[i].moved_to));
+
+          if (nodes[i].moved_here)
+            SVN_ERR(svn_sqlite__bind_int(stmt, 22, 1));
+
+          if (nodes[i].inherited_props)
+            SVN_ERR(svn_sqlite__bind_text(stmt, 23, nodes[i].inherited_props));
+
+          SVN_ERR(svn_sqlite__step_done(stmt));
+        }
+    }
+
+  if (actuals)
+    {
+      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+                                        STMT_INSERT_ACTUAL_NODE));
+
+      for (i = 0; actuals[i].local_relpath; i++)
+        {
+          SVN_ERR(svn_sqlite__bindf(stmt, "isssss",
+                                wc_id,
+                                actuals[i].local_relpath,
+                                actuals[i].local_relpath[0]
+                                  ? svn_relpath_dirname(actuals[i].local_relpath,
+                                                        scratch_pool)
+                                  : NULL,
+                                actuals[i].properties,
+                                actuals[i].changelist,
+                                actuals[i].conflict_data));
+
+          SVN_ERR(svn_sqlite__step_done(stmt));
+        }
+    }
+
+  SVN_ERR(svn_sqlite__close(sdb));
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/tests/libsvn_wc/utils.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/utils.h?rev=1660928&r1=1660927&r2=1660928&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.h (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.h Thu Feb 19 16:33:35 2015
@@ -179,6 +179,39 @@ sbox_wc_propset(svn_test__sandbox_t *b,
 svn_error_t *
 sbox_add_and_commit_greek_tree(svn_test__sandbox_t *b);
 
+/* Initial data to store in NODES */
+typedef struct svn_test__nodes_data_t
+{
+  int op_depth;
+  const char *local_relpath;
+  const char *presence;
+  int repos_id;
+  const char *repos_relpath;
+  svn_revnum_t revision;
+  svn_boolean_t moved_here;
+  const char *moved_to;
+  svn_node_kind_t kind;
+  const char *properties;
+  const char *depth;
+  const char *checksum;
+  const char *symlink_target;
+  svn_revnum_t last_revision;
+  apr_time_t last_date;
+  const char *last_author;
+  svn_boolean_t file_external;
+  const char *inherited_props;
+  svn_filesize_t recorded_size;
+  apr_time_t recorded_time;
+} svn_test__nodes_data_t;
+
+/* Initial data to store in ACTUAL */
+typedef struct svn_test__actual_data_t
+{
+  const char *local_relpath;
+  const char *properties;
+  const char *changelist;
+  const char *conflict_data;
+} svn_test__actual_data_t;
 
 /* Create a WC directory at WC_ABSPATH containing a fake WC DB, generated by
  * executing the SQL statements EXTRA_STATEMENTS in addition to the standard
@@ -186,6 +219,8 @@ sbox_add_and_commit_greek_tree(svn_test_
 svn_error_t *
 svn_test__create_fake_wc(const char *wc_abspath,
                          const char *extra_statements,
+                         const svn_test__nodes_data_t nodes[],
+                         const svn_test__actual_data_t actuals[],
                          apr_pool_t *scratch_pool);
 
 



Mime
View raw message