Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_repos/repos.c view on Meta::CPAN
apr_pool_t *pool)
{
svn_repos_t *src_repos;
svn_repos_t *dst_repos;
struct hotcopy_ctx_t hotcopy_context;
svn_error_t *err;
const char *src_abspath;
const char *dst_abspath;
SVN_ERR(svn_dirent_get_absolute(&src_abspath, src_path, pool));
SVN_ERR(svn_dirent_get_absolute(&dst_abspath, dst_path, pool));
if (strcmp(src_abspath, dst_abspath) == 0)
return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
_("Hotcopy source and destination are equal"));
/* Try to open original repository */
SVN_ERR(get_repos(&src_repos, src_abspath,
FALSE, FALSE,
FALSE, /* don't try to open the db yet. */
NULL,
pool));
/* If we are going to clean logs, then get an exclusive lock on
db-logs.lock, to ensure that no one else will work with logs.
If we are just copying, then get a shared lock to ensure that
no one else will clean logs while we copying them */
SVN_ERR(lock_db_logs_file(src_repos, clean_logs, pool));
/* Copy the repository to a new path, with exception of
specially handled directories */
hotcopy_context.dest = dst_abspath;
hotcopy_context.src_len = strlen(src_abspath);
hotcopy_context.incremental = incremental;
hotcopy_context.cancel_func = cancel_func;
hotcopy_context.cancel_baton = cancel_baton;
SVN_ERR(svn_io_dir_walk2(src_abspath,
0,
hotcopy_structure,
&hotcopy_context,
pool));
/* Prepare dst_repos object so that we may create locks,
so that we may open repository */
dst_repos = create_svn_repos_t(dst_abspath, pool);
dst_repos->fs_type = src_repos->fs_type;
dst_repos->format = src_repos->format;
err = create_locks(dst_repos, pool);
if (err)
{
if (incremental && err->apr_err == SVN_ERR_DIR_NOT_EMPTY)
svn_error_clear(err);
else
return svn_error_trace(err);
}
err = svn_io_dir_make_sgid(dst_repos->db_path, APR_OS_DEFAULT, pool);
if (err)
{
if (incremental && APR_STATUS_IS_EEXIST(err->apr_err))
svn_error_clear(err);
else
return svn_error_trace(err);
}
/* Exclusively lock the new repository.
No one should be accessing it at the moment */
SVN_ERR(lock_repos(dst_repos, TRUE, FALSE, pool));
SVN_ERR(svn_fs_hotcopy2(src_repos->db_path, dst_repos->db_path,
clean_logs, incremental,
cancel_func, cancel_baton, pool));
/* Destination repository is ready. Stamp it with a format number. */
return svn_io_write_version_file
(svn_dirent_join(dst_repos->path, SVN_REPOS__FORMAT, pool),
dst_repos->format, pool);
}
svn_error_t *
svn_repos_hotcopy(const char *src_path,
const char *dst_path,
svn_boolean_t clean_logs,
apr_pool_t *pool)
{
return svn_error_trace(svn_repos_hotcopy2(src_path, dst_path, clean_logs,
FALSE, NULL, NULL, pool));
}
/* Return the library version number. */
const svn_version_t *
svn_repos_version(void)
{
SVN_VERSION_BODY;
}
svn_error_t *
svn_repos_stat(svn_dirent_t **dirent,
svn_fs_root_t *root,
const char *path,
apr_pool_t *pool)
{
svn_node_kind_t kind;
svn_dirent_t *ent;
const char *datestring;
apr_hash_t *prophash;
SVN_ERR(svn_fs_check_path(&kind, root, path, pool));
if (kind == svn_node_none)
{
*dirent = NULL;
return SVN_NO_ERROR;
}
( run in 1.315 second using v1.01-cache-2.11-cpan-71847e10f99 )