You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/09/18 10:46:56 UTC
svn commit: r998423 - in /subversion/branches/object-model: BRANCH-README
subversion/bindings/c++/Client.cpp subversion/bindings/c++/include/Client.h
subversion/tests/libsvn++/ subversion/tests/libsvn++/client-test.cpp
Author: hwright
Date: Sat Sep 18 08:46:55 2010
New Revision: 998423
URL: http://svn.apache.org/viewvc?rev=998423&view=rev
Log:
On the object-model branch:
Wrap the client checkout API.
* BRANCH-README:
Mark the client checkout API as done.
* subversion/bindings/c++/Client.cpp
(Client::checkout): A couple of versions of this API.
* subversion/bindings/c++/include/Client.h
(Client::checkout): New.
* subversion/tests/libsvn++/client-test.cpp
(create_gree_repo): Remove prior incarnations of the repos.
(test_cat): Use the new checkout API to get a working copy, and run
another test on cat'ing the working copy.
(test_checkout): New test.
(test_funcs): Run the new test.
* subversion/tests/libsvn++:
Ignore the test working copy.
Modified:
subversion/branches/object-model/BRANCH-README
subversion/branches/object-model/subversion/bindings/c++/Client.cpp
subversion/branches/object-model/subversion/bindings/c++/include/Client.h
subversion/branches/object-model/subversion/tests/libsvn++/ (props changed)
subversion/branches/object-model/subversion/tests/libsvn++/client-test.cpp
Modified: subversion/branches/object-model/BRANCH-README
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/BRANCH-README?rev=998423&r1=998422&r2=998423&view=diff
==============================================================================
--- subversion/branches/object-model/BRANCH-README (original)
+++ subversion/branches/object-model/BRANCH-README Sat Sep 18 08:46:55 2010
@@ -11,7 +11,7 @@ on a branch, without any knowledge of ho
(these were not chosen arbitrarily, they represent all the
non-deprecated APIs in the client library):
* svn_client_version() [DONE]
- * svn_client_checkout3()
+ * svn_client_checkout3() [DONE]
* svn_client_update3()
* svn_client_switch2()
* svn_client_add4()
Modified: subversion/branches/object-model/subversion/bindings/c++/Client.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/bindings/c%2B%2B/Client.cpp?rev=998423&r1=998422&r2=998423&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/bindings/c++/Client.cpp (original)
+++ subversion/branches/object-model/subversion/bindings/c++/Client.cpp Sat Sep 18 08:46:55 2010
@@ -64,4 +64,28 @@ Client::cat(std::ostream &stream, const
revision.revision(), m_ctx, pool.pool()));
}
+Revision
+Client::checkout(const std::string &url, const std::string path)
+{
+ return checkout(url, path, Revision::HEAD, Revision::HEAD,
+ svn_depth_infinity, false, false);
+}
+
+Revision
+Client::checkout(const std::string &url, const std::string path,
+ const Revision &peg_revision, const Revision &revision,
+ svn_depth_t depth, bool ignore_externals,
+ bool allow_unver_obstructions)
+{
+ Pool pool;
+ svn_revnum_t result_rev;
+
+ SVN_CPP_ERR(svn_client_checkout3(&result_rev, url.c_str(), path.c_str(),
+ peg_revision.revision(),
+ revision.revision(), depth,
+ ignore_externals, allow_unver_obstructions,
+ m_ctx, pool.pool()));
+ return Revision::getNumberRev(result_rev);
+}
+
}
Modified: subversion/branches/object-model/subversion/bindings/c++/include/Client.h
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/bindings/c%2B%2B/include/Client.h?rev=998423&r1=998422&r2=998423&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/bindings/c++/include/Client.h (original)
+++ subversion/branches/object-model/subversion/bindings/c++/include/Client.h Sat Sep 18 08:46:55 2010
@@ -56,6 +56,12 @@ namespace SVN
void cat(std::ostream &stream, const std::string &path_or_url);
void cat(std::ostream &stream, const std::string &path_or_url,
const Revision &peg_revision, const Revision &revision);
+
+ Revision checkout(const std::string &url, const std::string path);
+ Revision checkout(const std::string &url, const std::string path,
+ const Revision &peg_revisio, const Revision &revision,
+ svn_depth_t depth, bool ignore_externals,
+ bool allow_unver_obstructions);
};
}
Propchange: subversion/branches/object-model/subversion/tests/libsvn++/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Sep 18 08:46:55 2010
@@ -2,3 +2,4 @@
client-cpp-test
util-cpp-test
test-cpp-client-repos
+test-cpp-client-wc
Modified: subversion/branches/object-model/subversion/tests/libsvn++/client-test.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/tests/libsvn%2B%2B/client-test.cpp?rev=998423&r1=998422&r2=998423&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/tests/libsvn++/client-test.cpp (original)
+++ subversion/branches/object-model/subversion/tests/libsvn++/client-test.cpp Sat Sep 18 08:46:55 2010
@@ -34,7 +34,7 @@ using namespace SVN;
static svn_error_t *
create_greek_repo(svn_repos_t **repos,
- const char *repos_name,
+ const char *repos_path,
const svn_test_opts_t *opts,
apr_pool_t *pool)
{
@@ -43,7 +43,8 @@ create_greek_repo(svn_repos_t **repos,
svn_fs_root_t *txn_root;
svn_revnum_t committed_rev;
- SVN_ERR(svn_test__create_repos(repos, repos_name, opts, pool));
+ SVN_ERR(svn_io_remove_dir2(repos_path, TRUE, NULL, NULL, pool));
+ SVN_ERR(svn_test__create_repos(repos, repos_path, opts, pool));
fs = svn_repos_fs(*repos);
/* Prepare a txn to receive the greek tree. */
@@ -73,7 +74,10 @@ test_cat(const svn_test_opts_t *opts,
Pool pool;
svn_repos_t *repos;
const char *repos_url;
+ const char *wc_path;
+ const char *cwd;
std::string iota_url;
+ std::string iota_path;
SVN_ERR(create_greek_repo(&repos, "test-cpp-client-repos", opts,
pool.pool()));
@@ -87,6 +91,44 @@ test_cat(const svn_test_opts_t *opts,
client.cat(stream, iota_url);
SVN_TEST_ASSERT(stream.str() == "This is the file 'iota'.\n");
+ SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool.pool()));
+ wc_path = svn_dirent_join(cwd, "test-cpp-client-wc", pool.pool());
+ SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool.pool()));
+ client.checkout(repos_url, wc_path);
+
+ iota_path = svn_dirent_join(wc_path, "iota", pool.pool());
+ stream.clear();
+ stream.str("");
+ client.cat(stream, iota_path);
+ SVN_TEST_ASSERT(stream.str() == "This is the file 'iota'.\n");
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_checkout(const svn_test_opts_t *opts,
+ apr_pool_t *ap)
+{
+ Pool pool;
+ svn_repos_t *repos;
+ const char *repos_url;
+ const char *wc_path;
+ const char *cwd;
+
+ SVN_ERR(create_greek_repo(&repos, "test-cpp-client-repos", opts,
+ pool.pool()));
+ SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, "test-cpp-client-repos",
+ pool.pool()));
+
+ Client client;
+
+ SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool.pool()));
+ wc_path = svn_dirent_join(cwd, "test-cpp-client-wc", pool.pool());
+ SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool.pool()));
+ Revision result_rev = client.checkout(repos_url, wc_path);
+
+ SVN_TEST_ASSERT(result_rev.revision()->value.number == 1);
+
return SVN_NO_ERROR;
}
@@ -99,5 +141,7 @@ struct svn_test_descriptor_t test_funcs[
"test get client version"),
SVN_TEST_OPTS_PASS(test_cat,
"test client cat"),
+ SVN_TEST_OPTS_PASS(test_checkout,
+ "test client checkout"),
SVN_TEST_NULL
};