You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by eh...@apache.org on 2010/09/06 12:57:12 UTC
svn commit: r992993 - in /subversion/trunk/subversion/libsvn_wc:
wc-metadata.sql wc_db.c
Author: ehu
Date: Mon Sep 6 10:57:12 2010
New Revision: 992993
URL: http://svn.apache.org/viewvc?rev=992993&view=rev
Log:
Add schema for the (experimental) NODES table, which will eventually
replace WORKING_NODE, BASE_NODE and NODE_DATA.
* subversion/libsvn_wc/wc-metadata.sql
(STMT_CREATE_NODES): New.
* subversion/libsvn_wc/wc_db.c (create_db): Create NODES table,
inside SVN_WC__NODES block.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
Modified: subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-metadata.sql?rev=992993&r1=992992&r2=992993&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-metadata.sql Mon Sep 6 10:57:12 2010
@@ -741,6 +741,217 @@ CREATE TABLE NODE_DATA (
CREATE INDEX I_NODE_PARENT ON NODE_DATA (wc_id, parent_relpath);
CREATE INDEX I_NODE_PATH ON NODE_DATA (wc_id, local_relpath);
+/* ------------------------------------------------------------------------- */
+
+/* The NODES table describes the way WORKING nodes are layered on top of
+ BASE nodes and on top of other WORKING nodes, due to nested tree structure
+ changes. The layers are modelled using the "op_depth" column.
+
+ Each row in BASE_NODE has an associated row NODE_DATA. Additionally, each
+ row in WORKING_NODE has one or more associated rows in NODE_DATA.
+
+ This table contains full node descriptions for nodes in either the BASE
+ or WORKING trees as described in notes/wc-ng/design. Fields relate
+ both to BASE and WORKING trees, unless documented otherwise.
+
+ ### This table is to be integrated into the SCHEMA statement as soon
+ the experimental status of NODES is lifted.
+ ### This table superseeds NODE_DATA
+
+ For illustration, with a scenario like this:
+
+ # (0)
+ svn rm foo
+ svn cp ^/moo foo # (1)
+ svn rm foo/bar
+ touch foo/bar
+ svn add foo/bar # (2)
+
+ , these are the NODES for the path foo/bar (before single-db, the
+ numbering of op_depth is still a bit different):
+
+ (0) BASE_NODE -----> NODES (op_depth == 0)
+ (1) NODES (op_depth == 1) ( <----_ )
+ (2) NODES (op_depth == 2) <----- WORKING_NODE
+
+ 0 is the original data for foo/bar before 'svn rm foo' (if it existed).
+ 1 is the data for foo/bar copied in from ^/moo/bar.
+ 2 is the to-be-committed data for foo/bar, created by 'svn add foo/bar'.
+
+ An 'svn revert foo/bar' would remove the NODES of (2).
+
+ */
+-- STMT_CREATE_NODES
+CREATE TABLE NODES (
+ /* Working copy location related fields */
+
+ wc_id INTEGER NOT NULL REFERENCES WCROOT (id),
+ local_relpath TEXT NOT NULL,
+
+ /* Contains the depth (= number of path segments) of the operation
+ modifying the working copy tree structure. All nodes below the root
+ of the operation (aka operation root, aka oproot) affected by the
+ operation will be assigned the same op_depth.
+
+ op_depth == 0 designates the initial checkout; the BASE tree.
+
+ */
+ op_depth INTEGER NOT NULL,
+
+ /* parent's local_relpath for aggregating children of a given parent.
+ this will be "" if the parent is the wcroot. Since a wcroot will
+ never have a WORKING node the parent_relpath will never be null. */
+ /* ### would be nice to make this column NOT NULL. */
+ parent_relpath TEXT,
+
+
+ /* Repository location fields */
+
+ /* When op_depth == 0, these fields refer to the repository location of the
+ BASE node, the location of the initial checkout.
+
+ When op_depth != 0, they indicate where this node was copied/moved from.
+ In this case, the fields are set only on the root of the operation,
+ and are NULL for all children. */
+ repos_id INTEGER REFERENCES REPOSITORY (id),
+ repos_path TEXT,
+ revision INTEGER,
+
+
+ /* WC state fields */
+
+ /* In case 'op_depth' is equal to 0, this is part of the BASE tree; in
+ that case, all presence values except 'base-deleted' are allowed.
+
+
+ In case 'op_depth' is greater than 0, this is part of a layer of
+ working nodes; in that case, the following presence values apply:
+
+ Is this node "present" or has it been excluded for some reason?
+ Only allowed values: normal, not-present, incomplete, base-deleted.
+ (the others do not make sense for the WORKING tree)
+
+ normal: this node has been added/copied/moved-here. There may be an
+ underlying BASE node at this location, implying this is a replace.
+ Scan upwards from here looking for copyfrom or moved_here values
+ to detect the type of operation constructing this node.
+
+ not-present: the node (or parent) was originally copied or moved-here.
+ A subtree of that source has since been deleted. There may be
+ underlying BASE node to replace. For a move-here or copy-here, the
+ records are simply removed rather than switched to not-present.
+ Note this reflects a deletion only. It is not possible move-away
+ nodes from the WORKING tree. The purported destination would receive
+ a copy from the original source of a copy-here/move-here, or if the
+ nodes were plain adds, those nodes would be shifted to that target
+ for addition.
+
+ incomplete: nodes are being added into the WORKING tree, and the full
+ information about this node is not (yet) present.
+
+ base-deleted: the underlying BASE node has been marked for deletion due
+ to a delete or a move-away (see the moved_to column to determine
+ which), and has not been replaced. */
+ presence TEXT NOT NULL,
+
+ /* NULL depth means "default" (typically svn_depth_infinity) */
+ /* ### depth on WORKING? seems this is a BASE-only concept. how do
+ ### you do "files" on an added-directory? can't really ignore
+ ### the subdirs! */
+ /* ### maybe a WC-to-WC copy can retain a depth? */
+ depth TEXT,
+
+ /* ### JF: For an old-style move, "copyfrom" info stores its source, but a
+ new WC-NG "move" is intended to be a "true rename" so its copyfrom
+ revision is implicit, being in effect (new head - 1) at commit time.
+ For a (new) move, we need to store or deduce the copyfrom local-relpath;
+ perhaps add a column called "moved_from". */
+
+ /* Boolean value, specifying if this node was moved here (rather than just
+ copied). The source of the move is specified in copyfrom_*. */
+ moved_here INTEGER,
+
+ /* If the underlying node was moved away (rather than just deleted), this
+ specifies the local_relpath of where the BASE node was moved to.
+ This is set only on the root of a move, and is NULL for all children.
+
+ Note that moved_to never refers to *this* node. It always refers
+ to the "underlying" node, whether that is BASE or a child node
+ implied from a parent's move/copy. */
+ moved_to TEXT,
+
+ /* Repository state fields */
+
+ /* the kind of the new node. may be "unknown" if the node is not present. */
+ kind TEXT NOT NULL,
+
+ /* If this node was moved here or copied here, then the following fields may
+ have information about their source node. See BASE_NODE.changed_* for
+ more information.
+
+ For an added or not-present node, these are null. */
+ changed_revision INTEGER,
+ changed_date INTEGER, /* an APR date/time (usec since 1970) */
+ changed_author TEXT,
+
+ /* The SHA-1 checksum of the pristine text, if this node is a file and was
+ moved here or copied here, else NULL. */
+ checksum TEXT,
+
+ /* serialized skel of this node's properties. NULL if we
+ have no information about the properties (a non-present node). */
+ properties BLOB,
+
+
+ /* Various cache fields */
+
+ /* The size in bytes of the working file when it had no local text
+ modifications. This means the size of the text when translated from
+ repository-normal format to working copy format with EOL style
+ translated and keywords expanded according to the properties in the
+ "properties" column of this row.
+
+ NULL if this node is not a file or if the size has not (yet) been
+ computed. */
+ translated_size INTEGER,
+
+ /* The mod-time of the working file when it was last determined to be
+ logically unmodified relative to its base, taking account of keywords
+ and EOL style. This value is used in the change detection heuristic
+ used by the status command.
+
+ NULL if this node is not a file or if this info has not yet been
+ determined.
+ */
+ last_mod_time INTEGER, /* an APR date/time (usec since 1970) */
+
+ /* serialized skel of this node's dav-cache. could be NULL if the
+ node does not have any dav-cache. */
+ dav_cache BLOB,
+
+ /* for kind==symlink, this specifies the target. */
+ symlink_target TEXT,
+
+ /* The serialized file external information. */
+ /* ### hack. hack. hack.
+ ### This information is already stored in properties, but because the
+ ### current working copy implementation is such a pain, we can't
+ ### readily retrieve it, hence this temporary cache column.
+ ### When it is removed, be sure to remove the extra column from
+ ### the db-tests.
+
+ ### Note: This is only here as a hack, and should *NOT* be added
+ ### to any wc_db APIs. */
+ file_external TEXT,
+
+
+ PRIMARY KEY (wc_id, local_relpath, op_depth)
+
+ );
+
+CREATE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath);
+CREATE INDEX I_NODES_PATH ON NODES (wc_id, local_relpath);
+
/* ------------------------------------------------------------------------- */
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=992993&r1=992992&r2=992993&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Sep 6 10:57:12 2010
@@ -1428,6 +1428,11 @@ create_db(svn_sqlite__db_t **sdb,
SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_NODE_DATA));
#endif
+#ifdef SVN_WC__NODES
+ /* Create the NODES table for the experimental schema */
+ SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_NODES));
+#endif
+
/* Insert the repository. */
SVN_ERR(create_repos_id(repos_id, repos_root_url, repos_uuid, *sdb,
scratch_pool));