Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_client/list.c view on Meta::CPAN
/* Filter out svn:externals from all properties hash. */
if (prop_hash)
prop_val = svn_hash_gets(prop_hash, SVN_PROP_EXTERNALS);
if (prop_val)
{
const char *url;
SVN_ERR(svn_ra_get_session_url(ra_session, &url, scratch_pool));
svn_hash_sets(externals,
svn_path_url_add_component2(url, dir, result_pool),
svn_string_dup(prop_val, result_pool));
}
if (ctx->cancel_func)
SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
/* Sort the hash, so we can call the callback in a "deterministic" order. */
array = svn_sort__hash(tmpdirents, svn_sort_compare_items_lexically,
scratch_pool);
for (i = 0; i < array->nelts; ++i)
{
svn_sort__item_t *item = &APR_ARRAY_IDX(array, i, svn_sort__item_t);
const char *path;
svn_dirent_t *the_ent = item->value;
svn_lock_t *lock;
svn_pool_clear(iterpool);
path = svn_relpath_join(dir, item->key, iterpool);
if (locks)
{
const char *abs_path = svn_fspath__join(fs_path, path, iterpool);
lock = svn_hash_gets(locks, abs_path);
}
else
lock = NULL;
if (the_ent->kind == svn_node_file
|| depth == svn_depth_immediates
|| depth == svn_depth_infinity)
SVN_ERR(list_func(baton, path, the_ent, lock, fs_path,
external_parent_url, external_target, iterpool));
/* If externals is non-NULL, populate the externals hash table
recursively for all directory entries. */
if (depth == svn_depth_infinity && the_ent->kind == svn_node_dir)
SVN_ERR(get_dir_contents(dirent_fields, path, rev,
ra_session, locks, fs_path, depth, ctx,
externals, external_parent_url,
external_target, list_func, baton,
result_pool, iterpool));
}
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
/* Like svn_ra_stat() but with a compatibility hack for pre-1.2 svnserve. */
/* ### Maybe we should move this behavior into the svn_ra_stat wrapper? */
svn_error_t *
svn_client__ra_stat_compatible(svn_ra_session_t *ra_session,
svn_revnum_t rev,
svn_dirent_t **dirent_p,
apr_uint32_t dirent_fields,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
svn_error_t *err;
err = svn_ra_stat(ra_session, "", rev, dirent_p, pool);
/* svnserve before 1.2 doesn't support the above, so fall back on
a less efficient method. */
if (err && err->apr_err == SVN_ERR_RA_NOT_IMPLEMENTED)
{
const char *repos_root_url;
const char *session_url;
svn_node_kind_t kind;
svn_dirent_t *dirent;
svn_error_clear(err);
SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root_url, pool));
SVN_ERR(svn_ra_get_session_url(ra_session, &session_url, pool));
SVN_ERR(svn_ra_check_path(ra_session, "", rev, &kind, pool));
if (kind != svn_node_none)
{
if (strcmp(session_url, repos_root_url) != 0)
{
svn_ra_session_t *parent_session;
apr_hash_t *parent_ents;
const char *parent_url, *base_name;
apr_pool_t *subpool = svn_pool_create(pool);
/* Open another session to the path's parent. This server
doesn't support svn_ra_reparent anyway, so don't try it. */
svn_uri_split(&parent_url, &base_name, session_url, subpool);
SVN_ERR(svn_client_open_ra_session2(&parent_session, parent_url,
NULL, ctx,
subpool, subpool));
/* Get all parent's entries, no props. */
SVN_ERR(svn_ra_get_dir2(parent_session, &parent_ents, NULL,
NULL, "", rev, dirent_fields, subpool));
/* Get the relevant entry. */
dirent = svn_hash_gets(parent_ents, base_name);
if (dirent)
*dirent_p = svn_dirent_dup(dirent, pool);
else
*dirent_p = NULL;
svn_pool_destroy(subpool); /* Close RA session */
}
else
{
/* We can't get the directory entry for the repository root,
but we can still get the information we want.
The created-rev of the repository root must, by definition,
be rev. */
dirent = apr_palloc(pool, sizeof(*dirent));
dirent->kind = kind;
dirent->size = SVN_INVALID_FILESIZE;
if (dirent_fields & SVN_DIRENT_HAS_PROPS)
{
apr_hash_t *props;
( run in 0.440 second using v1.01-cache-2.11-cpan-39bf76dae61 )