Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_client/export.c view on Meta::CPAN
from_path_or_url, NULL,
peg_revision,
revision, ctx, pool));
SVN_ERR(svn_ra_get_repos_root2(ra_session, &eb->repos_root_url, pool));
eb->root_path = to_path;
eb->root_url = loc->url;
eb->force = overwrite;
eb->target_revision = &edit_revision;
eb->externals = apr_hash_make(pool);
eb->native_eol = native_eol;
eb->ignore_keywords = ignore_keywords;
eb->cancel_func = ctx->cancel_func;
eb->cancel_baton = ctx->cancel_baton;
eb->notify_func = ctx->notify_func2;
eb->notify_baton = ctx->notify_baton2;
SVN_ERR(svn_ra_check_path(ra_session, "", loc->rev, &kind, pool));
if (kind == svn_node_file)
{
if (!ENABLE_EV2_IMPL)
SVN_ERR(export_file(from_path_or_url, to_path, eb, loc, ra_session,
overwrite, pool));
else
SVN_ERR(export_file_ev2(from_path_or_url, to_path, eb, loc,
ra_session, overwrite, pool));
}
else if (kind == svn_node_dir)
{
SVN_ERR(export_directory(from_path_or_url, to_path,
eb, loc, ra_session, overwrite,
ignore_externals, ignore_keywords, depth,
native_eol, ctx, pool));
}
else if (kind == svn_node_none)
{
return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
_("URL '%s' doesn't exist"),
from_path_or_url);
}
/* kind == svn_node_unknown not handled */
}
else
{
struct export_info_baton eib;
svn_node_kind_t kind;
apr_hash_t *externals = NULL;
/* This is a working copy export. */
/* just copy the contents of the working copy into the target path. */
SVN_ERR(svn_dirent_get_absolute(&from_path_or_url, from_path_or_url,
pool));
SVN_ERR(svn_dirent_get_absolute(&to_path, to_path, pool));
SVN_ERR(svn_io_check_path(from_path_or_url, &kind, pool));
/* ### [JAF] If something already exists on disk at the destination path,
* the behaviour depends on the node kinds of the source and destination
* and on the FORCE flag. The intention (I guess) is to follow the
* semantics of svn_client_export5(), semantics that are not fully
* documented but would be something like:
*
* -----------+---------------------------------------------------------
* Src | DIR FILE SPECIAL
* Dst (disk) +---------------------------------------------------------
* NONE | simple copy simple copy (as src=file?)
* DIR | merge if forced [2] inside if root [1] (as src=file?)
* FILE | err overwr if forced[3] (as src=file?)
* SPECIAL | ??? ??? ???
* -----------+---------------------------------------------------------
*
* [1] FILE onto DIR case: If this file is the root of the copy and thus
* the only node to be copied, then copy it as a child of the
* directory TO, applying these same rules again except that if this
* case occurs again (the child path is already a directory) then
* error out. If this file is not the root of the copy (it is
* reached by recursion), then error out.
*
* [2] DIR onto DIR case. If the 'FORCE' flag is true then copy the
* source's children inside the target dir, else error out. When
* copying the children, apply the same set of rules, except in the
* FILE onto DIR case error out like in note [1].
*
* [3] If the 'FORCE' flag is true then overwrite the destination file
* else error out.
*
* The reality (apparently, looking at the code) is somewhat different.
* For a start, to detect the source kind, it looks at what is on disk
* rather than the versioned working or base node.
*/
if (kind == svn_node_file)
SVN_ERR(append_basename_if_dir(&to_path, from_path_or_url, FALSE,
pool));
eib.to_path = to_path;
eib.revision = revision;
eib.overwrite = overwrite;
eib.ignore_keywords = ignore_keywords;
eib.wc_ctx = ctx->wc_ctx;
eib.native_eol = native_eol;
eib.notify_func = ctx->notify_func2;;
eib.notify_baton = ctx->notify_baton2;
eib.origin_abspath = from_path_or_url;
eib.exported = FALSE;
SVN_ERR(svn_wc_walk_status(ctx->wc_ctx, from_path_or_url, depth,
TRUE /* get_all */,
TRUE /* no_ignore */,
FALSE /* ignore_text_mods */,
NULL,
export_node, &eib,
ctx->cancel_func, ctx->cancel_baton,
pool));
if (!eib.exported)
return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
_("The node '%s' was not found."),
svn_dirent_local_style(from_path_or_url,
pool));
( run in 0.936 second using v1.01-cache-2.11-cpan-63c85eba8c4 )