Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_client/export.c view on Meta::CPAN
{
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));
if (!ignore_externals)
SVN_ERR(svn_wc__externals_defined_below(&externals, ctx->wc_ctx,
from_path_or_url,
pool, pool));
if (externals && apr_hash_count(externals))
{
apr_pool_t *iterpool = svn_pool_create(pool);
apr_hash_index_t *hi;
for (hi = apr_hash_first(pool, externals);
hi;
hi = apr_hash_next(hi))
{
const char *external_abspath = svn__apr_hash_index_key(hi);
const char *relpath;
const char *target_abspath;
svn_pool_clear(iterpool);
relpath = svn_dirent_skip_ancestor(from_path_or_url,
external_abspath);
target_abspath = svn_dirent_join(to_path, relpath,
iterpool);
/* Ensure that the parent directory exists */
SVN_ERR(svn_io_make_dir_recursively(
( run in 1.424 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )