Exemplo n.º 1
0
svn_error_t *
svn_fs_change_rev_prop(svn_fs_t *fs, svn_revnum_t rev, const char *name,
                       const svn_string_t *value, apr_pool_t *pool)
{
  return svn_error_trace(
           svn_fs_change_rev_prop2(fs, rev, name, NULL, value, pool));
}
Exemplo n.º 2
0
/* Change revision property NAME to VALUE for REVISION in REPOS.  If
   VALIDATE_PROPS is set, use functions which perform validation of
   the property value.  Otherwise, bypass those checks. */
static svn_error_t *
change_rev_prop(svn_repos_t *repos,
                svn_revnum_t revision,
                const char *name,
                const svn_string_t *value,
                svn_boolean_t validate_props,
                apr_pool_t *pool)
{
  if (validate_props)
    return svn_repos_fs_change_rev_prop4(repos, revision, NULL, name,
                                         NULL, value, FALSE, FALSE,
                                         NULL, NULL, pool);
  else
    return svn_fs_change_rev_prop2(svn_repos_fs(repos), revision, name,
                                   NULL, value, pool);
}
Exemplo n.º 3
0
svn_error_t *
svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
                              svn_revnum_t rev,
                              const char *author,
                              const char *name,
                              const svn_string_t *const *old_value_p,
                              const svn_string_t *new_value,
                              svn_boolean_t use_pre_revprop_change_hook,
                              svn_boolean_t use_post_revprop_change_hook,
                              svn_repos_authz_func_t authz_read_func,
                              void *authz_read_baton,
                              apr_pool_t *pool)
{
    svn_repos_revision_access_level_t readability;

    SVN_ERR(svn_repos_check_revision_access(&readability, repos, rev,
                                            authz_read_func, authz_read_baton,
                                            pool));

    if (readability == svn_repos_revision_access_full)
    {
        const svn_string_t *old_value;
        char action;
        apr_hash_t *hooks_env;

        SVN_ERR(svn_repos__validate_prop(name, new_value, pool));

        /* Fetch OLD_VALUE for svn_fs_change_rev_prop2(). */
        if (old_value_p)
        {
            old_value = *old_value_p;
        }
        else
        {
            /* Get OLD_VALUE anyway, in order for ACTION and OLD_VALUE arguments
             * to the hooks to be accurate. */
            svn_string_t *old_value2;

            SVN_ERR(svn_fs_revision_prop(&old_value2, repos->fs, rev, name, pool));
            old_value = old_value2;
        }

        /* Prepare ACTION. */
        if (! new_value)
            action = 'D';
        else if (! old_value)
            action = 'A';
        else
            action = 'M';

        /* Parse the hooks-env file (if any, and if to be used). */
        if (use_pre_revprop_change_hook || use_post_revprop_change_hook)
            SVN_ERR(svn_repos__parse_hooks_env(&hooks_env, repos->hooks_env_path,
                                               pool, pool));

        /* ### currently not passing the old_value to hooks */
        if (use_pre_revprop_change_hook)
            SVN_ERR(svn_repos__hooks_pre_revprop_change(repos, hooks_env, rev,
                    author, name, new_value,
                    action, pool));

        SVN_ERR(svn_fs_change_rev_prop2(repos->fs, rev, name,
                                        &old_value, new_value, pool));

        if (use_post_revprop_change_hook)
            SVN_ERR(svn_repos__hooks_post_revprop_change(repos, hooks_env, rev,
                    author, name, old_value,
                    action, pool));
    }
    else  /* rev is either unreadable or only partially readable */
    {
        return svn_error_createf
               (SVN_ERR_AUTHZ_UNREADABLE, NULL,
                _("Write denied:  not authorized to read all of revision %ld"), rev);
    }

    return SVN_NO_ERROR;
}