FreeBSD/contrib/subversion/subversion/libsvn_fs_x/tree.c
/* Create the empty file PATH under ROOT.  Temporary allocations are
   in SCRATCH_POOL. */
Create the empty file PATH under ROOT.  Temporary allocations are
in SCRATCH_POOL.
Create the empty file PATH under ROOT . Temporary allocations are in SCRATCH_POOL .
static svn_error_t *
x_make_file(svn_fs_root_t *root,
            const char *path,
            apr_pool_t *scratch_pool)
{
  parent_path_t *parent_path;
  dag_node_t *child;
  svn_fs_x__txn_id_t txn_id = root_txn_id(root);
  apr_pool_t *subpool = svn_pool_create(scratch_pool);
  path = svn_fs__canonicalize_abspath(path, subpool);
  SVN_ERR(open_path(&parent_path, root, path, open_path_last_optional,
                    TRUE, subpool));
  if (parent_path->node)
    return SVN_FS__ALREADY_EXISTS(root, path);
  if (root->txn_flags & SVN_FS_TXN_CHECK_LOCKS)
    SVN_ERR(svn_fs_x__allow_locked_operation(path, root->fs, FALSE, FALSE,
                                             subpool));
  SVN_ERR(make_path_mutable(root, parent_path->parent, path, subpool,
                            subpool));
  SVN_ERR(svn_fs_x__dag_make_file(&child,
                                  parent_path->parent->node,
                                  parent_path_path(parent_path->parent,
                                                   subpool),
                                  parent_path->entry,
                                  txn_id,
                                  subpool, subpool));
  SVN_ERR(dag_node_cache_set(root, parent_path_path(parent_path, subpool),
                             child, subpool));
  SVN_ERR(add_change(root->fs, txn_id, path, svn_fs_x__dag_get_id(child),
                     svn_fs_path_change_add, TRUE, FALSE, FALSE,
                     svn_node_file, SVN_INVALID_REVNUM, NULL, subpool));
  svn_pool_destroy(subpool);
  return SVN_NO_ERROR;
}
static svn_error_t * x_make_file ( svn_fs_root_t * root , const char * path , apr_pool_t * scratch_pool ) { parent_path_t * parent_path ; dag_node_t * child ; svn_fs_x__txn_id_t txn_id = root_txn_id ( root ) ; apr_pool_t * subpool = svn_pool_create ( scratch_pool ) ; path = svn_fs__canonicalize_abspath ( path , subpool ) ; SVN_ERR ( open_path ( & parent_path , root , path , open_path_last_optional , TRUE , subpool ) ) ; if ( parent_path -> node ) return SVN_FS__ALREADY_EXISTS ( root , path ) ; if ( root -> txn_flags & SVN_FS_TXN_CHECK_LOCKS ) SVN_ERR ( svn_fs_x__allow_locked_operation ( path , root -> fs , FALSE , FALSE , subpool ) ) ; SVN_ERR ( make_path_mutable ( root , parent_path -> parent , path , subpool , subpool ) ) ; SVN_ERR ( svn_fs_x__dag_make_file ( & child , parent_path -> parent -> node , parent_path_path ( parent_path -> parent , subpool ) , parent_path -> entry , txn_id , subpool , subpool ) ) ; SVN_ERR ( dag_node_cache_set ( root , parent_path_path ( parent_path , subpool ) , child , subpool ) ) ; SVN_ERR ( add_change ( root -> fs , txn_id , path , svn_fs_x__dag_get_id ( child ) , svn_fs_path_change_add , TRUE , FALSE , FALSE , svn_node_file , SVN_INVALID_REVNUM , NULL , subpool ) ) ; svn_pool_destroy ( subpool ) ; return SVN_NO_ERROR ; }
Create the empty file PATH under ROOT.
Create the empty file PATH under ROOT .
/* If there's already a file by that name, complain.
     This also catches the case of trying to make a file named `/'.  */ /* Check (non-recursively) to see if path is locked;  if so, check
     that we can use it. */ /* Create the file.  */ /* Add this file to the path cache. */ /* Make a record of this modification in the changes table. */