Mark many merge tests as skip-against-old-server.
[svn.git] / subversion / libsvn_fs_base / node-rev.c
bloba7fa5cff34fc5e6321d6bcc8fdc2dd76fd0573f0
1 /* node-rev.c --- storing and retrieving NODE-REVISION skels
3 * ====================================================================
4 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
18 #include <string.h>
20 #define APU_WANT_DB
21 #include <apu_want.h>
23 #include "svn_fs.h"
24 #include "fs.h"
25 #include "err.h"
26 #include "node-rev.h"
27 #include "reps-strings.h"
28 #include "id.h"
29 #include "../libsvn_fs/fs-loader.h"
31 #include "bdb/nodes-table.h"
32 #include "bdb/node-origins-table.h"
35 /* Creating completely new nodes. */
38 svn_error_t *
39 svn_fs_base__create_node(const svn_fs_id_t **id_p,
40 svn_fs_t *fs,
41 node_revision_t *noderev,
42 const char *copy_id,
43 const char *txn_id,
44 trail_t *trail,
45 apr_pool_t *pool)
47 svn_fs_id_t *id;
48 base_fs_data_t *bfd = fs->fsap_data;
50 /* Find an unused ID for the node. */
51 SVN_ERR(svn_fs_bdb__new_node_id(&id, fs, copy_id, txn_id, trail, pool));
53 /* Store its NODE-REVISION skel. */
54 SVN_ERR(svn_fs_bdb__put_node_revision(fs, id, noderev, trail, pool));
56 /* Add a record in the node origins index table if our format
57 supports it. */
58 if (bfd->format >= SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT)
60 SVN_ERR(svn_fs_bdb__set_node_origin(fs, svn_fs_base__id_node_id(id),
61 id, trail, pool));
64 *id_p = id;
65 return SVN_NO_ERROR;
70 /* Creating new revisions of existing nodes. */
72 svn_error_t *
73 svn_fs_base__create_successor(const svn_fs_id_t **new_id_p,
74 svn_fs_t *fs,
75 const svn_fs_id_t *old_id,
76 node_revision_t *new_noderev,
77 const char *copy_id,
78 const char *txn_id,
79 trail_t *trail,
80 apr_pool_t *pool)
82 svn_fs_id_t *new_id;
84 /* Choose an ID for the new node, and store it in the database. */
85 SVN_ERR(svn_fs_bdb__new_successor_id(&new_id, fs, old_id, copy_id,
86 txn_id, trail, pool));
88 /* Store the new skel under that ID. */
89 SVN_ERR(svn_fs_bdb__put_node_revision(fs, new_id, new_noderev,
90 trail, pool));
92 *new_id_p = new_id;
93 return SVN_NO_ERROR;
98 /* Deleting a node revision. */
100 svn_error_t *
101 svn_fs_base__delete_node_revision(svn_fs_t *fs,
102 const svn_fs_id_t *id,
103 svn_boolean_t origin_also,
104 trail_t *trail,
105 apr_pool_t *pool)
107 base_fs_data_t *bfd = fs->fsap_data;
109 /* ### todo: here, we should adjust other nodes to compensate for
110 the missing node. */
112 /* Delete the node origin record, too, if asked to do so and our
113 format supports it. */
114 if (origin_also && (bfd->format >= SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT))
116 SVN_ERR(svn_fs_bdb__delete_node_origin(fs, svn_fs_base__id_node_id(id),
117 trail, pool));
120 return svn_fs_bdb__delete_nodes_entry(fs, id, trail, pool);