FreeBSD/contrib/subversion/subversion/libsvn_fs_x/dag.c
/* Make a new entry named NAME in PARENT.  If IS_DIR is true, then the
   node revision the new entry points to will be a directory, else it
   will be a file.  The new node will be allocated in RESULT_POOL.  PARENT
   must be mutable, and must not have an entry named NAME.

   Use SCRATCH_POOL for all temporary allocations.
 */
Make a new entry named NAME in PARENT.  If IS_DIR is true, then the
node revision the new entry points to will be a directory, else it
will be a file.  The new node will be allocated in RESULT_POOL.  PARENT
must be mutable, and must not have an entry named NAME.

Use SCRATCH_POOL for all temporary allocations.
Make a new entry named NAME in PARENT . If IS_DIR is true then the node revision the new entry points to will be a directory else it will be a file . The new node will be allocated in RESULT_POOL . PARENT must be mutable and must not have an entry named NAME . Use SCRATCH_POOL for all temporary allocations .
static svn_error_t *
make_entry(dag_node_t **child_p,
           dag_node_t *parent,
           const char *parent_path,
           const char *name,
           svn_boolean_t is_dir,
           svn_fs_x__txn_id_t txn_id,
           apr_pool_t *result_pool,
           apr_pool_t *scratch_pool)
{
  svn_fs_x__noderev_t new_noderev, *parent_noderev;
  if (! svn_path_is_single_path_component(name))
    return svn_error_createf
      (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
       _("Attempted to create a node with an illegal name '%s'"), name);
  if (parent->kind != svn_node_dir)
    return svn_error_create
      (SVN_ERR_FS_NOT_DIRECTORY, NULL,
       _("Attempted to create entry in non-directory parent"));
  if (! svn_fs_x__dag_check_mutable(parent))
    return svn_error_createf
      (SVN_ERR_FS_NOT_MUTABLE, NULL,
       _("Attempted to clone child of non-mutable node"));
  memset(&new_noderev, 0, sizeof(new_noderev));
  new_noderev.kind = is_dir ? svn_node_dir : svn_node_file;
  new_noderev.created_path = svn_fspath__join(parent_path, name, result_pool);
  SVN_ERR(get_node_revision(&parent_noderev, parent));
  new_noderev.copyroot_path = apr_pstrdup(result_pool,
                                          parent_noderev->copyroot_path);
  new_noderev.copyroot_rev = parent_noderev->copyroot_rev;
  new_noderev.copyfrom_rev = SVN_INVALID_REVNUM;
  new_noderev.copyfrom_path = NULL;
  svn_fs_x__id_reset(&new_noderev.predecessor_id);
  SVN_ERR(svn_fs_x__create_node
          (svn_fs_x__dag_get_fs(parent), &new_noderev,
           &parent_noderev->copy_id, txn_id, scratch_pool));
  SVN_ERR(svn_fs_x__dag_get_node(child_p, svn_fs_x__dag_get_fs(parent),
                                 &new_noderev.noderev_id, result_pool,
                                 scratch_pool));
  return set_entry(parent, name, &new_noderev.noderev_id,
                   new_noderev.kind, txn_id, scratch_pool);
}
static svn_error_t * make_entry ( dag_node_t * * child_p , dag_node_t * parent , const char * parent_path , const char * name , svn_boolean_t is_dir , svn_fs_x__txn_id_t txn_id , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { svn_fs_x__noderev_t new_noderev , * parent_noderev ; if ( ! svn_path_is_single_path_component ( name ) ) return svn_error_createf ( SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT , NULL , _ ( " " ) , name ) ; if ( parent -> kind != svn_node_dir ) return svn_error_create ( SVN_ERR_FS_NOT_DIRECTORY , NULL , _ ( " " ) ) ; if ( ! svn_fs_x__dag_check_mutable ( parent ) ) return svn_error_createf ( SVN_ERR_FS_NOT_MUTABLE , NULL , _ ( " " ) ) ; memset ( & new_noderev , 0 , sizeof ( new_noderev ) ) ; new_noderev . kind = is_dir ? svn_node_dir : svn_node_file ; new_noderev . created_path = svn_fspath__join ( parent_path , name , result_pool ) ; SVN_ERR ( get_node_revision ( & parent_noderev , parent ) ) ; new_noderev . copyroot_path = apr_pstrdup ( result_pool , parent_noderev -> copyroot_path ) ; new_noderev . copyroot_rev = parent_noderev -> copyroot_rev ; new_noderev . copyfrom_rev = SVN_INVALID_REVNUM ; new_noderev . copyfrom_path = NULL ; svn_fs_x__id_reset ( & new_noderev . predecessor_id ) ; SVN_ERR ( svn_fs_x__create_node ( svn_fs_x__dag_get_fs ( parent ) , & new_noderev , & parent_noderev -> copy_id , txn_id , scratch_pool ) ) ; SVN_ERR ( svn_fs_x__dag_get_node ( child_p , svn_fs_x__dag_get_fs ( parent ) , & new_noderev . noderev_id , result_pool , scratch_pool ) ) ; return set_entry ( parent , name , & new_noderev . noderev_id , new_noderev . kind , txn_id , scratch_pool ) ; }
Make a new entry named NAME in PARENT.
Make a new entry named NAME in PARENT .
/* Make sure that NAME is a single path component. */ /* Make sure that parent is a directory */ /* Check that the parent is mutable. */ /* Create the new node's NODE-REVISION */ /* Create a new dag_node_t for our new node */ /* We can safely call set_entry because we already know that
     PARENT is mutable, and we just created CHILD, so we know it has
     no ancestors (therefore, PARENT cannot be an ancestor of CHILD) */