Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_repos/log.c view on Meta::CPAN
/* Either every changed path was unreadable... */
if (! found_readable)
*access_level = svn_repos_revision_access_none;
/* ... or some changed path was unreadable... */
else if (found_unreadable)
*access_level = svn_repos_revision_access_partial;
/* ... or every changed path was readable (the default). */
return SVN_NO_ERROR;
}
/* Store as keys in CHANGED the paths of all node in ROOT that show a
* significant change. "Significant" means that the text or
* properties of the node were changed, or that the node was added or
* deleted.
*
* The CHANGED hash set and its keys and values are allocated in POOL;
* keys are const char * paths and values are svn_log_changed_path_t.
*
* To prevent changes from being processed over and over again, the
* changed paths for ROOT may be passed in PREFETCHED_CHANGES. If the
* latter is NULL, we will request the list inside this function.
*
* If optional AUTHZ_READ_FUNC is non-NULL, then use it (with
* AUTHZ_READ_BATON and FS) to check whether each changed-path (and
* copyfrom_path) is readable:
*
* - If some paths are readable and some are not, then silently
* omit the unreadable paths from the CHANGED hash, and return
* SVN_ERR_AUTHZ_PARTIALLY_READABLE.
*
* - If absolutely every changed-path (and copyfrom_path) is
* unreadable, then return an empty CHANGED hash and
* SVN_ERR_AUTHZ_UNREADABLE. (This is to distinguish a revision
* which truly has no changed paths from a revision in which all
* paths are unreadable.)
*/
static svn_error_t *
detect_changed(apr_hash_t **changed,
svn_fs_root_t *root,
svn_fs_t *fs,
apr_hash_t *prefetched_changes,
svn_repos_authz_func_t authz_read_func,
void *authz_read_baton,
apr_pool_t *pool)
{
apr_hash_t *changes = prefetched_changes;
apr_hash_index_t *hi;
apr_pool_t *subpool;
svn_boolean_t found_readable = FALSE;
svn_boolean_t found_unreadable = FALSE;
*changed = svn_hash__make(pool);
if (changes == NULL)
SVN_ERR(svn_fs_paths_changed2(&changes, root, pool));
if (apr_hash_count(changes) == 0)
/* No paths changed in this revision? Uh, sure, I guess the
revision is readable, then. */
return SVN_NO_ERROR;
subpool = svn_pool_create(pool);
for (hi = apr_hash_first(pool, changes); hi; hi = apr_hash_next(hi))
{
/* NOTE: Much of this loop is going to look quite similar to
svn_repos_check_revision_access(), but we have to do more things
here, so we'll live with the duplication. */
const void *key;
void *val;
svn_fs_path_change2_t *change;
const char *path;
char action;
svn_log_changed_path2_t *item;
svn_pool_clear(subpool);
/* KEY will be the path, VAL the change. */
apr_hash_this(hi, &key, NULL, &val);
path = (const char *) key;
change = val;
/* Skip path if unreadable. */
if (authz_read_func)
{
svn_boolean_t readable;
SVN_ERR(authz_read_func(&readable,
root, path,
authz_read_baton, subpool));
if (! readable)
{
found_unreadable = TRUE;
continue;
}
}
/* At least one changed-path was readable. */
found_readable = TRUE;
switch (change->change_kind)
{
case svn_fs_path_change_reset:
continue;
case svn_fs_path_change_add:
action = 'A';
break;
case svn_fs_path_change_replace:
action = 'R';
break;
case svn_fs_path_change_delete:
action = 'D';
break;
case svn_fs_path_change_modify:
default:
( run in 0.757 second using v1.01-cache-2.11-cpan-63c85eba8c4 )