FreeBSD/contrib/subversion/subversion/libsvn_fs_x/tree.c
/* Delete the node at PATH under ROOT.  ROOT must be a transaction
   root.  Perform temporary allocations in SCRATCH_POOL. */
Delete the node at PATH under ROOT.  ROOT must be a transaction
root.  Perform temporary allocations in SCRATCH_POOL.
Delete the node at PATH under ROOT . ROOT must be a transaction root . Perform temporary allocations in SCRATCH_POOL .
static svn_error_t *
x_delete_node(svn_fs_root_t *root,
              const char *path,
              apr_pool_t *scratch_pool)
{
  parent_path_t *parent_path;
  svn_fs_x__txn_id_t txn_id;
  apr_int64_t mergeinfo_count = 0;
  svn_node_kind_t kind;
  apr_pool_t *subpool = svn_pool_create(scratch_pool);
  if (! root->is_txn_root)
    return SVN_FS__NOT_TXN(root);
  txn_id = root_txn_id(root);
  path = svn_fs__canonicalize_abspath(path, subpool);
  SVN_ERR(open_path(&parent_path, root, path, 0, TRUE, subpool));
  kind = svn_fs_x__dag_node_kind(parent_path->node);
  if (! parent_path->parent)
    return svn_error_create(SVN_ERR_FS_ROOT_DIR, NULL,
                            _("The root directory cannot be deleted"));
  if (root->txn_flags & SVN_FS_TXN_CHECK_LOCKS)
    SVN_ERR(svn_fs_x__allow_locked_operation(path, root->fs, TRUE, FALSE,
                                             subpool));
  SVN_ERR(make_path_mutable(root, parent_path->parent, path, subpool,
                            subpool));
  SVN_ERR(svn_fs_x__dag_get_mergeinfo_count(&mergeinfo_count,
                                            parent_path->node));
  SVN_ERR(svn_fs_x__dag_delete(parent_path->parent->node,
                               parent_path->entry,
                               txn_id, subpool));
  SVN_ERR(dag_node_cache_invalidate(root, parent_path_path(parent_path,
                                                           subpool),
                                    subpool));
  if (mergeinfo_count > 0)
    SVN_ERR(increment_mergeinfo_up_tree(parent_path->parent,
                                        -mergeinfo_count,
                                        subpool));
  SVN_ERR(add_change(root->fs, txn_id, path,
                     svn_fs_x__dag_get_id(parent_path->node),
                     svn_fs_path_change_delete, FALSE, FALSE, FALSE, kind,
                     SVN_INVALID_REVNUM, NULL, subpool));
  svn_pool_destroy(subpool);
  return SVN_NO_ERROR;
}
static svn_error_t * x_delete_node ( svn_fs_root_t * root , const char * path , apr_pool_t * scratch_pool ) { parent_path_t * parent_path ; svn_fs_x__txn_id_t txn_id ; apr_int64_t mergeinfo_count = 0 ; svn_node_kind_t kind ; apr_pool_t * subpool = svn_pool_create ( scratch_pool ) ; if ( ! root -> is_txn_root ) return SVN_FS__NOT_TXN ( root ) ; txn_id = root_txn_id ( root ) ; path = svn_fs__canonicalize_abspath ( path , subpool ) ; SVN_ERR ( open_path ( & parent_path , root , path , 0 , TRUE , subpool ) ) ; kind = svn_fs_x__dag_node_kind ( parent_path -> node ) ; if ( ! parent_path -> parent ) return svn_error_create ( SVN_ERR_FS_ROOT_DIR , NULL , _ ( " " ) ) ; if ( root -> txn_flags & SVN_FS_TXN_CHECK_LOCKS ) SVN_ERR ( svn_fs_x__allow_locked_operation ( path , root -> fs , TRUE , FALSE , subpool ) ) ; SVN_ERR ( make_path_mutable ( root , parent_path -> parent , path , subpool , subpool ) ) ; SVN_ERR ( svn_fs_x__dag_get_mergeinfo_count ( & mergeinfo_count , parent_path -> node ) ) ; SVN_ERR ( svn_fs_x__dag_delete ( parent_path -> parent -> node , parent_path -> entry , txn_id , subpool ) ) ; SVN_ERR ( dag_node_cache_invalidate ( root , parent_path_path ( parent_path , subpool ) , subpool ) ) ; if ( mergeinfo_count > 0 ) SVN_ERR ( increment_mergeinfo_up_tree ( parent_path -> parent , - mergeinfo_count , subpool ) ) ; SVN_ERR ( add_change ( root -> fs , txn_id , path , svn_fs_x__dag_get_id ( parent_path -> node ) , svn_fs_path_change_delete , FALSE , FALSE , FALSE , kind , SVN_INVALID_REVNUM , NULL , subpool ) ) ; svn_pool_destroy ( subpool ) ; return SVN_NO_ERROR ; }
Delete the node at PATH under ROOT.
Delete the node at PATH under ROOT .
/* We can't remove the root of the filesystem.  */ /* Check to see if path (or any child thereof) is locked; if so,
     check that we can use the existing lock(s). */ /* Make the parent directory mutable, and do the deletion.  */ /* Remove this node and any children from the path cache. */ /* Update mergeinfo counts for parents */ /* Make a record of this modification in the changes table. */