You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/12/13 18:59:42 UTC
svn commit: r1550783 - in /subversion/trunk: build.conf
subversion/libsvn_client/mtcc.c subversion/tests/libsvn_client/mtcc-test.c
Author: rhuijben
Date: Fri Dec 13 17:59:42 2013
New Revision: 1550783
URL: http://svn.apache.org/r1550783
Log:
Following up on r1550765, don't pull in the working copy support to test
svnmucc like operations. Use more of the new api instead.
* build.conf
(mtcc-test): Remove dependency. This fixes the Windows shared library build.
* subversion/libsvn_client/mtcc.c
(commit_directory): Add session url argument and use it to construct full
urls to copy from.
(svn_client_mtcc_commit): Update caller.
* subversion/tests/libsvn_client/mtcc-test.c
(includes): Remove libsvn_wc/utils.h.
(verify_mtcc_commit): New helper function.
(create_greek_repos): Remove copy&pasted function.
(make_greek_tree): New function.
(test_mkdir): Don't create a wc sandbox. Use a few other names.
(test_mkgreek): New test.
(test_funcs): Add test_mkgreek.
Modified:
subversion/trunk/build.conf
subversion/trunk/subversion/libsvn_client/mtcc.c
subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c
Modified: subversion/trunk/build.conf
URL: http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1550783&r1=1550782&r2=1550783&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Fri Dec 13 17:59:42 2013
@@ -1130,7 +1130,7 @@ msvc-force-static = yes
description = Test Multi Command Context
type = exe
path = subversion/tests/libsvn_client
-sources = mtcc-test.c ../libsvn_wc/utils.c
+sources = mtcc-test.c
install = test
libs = libsvn_test libsvn_client libsvn_wc libsvn_repos libsvn_ra libsvn_fs libsvn_delta libsvn_subr apriconv apr
Modified: subversion/trunk/subversion/libsvn_client/mtcc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mtcc.c?rev=1550783&r1=1550782&r2=1550783&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mtcc.c (original)
+++ subversion/trunk/subversion/libsvn_client/mtcc.c Fri Dec 13 17:59:42 2013
@@ -597,6 +597,7 @@ commit_directory(const svn_delta_editor_
const char *relpath,
svn_revnum_t base_rev,
void *dir_baton,
+ const char *session_url,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
@@ -628,23 +629,35 @@ commit_directory(const svn_delta_editor_
case OP_ADD_DIR:
SVN_ERR(editor->add_directory(child_relpath, dir_baton,
- cop->src_relpath, cop->src_rev,
+ cop->src_relpath
+ ? svn_path_url_add_component2(
+ session_url,
+ cop->src_relpath,
+ iterpool)
+ : NULL,
+ cop->src_rev,
iterpool, &child_baton));
SVN_ERR(commit_directory(editor, cop, child_relpath,
- SVN_INVALID_REVNUM, child_baton, ctx,
- iterpool));
+ SVN_INVALID_REVNUM, child_baton,
+ session_url, ctx, iterpool));
break;
case OP_OPEN_DIR:
SVN_ERR(editor->open_directory(child_relpath, dir_baton,
base_rev, iterpool, &child_baton));
SVN_ERR(commit_directory(editor, cop, child_relpath,
- SVN_INVALID_REVNUM, child_baton, ctx,
- iterpool));
+ base_rev, child_baton,
+ session_url, ctx, iterpool));
break;
case OP_ADD_FILE:
SVN_ERR(editor->add_file(child_relpath, dir_baton,
- cop->src_relpath, cop->src_rev,
+ cop->src_relpath
+ ? svn_path_url_add_component2(
+ session_url,
+ cop->src_relpath,
+ iterpool)
+ : NULL,
+ cop->src_rev,
iterpool, &child_baton));
SVN_ERR(commit_file(editor, cop, child_baton, ctx, iterpool));
break;
@@ -674,6 +687,9 @@ svn_client_mtcc_commit(apr_hash_t *revpr
void *edit_baton;
svn_error_t *err;
void *root_baton;
+ const char *session_url;
+
+ SVN_ERR(svn_ra_get_session_url(mtcc->ra_session, &session_url, scratch_pool));
SVN_ERR(svn_ra_get_commit_editor3(mtcc->ra_session, &editor, &edit_baton,
revprop_table,
@@ -686,7 +702,7 @@ svn_client_mtcc_commit(apr_hash_t *revpr
if (!err)
err = commit_directory(editor, mtcc->root_op, "", mtcc->base_revision,
- root_baton, mtcc->ctx, scratch_pool);
+ root_baton, session_url, mtcc->ctx, scratch_pool);
if (!err)
SVN_ERR(editor->close_edit(edit_baton, scratch_pool));
Modified: subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c?rev=1550783&r1=1550782&r2=1550783&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c Fri Dec 13 17:59:42 2013
@@ -32,40 +32,58 @@
#include "../svn_test.h"
#include "../svn_test_fs.h"
-#include "../libsvn_wc/utils.h"
-
-/* Create a repository with a filesystem based on OPTS in a subdir NAME,
- * commit the standard Greek tree as revision 1, and set *REPOS_URL to
- * the URL we will use to access it.
- *
- * ### This always returns a file: URL. We should upgrade this to use the
- * test suite's specified URL scheme instead. */
static svn_error_t *
-create_greek_repos(const char **repos_url,
- const char *name,
- const svn_test_opts_t *opts,
+verify_mtcc_commit(svn_client_mtcc_t *mtcc,
apr_pool_t *pool)
{
- svn_repos_t *repos;
- svn_revnum_t committed_rev;
- svn_fs_txn_t *txn;
- svn_fs_root_t *txn_root;
-
- /* Create a filesytem and repository. */
- SVN_ERR(svn_test__create_repos(
- &repos, svn_test_data_path(name, pool), opts, pool));
-
- /* Prepare and commit a txn containing the Greek tree. */
- SVN_ERR(svn_fs_begin_txn2(&txn, svn_repos_fs(repos), 0 /* rev */,
- 0 /* flags */, pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
- SVN_ERR(svn_test__create_greek_tree(txn_root, pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &committed_rev, txn, pool));
- SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(committed_rev));
+ /* TODO: Verify actual commit, etc. */
+ SVN_ERR(svn_client_mtcc_commit(apr_hash_make(pool), NULL, NULL, mtcc, pool));
- SVN_ERR(svn_uri_get_file_url_from_dirent(
- repos_url, svn_test_data_path(name, pool), pool));
+ return SVN_NO_ERROR;
+};
+
+
+/* Constructs a greek tree as revision 1 in the repository at repos_url */
+static svn_error_t *
+make_greek_tree(const char *repos_url,
+ apr_pool_t *scratch_pool)
+{
+ svn_client_mtcc_t *mtcc;
+ svn_client_ctx_t *ctx;
+ apr_pool_t *subpool;
+ int i;
+
+ subpool = svn_pool_create(scratch_pool);
+
+ SVN_ERR(svn_client_create_context2(&ctx, NULL, subpool));
+ SVN_ERR(svn_client_mtcc_create(&mtcc, repos_url, 1, ctx, subpool, subpool));
+
+ for (i = 0; svn_test__greek_tree_nodes[i].path; i++)
+ {
+ if (svn_test__greek_tree_nodes[i].contents)
+ {
+ SVN_ERR(svn_client_mtcc_add_add_file(
+ svn_test__greek_tree_nodes[i].path,
+ svn_stream_from_string(
+ svn_string_create(
+ svn_test__greek_tree_nodes[i].contents,
+ subpool),
+ subpool),
+ NULL /* src_checksum */,
+ mtcc, subpool));
+ }
+ else
+ {
+ SVN_ERR(svn_client_mtcc_add_mkdir(
+ svn_test__greek_tree_nodes[i].path,
+ mtcc, subpool));
+ }
+ }
+
+ SVN_ERR(verify_mtcc_commit(mtcc, subpool));
+
+ svn_pool_clear(subpool);
return SVN_NO_ERROR;
}
@@ -73,26 +91,60 @@ static svn_error_t *
test_mkdir(const svn_test_opts_t *opts,
apr_pool_t *pool)
{
- svn_test__sandbox_t b;
svn_client_mtcc_t *mtcc;
svn_client_ctx_t *ctx;
-
- SVN_ERR(svn_test__sandbox_create(&b, "mtcc-mkdir", opts, pool));
+ const char *repos_abspath;
+ const char *repos_url;
+ svn_repos_t* repos;
+
+ repos_abspath = svn_test_data_path("mtcc-mkdir", pool);
+ SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
+ SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
+ SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+ SVN_ERR(svn_client_mtcc_create(&mtcc, repos_url, 1, ctx, pool, pool));
- SVN_ERR(svn_client_mtcc_create(&mtcc, b.repos_url, 1, ctx, pool, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("branches", mtcc, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("trunk", mtcc, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("branches/1.x", mtcc, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("tags", mtcc, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("tags/1.0", mtcc, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("tags/1.1", mtcc, pool));
- SVN_ERR(svn_client_mtcc_add_mkdir("A", mtcc, pool));
- SVN_ERR(svn_client_mtcc_add_mkdir("B", mtcc, pool));
- SVN_ERR(svn_client_mtcc_add_mkdir("A/C", mtcc, pool));
- SVN_ERR(svn_client_mtcc_add_mkdir("A/D", mtcc, pool));
+ SVN_ERR(verify_mtcc_commit(mtcc, pool));
- SVN_ERR(svn_client_mtcc_commit(apr_hash_make(pool), NULL, NULL, mtcc, pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_mkgreek(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_client_mtcc_t *mtcc;
+ svn_client_ctx_t *ctx;
+ const char *repos_abspath;
+ const char *repos_url;
+ svn_repos_t* repos;
+
+ repos_abspath = svn_test_data_path("mtcc-mkgreek", pool);
+ SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
+ SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
+ SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
+
+ SVN_ERR(make_greek_tree(repos_url, pool));
+
+ SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+ SVN_ERR(svn_client_mtcc_create(&mtcc, repos_url, 2, ctx, pool, pool));
+
+ SVN_ERR(svn_client_mtcc_add_copy("A", 1, "greek_A", mtcc, pool));
+
+ SVN_ERR(verify_mtcc_commit(mtcc, pool));
return SVN_NO_ERROR;
}
+
/* ========================================================================== */
@@ -103,6 +155,8 @@ struct svn_test_descriptor_t test_funcs[
SVN_TEST_NULL,
SVN_TEST_OPTS_PASS(test_mkdir,
"test mtcc mkdir"),
+ SVN_TEST_OPTS_PASS(test_mkgreek,
+ "test making greek tree"),
SVN_TEST_NULL
};