Ejemplo n.º 1
0
/* Apply each property in PROPS to the node at FSPATH in ROOT.  */
static svn_error_t *
add_new_props(svn_fs_root_t *root,
              const char *fspath,
              apr_hash_t *props,
              apr_pool_t *scratch_pool)
{
    apr_pool_t *iterpool = svn_pool_create(scratch_pool);
    apr_hash_index_t *hi;

    /* ### it would be nice to have svn_fs_set_node_props(). but since we
       ### don't... add each property to the node. this is a new node, so
       ### we don't need to worry about deleting props. just adding.  */

    for (hi = apr_hash_first(scratch_pool, props); hi;
            hi = apr_hash_next(hi))
    {
        const char *name = svn__apr_hash_index_key(hi);
        const svn_string_t *value = svn__apr_hash_index_val(hi);

        svn_pool_clear(iterpool);

        SVN_ERR(svn_fs_change_node_prop(root, fspath, name, value, iterpool));
    }

    svn_pool_destroy(iterpool);
    return SVN_NO_ERROR;
}
Ejemplo n.º 2
0
static svn_error_t *
alter_props(svn_fs_root_t *root,
            const char *fspath,
            apr_hash_t *props,
            apr_pool_t *scratch_pool)
{
    apr_pool_t *iterpool = svn_pool_create(scratch_pool);
    apr_hash_t *old_props;
    apr_array_header_t *propdiffs;
    int i;

    SVN_ERR(svn_fs_node_proplist(&old_props, root, fspath, scratch_pool));

    SVN_ERR(svn_prop_diffs(&propdiffs, props, old_props, scratch_pool));

    for (i = 0; i < propdiffs->nelts; ++i)
    {
        const svn_prop_t *prop = &APR_ARRAY_IDX(propdiffs, i, svn_prop_t);

        svn_pool_clear(iterpool);

        /* Add, change, or delete properties.  */
        SVN_ERR(svn_fs_change_node_prop(root, fspath, prop->name, prop->value,
                                        iterpool));
    }

    svn_pool_destroy(iterpool);
    return SVN_NO_ERROR;
}
Ejemplo n.º 3
0
static svn_error_t *
test_change_file_prop(void *file_baton,
                      const char *name, const svn_string_t *value,
                      apr_pool_t *pool)
{
  struct file_baton *fb = file_baton;

  return svn_fs_change_node_prop(fb->edit_baton->txn_root,
                                 fb->path, name, value, pool);
}
Ejemplo n.º 4
0
svn_error_t *
svn_repos_fs_change_node_prop(svn_fs_root_t *root,
                              const char *path,
                              const char *name,
                              const svn_string_t *value,
                              apr_pool_t *pool)
{
  /* Validate the property, then call the wrapped function. */
  SVN_ERR(validate_prop(name, value, pool));
  return svn_fs_change_node_prop(root, path, name, value, pool);
}
Ejemplo n.º 5
0
static svn_error_t *
test_change_dir_prop(void *parent_baton,
                     const char *name, const svn_string_t *value,
                     apr_pool_t *pool)
{
  struct dir_baton *db = parent_baton;
  struct edit_baton *eb = db->edit_baton;

  /* Construct the full path of this entry and change the property. */
  return svn_fs_change_node_prop(eb->txn_root, db->full_path, 
                                 name, value, pool);
}
Ejemplo n.º 6
0
/* Change property NAME to VALUE for PATH in TXN_ROOT.  If
   VALIDATE_PROPS is set, use functions which perform validation of
   the property value.  Otherwise, bypass those checks. */
static svn_error_t *
change_node_prop(svn_fs_root_t *txn_root,
                 const char *path,
                 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_node_prop(txn_root, path, name, value, pool);
  else
    return svn_fs_change_node_prop(txn_root, path, name, value, pool);
}
Ejemplo n.º 7
0
svn_error_t *
svn_repos_fs_change_node_prop(svn_fs_root_t *root,
                              const char *path,
                              const char *name,
                              const svn_string_t *value,
                              apr_pool_t *pool)
{
    if (value && strcmp(name, SVN_PROP_MERGEINFO) == 0)
        SVN_ERR(verify_mergeinfo(value, path, pool));

    /* Validate the property, then call the wrapped function. */
    SVN_ERR(svn_repos__validate_prop(name, value, pool));
    return svn_fs_change_node_prop(root, path, name, value, pool);
}