Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_ra/compat.c view on Meta::CPAN
else
return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
_("Missing changed-path information for "
"'%s' in revision %ld"),
svn_dirent_local_style(path, pool), revision);
}
*prev_path_p = prev_path;
return SVN_NO_ERROR;
}
/* Set *FS_PATH_P to the absolute filesystem path associated with the
URL built from SESSION's URL and REL_PATH (which is relative to
session's URL. Use POOL for allocations. */
static svn_error_t *
get_fs_path(const char **fs_path_p,
svn_ra_session_t *session,
const char *rel_path,
apr_pool_t *pool)
{
const char *url, *fs_path;
SVN_ERR(svn_ra_get_session_url(session, &url, pool));
SVN_ERR(svn_ra_get_path_relative_to_root(session, &fs_path, url, pool));
*fs_path_p = svn_fspath__canonicalize(svn_relpath_join(fs_path,
rel_path, pool),
pool);
return SVN_NO_ERROR;
}
/*** Fallback implementation of svn_ra_get_locations(). ***/
/* ### This is to support 1.0 servers. */
struct log_receiver_baton
{
/* The kind of the path we're tracing. */
svn_node_kind_t kind;
/* The path at which we are trying to find our versioned resource in
the log output. */
const char *last_path;
/* Input revisions and output hash; the whole point of this little game. */
svn_revnum_t peg_revision;
apr_array_header_t *location_revisions;
const char *peg_path;
apr_hash_t *locations;
/* A pool from which to allocate stuff stored in this baton. */
apr_pool_t *pool;
};
/* Implements svn_log_entry_receiver_t; helper for slow_get_locations.
As input, takes log_receiver_baton (defined above) and attempts to
"fill in" locations in the baton over the course of many
iterations. */
static svn_error_t *
log_receiver(void *baton,
svn_log_entry_t *log_entry,
apr_pool_t *pool)
{
struct log_receiver_baton *lrb = baton;
apr_pool_t *hash_pool = apr_hash_pool_get(lrb->locations);
const char *current_path = lrb->last_path;
const char *prev_path;
/* No paths were changed in this revision. Nothing to do. */
if (! log_entry->changed_paths2)
return SVN_NO_ERROR;
/* If we've run off the end of the path's history, there's nothing
to do. (This should never happen with a properly functioning
server, since we'd get no more log messages after the one where
path was created. But a malfunctioning server shouldn't cause us
to trigger an assertion failure.) */
if (! current_path)
return SVN_NO_ERROR;
/* If we haven't found our peg path yet, and we are now looking at a
revision equal to or older than the peg revision, then our
"current" path is our peg path. */
if ((! lrb->peg_path) && (log_entry->revision <= lrb->peg_revision))
lrb->peg_path = apr_pstrdup(lrb->pool, current_path);
/* Determine the paths for any of the revisions for which we haven't
gotten paths already. */
while (lrb->location_revisions->nelts)
{
svn_revnum_t next = APR_ARRAY_IDX(lrb->location_revisions,
lrb->location_revisions->nelts - 1,
svn_revnum_t);
if (log_entry->revision <= next)
{
apr_hash_set(lrb->locations,
apr_pmemdup(hash_pool, &next, sizeof(next)),
sizeof(next),
apr_pstrdup(hash_pool, current_path));
apr_array_pop(lrb->location_revisions);
}
else
break;
}
/* Figure out at which repository path our object of interest lived
in the previous revision. */
SVN_ERR(prev_log_path(&prev_path, NULL, NULL, log_entry->changed_paths2,
current_path, lrb->kind, log_entry->revision, pool));
/* Squirrel away our "next place to look" path (suffer the strcmp
hit to save on allocations). */
if (! prev_path)
lrb->last_path = NULL;
else if (strcmp(prev_path, current_path) != 0)
lrb->last_path = apr_pstrdup(lrb->pool, prev_path);
return SVN_NO_ERROR;
( run in 0.509 second using v1.01-cache-2.11-cpan-71847e10f99 )