<commit_before>/* dag.c : DAG-like interface filesystem, private to libsvn_fs
 *
 * ====================================================================
 * Copyright (c) 2000 CollabNet.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://subversion.tigris.org/license-1.html.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 * ====================================================================
 */

#include "svn_path.h"
#include "svn_fs.h"
#include "dag.h"
#include "err.h"
#include "fs.h"
#include "node-rev.h"
#include "nodes-table.h"
#include "txn-table.h"
#include "rev-table.h"
#include "skel.h"
#include "trail.h"




/* Initializing a filesystem.  */

struct dag_node_t
{
  /* The filesystem this dag node came from. */
  svn_fs_t *fs;

  /* The identifier for this dag node in FS (i.e., the DB key, parsed
     into an svn_fs_id_t). */
  svn_fs_id_t *id;

  /* The contents of the node (i.e., the DB value, parsed into a
     skel). */
  skel_t *contents;

  /* The transaction trail pool in which this dag_node_t was
     allocated. */
  apr_pool_t *pool;
};


/* Trail body for svn_fs__dag_init_fs. */
static svn_error_t *
dag_init_fs (void *fs_baton, trail_t *trail)
{
  svn_fs_t *fs = fs_baton;

  /* Create empty root directory with node revision 0.0:
     "nodes" : "0.0" -> "(fulltext [(dir ()) ()])" */
  {
    static char rep_skel[] = "(fulltext ((dir ()) ()))";
    SVN_ERR (svn_fs__put_rep (fs,
                              svn_fs_parse_id ("0.0", 3, trail->pool),
                              svn_fs__parse_skel (rep_skel,
                                                  sizeof (rep_skel) - 1,
                                                  trail->pool),
                              trail));
  } 

  /* Link it into filesystem revision 0:
     "revisions" : 0 -> "(revision  3 0.0  ())" */
  {
    static char rev_skel[] = "(revision  3 0.0  ())";
    svn_revnum_t rev = 0;
    SVN_ERR (svn_fs__put_rev (&rev, fs,
                              svn_fs__parse_skel (rev_skel,
                                                  sizeof (rev_skel) - 1,
                                                  trail->pool),
                              trail->db_txn,
                              trail->pool));

    if (rev != 0)
      return svn_error_createf (SVN_ERR_FS_CORRUPT, 0, 0, fs->pool,
                                "initial revision number is not `0'"
                                " in filesystem `%s'",
                                fs->env_path);
  }

  return SVN_NO_ERROR;
}


svn_error_t *
svn_fs__dag_init_fs (svn_fs_t *fs)
{
  return svn_fs__retry_txn (fs, dag_init_fs, fs, fs->pool);
}




/* ### these functions are defined so that we can load the library.
   ### without them, we get undefined references from tree.c
   ### obviously, they don't work and will need to be filled in...
*/
svn_error_t *svn_fs__dag_txn_node (dag_node_t **node_p,
                                   svn_fs_t *fs,
                                   const char *txn,
                                   const svn_fs_id_t *id,
                                   trail_t *trail)
{
  abort();
  /* NOTREACHED */
  return NULL;
}
void svn_fs__dag_close (dag_node_t *node)
{
  abort();
}
const svn_fs_id_t *svn_fs__dag_get_id (dag_node_t *node)
{
  abort();
  /* NOTREACHED */
  return NULL;
}
svn_error_t *svn_fs__dag_get_proplist (skel_t **proplist_p,
                                       dag_node_t *node,
                                       trail_t *trail)
{
  abort();
  /* NOTREACHED */
  return NULL;
}
svn_error_t *svn_fs__dag_set_proplist (dag_node_t *node,
                                       skel_t *proplist,
                                       trail_t *trail)
{
  abort();
  /* NOTREACHED */
  return NULL;
}<commit_msg>* libsvn_fs/dag.c (svn_fs__dag_txn_node): Delete stub function; was deleted from interface in an earlier change.<commit_after>/* dag.c : DAG-like interface filesystem, private to libsvn_fs
 *
 * ====================================================================
 * Copyright (c) 2000 CollabNet.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://subversion.tigris.org/license-1.html.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 * ====================================================================
 */

#include "svn_path.h"
#include "svn_fs.h"
#include "dag.h"
#include "err.h"
#include "fs.h"
#include "node-rev.h"
#include "nodes-table.h"
#include "txn-table.h"
#include "rev-table.h"
#include "skel.h"
#include "trail.h"




/* Initializing a filesystem.  */

struct dag_node_t
{
  /* The filesystem this dag node came from. */
  svn_fs_t *fs;

  /* The identifier for this dag node in FS (i.e., the DB key, parsed
     into an svn_fs_id_t). */
  svn_fs_id_t *id;

  /* The contents of the node (i.e., the DB value, parsed into a
     skel). */
  skel_t *contents;

  /* The transaction trail pool in which this dag_node_t was
     allocated. */
  apr_pool_t *pool;
};


/* Trail body for svn_fs__dag_init_fs. */
static svn_error_t *
dag_init_fs (void *fs_baton, trail_t *trail)
{
  svn_fs_t *fs = fs_baton;

  /* Create empty root directory with node revision 0.0:
     "nodes" : "0.0" -> "(fulltext [(dir ()) ()])" */
  {
    static char rep_skel[] = "(fulltext ((dir ()) ()))";
    SVN_ERR (svn_fs__put_rep (fs,
                              svn_fs_parse_id ("0.0", 3, trail->pool),
                              svn_fs__parse_skel (rep_skel,
                                                  sizeof (rep_skel) - 1,
                                                  trail->pool),
                              trail));
  } 

  /* Link it into filesystem revision 0:
     "revisions" : 0 -> "(revision  3 0.0  ())" */
  {
    static char rev_skel[] = "(revision  3 0.0  ())";
    svn_revnum_t rev = 0;
    SVN_ERR (svn_fs__put_rev (&rev, fs,
                              svn_fs__parse_skel (rev_skel,
                                                  sizeof (rev_skel) - 1,
                                                  trail->pool),
                              trail->db_txn,
                              trail->pool));

    if (rev != 0)
      return svn_error_createf (SVN_ERR_FS_CORRUPT, 0, 0, fs->pool,
                                "initial revision number is not `0'"
                                " in filesystem `%s'",
                                fs->env_path);
  }

  return SVN_NO_ERROR;
}


svn_error_t *
svn_fs__dag_init_fs (svn_fs_t *fs)
{
  return svn_fs__retry_txn (fs, dag_init_fs, fs, fs->pool);
}




/* ### these functions are defined so that we can load the library.
   ### without them, we get undefined references from tree.c
   ### obviously, they don't work and will need to be filled in...
*/
void svn_fs__dag_close (dag_node_t *node)
{
  abort();
}
const svn_fs_id_t *svn_fs__dag_get_id (dag_node_t *node)
{
  abort();
  /* NOTREACHED */
  return NULL;
}
svn_error_t *svn_fs__dag_get_proplist (skel_t **proplist_p,
                                       dag_node_t *node,
                                       trail_t *trail)
{
  abort();
  /* NOTREACHED */
  return NULL;
}
svn_error_t *svn_fs__dag_set_proplist (dag_node_t *node,
                                       skel_t *proplist,
                                       trail_t *trail)
{
  abort();
  /* NOTREACHED */
  return NULL;
}
{'fraction_non_alphanumeric': 0.14165588615782665, 'fraction_numerical': 0.006985769728331177, 'mean_word_length': 1.834983498349835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5494999', 'n_tokens_mistral': 2586, 'n_tokens_neox': 2480, 'n_words': 667}