/* 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, 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, name, 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)); SVN_ERR(svn_uri_get_file_url_from_dirent(repos_url, name, pool)); return SVN_NO_ERROR; }
/* Create an empty repository and WC for the test TEST_NAME. Set *REPOS_URL * to the URL of the new repository and *WC_ABSPATH to the root path of the * new WC. * * Create the repository and WC in subdirectories called * REPOSITORIES_WORK_DIR/TEST_NAME and WCS_WORK_DIR/TEST_NAME respectively, * within the current working directory. * * Register the repo and WC to be cleaned up when the test suite exits. */ static svn_error_t * create_repos_and_wc(const char **repos_url, const char **wc_abspath, const char *test_name, const svn_test_opts_t *opts, apr_pool_t *pool) { const char *repos_path = svn_relpath_join(REPOSITORIES_WORK_DIR, test_name, pool); const char *wc_path = svn_relpath_join(WCS_WORK_DIR, test_name, pool); /* Remove the repo and WC dirs if they already exist, to ensure the test * will run even if a previous failed attempt was not cleaned up. */ SVN_ERR(svn_io_remove_dir2(repos_path, TRUE, NULL, NULL, pool)); SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool)); /* Create the parent dirs of the repo and WC if necessary. */ SVN_ERR(svn_io_make_dir_recursively(REPOSITORIES_WORK_DIR, pool)); SVN_ERR(svn_io_make_dir_recursively(WCS_WORK_DIR, pool)); /* Create a repos. Register it for clean-up. Set *REPOS_URL to its path. */ { svn_repos_t *repos; /* Use a subpool to create the repository and then destroy the subpool so the repository's underlying filesystem is closed. If opts->fs_type is BDB this prevents any attempt to open a second environment handle within the same process when we checkout the WC below. BDB 4.4+ allows only a single environment handle to be open per process. */ apr_pool_t *subpool = svn_pool_create(pool); SVN_ERR(svn_test__create_repos(&repos, repos_path, opts, subpool)); SVN_ERR(svn_uri_get_file_url_from_dirent(repos_url, repos_path, pool)); svn_pool_destroy(subpool); } /* Create a WC. Set *WC_ABSPATH to its path. */ { apr_pool_t *subpool = svn_pool_create(pool); /* To cleanup CTX */ svn_client_ctx_t *ctx; svn_opt_revision_t head_rev = { svn_opt_revision_head, {0} }; SVN_ERR(svn_client_create_context(&ctx, subpool)); SVN_ERR(svn_dirent_get_absolute(wc_abspath, wc_path, pool)); SVN_ERR(svn_client_checkout3(NULL, *repos_url, *wc_abspath, &head_rev, &head_rev, svn_depth_infinity, FALSE /* ignore_externals */, FALSE /* allow_unver_obstructions */, ctx, subpool)); svn_pool_destroy(subpool); } /* Register this WC for cleanup. */ svn_test_add_dir_cleanup(*wc_abspath); return SVN_NO_ERROR; }