Author: ivan Date: Mon Nov 4 13:13:54 2013 New Revision: 1538585 URL: http://svn.apache.org/r1538585 Log: Implement svn_repos_fs_type() for easy access to repository filesystem type.
* subversion/include/svn_repos.h * subversion/libsvn_repos/repos.c (svn_repos_fs_type): New. * subversion/tests/libsvn_repos/repos-test.c (test_repos_fs_type): New test for svn_repos_fs_type() function. (test_funcs): Add test_repos_fs_type. Modified: subversion/trunk/subversion/include/svn_repos.h subversion/trunk/subversion/libsvn_repos/repos.c subversion/trunk/subversion/tests/libsvn_repos/repos-test.c Modified: subversion/trunk/subversion/include/svn_repos.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1538585&r1=1538584&r2=1538585&view=diff ============================================================================== --- subversion/trunk/subversion/include/svn_repos.h (original) +++ subversion/trunk/subversion/include/svn_repos.h Mon Nov 4 13:13:54 2013 @@ -558,6 +558,10 @@ svn_repos_capabilities(apr_hash_t **capa svn_fs_t * svn_repos_fs(svn_repos_t *repos); +/** Return the type of filesystem associated with repository object + * @a repos allocated in @a pool. */ +const char * +svn_repos_fs_type(svn_repos_t *repos, apr_pool_t *pool); /** Make a hot copy of the Subversion repository found at @a src_path * to @a dst_path. Modified: subversion/trunk/subversion/libsvn_repos/repos.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.c?rev=1538585&r1=1538584&r2=1538585&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_repos/repos.c (original) +++ subversion/trunk/subversion/libsvn_repos/repos.c Mon Nov 4 13:13:54 2013 @@ -1796,6 +1796,11 @@ svn_repos_fs(svn_repos_t *repos) return repos->fs; } +const char * +svn_repos_fs_type(svn_repos_t *repos, apr_pool_t *pool) +{ + return apr_pstrdup(pool, repos->fs_type); +} /* For historical reasons, for the Berkeley DB backend, this code uses * repository locking, which is motivated by the need to support the Modified: subversion/trunk/subversion/tests/libsvn_repos/repos-test.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_repos/repos-test.c?rev=1538585&r1=1538584&r2=1538585&view=diff ============================================================================== --- subversion/trunk/subversion/tests/libsvn_repos/repos-test.c (original) +++ subversion/trunk/subversion/tests/libsvn_repos/repos-test.c Mon Nov 4 13:13:54 2013 @@ -3521,7 +3521,27 @@ test_config_pool(const svn_test_opts_t * return SVN_NO_ERROR; } - + +static svn_error_t * +test_repos_fs_type(const svn_test_opts_t *opts, + apr_pool_t *pool) +{ + svn_repos_t *repos; + + /* Create test repository. */ + SVN_ERR(svn_test__create_repos(&repos, "test-repo-repos_fs_type", + opts, pool)); + + SVN_TEST_STRING_ASSERT(svn_repos_fs_type(repos, pool), opts->fs_type); + + /* Re-open repository and verify fs-type again. */ + SVN_ERR(svn_repos_open2(&repos, svn_repos_path(repos, pool), NULL, pool)); + + SVN_TEST_STRING_ASSERT(svn_repos_fs_type(repos, pool), opts->fs_type); + + return SVN_NO_ERROR; +} + /* The test table. */ struct svn_test_descriptor_t test_funcs[] = @@ -3571,5 +3591,7 @@ struct svn_test_descriptor_t test_funcs[ "test svn_repos_info_*"), SVN_TEST_OPTS_PASS(test_config_pool, "test svn_repos__config_pool_*"), - SVN_TEST_NULL + SVN_TEST_OPTS_PASS(test_repos_fs_type, + "test test_repos_fs_type"), + SVN_TEST_NULL };