subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1658686 [19/19] - in /subversion/branches/pin-externals: ./ build/generator/ build/generator/templates/ subversion/bindings/swig/ subversion/include/ subversion/libsvn_client/ subversion/libsvn_fs_fs/ subversion/libsvn_fs_x/ subversion/lib...
Date Tue, 10 Feb 2015 11:41:59 GMT
Modified: subversion/branches/pin-externals/subversion/tests/libsvn_fs/locks-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/tests/libsvn_fs/locks-test.c?rev=1658686&r1=1658685&r2=1658686&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/tests/libsvn_fs/locks-test.c (original)
+++ subversion/branches/pin-externals/subversion/tests/libsvn_fs/locks-test.c Tue Feb 10 11:41:57
2015
@@ -53,9 +53,19 @@ get_locks_callback(void *baton,
   struct get_locks_baton_t *b = baton;
   apr_pool_t *hash_pool = apr_hash_pool_get(b->locks);
   svn_string_t *lock_path = svn_string_create(lock->path, hash_pool);
-  apr_hash_set(b->locks, lock_path->data, lock_path->len,
-               svn_lock_dup(lock, hash_pool));
-  return SVN_NO_ERROR;
+
+  if (!apr_hash_get(b->locks, lock_path->data, lock_path->len))
+    {
+      apr_hash_set(b->locks, lock_path->data, lock_path->len,
+                   svn_lock_dup(lock, hash_pool));
+      return SVN_NO_ERROR; 
+    }
+  else
+    {
+      return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+                               "Lock for path '%s' is being reported twice.",
+                               lock->path);
+    }
 }
 
 /* A factory function. */
@@ -1134,6 +1144,72 @@ obtain_write_lock_failure(const svn_test
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+parent_and_child_lock(const svn_test_opts_t *opts,
+                      apr_pool_t *pool)
+{
+  svn_fs_t *fs;
+  svn_fs_access_t *access;
+  svn_fs_txn_t *txn;
+  svn_fs_root_t *root;
+  const char *conflict;
+  svn_revnum_t newrev;
+  svn_lock_t *lock;
+  struct get_locks_baton_t *get_locks_baton;
+  apr_size_t num_expected_paths;
+
+  SVN_ERR(svn_test__create_fs(&fs, "test-parent-and-child-lock", opts, pool));
+  SVN_ERR(svn_fs_create_access(&access, "bubba", pool));
+  SVN_ERR(svn_fs_set_access(fs, access));
+
+  /* Make a file '/A'. */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
+  SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+  SVN_ERR(svn_fs_make_file(root, "/A", pool));
+  SVN_ERR(svn_fs_commit_txn(&conflict, &newrev, txn, pool));
+
+  /* Obtain a lock on '/A'. */
+  SVN_ERR(svn_fs_lock(&lock, fs, "/A", NULL, NULL, FALSE, 0, newrev, FALSE,
+                      pool));
+
+  /* Add a lock token to FS access context. */
+  SVN_ERR(svn_fs_access_add_lock_token(access, lock->token));
+
+  /* Make some weird change: replace file '/A' by a directory with a
+     child.  Issue 2507 means that the result is that the directory /A
+     remains locked. */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, newrev, pool));
+  SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+  SVN_ERR(svn_fs_delete(root, "/A", pool));
+  SVN_ERR(svn_fs_make_dir(root, "/A", pool));
+  SVN_ERR(svn_fs_make_file(root, "/A/b", pool));
+  SVN_ERR(svn_fs_commit_txn(&conflict, &newrev, txn, pool));
+
+  /* Obtain a lock on '/A/b'.  Issue 2507 means that the lock index
+     for / refers to both /A and /A/b, and that the lock index for /A
+     refers to /A/b. */
+  SVN_ERR(svn_fs_lock(&lock, fs, "/A/b", NULL, NULL, FALSE, 0, newrev, FALSE,
+                      pool));
+
+  /* Verify the locked paths. The lock for /A/b should not be reported
+     twice even though issue 2507 means we access the index for / and
+     the index for /A both of which refer to /A/b. */
+  {
+    static const char *expected_paths[] = {
+      "/A",
+      "/A/b",
+    };
+    num_expected_paths = sizeof(expected_paths) / sizeof(const char *);
+    get_locks_baton = make_get_locks_baton(pool);
+    SVN_ERR(svn_fs_get_locks(fs, "/", get_locks_callback,
+                             get_locks_baton, pool));
+    SVN_ERR(verify_matching_lock_paths(get_locks_baton, expected_paths,
+                                       num_expected_paths, pool));
+  }
+
+  return SVN_NO_ERROR;
+}
+
 /* ------------------------------------------------------------------------ */
 
 /* The test table.  */
@@ -1171,6 +1247,8 @@ static struct svn_test_descriptor_t test
                        "lock callback error"),
     SVN_TEST_OPTS_PASS(obtain_write_lock_failure,
                        "lock/unlock when 'write-lock' couldn't be obtained"),
+    SVN_TEST_OPTS_PASS(parent_and_child_lock,
+                       "lock parent and it's child"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/pin-externals/subversion/tests/libsvn_subr/x509-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/tests/libsvn_subr/x509-test.c?rev=1658686&r1=1658685&r2=1658686&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/tests/libsvn_subr/x509-test.c (original)
+++ subversion/branches/pin-externals/subversion/tests/libsvn_subr/x509-test.c Tue Feb 10
11:41:57 2015
@@ -500,6 +500,98 @@ static struct x509_test cert_tests[] = {
     NULL,
     "99302ca2824f585a117bb41302a388daa0519765"
   },
+  /* certificate with subject that includes an attribute that has an
+   * object id that has leading zeros.  This isn't technically legal
+   * but a simplistic parser might parser it the same as an object
+   * id that doesn't have a leading zero.  In this case the object id
+   * with a leading zero could parse to the same object id as the
+   * Common Name.  Make sure we don't treat it as such. */
+  { "MIIDDjCCAfYCAQEwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQVUxEzARBgNV"
+    "BAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0"
+    "ZDAeFw0xNTAxMjcwNzQ5MDhaFw0xNjAxMjcwNzQ5MDhaMFUxCzAJBgNVBAYTAlVT"
+    "MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRMwEQYDVQQHEwpOb3J0aCBCZW5kMRwwGgYE"
+    "VQSAAxMSbm90YWNuLmV4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A"
+    "MIIBCgKCAQEAvXCJv0gr9d3GNYiukPrbse0FdXmuBx2mPf665WyZVHk9JiPnDcb2"
+    "ng8gHLgJe8izou6I0vN2iJgy91rUPvX9zA3qVhml+cboVY2jHCPWo/v5PQsXAgLV"
+    "5gVjp2POn3N0O1xcS1yNe249LkP0Di3kAMp5gkzdprm3fD3JDW1Q+ocQylnbjzG0"
+    "FtNQSUJLITvPXjR7ny46Fci2mv8scHOvlEXTK5/2RoBaoK2jWQimqGfFj1sr1vqZ"
+    "Wcb6NAdZso64Xg1V6CWX8zymlA7gAhTQWveq+ovUWcXpmR8aj9pYNuy0aZW3BANz"
+    "N6L0G7OZiVUvvzpfnn0V3Z/sR/iQs7q3nQIDAQABMA0GCSqGSIb3DQEBBQUAA4IB"
+    "AQACZwruCiesCRkT08AtHl0WQnQui58e9/7En+iqxNQO6+fx84SfWGcUFYZtvzdO"
+    "KkHNTs06km+471OjLSDcotRkdqO1JxQCkNxbrPat7T6FrO9n2JFivx6eijRqK/jB"
+    "cBYW92dK4BfXU4+FyeB2OIpyPjuqLU2j7S5p7qNU50i/1J7Qt669nXeaPINIfZdW"
+    "sDjjWkFR1VOgXS/zeu/GOxlQFmmcde+X/qkFI+L352VX7Ktf95j4ms4vG2yZgNfe"
+    "jbNb9a7LMcqlop/PlX5WBGv8GGKUNZO0LvukFYOULf1oL8VQsN0x/gRHGC7m9kVM"
+    "3hojWZDXAY4mYqdBCRX7/gkt",
+    "C=US, ST=Washington, L=North Bend, 2.5.4.03=notacn.example.com",
+    "2.5.4.6 2.5.4.8 2.5.4.7 2.5.4.03",
+    "C=AU, ST=Some-State, O=Internet Widgits Pty Ltd",
+    "2.5.4.6 2.5.4.8 2.5.4.10",
+    "2015-01-27T07:49:08.000000Z",
+    "2016-01-27T07:49:08.000000Z",
+    NULL,
+    "6f24b834ba00fb4ef863df63b8fbeddab25e4838"
+  },
+  /* certificate with subject that includes an attribute that has an
+   * object id that has an overflow such that it calculates to
+   * the same object id as the Common Name (2.5.4.3).  OpenSSL
+   * with its bignum support shows this as 2.5.4.2361183241434822606851.
+   * It would be wrong to display this as a Common Name to the user. */
+  { "MIIDGTCCAgECAQEwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQVUxEzARBgNV"
+    "BAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0"
+    "ZDAeFw0xNTAxMjcwODMxNDNaFw0xNjAxMjcwODMxNDNaMGAxCzAJBgNVBAYTAlVT"
+    "MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRMwEQYDVQQHEwpOb3J0aCBCZW5kMScwJQYN"
+    "VQSCgICAgICAgICAAxMUb3ZlcmZsb3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3"
+    "DQEBAQUAA4IBDwAwggEKAoIBAQDHL1e8zSPyRND3tI42Vqca2FoCiWn881Czv2ct"
+    "tGFwyjUM8R1yHXEP+doS9KN9L29xRWZRxyCQ18S+QbjNQCh6Ay22qnkBu0uPdVB6"
+    "iIVKiW9RzU8dZSFMnveUZYLloG12kK++ooJGIstTJwkI8Naw1X1D29gZaY9oSKAc"
+    "Gs5c92po61RoetB744dUfUbAXi8eEd4ShdsdnCoswpEI4WTLdYLZ/cH/sU1a5Djm"
+    "cAfEBzZSOseEQSG7Fa/HvHyW+jDNnKG2r73M45TDcXAunSFcAYl1ioBaRwwdcTbK"
+    "SMGORThIX5UwpJDZI5sTVmTTRuCjbMxXXki/g9fTYD6mlaavAgMBAAEwDQYJKoZI"
+    "hvcNAQEFBQADggEBABvZSzFniMK4lqJcubzzk410NqZQEDBxdNZTNGrQYIDV8fDU"
+    "LLoQ2/2Y6kOQbx8r3RNcaJ6JtJeVqAq05It9oR5lMJFA2r0YMl4eB2V6o35+eaKY"
+    "FXrJzwx0rki2mX+iKsgRbJTv6mFb4I7vny404WKHNgYIfB8Z5jgbwWgrXH9M6BMb"
+    "FL9gZHMmU+6uqvCPYeIIZaAjT4J4E9322gpcumI9KGVApmbQhi5lC1hBh+eUprG7"
+    "4Brl9GeCLSTnTTf4GHIpqaUsKMtJ1sN/KJGwEB7Z4aszr80P5/sjHXOyqJ78tx46"
+    "pwH7/Fx0pM7nZjJVGvcxGBBOMeKy/o2QUVvEYPU=",
+    "C=US, ST=Washington, L=North Bend, \?\?=overflow.example.com",
+    "2.5.4.6 2.5.4.8 2.5.4.7 \?\?",
+    "C=AU, ST=Some-State, O=Internet Widgits Pty Ltd",
+    "2.5.4.6 2.5.4.8 2.5.4.10",
+    "2015-01-27T08:31:43.000000Z",
+    "2016-01-27T08:31:43.000000Z",
+    NULL,
+    "c1f063daf23e402fe58bab1a3fa2ba05c1106158"
+  },
+  /* certificate with multiple common names, make sure this behaves
+   * the same way as serf. */
+  { "MIIDJjCCAg4CAQEwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQVUxEzARBgNV"
+    "BAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0"
+    "ZDAeFw0xNTAxMjExNzUwMDZaFw0xNjAxMjExNzUwMDZaMG0xCzAJBgNVBAYTAlVT"
+    "MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRMwEQYDVQQHEwpOb3J0aCBCZW5kMRkwFwYD"
+    "VQQDExBnb29kLmV4YW1wbGUuY29tMRkwFwYDVQQDExBldmlsLmV4YW1wbGUuY29t"
+    "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5pfrXkiiDGCWSYhMQNHJ"
+    "gNBLEBNcFzsGpW8i6rMKVephwG7p4VqIvc0pSsmpD9IYuIxxq/2E2cziaTWyqCBp"
+    "hKKipqt8eMcu6u45LduHGiCcnN7rHORbQZTdvwzTmiVN1eI1oCVejB4zgHNkHUko"
+    "DyaALCHGRz8l7Qq6hSbiOnhH1qlscIIEsgQEyDlMZpbsWVTQKPxluhtgqVEn7wPN"
+    "qScrf2evq050NuNYYFzCmuqOGKq2gKbD/BlUqCNmEM2JPg/bdcAQxFCf0HcvDiS9"
+    "e29suMKWZAzJkbzrWhlDMG1Xt5c7dd82PcGwnL//Q7muE57luCw38Gp2vQQ3/Uki"
+    "vQIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQBry9wfxYia/dCSKvDXOBKUgWFQtI8j"
+    "7vYHuouTvIb5m6b62kiUdtuaVKi3jnUbHUFohOi/6o+HIwbXSgz5CbiLjgUvONBU"
+    "BLekaguIYX9tTmg+vhWchcmVMHufj6HdQkzWtyojSQD9GjHGInNDG102KlN1cdL8"
+    "jGTrru4vnef+xA24EvYPdcS2+H2yYH0THL3JPKo1GtO4NCEGWQbS6Ygwcy+BQpbU"
+    "TBIWhlbleuCalB8qhWyijcHeszT7mFR0CarEaSLeZj6FaQpZB636iHuELmxcgiFw"
+    "j3r3QZyAMEGvPPBPKYSTgmol31pX9LYvuFGA9ADQ2in/n9WdMfYzFzOn",
+    "C=US, ST=Washington, L=North Bend, "
+    "CN=good.example.com, CN=evil.example.com",
+    "2.5.4.6 2.5.4.8 2.5.4.7 2.5.4.3 2.5.4.3",
+    "C=AU, ST=Some-State, O=Internet Widgits Pty Ltd",
+    "2.5.4.6 2.5.4.8 2.5.4.10",
+    "2015-01-21T17:50:06.000000Z",
+    "2016-01-21T17:50:06.000000Z",
+    "good.example.com",
+    "9693f17e59205f41ca2e14450d151b945651b2d7"
+  },
   { NULL }
 };
 
@@ -593,10 +685,16 @@ compare_oids(const char *expected,
   buf = svn_stringbuf_create_empty(pool);
   for (i = 0; i < actual->nelts; ++i)
     {
-      const char *oid = APR_ARRAY_IDX(actual, i, const char*);
+      apr_size_t len;
+      const svn_x509_name_attr_t *attr = APR_ARRAY_IDX(actual, i, const svn_x509_name_attr_t
*);
+      const void *oid = svn_x509_name_attr_get_oid(attr, &len);
+      const char *oid_string = svn_x509_oid_to_string(oid, len, pool, pool);
       if (i > 0)
         svn_stringbuf_appendbyte(buf, ' ');
-      svn_stringbuf_appendcstr(buf, oid);
+      if (oid_string)
+        svn_stringbuf_appendcstr(buf, oid_string);
+      else
+        svn_stringbuf_appendcstr(buf, "??");
     }
 
   if (strcmp(expected, buf->data))
@@ -626,7 +724,7 @@ compare_results(struct x509_test *xt,
                              "expected '%s', got '%s'", xt->subject,
                              xt->subject, v);
 
-  SVN_ERR(compare_oids(xt->subject_oids, svn_x509_certinfo_get_subject_oids(certinfo),
+  SVN_ERR(compare_oids(xt->subject_oids, svn_x509_certinfo_get_subject_attrs(certinfo),
                        xt->subject, pool));
 
   v = svn_x509_certinfo_get_issuer(certinfo, pool);
@@ -639,7 +737,7 @@ compare_results(struct x509_test *xt,
                              "expected '%s', got '%s'", xt->subject,
                              xt->issuer, v);
 
-  SVN_ERR(compare_oids(xt->issuer_oids, svn_x509_certinfo_get_issuer_oids(certinfo),
+  SVN_ERR(compare_oids(xt->issuer_oids, svn_x509_certinfo_get_issuer_attrs(certinfo),
                        xt->subject, pool));
 
   SVN_ERR(compare_dates(xt->valid_from,
@@ -700,39 +798,9 @@ test_x509_parse_cert(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+#if 0
 static struct x509_test broken_cert_tests[] = {
-  /* certificate with subject that includes an attribute that has a
-   * object id that has and overflow such that it calculates to
-   * the same object id as the Common Name (2.5.4.3).  OpenSSL
-   * with its bignum support shows this as 2.5.4.2361183241434822606851.
-   * It would be wrong to display this as a Common Name to the user. */
-  { "MIIDGTCCAgECAQEwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQVUxEzARBgNV"
-    "BAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0"
-    "ZDAeFw0xNTAxMjcwODMxNDNaFw0xNjAxMjcwODMxNDNaMGAxCzAJBgNVBAYTAlVT"
-    "MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRMwEQYDVQQHEwpOb3J0aCBCZW5kMScwJQYN"
-    "VQSCgICAgICAgICAAxMUb3ZlcmZsb3cuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3"
-    "DQEBAQUAA4IBDwAwggEKAoIBAQDHL1e8zSPyRND3tI42Vqca2FoCiWn881Czv2ct"
-    "tGFwyjUM8R1yHXEP+doS9KN9L29xRWZRxyCQ18S+QbjNQCh6Ay22qnkBu0uPdVB6"
-    "iIVKiW9RzU8dZSFMnveUZYLloG12kK++ooJGIstTJwkI8Naw1X1D29gZaY9oSKAc"
-    "Gs5c92po61RoetB744dUfUbAXi8eEd4ShdsdnCoswpEI4WTLdYLZ/cH/sU1a5Djm"
-    "cAfEBzZSOseEQSG7Fa/HvHyW+jDNnKG2r73M45TDcXAunSFcAYl1ioBaRwwdcTbK"
-    "SMGORThIX5UwpJDZI5sTVmTTRuCjbMxXXki/g9fTYD6mlaavAgMBAAEwDQYJKoZI"
-    "hvcNAQEFBQADggEBABvZSzFniMK4lqJcubzzk410NqZQEDBxdNZTNGrQYIDV8fDU"
-    "LLoQ2/2Y6kOQbx8r3RNcaJ6JtJeVqAq05It9oR5lMJFA2r0YMl4eB2V6o35+eaKY"
-    "FXrJzwx0rki2mX+iKsgRbJTv6mFb4I7vny404WKHNgYIfB8Z5jgbwWgrXH9M6BMb"
-    "FL9gZHMmU+6uqvCPYeIIZaAjT4J4E9322gpcumI9KGVApmbQhi5lC1hBh+eUprG7"
-    "4Brl9GeCLSTnTTf4GHIpqaUsKMtJ1sN/KJGwEB7Z4aszr80P5/sjHXOyqJ78tx46"
-    "pwH7/Fx0pM7nZjJVGvcxGBBOMeKy/o2QUVvEYPU=",
-    "C=US, ST=Washington, L=North Bend, \?\?=overflow.example.com",
-    "2.5.4.6 2.5.4.8 2.5.4.7 2.5.4.3",
-    "C=AU, ST=Some-State, O=Internet Widgits Pty Ltd",
-    "2.5.4.6 2.5.4.8 2.5.4.10",
-    "2015-01-27T08:31:43.000000Z",
-    "2016-01-27T08:31:43.000000Z",
-    NULL,
-    "c1f063daf23e402fe58bab1a3fa2ba05c1106158"
-  },
-  { NULL }
+ { NULL }
 };
 
 static svn_error_t *
@@ -761,6 +829,7 @@ test_x509_parse_cert_broken(apr_pool_t *
 
   return SVN_NO_ERROR;
 }
+#endif
 
 /* The test table.  */
 
@@ -771,8 +840,8 @@ static struct svn_test_descriptor_t test
     SVN_TEST_NULL,
     SVN_TEST_PASS2(test_x509_parse_cert,
                    "test svn_x509_parse_cert"),
-    SVN_TEST_XFAIL2(test_x509_parse_cert_broken,
-                    "test broken certs"),
+/*    SVN_TEST_XFAIL2(test_x509_parse_cert_broken,
+                    "test broken certs"), */
     SVN_TEST_NULL
   };
 

Propchange: subversion/branches/pin-externals/subversion/tests/libsvn_wc/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Feb 10 11:41:57 2015
@@ -12,3 +12,4 @@ wc-incomplete-tester
 wc-lock-tester
 wc-queries-test
 wc-test
+wc-test-queries.h

Modified: subversion/branches/pin-externals/subversion/tests/libsvn_wc/db-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/tests/libsvn_wc/db-test.c?rev=1658686&r1=1658685&r2=1658686&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/branches/pin-externals/subversion/tests/libsvn_wc/db-test.c Tue Feb 10 11:41:57
2015
@@ -665,7 +665,7 @@ test_inserting_nodes(apr_pool_t *pool)
             props,
             1, TIME_1a, AUTHOR_1,
             children, svn_depth_infinity,
-            NULL, NULL, FALSE, NULL, NULL, NULL,
+            NULL, FALSE, NULL, NULL, NULL, NULL,
             pool));
 
   /* Replace an incomplete node with a file node. */

Modified: subversion/branches/pin-externals/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/tests/libsvn_wc/op-depth-test.c?rev=1658686&r1=1658685&r2=1658686&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/branches/pin-externals/subversion/tests/libsvn_wc/op-depth-test.c Tue Feb 10
11:41:57 2015
@@ -53,6 +53,10 @@
 
 #include "../svn_test.h"
 
+#include "wc-test-queries.h"
+
+WC_TEST_QUERIES_SQL_DECLARE_STATEMENTS(op_depth_statements);
+
 /* Compare strings, like strcmp but either or both may be NULL which
  * compares equal to NULL and not equal to any non-NULL string. */
 static int
@@ -73,14 +77,13 @@ strcmp_null(const char *s1, const char *
 static svn_error_t *
 open_wc_db(svn_sqlite__db_t **sdb,
            const char *wc_root_abspath,
-           const char *const *my_statements,
            apr_pool_t *result_pool,
            apr_pool_t *scratch_pool)
 {
   SVN_ERR(svn_wc__db_util_open_db(sdb, wc_root_abspath, "wc.db",
                                   svn_sqlite__mode_readwrite,
                                   FALSE /* exclusive */, 0 /* timeout */,
-                                  my_statements,
+                                  op_depth_statements,
                                   result_pool, scratch_pool));
   return SVN_NO_ERROR;
 }
@@ -264,17 +267,6 @@ check_db_rows(svn_test__sandbox_t *b,
   svn_sqlite__db_t *sdb;
   int i;
   svn_sqlite__stmt_t *stmt;
-  static const char *const statements[] = {
-    "SELECT op_depth, nodes.presence, nodes.local_relpath, revision,"
-    "       repos_path, file_external, def_local_relpath, moved_to, moved_here,"
-    "       properties"
-    " FROM nodes "
-    " LEFT OUTER JOIN externals"
-    "             ON nodes.wc_id = externals.wc_id "
-    "                AND nodes.local_relpath = externals.local_relpath"
-    " WHERE nodes.local_relpath = ?1 OR nodes.local_relpath LIKE ?2",
-    NULL };
-#define STMT_SELECT_NODES_INFO 0
 
   svn_boolean_t have_row;
   apr_hash_t *found_hash = apr_hash_make(b->pool);
@@ -287,7 +279,7 @@ check_db_rows(svn_test__sandbox_t *b,
   comparison_baton.errors = NULL;
 
   /* Fill ACTUAL_HASH with data from the WC DB. */
-  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, statements, b->pool, b->pool));
+  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, b->pool, b->pool));
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_NODES_INFO));
   SVN_ERR(svn_sqlite__bindf(stmt, "ss", base_relpath,
                             (base_relpath[0]
@@ -399,13 +391,6 @@ check_db_conflicts(svn_test__sandbox_t *
   svn_sqlite__db_t *sdb;
   int i;
   svn_sqlite__stmt_t *stmt;
-  static const char *const statements[] = {
-    "SELECT local_relpath"
-    " FROM actual_node "
-    " WHERE conflict_data is NOT NULL "
-    "   AND local_relpath = ?1 OR local_relpath LIKE ?2",
-    NULL };
-#define STMT_SELECT_ACTUAL_INFO 0
 
   svn_boolean_t have_row;
   apr_hash_t *found_hash = apr_hash_make(b->pool);
@@ -420,7 +405,7 @@ check_db_conflicts(svn_test__sandbox_t *
   comparison_baton.errors = NULL;
 
   /* Fill ACTUAL_HASH with data from the WC DB. */
-  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, statements, b->pool, b->pool));
+  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, b->pool, b->pool));
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_ACTUAL_INFO));
   SVN_ERR(svn_sqlite__bindf(stmt, "ss", base_relpath,
                             (base_relpath[0]
@@ -1166,27 +1151,17 @@ insert_dirs(svn_test__sandbox_t *b,
 {
   svn_sqlite__db_t *sdb;
   svn_sqlite__stmt_t *stmt;
-  static const char * const statements[] = {
-    "DELETE FROM nodes;",
-    "INSERT INTO nodes (local_relpath, op_depth, presence, repos_path,"
-    "                   revision, wc_id, repos_id, kind, depth)"
-    "           VALUES (?1, ?2, ?3, ?4, ?5, 1, 1, 'dir', 'infinity');",
-    "INSERT INTO nodes (local_relpath, op_depth, presence, repos_path,"
-    "                   revision, parent_relpath, wc_id, repos_id, kind, depth)"
-    "           VALUES (?1, ?2, ?3, ?4, ?5, ?6, 1, 1, 'dir', 'infinity');",
-    NULL,
-  };
 
-  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, statements, b->pool, b->pool));
+  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, b->pool, b->pool));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, 0));
+  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_NODES));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   while(nodes->local_relpath)
     {
       if (nodes->local_relpath[0])
         {
-          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, 2));
+          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_NODE));
           SVN_ERR(svn_sqlite__bindf(stmt, "sdssrs",
                                     nodes->local_relpath,
                                     nodes->op_depth,
@@ -1198,7 +1173,7 @@ insert_dirs(svn_test__sandbox_t *b,
         }
       else
         {
-          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, 1));
+          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_NODE_ROOT));
           SVN_ERR(svn_sqlite__bindf(stmt, "sdssr",
                                     nodes->local_relpath,
                                     nodes->op_depth,
@@ -1244,7 +1219,7 @@ base_dir_insert_remove(svn_test__sandbox
                                         "not-even-a-uuid", revision,
                                         apr_hash_make(b->pool), revision,
                                         0, NULL, NULL, svn_depth_infinity,
-                                        NULL, NULL, FALSE, NULL, NULL, NULL,
+                                        NULL, FALSE, NULL, NULL, NULL, NULL,
                                         b->pool));
 
   after = apr_palloc(b->pool, sizeof(*after) * (apr_size_t)(num_before + num_added + 1));
@@ -1963,29 +1938,20 @@ insert_actual(svn_test__sandbox_t *b,
 {
   svn_sqlite__db_t *sdb;
   svn_sqlite__stmt_t *stmt;
-  static const char * const statements[] = {
-    "DELETE FROM actual_node;",
-    "INSERT INTO actual_node (local_relpath, changelist, wc_id)"
-    "                 VALUES (?1, ?2, 1)",
-    "INSERT INTO actual_node (local_relpath, parent_relpath, changelist, wc_id)"
-    "                VALUES (?1, ?2, ?3, 1)",
-    "UPDATE nodes SET kind = 'file' WHERE wc_id = 1 and local_relpath = ?1",
-    NULL,
-  };
 
   if (!actual)
     return SVN_NO_ERROR;
 
-  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, statements, b->pool, b->pool));
+  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, b->pool, b->pool));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, 0));
+  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_ACTUAL));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   while(actual->local_relpath)
     {
       if (actual->local_relpath[0])
         {
-          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, 2));
+          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_ACTUAL));
           SVN_ERR(svn_sqlite__bindf(stmt, "sss",
                                     actual->local_relpath,
                                     svn_relpath_dirname(actual->local_relpath,
@@ -1994,7 +1960,7 @@ insert_actual(svn_test__sandbox_t *b,
         }
       else
         {
-          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, 1));
+          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_ACTUAL_ROOT));
           SVN_ERR(svn_sqlite__bindf(stmt, "ss",
                                     actual->local_relpath,
                                     actual->changelist));
@@ -2002,7 +1968,7 @@ insert_actual(svn_test__sandbox_t *b,
       SVN_ERR(svn_sqlite__step_done(stmt));
       if (actual->changelist)
         {
-          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, 3));
+          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_NODES_SET_FILE));
           SVN_ERR(svn_sqlite__bindf(stmt, "s", actual->local_relpath));
           SVN_ERR(svn_sqlite__step_done(stmt));
         }
@@ -2018,10 +1984,6 @@ check_db_actual(svn_test__sandbox_t* b,
 {
   svn_sqlite__db_t *sdb;
   svn_sqlite__stmt_t *stmt;
-  static const char * const statements[] = {
-    "SELECT local_relpath FROM actual_node WHERE wc_id = 1;",
-    NULL,
-  };
   svn_boolean_t have_row;
   apr_hash_t *path_hash = apr_hash_make(b->pool);
 
@@ -2035,9 +1997,9 @@ check_db_actual(svn_test__sandbox_t* b,
       ++rows;
     }
 
-  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, statements, b->pool, b->pool));
+  SVN_ERR(open_wc_db(&sdb, b->wc_abspath, b->pool, b->pool));
 
-  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, 0));
+  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_ALL_ACTUAL));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   while (have_row)
     {
@@ -9266,46 +9228,181 @@ del4_update_edit_AAA(const svn_test_opts
 
   {
     nodes_row_t nodes[] = {
-
-      { 0, "A/A/A",     "normal",    2, "A/A/A", NOT_MOVED,            "key" },
-      { 1, "A/A/A",     "normal",    2, "B/A/A", FALSE, "AAA_1", TRUE, "key" },
-      { 2, "A/A/A",     "normal",    2, "C/A/A", FALSE, "AAA_2", TRUE, "key" },
-      { 3, "A/A/A",     "normal",    2, "D/A/A", FALSE, "AAA_3", TRUE, "key" },
-
-      { 0, "A/A/A/A",   "normal",    2, "A/A/A/A", NOT_MOVED,          "key" },
-      { 1, "A/A/A/A",   "normal",    2, "B/A/A/A", FALSE, NULL, TRUE,  "key" },
-      { 2, "A/A/A/A",   "normal",    2, "C/A/A/A", FALSE, NULL, TRUE,  "key" },
-      { 3, "A/A/A/A",   "normal",    2, "D/A/A/A", FALSE, NULL, TRUE,  "key" },
+      {0, "",                 "normal",       2, ""},
+      {0, "A",                "normal",       2, "A"},
+      {0, "A/A",              "normal",       2, "A/A"},
+      {0, "A/A/A",            "normal",       2, "A/A/A", NOT_MOVED, "key"},
+      {0, "A/A/A/A",          "normal",       2, "A/A/A/A", NOT_MOVED, "key"},
+      {0, "B",                "normal",       2, "B"},
+      {0, "B/A",              "normal",       2, "B/A"},
+      {0, "B/A/A",            "normal",       2, "B/A/A", NOT_MOVED, "key"},
+      {0, "B/A/A/A",          "normal",       2, "B/A/A/A", NOT_MOVED, "key"},
+      {0, "C",                "normal",       2, "C"},
+      {0, "C/A",              "normal",       2, "C/A"},
+      {0, "C/A/A",            "normal",       2, "C/A/A", NOT_MOVED, "key"},
+      {0, "C/A/A/A",          "normal",       2, "C/A/A/A", NOT_MOVED, "key"},
+      {0, "D",                "normal",       2, "D"},
+      {0, "D/A",              "normal",       2, "D/A"},
+      {0, "D/A/A",            "normal",       2, "D/A/A", NOT_MOVED, "key"},
+      {0, "D/A/A/A",          "normal",       2, "D/A/A/A", NOT_MOVED, "key"},
+
+      {1, "A",                "normal",       2, "B", MOVED_HERE},
+      {1, "A/A",              "normal",       2, "B/A", MOVED_HERE},
+      {1, "A/A/A",            "normal",       2, "B/A/A", FALSE, "AAA_1", TRUE, "key"},
+      {1, "A/A/A/A",          "normal",       2, "B/A/A/A", FALSE, NULL, TRUE, "key"},
+      {1, "AAA_1",            "normal",       2, "A/A/A", MOVED_HERE, "key"},
+      {1, "AAA_1/A",          "normal",       2, "A/A/A/A", MOVED_HERE, "key"},
+      {1, "AAA_2",            "normal",       2, "B/A/A", MOVED_HERE, "key"},
+      {1, "AAA_2/A",          "normal",       2, "B/A/A/A", MOVED_HERE, "key"},
+      {1, "AAA_3",            "normal",       2, "C/A/A", MOVED_HERE, "key"},
+      {1, "AAA_3/A",          "normal",       2, "C/A/A/A", MOVED_HERE, "key"},
+      {1, "B",                "base-deleted", NO_COPY_FROM, "A"},
+      {1, "B/A",              "base-deleted", NO_COPY_FROM},
+      {1, "B/A/A",            "base-deleted", NO_COPY_FROM},
+      {1, "B/A/A/A",          "base-deleted", NO_COPY_FROM},
+
+      {2, "A/A",              "normal",       2, "C/A", MOVED_HERE},
+      {2, "A/A/A",            "normal",       2, "C/A/A", FALSE, "AAA_2", TRUE, "key"},
+      {2, "A/A/A/A",          "normal",       2, "C/A/A/A", FALSE, NULL, TRUE,  "key"},
+      {2, "C/A",              "base-deleted", NO_COPY_FROM, "A/A"},
+      {2, "C/A/A",            "base-deleted", NO_COPY_FROM},
+      {2, "C/A/A/A",          "base-deleted", NO_COPY_FROM},
+
+      {3, "A/A/A",            "normal",       2, "D/A/A", FALSE, "AAA_3", TRUE, "key"},
+      {3, "A/A/A/A",          "normal",       2, "D/A/A/A", FALSE, NULL, TRUE,  "key"},
+      {3, "D/A/A",            "base-deleted", NO_COPY_FROM, "A/A/A"},
+      {3, "D/A/A/A",          "base-deleted", NO_COPY_FROM},
 
       { 0 },
     };
 
-    SVN_ERR(check_db_rows(&b, "A/A/A", nodes));
+    SVN_ERR(check_db_rows(&b, "", nodes));
+    SVN_ERR(check_db_conflicts(&b, "", NULL));
   }
 
   /* Go back to start position */
   SVN_ERR(sbox_wc_update(&b, "", 1));
   SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+
+  {
+    nodes_row_t nodes[] = {
+      {0, "",                 "normal",       1, ""},
+      {0, "A",                "normal",       1, "A"},
+      {0, "A/A",              "normal",       1, "A/A"},
+      {0, "A/A/A",            "normal",       1, "A/A/A", NOT_MOVED},
+      {0, "A/A/A/A",          "normal",       1, "A/A/A/A", NOT_MOVED},
+      {0, "B",                "normal",       1, "B"},
+      {0, "B/A",              "normal",       1, "B/A"},
+      {0, "B/A/A",            "normal",       1, "B/A/A", NOT_MOVED},
+      {0, "B/A/A/A",          "normal",       1, "B/A/A/A", NOT_MOVED},
+      {0, "C",                "normal",       1, "C"},
+      {0, "C/A",              "normal",       1, "C/A"},
+      {0, "C/A/A",            "normal",       1, "C/A/A", NOT_MOVED},
+      {0, "C/A/A/A",          "normal",       1, "C/A/A/A", NOT_MOVED},
+      {0, "D",                "normal",       1, "D"},
+      {0, "D/A",              "normal",       1, "D/A"},
+      {0, "D/A/A",            "normal",       1, "D/A/A", NOT_MOVED},
+      {0, "D/A/A/A",          "normal",       1, "D/A/A/A", NOT_MOVED},
+
+      {1, "A",                "normal",       1, "B", MOVED_HERE},
+      {1, "A/A",              "normal",       1, "B/A", MOVED_HERE},
+      {1, "A/A/A",            "normal",       1, "B/A/A", FALSE, "AAA_1", TRUE},
+      {1, "A/A/A/A",          "normal",       1, "B/A/A/A", FALSE, NULL, TRUE},
+      {1, "AAA_1",            "normal",       1, "A/A/A", MOVED_HERE},
+      {1, "AAA_1/A",          "normal",       1, "A/A/A/A", MOVED_HERE},
+      {1, "AAA_2",            "normal",       1, "B/A/A", MOVED_HERE},
+      {1, "AAA_2/A",          "normal",       1, "B/A/A/A", MOVED_HERE},
+      {1, "AAA_3",            "normal",       1, "C/A/A", MOVED_HERE},
+      {1, "AAA_3/A",          "normal",       1, "C/A/A/A", MOVED_HERE},
+      {1, "B",                "base-deleted", NO_COPY_FROM, "A"},
+      {1, "B/A",              "base-deleted", NO_COPY_FROM},
+      {1, "B/A/A",            "base-deleted", NO_COPY_FROM},
+      {1, "B/A/A/A",          "base-deleted", NO_COPY_FROM},
+
+      {2, "A/A",              "normal",       1, "C/A", MOVED_HERE},
+      {2, "A/A/A",            "normal",       1, "C/A/A", FALSE, "AAA_2", TRUE},
+      {2, "A/A/A/A",          "normal",       1, "C/A/A/A", FALSE, NULL, TRUE},
+      {2, "C/A",              "base-deleted", NO_COPY_FROM, "A/A"},
+      {2, "C/A/A",            "base-deleted", NO_COPY_FROM},
+      {2, "C/A/A/A",          "base-deleted", NO_COPY_FROM},
+
+      {3, "A/A/A",            "normal",       1, "D/A/A", FALSE, "AAA_3", TRUE},
+      {3, "A/A/A/A",          "normal",       1, "D/A/A/A", FALSE, NULL, TRUE},
+      {3, "D/A/A",            "base-deleted", NO_COPY_FROM, "A/A/A"},
+      {3, "D/A/A/A",          "base-deleted", NO_COPY_FROM},
+
+      { 0 },
+    };
+
+    SVN_ERR(check_db_rows(&b, "", nodes));
+    SVN_ERR(check_db_conflicts(&b, "", NULL));
+  }
+
   /* Update and resolve via their strategy */
   SVN_ERR(sbox_wc_update(&b, "", 2));
+  {
+    conflict_info_t conflicts[] = {
+      {"A", FALSE, FALSE, TRUE},
+      {"B", FALSE, FALSE, TRUE},
+      {"C/A", FALSE, FALSE, TRUE},
+      {"D/A/A", FALSE, FALSE, TRUE},
+
+      {0},
+    };
+
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+  /* This breaks the move from D/A/A -> A/A/A */
   SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_merged));
 
   {
     nodes_row_t nodes[] = {
-
-      { 0, "A/A/A",     "normal",    2, "A/A/A", NOT_MOVED, "key" },
-      { 1, "A/A/A",     "normal",    1, "B/A/A", FALSE, "AAA_1" },
-      { 2, "A/A/A",     "normal",    1, "C/A/A", FALSE, "AAA_2" },
-      { 3, "A/A/A",     "normal",    1, "D/A/A", FALSE, "AAA_3" },
-
-      { 0, "A/A/A/A",   "normal",    2, "A/A/A/A", NOT_MOVED, "key" },
-      { 1, "A/A/A/A",   "normal",    1, "B/A/A/A" },
-      { 2, "A/A/A/A",   "normal",    1, "C/A/A/A" },
-      { 3, "A/A/A/A",   "normal",    1, "D/A/A/A" },
+      {0, "",          "normal",       2, ""},
+      {0, "A",         "normal",       2, "A"},
+      {0, "A/A",       "normal",       2, "A/A"},
+      {0, "A/A/A",     "normal",       2, "A/A/A", NOT_MOVED, "key"},
+      {0, "A/A/A/A",   "normal",       2, "A/A/A/A", NOT_MOVED, "key"},
+      {0, "B",         "normal",       2, "B"},
+      {0, "B/A",       "normal",       2, "B/A"},
+      {0, "B/A/A",     "normal",       2, "B/A/A", NOT_MOVED, "key"},
+      {0, "B/A/A/A",   "normal",       2, "B/A/A/A", NOT_MOVED, "key"},
+      {0, "C",         "normal",       2, "C"},
+      {0, "C/A",       "normal",       2, "C/A"},
+      {0, "C/A/A",     "normal",       2, "C/A/A", NOT_MOVED, "key"},
+      {0, "C/A/A/A",   "normal",       2, "C/A/A/A", NOT_MOVED, "key"},
+      {0, "D",         "normal",       2, "D"},
+      {0, "D/A",       "normal",       2, "D/A"},
+      {0, "D/A/A",     "normal",       2, "D/A/A", NOT_MOVED, "key"},
+      {0, "D/A/A/A",   "normal",       2, "D/A/A/A", NOT_MOVED, "key"},
+      {1, "A",         "normal",       1, "B"},
+      {1, "A/A",       "normal",       1, "B/A"},
+      {1, "A/A/A",     "normal",       1, "B/A/A", FALSE, "AAA_1"},
+      {1, "A/A/A/A",   "normal",       1, "B/A/A/A"},
+      {1, "AAA_1",     "normal",       1, "A/A/A", MOVED_HERE},
+      {1, "AAA_1/A",   "normal",       1, "A/A/A/A", MOVED_HERE},
+      {1, "AAA_2",     "normal",       1, "B/A/A"},
+      {1, "AAA_2/A",   "normal",       1, "B/A/A/A"},
+      {1, "AAA_3",     "normal",       1, "C/A/A", MOVED_HERE},
+      {1, "AAA_3/A",   "normal",       1, "C/A/A/A", MOVED_HERE},
+      {1, "B",         "base-deleted", NO_COPY_FROM},
+      {1, "B/A",       "base-deleted", NO_COPY_FROM},
+      {1, "B/A/A",     "base-deleted", NO_COPY_FROM},
+      {1, "B/A/A/A",   "base-deleted", NO_COPY_FROM},
+      {2, "A/A",       "normal",       1, "C/A"},
+      {2, "A/A/A",     "normal",       1, "C/A/A"},
+      {2, "A/A/A/A",   "normal",       1, "C/A/A/A"},
+      {2, "C/A",       "base-deleted", NO_COPY_FROM},
+      {2, "C/A/A",     "base-deleted", NO_COPY_FROM},
+      {2, "C/A/A/A",   "base-deleted", NO_COPY_FROM},
+      {3, "A/A/A",     "normal",       1, "D/A/A", FALSE, "AAA_3"},
+      {3, "A/A/A/A",   "normal",       1, "D/A/A/A"},
+      {3, "D/A/A",     "base-deleted", NO_COPY_FROM},
+      {3, "D/A/A/A",   "base-deleted", NO_COPY_FROM},
 
       { 0 },
     };
-      SVN_ERR(check_db_rows(&b, "A/A/A", nodes));
+
+    SVN_ERR(check_db_rows(&b, "", nodes));
   }
 
 
@@ -9550,7 +9647,7 @@ move4_update_edit_AAA(const svn_test_opt
         { 0, "A/A/A",     "normal",       2, "A/A/A", NOT_MOVED, "key" },
         { 1, "A/A/A",     "normal",       1, "B/A/A" },
         { 2, "A/A/A",     "normal",       1, "C/A/A" },
-        { 3, "A/A/A",     "normal",       1, "D/A/A" },
+        { 3, "A/A/A",     "normal",       1, "D/A/A", FALSE, "AAA_3"},
 
         { 0, "A/A/A/A",   "normal",       2, "A/A/A/A", NOT_MOVED, "key" },
         { 1, "A/A/A/A",   "normal",       1, "B/A/A/A" },
@@ -9559,7 +9656,8 @@ move4_update_edit_AAA(const svn_test_opt
 
         { 0 },
       };
-        SVN_ERR(check_db_rows(&b, "A/A/A", nodes));
+
+      SVN_ERR(check_db_rows(&b, "A/A/A", nodes));
     }
 
     return SVN_NO_ERROR;
@@ -10481,6 +10579,108 @@ move_within_mixed_move(const svn_test_op
 
   return SVN_NO_ERROR;
 }
+
+static svn_error_t *
+move_edit_obstruction(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t b;
+
+  SVN_ERR(svn_test__sandbox_create(&b, "move_edit_obstruction", opts, pool));
+
+  SVN_ERR(sbox_add_and_commit_greek_tree(&b));
+
+  SVN_ERR(sbox_file_write(&b, "A/B/E/alpha", "Update alpha"));
+  SVN_ERR(sbox_wc_propset(&b, "a", "b", "A/B/F"));
+  SVN_ERR(sbox_wc_commit(&b, "")); /* r2 */
+
+  SVN_ERR(sbox_wc_update(&b, "", 1));
+
+  /* Simple move */
+  SVN_ERR(sbox_wc_move(&b, "A", "A_mv"));
+  SVN_ERR(sbox_wc_update(&b, "", 2));
+  SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
+                          svn_wc_conflict_choose_mine_conflict));
+
+  {
+    nodes_row_t nodes[] = {
+      {1, "A_mv",             "normal",       2, "A", MOVED_HERE},
+      {1, "A_mv/B",           "normal",       2, "A/B", MOVED_HERE},
+      {1, "A_mv/B/E",         "normal",       2, "A/B/E", MOVED_HERE},
+      {1, "A_mv/B/E/alpha",   "normal",       2, "A/B/E/alpha", MOVED_HERE},
+      {1, "A_mv/B/E/beta",    "normal",       2, "A/B/E/beta", MOVED_HERE},
+      {1, "A_mv/B/F",         "normal",       2, "A/B/F", MOVED_HERE, "a"},
+      {1, "A_mv/B/lambda",    "normal",       2, "A/B/lambda", MOVED_HERE},
+      {1, "A_mv/C",           "normal",       2, "A/C", MOVED_HERE},
+      {1, "A_mv/D",           "normal",       2, "A/D", MOVED_HERE},
+      {1, "A_mv/D/G",         "normal",       2, "A/D/G", MOVED_HERE},
+      {1, "A_mv/D/G/pi",      "normal",       2, "A/D/G/pi", MOVED_HERE},
+      {1, "A_mv/D/G/rho",     "normal",       2, "A/D/G/rho", MOVED_HERE},
+      {1, "A_mv/D/G/tau",     "normal",       2, "A/D/G/tau", MOVED_HERE},
+      {1, "A_mv/D/gamma",     "normal",       2, "A/D/gamma", MOVED_HERE},
+      {1, "A_mv/D/H",         "normal",       2, "A/D/H", MOVED_HERE},
+      {1, "A_mv/D/H/chi",     "normal",       2, "A/D/H/chi", MOVED_HERE},
+      {1, "A_mv/D/H/omega",   "normal",       2, "A/D/H/omega", MOVED_HERE},
+      {1, "A_mv/D/H/psi",     "normal",       2, "A/D/H/psi", MOVED_HERE},
+      {1, "A_mv/mu",          "normal",       2, "A/mu", MOVED_HERE},
+      {0}
+    };
+
+    SVN_ERR(check_db_rows(&b, "A_mv", nodes));
+    SVN_ERR(check_db_conflicts(&b, "", NULL));
+  }
+
+  /* Now do the same thing with local obstructions on the edited nodes */
+  SVN_ERR(sbox_wc_update(&b, "", 1));
+  SVN_ERR(sbox_wc_revert(&b, "", svn_depth_infinity));
+  SVN_ERR(sbox_wc_move(&b, "A", "A_mv"));
+
+  SVN_ERR(svn_io_remove_file2(sbox_wc_path(&b, "A_mv/B/E/alpha"), FALSE, pool));
+  SVN_ERR(svn_io_dir_make(sbox_wc_path(&b, "A_mv/B/E/alpha"), APR_OS_DEFAULT,
+                          pool));
+  SVN_ERR(svn_io_dir_remove_nonrecursive(sbox_wc_path(&b, "A_mv/B/F"), pool));
+  SVN_ERR(sbox_file_write(&b, "A_mv/B/F", "F file"));
+
+  SVN_ERR(sbox_wc_update(&b, "", 2));
+  SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
+                          svn_wc_conflict_choose_mine_conflict));
+
+  {
+    nodes_row_t nodes[] = {
+      {1, "A_mv",             "normal",       2, "A", MOVED_HERE},
+      {1, "A_mv/B",           "normal",       2, "A/B", MOVED_HERE},
+      {1, "A_mv/B/E",         "normal",       2, "A/B/E", MOVED_HERE},
+      {1, "A_mv/B/E/alpha",   "normal",       2, "A/B/E/alpha", MOVED_HERE},
+      {1, "A_mv/B/E/beta",    "normal",       2, "A/B/E/beta", MOVED_HERE},
+      {1, "A_mv/B/F",         "normal",       2, "A/B/F", MOVED_HERE, "a"},
+      {1, "A_mv/B/lambda",    "normal",       2, "A/B/lambda", MOVED_HERE},
+      {1, "A_mv/C",           "normal",       2, "A/C", MOVED_HERE},
+      {1, "A_mv/D",           "normal",       2, "A/D", MOVED_HERE},
+      {1, "A_mv/D/G",         "normal",       2, "A/D/G", MOVED_HERE},
+      {1, "A_mv/D/G/pi",      "normal",       2, "A/D/G/pi", MOVED_HERE},
+      {1, "A_mv/D/G/rho",     "normal",       2, "A/D/G/rho", MOVED_HERE},
+      {1, "A_mv/D/G/tau",     "normal",       2, "A/D/G/tau", MOVED_HERE},
+      {1, "A_mv/D/gamma",     "normal",       2, "A/D/gamma", MOVED_HERE},
+      {1, "A_mv/D/H",         "normal",       2, "A/D/H", MOVED_HERE},
+      {1, "A_mv/D/H/chi",     "normal",       2, "A/D/H/chi", MOVED_HERE},
+      {1, "A_mv/D/H/omega",   "normal",       2, "A/D/H/omega", MOVED_HERE},
+      {1, "A_mv/D/H/psi",     "normal",       2, "A/D/H/psi", MOVED_HERE},
+      {1, "A_mv/mu",          "normal",       2, "A/mu", MOVED_HERE},
+      {0}
+    };
+    conflict_info_t conflicts[] = {
+      { "A_mv/B/E/alpha", FALSE, FALSE, TRUE },
+      { "A_mv/B/F", FALSE, FALSE, TRUE },
+
+      {0}
+    };
+
+    SVN_ERR(check_db_rows(&b, "A_mv", nodes));
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+
+  return SVN_NO_ERROR;
+}
+
 /* ---------------------------------------------------------------------- */
 /* The list of test functions */
 
@@ -10656,7 +10856,7 @@ static struct svn_test_descriptor_t test
                        "del4: delete AAA"),
     SVN_TEST_OPTS_PASS(del4_update_add_AAA,
                        "del4: add AAA"),
-    SVN_TEST_OPTS_XFAIL(del4_update_replace_AAA,
+    SVN_TEST_OPTS_PASS(del4_update_replace_AAA,
                        "del4: replace AAA"),
     SVN_TEST_OPTS_PASS(del4_update_delself_AAA,
                        "del4: delete self AAA"),
@@ -10668,7 +10868,7 @@ static struct svn_test_descriptor_t test
                        "move4: delete AAA"),
     SVN_TEST_OPTS_PASS(move4_update_add_AAA,
                        "move4: add AAA"),
-    SVN_TEST_OPTS_XFAIL(move4_update_replace_AAA,
+    SVN_TEST_OPTS_PASS(move4_update_replace_AAA,
                        "move4: replace AAA"),
     SVN_TEST_OPTS_PASS(move4_update_delself_AAA,
                        "move4: delete self AAA"),
@@ -10686,6 +10886,8 @@ static struct svn_test_descriptor_t test
                        "nested move delete"),
     SVN_TEST_OPTS_XFAIL(move_within_mixed_move,
                         "move within mixed move"),
+    SVN_TEST_OPTS_PASS(move_edit_obstruction,
+                       "move edit obstruction"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/pin-externals/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/tests/svn_test_main.c?rev=1658686&r1=1658685&r2=1658686&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/tests/svn_test_main.c (original)
+++ subversion/branches/pin-externals/subversion/tests/svn_test_main.c Tue Feb 10 11:41:57
2015
@@ -695,13 +695,27 @@ svn_error_t *
 svn_test__init_auth_baton(svn_auth_baton_t **ab,
                           apr_pool_t *result_pool)
 {
+  svn_config_t *cfg_config;
+
+  SVN_ERR(svn_config_create2(&cfg_config, FALSE, FALSE, result_pool));
+
+  /* Disable the crypto backends that might not be entirely
+     threadsafe and/or compatible with running headless.
+
+     The windows system is just our own files, but then with user-key
+     encrypted data inside. */
+  svn_config_set(cfg_config,
+                 SVN_CONFIG_SECTION_AUTH,
+                 SVN_CONFIG_OPTION_PASSWORD_STORES,
+                 "windows-cryptoapi");
+
   SVN_ERR(svn_cmdline_create_auth_baton(ab,
                                         TRUE  /* non_interactive */,
                                         "jrandom", "rayjandom",
                                         NULL,
                                         TRUE  /* no_auth_cache */,
                                         FALSE /* trust_server_cert */,
-                                        NULL, NULL, NULL, result_pool));
+                                        cfg_config, NULL, NULL, result_pool));
 
   return SVN_NO_ERROR;
 }



Mime
View raw message