You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/09/24 16:02:52 UTC
svn commit: r1000876 [2/4] - in /subversion/branches/object-model: ./ build/
notes/ notes/http-and-webdav/ subversion/include/
subversion/include/private/ subversion/libsvn_client/
subversion/libsvn_diff/ subversion/libsvn_fs/ subversion/libsvn_ra/ sub...
Modified: subversion/branches/object-model/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_ra_svn/client.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/object-model/subversion/libsvn_ra_svn/client.c Fri Sep 24 14:02:50 2010
@@ -622,6 +622,7 @@ static svn_error_t *open_session(svn_ra_
/* In protocol version 2, we send back our protocol version, our
* capability list, and the URL, and subsequently there is an auth
* request. */
+ /* Client-side capabilities list: */
SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "n(wwwwww)cc(?c)",
(apr_uint64_t) 2,
SVN_RA_SVN_CAP_EDIT_PIPELINE,
@@ -813,16 +814,49 @@ static svn_error_t *ra_svn_get_dated_rev
return SVN_NO_ERROR;
}
+/* Forward declaration. */
+static svn_error_t *ra_svn_has_capability(svn_ra_session_t *session,
+ svn_boolean_t *has,
+ const char *capability,
+ apr_pool_t *pool);
+
static svn_error_t *ra_svn_change_rev_prop(svn_ra_session_t *session, svn_revnum_t rev,
const char *name,
+ const svn_string_t *const *old_value_p,
const svn_string_t *value,
apr_pool_t *pool)
{
svn_ra_svn__session_baton_t *sess_baton = session->priv;
svn_ra_svn_conn_t *conn = sess_baton->conn;
+ svn_boolean_t dont_care;
+ const svn_string_t *old_value;
+ svn_boolean_t has_atomic_revprops;
+
+ SVN_ERR(ra_svn_has_capability(session, &has_atomic_revprops,
+ SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
+ pool));
+
+ if (old_value_p)
+ {
+ /* How did you get past the same check in svn_ra_change_rev_prop2()? */
+ SVN_ERR_ASSERT(has_atomic_revprops);
+
+ dont_care = FALSE;
+ old_value = *old_value_p;
+ }
+ else
+ {
+ dont_care = TRUE;
+ old_value = NULL;
+ }
+
+ if (has_atomic_revprops)
+ SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "change-rev-prop2", "rc(?s)(b?s)",
+ rev, name, value, dont_care, old_value));
+ else
+ SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "change-rev-prop", "rc?s",
+ rev, name, value));
- SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "change-rev-prop", "rc?s",
- rev, name, value));
SVN_ERR(handle_auth_request(sess_baton, pool));
SVN_ERR(svn_ra_svn_read_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
@@ -2420,6 +2454,9 @@ static svn_error_t *ra_svn_has_capabilit
else if (strcmp(capability, SVN_RA_CAPABILITY_COMMIT_REVPROPS) == 0)
*has = svn_ra_svn_has_capability(sess->conn,
SVN_RA_SVN_CAP_COMMIT_REVPROPS);
+ else if (strcmp(capability, SVN_RA_CAPABILITY_ATOMIC_REVPROPS) == 0)
+ *has = svn_ra_svn_has_capability(sess->conn,
+ SVN_RA_SVN_CAP_ATOMIC_REVPROPS);
else /* Don't know any other capabilities, so error. */
{
return svn_error_createf
Modified: subversion/branches/object-model/subversion/libsvn_ra_svn/protocol
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_ra_svn/protocol?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_ra_svn/protocol (original)
+++ subversion/branches/object-model/subversion/libsvn_ra_svn/protocol Fri Sep 24 14:02:50 2010
@@ -199,6 +199,9 @@ capability and C indicates a client capa
[S] depth If the server presents this capability, it understands
requested operational depth (see section 3.1.1) and
per-path ambient depth (see section 3.1.3).
+[S] atomic-revprops If the server presents support this capability, it
+ supports the change-rev-prop2 command.
+ See section 3.1.1.
3. Commands
-----------
@@ -261,6 +264,16 @@ second place for auth-request point as n
changed to be optional without creating an optional tuple for
that one parameter as we normally do.)
+ change-rev-prop2
+ params: ( rev:number name:string [ value:string ]
+ ( dont-care:bool ? previous-value:string ) )
+ response: ( )
+ If value is not specified, the rev-prop is removed. If dont-care is false,
+ then the rev-prop is changed only if it is currently set as previous-value
+ indicates. (If dont-care is false and previous-value is unspecified, then
+ the revision property must be previously unset.) If dont-care is true,
+ then previous-value must not be specified.
+
rev-proplist
params: ( rev:number )
response: ( props:proplist )
Modified: subversion/branches/object-model/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_repos/deprecated.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/branches/object-model/subversion/libsvn_repos/deprecated.c Fri Sep 24 14:02:50 2010
@@ -328,6 +328,26 @@ svn_repos_replay(svn_fs_root_t *root,
/*** From fs-wrap.c ***/
svn_error_t *
+svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
+ svn_revnum_t rev,
+ const char *author,
+ const char *name,
+ const svn_string_t *new_value,
+ svn_boolean_t use_pre_revprop_change_hook,
+ svn_boolean_t use_post_revprop_change_hook,
+ svn_repos_authz_func_t authz_read_func,
+ void *authz_read_baton,
+ apr_pool_t *pool)
+{
+ return svn_repos_fs_change_rev_prop4(repos, rev, author, name, NULL,
+ new_value,
+ use_pre_revprop_change_hook,
+ use_post_revprop_change_hook,
+ authz_read_func,
+ authz_read_baton, pool);
+}
+
+svn_error_t *
svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
svn_revnum_t rev,
const char *author,
Modified: subversion/branches/object-model/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_repos/fs-wrap.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/branches/object-model/subversion/libsvn_repos/fs-wrap.c Fri Sep 24 14:02:50 2010
@@ -263,10 +263,11 @@ svn_repos_fs_change_txn_prop(svn_fs_txn_
svn_error_t *
-svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
+svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
svn_revnum_t rev,
const char *author,
const char *name,
+ const svn_string_t *const *old_value_p,
const svn_string_t *new_value,
svn_boolean_t use_pre_revprop_change_hook,
svn_boolean_t use_post_revprop_change_hook,
@@ -274,7 +275,6 @@ svn_repos_fs_change_rev_prop3(svn_repos_
void *authz_read_baton,
apr_pool_t *pool)
{
- svn_string_t *old_value;
svn_repos_revision_access_level_t readability;
char action;
@@ -284,9 +284,26 @@ svn_repos_fs_change_rev_prop3(svn_repos_
if (readability == svn_repos_revision_access_full)
{
+ const svn_string_t *old_value;
+
SVN_ERR(validate_prop(name, new_value, pool));
- SVN_ERR(svn_fs_revision_prop(&old_value, repos->fs, rev, name, pool));
+ /* Fetch OLD_VALUE for svn_fs_change_rev_prop2(). */
+ if (old_value_p)
+ {
+ old_value = *old_value_p;
+ }
+ else
+ {
+ /* Get OLD_VALUE anyway, in order for ACTION and OLD_VALUE arguments
+ * to the hooks to be accurate. */
+ svn_string_t *old_value2;
+
+ SVN_ERR(svn_fs_revision_prop(&old_value2, repos->fs, rev, name, pool));
+ old_value = old_value2;
+ }
+
+ /* Prepare ACTION. */
if (! new_value)
action = 'D';
else if (! old_value)
@@ -294,12 +311,13 @@ svn_repos_fs_change_rev_prop3(svn_repos_
else
action = 'M';
+ /* ### currently not passing the old_value to hooks */
if (use_pre_revprop_change_hook)
SVN_ERR(svn_repos__hooks_pre_revprop_change(repos, rev, author, name,
new_value, action, pool));
- SVN_ERR(svn_fs_change_rev_prop2(repos->fs, rev, name, NULL,
- new_value, pool));
+ SVN_ERR(svn_fs_change_rev_prop2(repos->fs, rev, name,
+ &old_value, new_value, pool));
if (use_post_revprop_change_hook)
SVN_ERR(svn_repos__hooks_post_revprop_change(repos, rev, author, name,
Modified: subversion/branches/object-model/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_subr/error.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_subr/error.c (original)
+++ subversion/branches/object-model/subversion/libsvn_subr/error.c Fri Sep 24 14:02:50 2010
@@ -269,6 +269,18 @@ svn_error_root_cause(svn_error_t *err)
return err;
}
+svn_boolean_t
+svn_error_has_cause(svn_error_t *err, apr_status_t apr_err)
+{
+ svn_error_t *child;
+
+ for (child = err; child; child = child->child)
+ if (child->apr_err == apr_err)
+ return TRUE;
+
+ return FALSE;
+}
+
svn_error_t *
svn_error_dup(svn_error_t *err)
{
Modified: subversion/branches/object-model/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_subr/sqlite.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/object-model/subversion/libsvn_subr/sqlite.c Fri Sep 24 14:02:50 2010
@@ -941,6 +941,11 @@ svn_sqlite__open(svn_sqlite__db_t **db,
SVN_ERR(exec_sql(*db, "PRAGMA foreign_keys=ON;"));
#endif
+ /* Store temporary tables in RAM instead of in temporary files, but don't
+ fail on this if this option is disabled in the sqlite compilation by
+ setting SQLITE_TEMP_STORE to 0 (always to disk) */
+ svn_error_clear(exec_sql(*db, "PRAGMA temp_store = MEMORY;"));
+
/* Validate the schema, upgrading if necessary. */
if (upgrade_sql != NULL)
SVN_ERR(check_format(*db, latest_schema, upgrade_sql, scratch_pool));
Modified: subversion/branches/object-model/subversion/libsvn_subr/svn_string.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_subr/svn_string.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_subr/svn_string.c (original)
+++ subversion/branches/object-model/subversion/libsvn_subr/svn_string.c Fri Sep 24 14:02:50 2010
@@ -661,7 +661,7 @@ svn_cstring_strtoui64(apr_uint64_t *n, c
val < 0 || (apr_uint64_t)val < minval || (apr_uint64_t)val > maxval)
return svn_error_return(
svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
- _("Number '%s' is out of range '[%lu, %lu]'"),
+ _("Number '%s' is out of range '[%llu, %llu]'"),
str, minval, maxval));
*n = val;
return SVN_NO_ERROR;
@@ -705,7 +705,7 @@ svn_cstring_strtoi64(apr_int64_t *n, con
val < minval || val > maxval)
return svn_error_return(
svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
- _("Number '%s' is out of range '[%ld, %ld]'"),
+ _("Number '%s' is out of range '[%lld, %lld]'"),
str, minval, maxval));
*n = val;
return SVN_NO_ERROR;
Modified: subversion/branches/object-model/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_wc/copy.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_wc/copy.c (original)
+++ subversion/branches/object-model/subversion/libsvn_wc/copy.c Fri Sep 24 14:02:50 2010
@@ -46,7 +46,8 @@
/*** Code. ***/
-/* Make a copy of SRC_ABSPATH under a temporary name in the directory
+/* Make a copy of the filesystem node (or tree if RECURSIVE) at
+ SRC_ABSPATH under a temporary name in the directory
TMPDIR_ABSPATH and return the absolute path of the copy in
*DST_ABSPATH. Return the node kind of SRC_ABSPATH in *KIND. If
SRC_ABSPATH doesn't exist then set *DST_ABSPATH to NULL to indicate
@@ -94,6 +95,9 @@ copy_to_tmpdir(const char **dst_abspath,
if (*kind == svn_node_dir)
{
if (recursive)
+ /* ### Huh? This looks like it's expected to overwrite the temp file
+ *DST_ABSPATH, but it would return an error if the destination
+ exists. And same for svn_io_dir_make() below. What gives? */
SVN_ERR(svn_io_copy_dir_recursively(src_abspath,
tmpdir_abspath,
svn_dirent_basename(*dst_abspath,
@@ -115,10 +119,87 @@ copy_to_tmpdir(const char **dst_abspath,
}
-/* A replacement for both copy_file_administratively and
- copy_added_file_administratively. Not yet fully working. Relies
- on in-db-props. SRC_ABSPATH is a versioned file but the filesystem
- node might not be a file.
+/* If SRC_ABSPATH and DST_ABSPATH use different pristine stores, copy the
+ pristine text of SRC_ABSPATH (if there is one) into the pristine text
+ store connected to DST_ABSPATH. This will only happen when copying into
+ a separate WC such as an external directory.
+ */
+static svn_error_t *
+copy_pristine_text_if_necessary(svn_wc__db_t *db,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool)
+{
+ const svn_checksum_t *checksum;
+
+ SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ &checksum,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ db, src_abspath,
+ scratch_pool, scratch_pool));
+ if (checksum)
+ {
+ svn_boolean_t present;
+ svn_stream_t *src_pristine, *tmp_pristine;
+ const char *tmp_pristine_abspath;
+ const svn_checksum_t *sha1_checksum, *md5_checksum;
+ const char *tmpdir_abspath;
+
+ /* If it's already in DST_ABSPATH's pristine store, we're done. */
+ SVN_ERR(svn_wc__db_pristine_check(&present, db, dst_abspath, checksum,
+ scratch_pool));
+ if (present)
+ return SVN_NO_ERROR;
+
+ if (checksum->kind == svn_checksum_md5)
+ {
+ md5_checksum = checksum;
+ SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db,
+ src_abspath, checksum,
+ scratch_pool, scratch_pool));
+ }
+ else
+ {
+ sha1_checksum = checksum;
+ SVN_ERR(svn_wc__db_pristine_get_md5(&md5_checksum, db,
+ src_abspath, checksum,
+ scratch_pool, scratch_pool));
+ }
+
+ SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath, db, dst_abspath,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_wc__db_pristine_read(&src_pristine, db,
+ src_abspath, sha1_checksum,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_stream_open_unique(&tmp_pristine, &tmp_pristine_abspath,
+ tmpdir_abspath, svn_io_file_del_none,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_stream_copy3(src_pristine, tmp_pristine,
+ cancel_func, cancel_baton,
+ scratch_pool));
+ SVN_ERR(svn_wc__db_pristine_install(db, tmp_pristine_abspath,
+ sha1_checksum, md5_checksum,
+ scratch_pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
+/* Copy the versioned file SRC_ABSPATH in DB to the path DST_ABSPATH in DB.
+ If METADATA_ONLY is true, copy only the versioned metadata,
+ otherwise copy both the versioned metadata and the filesystem node (even
+ if it is the wrong kind, and recursively if it is a dir).
+
+ A replacement for both copy_file_administratively and
+ copy_added_file_administratively.
+
+ ### Not yet fully working. Relies on in-db-props.
This also works for versioned symlinks that are stored in the db as
svn_wc__db_kind_file with svn:special set. */
@@ -136,62 +217,20 @@ copy_versioned_file(svn_wc__db_t *db,
svn_skel_t *work_items = NULL;
const char *dir_abspath = svn_dirent_dirname(dst_abspath, scratch_pool);
const char *tmpdir_abspath;
- svn_stream_t *src_pristine;
const char *tmp_dst_abspath;
svn_node_kind_t kind;
SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath, db, dst_abspath,
scratch_pool, scratch_pool));
- /* This goes away when we centralise, but until then we might need
- to do a cross-db pristine copy. */
- if (strcmp(svn_dirent_dirname(src_abspath, scratch_pool),
- svn_dirent_dirname(dst_abspath, scratch_pool)))
- {
- const svn_checksum_t *checksum;
-
- SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- &checksum,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
- db, src_abspath,
- scratch_pool, scratch_pool));
- if (checksum)
- {
- svn_stream_t *tmp_pristine;
- const char *tmp_pristine_abspath;
- const svn_checksum_t *sha1_checksum, *md5_checksum;
-
- if (checksum->kind == svn_checksum_md5)
- {
- md5_checksum = checksum;
- SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db,
- src_abspath, checksum,
- scratch_pool, scratch_pool));
- }
- else
- {
- sha1_checksum = checksum;
- SVN_ERR(svn_wc__db_pristine_get_md5(&md5_checksum, db,
- src_abspath, checksum,
- scratch_pool, scratch_pool));
- }
- SVN_ERR(svn_wc__db_pristine_read(&src_pristine, db,
- src_abspath, sha1_checksum,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_stream_open_unique(&tmp_pristine, &tmp_pristine_abspath,
- tmpdir_abspath, svn_io_file_del_none,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_stream_copy3(src_pristine, tmp_pristine,
- cancel_func, cancel_baton,
- scratch_pool));
- SVN_ERR(svn_wc__db_pristine_install(db, tmp_pristine_abspath,
- sha1_checksum, md5_checksum,
- scratch_pool));
- }
- }
+ /* In case we are copying from one WC to another (e.g. an external dir),
+ ensure the destination WC has a copy of the pristine text. */
+ SVN_ERR(copy_pristine_text_if_necessary(db, src_abspath, dst_abspath,
+ cancel_func, cancel_baton,
+ scratch_pool));
+ /* Prepare a temp copy of the filesystem node. It is usually a file, but
+ copy recursively if it's a dir. */
if (!metadata_only)
{
SVN_ERR(copy_to_tmpdir(&tmp_dst_abspath, &kind, src_abspath,
@@ -209,6 +248,8 @@ copy_versioned_file(svn_wc__db_t *db,
}
}
+ /* Copy the (single) node's metadata, and move the new filesystem node
+ into place. */
SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath,
work_items, scratch_pool));
SVN_ERR(svn_wc__wq_run(db, dir_abspath,
@@ -225,6 +266,10 @@ copy_versioned_file(svn_wc__db_t *db,
return SVN_NO_ERROR;
}
+/* Copy the versioned dir SRC_ABSPATH in DB to the path DST_ABSPATH in DB,
+ recursively. If METADATA_ONLY is true, copy only the versioned metadata,
+ otherwise copy both the versioned metadata and the filesystem nodes (even
+ if they are the wrong kind, and including unversioned children). */
static svn_error_t *
copy_versioned_dir(svn_wc__db_t *db,
const char *src_abspath,
@@ -246,6 +291,7 @@ copy_versioned_dir(svn_wc__db_t *db,
apr_pool_t *iterpool;
int i;
+ /* Prepare a temp copy of the single filesystem node (usually a dir). */
if (!metadata_only)
{
SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath, db,
@@ -266,6 +312,8 @@ copy_versioned_dir(svn_wc__db_t *db,
}
}
+ /* Copy the (single) node's metadata, and move the new filesystem node
+ into place. */
SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath,
work_items, scratch_pool));
SVN_ERR(svn_wc__wq_run(db, dir_abspath,
@@ -281,8 +329,8 @@ copy_versioned_dir(svn_wc__db_t *db,
}
if (!metadata_only && kind == svn_node_dir)
- /* All children, versioned and unversioned. We're only interested in the
- names of the children, so we can pass TRUE as the only_check_type
+ /* All filesystem children, versioned and unversioned. We're only
+ interested in their names, so we can pass TRUE as the only_check_type
param. */
SVN_ERR(svn_io_get_dirents3(&children, src_abspath, TRUE,
scratch_pool, scratch_pool));
@@ -330,9 +378,9 @@ copy_versioned_dir(svn_wc__db_t *db,
apr_hash_set(children, child_name, APR_HASH_KEY_STRING, NULL);
}
+ /* Copy all the remaining filesystem children, which are unversioned. */
if (!metadata_only && kind == svn_node_dir)
{
- /* All the remaining children are unversioned. */
apr_hash_index_t *hi;
for (hi = apr_hash_first(scratch_pool, children); hi;
@@ -392,7 +440,6 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
apr_pool_t *scratch_pool)
{
svn_wc__db_t *db = wc_ctx->db;
- svn_node_kind_t src_kind;
svn_wc__db_kind_t src_db_kind;
const char *dstdir_abspath;
@@ -481,6 +528,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
SVN_ERR_WC_INVALID_SCHEDULE, NULL,
_("Cannot copy to '%s' as it is scheduled for deletion"),
svn_dirent_local_style(dst_abspath, scratch_pool));
+ /* ### should report dstdir_abspath instead of dst_abspath? */
}
/* TODO(#2843): Rework the error report. */
@@ -528,16 +576,13 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
}
}
- SVN_ERR(svn_io_check_path(src_abspath, &src_kind, scratch_pool));
-
+ /* Check that the target path is not obstructed, if required. */
if (!metadata_only)
{
svn_node_kind_t dst_kind;
- /* This is the error checking from copy_file_administratively
- but converted to wc-ng. It's not in copy_file since this
- checking only needs to happen at the root of the copy and not
- when called recursively. */
+ /* (We need only to check the root of the copy, not every path inside
+ copy_versioned_file/_dir.) */
SVN_ERR(svn_io_check_path(dst_abspath, &dst_kind, scratch_pool));
if (dst_kind != svn_node_none)
return svn_error_createf(SVN_ERR_ENTRY_EXISTS, NULL,
Modified: subversion/branches/object-model/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_wc/deprecated.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/object-model/subversion/libsvn_wc/deprecated.c Fri Sep 24 14:02:50 2010
@@ -3364,12 +3364,16 @@ svn_wc_relocate3(const char *path,
const char *local_abspath;
svn_wc_context_t *wc_ctx;
+ if (! recurse)
+ svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, 0,
+ _("Non-recursive relocation not supported"));
+
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
svn_wc__adm_get_db(adm_access),
pool));
- SVN_ERR(svn_wc_relocate4(wc_ctx, local_abspath, from, to, recurse,
+ SVN_ERR(svn_wc_relocate4(wc_ctx, local_abspath, from, to,
validator, validator_baton, pool));
return svn_error_return(svn_wc_context_destroy(wc_ctx));
Modified: subversion/branches/object-model/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_wc/entries.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/object-model/subversion/libsvn_wc/entries.c Fri Sep 24 14:02:50 2010
@@ -606,16 +606,35 @@ read_one_entry(const svn_wc_entry_t **ne
{
svn_sqlite__db_t *sdb;
svn_sqlite__stmt_t *stmt;
+#ifdef SVN_WC__NODES
+ svn_sqlite__stmt_t *stmt_nodes;
+ svn_boolean_t have_nodes_row;
+#endif
SVN_ERR(svn_wc__db_temp_borrow_sdb(
&sdb, db, dir_abspath,
svn_wc__db_openmode_readonly,
scratch_pool));
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_SELECT_NOT_PRESENT));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, entry->name));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt_nodes, sdb,
+ STMT_SELECT_NOT_PRESENT));
+ SVN_ERR(svn_sqlite__bindf(stmt_nodes, "is", wc_id, entry->name));
+ SVN_ERR(svn_sqlite__step(&have_nodes_row, stmt_nodes));
+#ifndef SVN_WC__NODES_ONLY
+ SVN_ERR_ASSERT(have_row == have_nodes_row);
+ SVN_ERR(svn_sqlite__reset(stmt_nodes));
+#else
+ stmt = stmt_nodes;
+ have_row = have_nodes_row;
+#endif
+#endif
SVN_ERR(svn_sqlite__reset(stmt));
}
@@ -2138,6 +2157,7 @@ write_entry(svn_wc__db_t *db,
&entry->file_external_rev,
scratch_pool));
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_UPDATE_FILE_EXTERNAL));
SVN_ERR(svn_sqlite__bindf(stmt, "iss",
@@ -2145,6 +2165,16 @@ write_entry(svn_wc__db_t *db,
entry->name,
str));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ STMT_UPDATE_FILE_EXTERNAL_1));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+ (apr_uint64_t)1 /* wc_id */,
+ entry->name,
+ str));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
}
}
Modified: subversion/branches/object-model/subversion/libsvn_wc/relocate.c
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_wc/relocate.c?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_wc/relocate.c (original)
+++ subversion/branches/object-model/subversion/libsvn_wc/relocate.c Fri Sep 24 14:02:50 2010
@@ -76,7 +76,6 @@ svn_wc_relocate4(svn_wc_context_t *wc_ct
const char *local_abspath,
const char *from,
const char *to,
- svn_boolean_t recurse,
svn_wc_relocation_validator3_t validator,
void *validator_baton,
apr_pool_t *scratch_pool)
@@ -87,6 +86,35 @@ svn_wc_relocate4(svn_wc_context_t *wc_ct
const char *old_url;
const char *new_repos_root;
const char *uuid;
+ svn_boolean_t is_wc_root;
+
+ SVN_ERR(svn_wc__strictly_is_wc_root(&is_wc_root, wc_ctx, local_abspath,
+ scratch_pool));
+ if (! is_wc_root)
+ {
+ const char *wcroot_abspath;
+ svn_error_t *err;
+
+ err = svn_wc__db_get_wcroot(&wcroot_abspath, wc_ctx->db,
+ local_abspath, scratch_pool, scratch_pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return svn_error_createf(
+ SVN_ERR_WC_INVALID_OP_ON_CWD, NULL,
+ _("Cannot relocate '%s' as it is not the root of a working copy"),
+ svn_dirent_local_style(local_abspath, scratch_pool));
+ }
+ else
+ {
+ return svn_error_createf(
+ SVN_ERR_WC_INVALID_OP_ON_CWD, NULL,
+ _("Cannot relocate '%s' as it is not the root of a working copy; "
+ "try relocating '%s' instead"),
+ svn_dirent_local_style(local_abspath, scratch_pool),
+ svn_dirent_local_style(wcroot_abspath, scratch_pool));
+ }
+ }
SVN_ERR(svn_wc__db_read_info(NULL, &kind, NULL, &repos_relpath,
&old_repos_root, &uuid,
@@ -112,48 +140,7 @@ svn_wc_relocate4(svn_wc_context_t *wc_ct
SVN_ERR(validator(validator_baton, uuid, to, new_repos_root, scratch_pool));
- /* ### FIXME: This will ultimately cause the DAV cache to be
- recursively cleared, which is great in the recursive case, but
- overreaching otherwise. Granted, this only affects performance,
- and that only for DAV RA implementations that rely on the DAV
- cache. */
- SVN_ERR(svn_wc__db_global_relocate(wc_ctx->db, local_abspath, new_repos_root,
- scratch_pool));
-
- if (!recurse)
- {
- /* This gets sticky. We need to do the above relocation, and then
- relocate each of the children *back* to the original location. Ugh.
- */
- const apr_array_header_t *children;
- apr_pool_t *iterpool;
- int i;
-
- SVN_ERR(svn_wc__db_read_children(&children, wc_ctx->db, local_abspath,
- scratch_pool, scratch_pool));
- iterpool = svn_pool_create(scratch_pool);
- for (i = 0; i < children->nelts; i++)
- {
- const char *child = APR_ARRAY_IDX(children, i, const char *);
- const char *child_abspath;
- const char *child_from;
- const char *child_to;
-
- svn_pool_clear(iterpool);
- child_abspath = svn_dirent_join(local_abspath, child, iterpool);
-
- /* We invert the "from" and "to" because we're switching the
- children back to the original location. */
- child_from = svn_uri_join(to, child, iterpool);
- child_to = svn_uri_join(from, child, iterpool);
-
- SVN_ERR(svn_wc_relocate4(wc_ctx, child_abspath, child_from,
- child_to, TRUE, validator, validator_baton,
- iterpool));
- }
-
- svn_pool_destroy(iterpool);
- }
-
- return SVN_NO_ERROR;
+ return svn_error_return(svn_wc__db_global_relocate(wc_ctx->db, local_abspath,
+ new_repos_root,
+ scratch_pool));
}
Modified: subversion/branches/object-model/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/libsvn_wc/wc-queries.sql?rev=1000876&r1=1000875&r2=1000876&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/object-model/subversion/libsvn_wc/wc-queries.sql Fri Sep 24 14:02:50 2010
@@ -27,309 +27,335 @@
/* these are used in wc_db.c */
-- STMT_SELECT_BASE_NODE
-select repos_id, repos_relpath, presence, kind, revnum, checksum,
+SELECT repos_id, repos_relpath, presence, kind, revnum, checksum,
translated_size, changed_rev, changed_date, changed_author, depth,
symlink_target, last_mod_time, properties
-from base_node
-where wc_id = ?1 and local_relpath = ?2;
+FROM base_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_BASE_NODE_1
-select repos_id, repos_path, presence, kind, revision, checksum,
+SELECT repos_id, repos_path, presence, kind, revision, checksum,
translated_size, changed_revision, changed_date, changed_author, depth,
symlink_target, last_mod_time, properties
-from nodes
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_SELECT_BASE_NODE_WITH_LOCK
-select base_node.repos_id, base_node.repos_relpath, presence, kind,
+SELECT base_node.repos_id, base_node.repos_relpath, presence, kind,
revnum, checksum, translated_size, changed_rev, changed_date,
changed_author, depth, symlink_target, last_mod_time, properties,
lock_token, lock_owner, lock_comment, lock_date
-from base_node
-left outer join lock on base_node.repos_id = lock.repos_id
- and base_node.repos_relpath = lock.repos_relpath
-where wc_id = ?1 and local_relpath = ?2;
+FROM base_node
+LEFT OUTER JOIN lock ON base_node.repos_id = lock.repos_id
+ AND base_node.repos_relpath = lock.repos_relpath
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_BASE_NODE_WITH_LOCK_1
-select nodes.repos_id, nodes.repos_path, presence, kind, revision,
+SELECT nodes.repos_id, nodes.repos_path, presence, kind, revision,
checksum, translated_size, changed_revision, changed_date, changed_author,
depth, symlink_target, last_mod_time, properties, lock_token, lock_owner,
lock_comment, lock_date
-from nodes
-left outer join lock on nodes.repos_id = lock.repos_id
- and nodes.repos_path = lock.repos_relpath
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+FROM nodes
+LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id
+ AND nodes.repos_path = lock.repos_relpath
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_SELECT_WORKING_NODE
-select presence, kind, checksum, translated_size,
+SELECT presence, kind, checksum, translated_size,
changed_rev, changed_date, changed_author, depth, symlink_target,
copyfrom_repos_id, copyfrom_repos_path, copyfrom_revnum,
moved_here, moved_to, last_mod_time, properties
-from working_node
-where wc_id = ?1 and local_relpath = ?2;
+FROM working_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_WORKING_NODE_1
-select presence, kind, checksum, translated_size,
+SELECT presence, kind, checksum, translated_size,
changed_revision, changed_date, changed_author, depth, symlink_target,
repos_id, repos_path, revision,
moved_here, moved_to, last_mod_time, properties
-from nodes
-where wc_id = ?1 and local_relpath = ?2 and op_depth > 0 order by op_depth desc
-limit 1;
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0
+ORDER BY op_depth DESC
+LIMIT 1;
-- STMT_SELECT_ACTUAL_NODE
-select prop_reject, changelist, conflict_old, conflict_new,
+SELECT prop_reject, changelist, conflict_old, conflict_new,
conflict_working, tree_conflict_data, properties
-from actual_node
-where wc_id = ?1 and local_relpath = ?2;
+FROM actual_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_REPOSITORY_BY_ID
-select root, uuid from repository where id = ?1;
+SELECT root, uuid FROM repository WHERE id = ?1;
-- STMT_SELECT_WCROOT_NULL
-select id from wcroot where local_abspath is null;
+SELECT id FROM wcroot WHERE local_abspath IS NULL;
-- STMT_SELECT_REPOSITORY
-select id from repository where root = ?1;
+SELECT id FROM repository WHERE root = ?1;
-- STMT_INSERT_REPOSITORY
-insert into repository (root, uuid) values (?1, ?2);
+INSERT INTO repository (root, uuid) VALUES (?1, ?2);
-- STMT_INSERT_BASE_NODE
-insert or replace into base_node (
+INSERT OR replace INTO base_node (
wc_id, local_relpath, repos_id, repos_relpath, parent_relpath, presence,
kind, revnum, properties, changed_rev, changed_date, changed_author,
depth, checksum, translated_size, symlink_target, dav_cache)
-values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
?15, ?16, ?17);
-- STMT_INSERT_NODE
-insert or replace into nodes (
+INSERT OR REPLACE INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
revision, presence, depth, kind, changed_revision, changed_date,
changed_author, checksum, properties, translated_size, last_mod_time,
dav_cache, symlink_target )
-values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
?15, ?16, ?17, ?18, ?19);
-- STMT_INSERT_BASE_NODE_INCOMPLETE
-insert or ignore into base_node (
+INSERT OR IGNORE INTO base_node (
wc_id, local_relpath, parent_relpath, presence, kind, revnum)
-values (?1, ?2, ?3, 'incomplete', 'unknown', ?4);
+VALUES (?1, ?2, ?3, 'incomplete', 'unknown', ?4);
-- STMT_INSERT_BASE_NODE_INCOMPLETE_DIR
-insert or ignore into base_node (
+INSERT OR IGNORE INTO base_node (
wc_id, local_relpath, repos_id, repos_relpath, parent_relpath, presence,
kind, revnum, depth)
-values (?1, ?2, ?3, ?4, ?5, 'incomplete', 'dir', ?6, ?7);
+VALUES (?1, ?2, ?3, ?4, ?5, 'incomplete', 'dir', ?6, ?7);
-- STMT_INSERT_WORKING_NODE_INCOMPLETE
-INSERT OR IGNORE INTO WORKING_NODE (
+INSERT OR IGNORE INTO working_node (
wc_id, local_relpath, parent_relpath, presence, kind)
VALUES (?1, ?2, ?3, 'incomplete', 'unknown');
-- STMT_COUNT_BASE_NODE_CHILDREN
-SELECT COUNT(*) FROM BASE_NODE
+SELECT COUNT(*) FROM base_node
WHERE wc_id = ?1 AND parent_relpath = ?2;
+-- STMT_COUNT_BASE_NODE_CHILDREN_1
+SELECT COUNT(*) FROM nodes
+WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0;
+
-- STMT_COUNT_WORKING_NODE_CHILDREN
-SELECT COUNT(*) FROM WORKING_NODE
+SELECT COUNT(*) FROM working_node
WHERE wc_id = ?1 AND parent_relpath = ?2;
+-- STMT_COUNT_WORKING_NODE_CHILDREN_1
+SELECT COUNT(*) FROM (SELECT DISTINCT local_relpath FROM nodes
+ WHERE wc_id = ?1 AND parent_relpath = ?2
+ AND op_depth > 0);
+
-- STMT_SELECT_BASE_NODE_CHILDREN
-select local_relpath from base_node
-where wc_id = ?1 and parent_relpath = ?2;
+SELECT local_relpath FROM base_node
+WHERE wc_id = ?1 AND parent_relpath = ?2;
+
+-- STMT_SELECT_BASE_NODE_CHILDREN_1
+SELECT local_relpath FROM nodes
+WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0;
-- STMT_SELECT_WORKING_NODE_CHILDREN
-SELECT local_relpath FROM WORKING_NODE
+SELECT local_relpath FROM working_node
WHERE wc_id = ?1 AND parent_relpath = ?2;
+-- STMT_SELECT_WORKING_NODE_CHILDREN_1
+SELECT DISTINCT local_relpath FROM nodes
+WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth > 0;
+
-- STMT_SELECT_WORKING_IS_FILE
-select kind == 'file' from working_node
-where wc_id = ?1 and local_relpath = ?2;
+SELECT kind == 'file' FROM working_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_BASE_IS_FILE
-select kind == 'file' from base_node
-where wc_id = ?1 and local_relpath = ?2;
+SELECT kind == 'file' FROM base_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_BASE_PROPS
-select properties from base_node
-where wc_id = ?1 and local_relpath = ?2;
+SELECT properties FROM base_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_BASE_PROPS_1
-select properties from nodes
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+SELECT properties FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_SELECT_WORKING_PROPS
-SELECT properties, presence FROM WORKING_NODE
+SELECT properties, presence FROM working_node
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_WORKING_PROPS_1
-SELECT properties, presence FROM NODES
-WHERE wc_id = ?1 AND local_relpath = ?2
-AND op_depth > 0 ORDER BY op_depth DESC LIMIT 1;
+SELECT properties, presence FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0
+ORDER BY op_depth DESC
+LIMIT 1;
-- STMT_SELECT_ACTUAL_PROPS
-select properties from actual_node
-where wc_id = ?1 and local_relpath = ?2;
+SELECT properties FROM actual_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_BASE_PROPS
-update base_node set properties = ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE base_node SET properties = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_NODE_BASE_PROPS
-update nodes set properties = ?3
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET properties = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_WORKING_PROPS
-update working_node set properties = ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE working_node SET properties = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_NODE_WORKING_PROPS
-update nodes set properties = ?3
-where wc_id = ?1 and local_relpath = ?2
- and op_depth in
- (select op_depth from nodes
- where wc_id = ?1 and local_relpath = ?2
- order by op_depth desc
- limit 1);
+UPDATE nodes SET properties = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2
+ AND op_depth =
+ (SELECT MAX(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
-- STMT_UPDATE_ACTUAL_PROPS
-update actual_node set properties = ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE actual_node SET properties = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_ACTUAL_PROPS
-insert into actual_node (wc_id, local_relpath, parent_relpath, properties)
-values (?1, ?2, ?3, ?4);
+INSERT INTO actual_node (wc_id, local_relpath, parent_relpath, properties)
+VALUES (?1, ?2, ?3, ?4);
-- STMT_INSERT_LOCK
-insert or replace into lock
+INSERT OR REPLACE INTO lock
(repos_id, repos_relpath, lock_token, lock_owner, lock_comment,
lock_date)
-values (?1, ?2, ?3, ?4, ?5, ?6);
+VALUES (?1, ?2, ?3, ?4, ?5, ?6);
-- STMT_INSERT_WCROOT
-insert into wcroot (local_abspath)
-values (?1);
+INSERT INTO wcroot (local_abspath)
+VALUES (?1);
-- STMT_UPDATE_BASE_DAV_CACHE
-update base_node set dav_cache = ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE base_node SET dav_cache = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_BASE_NODE_DAV_CACHE
-update nodes set dav_cache = ?3
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET dav_cache = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_SELECT_BASE_DAV_CACHE
-select dav_cache from base_node
-where wc_id = ?1 and local_relpath = ?2;
+SELECT dav_cache FROM base_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_SELECT_DELETION_INFO
-select base_node.presence, working_node.presence, moved_to
-from working_node
-left outer join base_node on base_node.wc_id = working_node.wc_id
- and base_node.local_relpath = working_node.local_relpath
-where working_node.wc_id = ?1 and working_node.local_relpath = ?2;
+SELECT base_node.presence, working_node.presence, moved_to
+FROM working_node
+LEFT OUTER JOIN base_node ON base_node.wc_id = working_node.wc_id
+ AND base_node.local_relpath = working_node.local_relpath
+WHERE working_node.wc_id = ?1 AND working_node.local_relpath = ?2;
+
+-- STMT_SELECT_DELETION_INFO_1
+SELECT nodes_base.presence, nodes_work.presence, nodes_work.moved_to
+FROM nodes nodes_work
+LEFT OUTER JOIN nodes nodes_base ON nodes_base.wc_id = nodes_work.wc_id
+ AND nodes_base.local_relpath = nodes_work.local_relpath
+ AND nodes_base.op_depth = 0
+WHERE nodes_work.wc_id = ?1 AND nodes_work.local_relpath = ?2
+ AND nodes_work.op_depth = (SELECT MAX(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2
+ AND op_depth > 0);
-- STMT_DELETE_LOCK
-delete from lock
-where repos_id = ?1 and repos_relpath = ?2;
+DELETE FROM lock
+WHERE repos_id = ?1 AND repos_relpath = ?2;
-- STMT_CLEAR_BASE_RECURSIVE_DAV_CACHE
-update base_node set dav_cache = null
-where dav_cache is not null and wc_id = ?1 and
- (local_relpath = ?2 or
- local_relpath like ?3 escape '#');
+UPDATE base_node SET dav_cache = NULL
+WHERE dav_cache IS NOT NULL AND wc_id = ?1 AND
+ (local_relpath = ?2 OR
+ local_relpath LIKE ?3 ESCAPE '#');
-- STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE
-update nodes set dav_cache = null
-where dav_cache is not null and wc_id = ?1 and op_depth = 0 and
- (local_relpath = ?2 or
- local_relpath like ?3 escape '#');
+UPDATE nodes SET dav_cache = NULL
+WHERE dav_cache IS NOT NULL AND wc_id = ?1 AND op_depth = 0 AND
+ (local_relpath = ?2 OR
+ local_relpath LIKE ?3 ESCAPE '#');
-- STMT_UPDATE_BASE_RECURSIVE_REPO
-update base_node set repos_id = ?4
-where repos_id is not null and wc_id = ?1 and
- (local_relpath = ?2 or
- local_relpath like ?3 escape '#');
+UPDATE base_node SET repos_id = ?4
+WHERE repos_id IS NOT NULL AND wc_id = ?1 AND
+ (local_relpath = ?2 OR
+ local_relpath LIKE ?3 ESCAPE '#');
-- STMT_UPDATE_WORKING_RECURSIVE_COPYFROM_REPO
-update working_node set copyfrom_repos_id = ?4
-where copyfrom_repos_id is not null and wc_id = ?1 and
- (local_relpath = ?2 or
- local_relpath like ?3 escape '#');
+UPDATE working_node SET copyfrom_repos_id = ?4
+WHERE copyfrom_repos_id IS NOT NULL AND wc_id = ?1 AND
+ (local_relpath = ?2 OR
+ local_relpath LIKE ?3 ESCAPE '#');
-- STMT_RECURSIVE_UPDATE_NODE_REPO
-update NODES set repos_id = ?5, dav_cache = null
-where wc_id = ?1 and repos_id = ?4 and
+UPDATE nodes SET repos_id = ?5, dav_cache = NULL
+WHERE wc_id = ?1 AND repos_id = ?4 AND
(local_relpath = ?2
- or local_relpath like ?3 escape '#');
+ OR local_relpath LIKE ?3 ESCAPE '#');
-- STMT_UPDATE_LOCK_REPOS_ID
-update lock set repos_id = ?4
-where repos_id = ?1 and
- (repos_relpath = ?2 or
- repos_relpath like ?3 escape '#');
+UPDATE lock SET repos_id = ?4
+WHERE repos_id = ?1 AND
+ (repos_relpath = ?2 OR
+ repos_relpath LIKE ?3 ESCAPE '#');
-- STMT_UPDATE_BASE_FILEINFO
-UPDATE BASE_NODE SET translated_size = ?3, last_mod_time = ?4
+UPDATE base_node SET translated_size = ?3, last_mod_time = ?4
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_BASE_NODE_FILEINFO
-update nodes set translated_size = ?3, last_mod_time = ?4
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET translated_size = ?3, last_mod_time = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_WORKING_FILEINFO
-UPDATE WORKING_NODE SET translated_size = ?3, last_mod_time = ?4
+UPDATE working_node SET translated_size = ?3, last_mod_time = ?4
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_WORKING_NODE_FILEINFO
-update nodes set translated_size = ?3, last_mod_time = ?4
-where wc_id = ?1 and local_relpath = ?2
- and op_depth = (select op_depth from nodes
- where wc_id = ?1 and local_relpath = ?2
- order by op_depth desc
- limit 1);
+UPDATE nodes SET translated_size = ?3, last_mod_time = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2
+ AND op_depth = (SELECT MAX(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
-- STMT_UPDATE_ACTUAL_TREE_CONFLICTS
-update actual_node set tree_conflict_data = ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE actual_node SET tree_conflict_data = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_ACTUAL_TREE_CONFLICTS
/* tree conflicts are always recorded on the wcroot node, so the
parent_relpath will be null. */
-insert into actual_node (
+INSERT INTO actual_node (
wc_id, local_relpath, tree_conflict_data)
-values (?1, ?2, ?3);
+VALUES (?1, ?2, ?3);
-- STMT_UPDATE_ACTUAL_TEXT_CONFLICTS
-update actual_node set conflict_old = ?3, conflict_new = ?4,
-conflict_working = ?5
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE actual_node SET conflict_old = ?3, conflict_new = ?4,
+ conflict_working = ?5
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_ACTUAL_TEXT_CONFLICTS
-insert into actual_node (
+INSERT INTO actual_node (
wc_id, local_relpath, conflict_old, conflict_new, conflict_working,
parent_relpath)
-values (?1, ?2, ?3, ?4, ?5, ?6);
+VALUES (?1, ?2, ?3, ?4, ?5, ?6);
-- STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS
-update actual_node set prop_reject = ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE actual_node SET prop_reject = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS
-insert into actual_node (
+INSERT INTO actual_node (
wc_id, local_relpath, prop_reject, parent_relpath)
-values (?1, ?2, ?3, ?4);
+VALUES (?1, ?2, ?3, ?4);
-- STMT_UPDATE_ACTUAL_CHANGELIST
-update actual_node set changelist = ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE actual_node SET changelist = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_ACTUAL_CHANGELIST
-insert into actual_node (
+INSERT INTO actual_node (
wc_id, local_relpath, changelist, parent_relpath)
-values (?1, ?2, ?3, ?4);
+VALUES (?1, ?2, ?3, ?4);
-- STMT_RESET_ACTUAL_WITH_CHANGELIST
REPLACE INTO actual_node (
@@ -337,127 +363,121 @@ REPLACE INTO actual_node (
VALUES (?1, ?2, ?3, ?4);
-- STMT_DELETE_BASE_NODE
-delete from base_node
-where wc_id = ?1 and local_relpath = ?2;
+DELETE FROM base_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_DELETE_BASE_NODE_1
-delete from nodes
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+DELETE FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_DELETE_WORKING_NODE
-delete from working_node
-where wc_id = ?1 and local_relpath = ?2;
+DELETE FROM working_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_DELETE_WORKING_NODES
-delete from nodes
-where wc_id = ?1 and local_relpath = ?2 and op_depth > 0;
+DELETE FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0;
-- STMT_DELETE_NODES
-delete from nodes
-where wc_id = ?1 and local_relpath = ?2;
+DELETE FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_DELETE_ACTUAL_NODE
-delete from actual_node
-where wc_id = ?1 and local_relpath = ?2;
+DELETE FROM actual_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_BASE_DEPTH
-UPDATE BASE_NODE SET depth = ?3
+UPDATE base_node SET depth = ?3
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_NODE_BASE_DEPTH
-update NODES set depth = ?3
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET depth = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_WORKING_DEPTH
-UPDATE WORKING_NODE SET depth = ?3
+UPDATE working_node SET depth = ?3
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_NODE_WORKING_DEPTH
-update NODES set depth = ?3
-where wc_id = ?1 and local_relpath = ?2 and
- op_depth in (select op_depth from NODES
- where wc_id = ?1 and local_relpath = ?2
- order by op_depth desc
- limit 1);
+UPDATE nodes SET depth = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2 AND
+ op_depth = (SELECT MAX(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
-- STMT_UPDATE_BASE_EXCLUDED
-UPDATE BASE_NODE SET presence = 'excluded', depth = NULL
+UPDATE base_node SET presence = 'excluded', depth = NULL
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_NODE_BASE_EXCLUDED
-update NODES set presence = 'excluded', depth = NULL
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET presence = 'excluded', depth = NULL
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_WORKING_EXCLUDED
-UPDATE WORKING_NODE SET presence = 'excluded', depth = NULL
+UPDATE working_node SET presence = 'excluded', depth = NULL
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_NODE_WORKING_EXCLUDED
-update nodes SET presence = 'excluded', depth = NULL
-where wc_id = ?1 and local_relpath = ?2 and
- op_depth IN (select op_depth from NODES
- where wc_id = ?1 and local_relpath = ?2
- order by op_depth DECSC
- limit 1);
+UPDATE nodes SET presence = 'excluded', depth = NULL
+WHERE wc_id = ?1 AND local_relpath = ?2 AND
+ op_depth = (SELECT MAX(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2);
-- STMT_UPDATE_BASE_PRESENCE
-update base_node set presence= ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE base_node SET presence= ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_NODE_BASE_PRESENCE
-update nodes set presence = ?3
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET presence = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_BASE_PRESENCE_KIND
-update base_node set presence = ?3, kind = ?4
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE base_node SET presence = ?3, kind = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_NODE_BASE_PRESENCE_KIND
-update nodes set presence = ?3, kind = ?4
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET presence = ?3, kind = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_WORKING_PRESENCE
-update working_node set presence = ?3
-where wc_id = ?1 and local_relpath =?2;
+UPDATE working_node SET presence = ?3
+WHERE wc_id = ?1 AND local_relpath =?2;
-- STMT_UPDATE_NODE_WORKING_PRESENCE
-update nodes set presence = ?3
-where wc_id = ?1 and local_relpath = ?2
- and op_depth in (select op_depth from nodes
- where wc_id = ?1 and local_relpath = ?2
- order by op_depth desc
- limit 1);
+UPDATE nodes SET presence = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2
+ AND op_depth = (SELECT MAX(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
-- STMT_UPDATE_BASE_PRESENCE_AND_REVNUM
-update base_node set presence = ?3, revnum = ?4
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE base_node SET presence = ?3, revnum = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_BASE_NODE_PRESENCE_AND_REVNUM
-update nodes set presence = ?3, revision = ?4
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET presence = ?3, revision = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_BASE_PRESENCE_REVNUM_AND_REPOS_RELPATH
-update base_node set presence = ?3, revnum = ?4, repos_relpath = ?5
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE base_node SET presence = ?3, revnum = ?4, repos_relpath = ?5
+WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH
-update nodes set presence = ?3, revision = ?4, repos_path = ?5
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET presence = ?3, revision = ?4, repos_path = ?5
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_LOOK_FOR_WORK
-SELECT id FROM WORK_QUEUE LIMIT 1;
+SELECT id FROM work_queue LIMIT 1;
-- STMT_INSERT_WORK_ITEM
-INSERT INTO WORK_QUEUE (work) values (?1);
+INSERT INTO work_queue (work) VALUES (?1);
-- STMT_SELECT_WORK_ITEM
-SELECT id, work FROM WORK_QUEUE ORDER BY id LIMIT 1;
+SELECT id, work FROM work_queue ORDER BY id LIMIT 1;
-- STMT_DELETE_WORK_ITEM
-DELETE FROM WORK_QUEUE WHERE id = ?1;
+DELETE FROM work_queue WHERE id = ?1;
-- STMT_INSERT_PRISTINE
-INSERT OR IGNORE INTO PRISTINE (checksum, md5_checksum, size, refcount)
+INSERT OR IGNORE INTO pristine (checksum, md5_checksum, size, refcount)
VALUES (?1, ?2, ?3, 1);
-- STMT_SELECT_PRISTINE_MD5_CHECKSUM
@@ -487,16 +507,26 @@ SELECT 1 FROM actual_node
OR right_checksum = ?1 OR right_checksum = ?2
LIMIT 1
+-- STMT_SELECT_ANY_PRISTINE_REFERENCE_1
+SELECT 1 FROM nodes
+ WHERE checksum = ?1 OR checksum = ?2
+UNION ALL
+SELECT 1 FROM actual_node
+ WHERE older_checksum = ?1 OR older_checksum = ?2
+ OR left_checksum = ?1 OR left_checksum = ?2
+ OR right_checksum = ?1 OR right_checksum = ?2
+LIMIT 1
+
-- STMT_DELETE_PRISTINE
-DELETE FROM PRISTINE
+DELETE FROM pristine
WHERE checksum = ?1
-- STMT_SELECT_ACTUAL_CONFLICT_VICTIMS
SELECT local_relpath
FROM actual_node
WHERE wc_id = ?1 AND parent_relpath = ?2 AND
-NOT((prop_reject IS NULL) AND (conflict_old IS NULL)
- AND (conflict_new IS NULL) AND (conflict_working IS NULL))
+ NOT ((prop_reject IS NULL) AND (conflict_old IS NULL)
+ AND (conflict_new IS NULL) AND (conflict_working IS NULL))
-- STMT_SELECT_ACTUAL_TREE_CONFLICT
SELECT tree_conflict_data
@@ -509,74 +539,75 @@ FROM actual_node
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_CLEAR_TEXT_CONFLICT
-UPDATE ACTUAL_NODE SET
- conflict_old = null,
- conflict_new = null,
- conflict_working = null
+UPDATE actual_node SET
+ conflict_old = NULL,
+ conflict_new = NULL,
+ conflict_working = NULL
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_CLEAR_PROPS_CONFLICT
-UPDATE ACTUAL_NODE SET
- prop_reject = null
+UPDATE actual_node SET
+ prop_reject = NULL
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_WC_LOCK
-INSERT INTO WC_LOCK (wc_id, local_dir_relpath, locked_levels)
+INSERT INTO wc_lock (wc_id, local_dir_relpath, locked_levels)
VALUES (?1, ?2, ?3);
-- STMT_SELECT_WC_LOCK
-SELECT locked_levels FROM WC_LOCK
+SELECT locked_levels FROM wc_lock
WHERE wc_id = ?1 AND local_dir_relpath = ?2;
-- STMT_DELETE_WC_LOCK
-DELETE FROM WC_LOCK
+DELETE FROM wc_lock
WHERE wc_id = ?1 AND local_dir_relpath = ?2;
-- STMT_FIND_WC_LOCK
-SELECT local_dir_relpath FROM WC_LOCK
+SELECT local_dir_relpath FROM wc_lock
WHERE wc_id = ?1 AND local_dir_relpath LIKE ?2 ESCAPE '#';
-- STMT_APPLY_CHANGES_TO_BASE
/* translated_size and last_mod_time are not mentioned here because they will
be tweaked after the working-file is installed.
### what to do about file_external? */
-INSERT OR REPLACE INTO BASE_NODE (
+INSERT OR REPLACE INTO base_node (
wc_id, local_relpath, parent_relpath, presence, kind, revnum, changed_rev,
changed_author, properties, repos_id, repos_relpath, checksum, changed_date,
depth, symlink_target, dav_cache)
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16);
-- STMT_APPLY_CHANGES_TO_BASE_NODE
-insert or replace into NODES (
+INSERT OR REPLACE INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
revision, presence, depth, kind, changed_revision, changed_date,
changed_author, checksum, properties, dav_cache, symlink_target )
-values (?1, ?2, 0,
+VALUES (?1, ?2, 0,
?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16);
-- STMT_INSERT_WORKING_NODE_FROM_BASE_NODE
-INSERT INTO WORKING_NODE (
+INSERT INTO working_node (
wc_id, local_relpath, parent_relpath, presence, kind, checksum,
translated_size, changed_rev, changed_date, changed_author, depth,
symlink_target, last_mod_time )
SELECT wc_id, local_relpath, parent_relpath, ?3 AS presence, kind, checksum,
translated_size, changed_rev, changed_date, changed_author, depth,
- symlink_target, last_mod_time FROM BASE_NODE
+ symlink_target, last_mod_time
+FROM base_node
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_WORKING_NODE_FROM_BASE
-INSERT INTO NODES (
+INSERT INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, presence, kind, checksum,
changed_revision, changed_date, changed_author, depth, symlink_target,
translated_size, last_mod_time, properties)
-SELECT wc_id, local_relpath, ?3 as op_depth, parent_relpath, ?4 as presence,
+SELECT wc_id, local_relpath, ?3 AS op_depth, parent_relpath, ?4 AS presence,
kind, checksum, changed_revision, changed_date, changed_author, depth,
symlink_target, translated_size, last_mod_time, properties
-FROM NODES
+FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE_NODE
-INSERT INTO WORKING_NODE (
+INSERT INTO working_node (
wc_id, local_relpath, parent_relpath, presence, kind, checksum,
translated_size, changed_rev, changed_date, changed_author, depth,
symlink_target, last_mod_time, properties, copyfrom_repos_id,
@@ -584,86 +615,84 @@ INSERT INTO WORKING_NODE (
SELECT wc_id, local_relpath, parent_relpath, 'normal', kind, checksum,
translated_size, changed_rev, changed_date, changed_author, depth,
symlink_target, last_mod_time, properties, repos_id,
- repos_relpath, revnum FROM BASE_NODE
+ repos_relpath, revnum
+FROM base_node
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE
-insert into NODES (
+INSERT INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
revision, presence, depth, kind, changed_revision, changed_date,
changed_author, checksum, properties, translated_size, last_mod_time,
symlink_target )
-select wc_id, local_relpath, ?3 as op_depth, parent_relpath, repos_id,
+SELECT wc_id, local_relpath, ?3 AS op_depth, parent_relpath, repos_id,
repos_path, revision, 'normal', depth, kind, changed_revision,
changed_date, changed_author, checksum, properties, translated_size,
last_mod_time, symlink_target
-from NODES
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_INSERT_WORKING_NODE_NOT_PRESENT_FROM_BASE_NODE
-INSERT INTO WORKING_NODE (
+INSERT INTO working_node (
wc_id, local_relpath, parent_relpath, presence, kind, changed_rev,
changed_date, changed_author, copyfrom_repos_id,
copyfrom_repos_path, copyfrom_revnum )
SELECT wc_id, local_relpath, parent_relpath, 'not-present', kind, changed_rev,
changed_date, changed_author, repos_id,
- repos_relpath, revnum FROM BASE_NODE
+ repos_relpath, revnum
+FROM base_node
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_WORKING_NODE_NOT_PRESENT_FROM_BASE
-insert into NODES (
+INSERT INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
revision, presence, kind, changed_revision, changed_date, changed_author )
-select wc_id, local_relpath, ?3 as op_depth, parent_relpath, repos_id,
+SELECT wc_id, local_relpath, ?3 as op_depth, parent_relpath, repos_id,
repos_path, revision, 'not-present', kind, changed_revision,
changed_date, changed_author
-from NODES
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- ### the statement below should be setting copyfrom_revision!
-- STMT_UPDATE_COPYFROM
-UPDATE WORKING_NODE set copyfrom_repos_id = ?3, copyfrom_repos_path = ?4
+UPDATE working_node SET copyfrom_repos_id = ?3, copyfrom_repos_path = ?4
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_COPYFROM_TO_INHERIT
-UPDATE WORKING_NODE SET
- copyfrom_repos_id = null,
- copyfrom_repos_path = null,
- copyfrom_revnum = null
+UPDATE working_node SET
+ copyfrom_repos_id = NULL,
+ copyfrom_repos_path = NULL,
+ copyfrom_revnum = NULL
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_COPYFROM_TO_INHERIT_1
-UPDATE NODES SET
- repos_id = null,
- repos_path = null,
- revision = null
+UPDATE nodes SET
+ repos_id = NULL,
+ repos_path = NULL,
+ revision = NULL
WHERE wc_id = ?1 AND local_relpath = ?2
- AND op_depth IN (SELECT op_depth FROM nodes
- WHERE wc_id = ?1 AND local_relpath = ?2
- ORDER BY op_depth DESC
- LIMIT 1);
+ AND op_depth = (SELECT MAX(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
-- STMT_DETERMINE_TREE_FOR_RECORDING
-SELECT 0 FROM BASE_NODE WHERE wc_id = ?1 AND local_relpath = ?2
+SELECT 0 FROM base_node WHERE wc_id = ?1 AND local_relpath = ?2
UNION
-SELECT 1 FROM WORKING_NODE WHERE wc_id = ?1 AND local_relpath = ?2;
+SELECT 1 FROM working_node WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_DETERMINE_TREE_FOR_RECORDING_1
-SELECT 0 FROM NODES WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
+SELECT 0 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
UNION
-SELECT 1 FROM NODES WHERE wc_id = ?1 AND local_relpath = ?2
- AND op_depth IN (SELECT op_depth FROM nodes
- WHERE wc_id = ?1 AND local_relpath = ?2
- ORDER BY op_depth DESC
- LIMIT 1);
+SELECT 1 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2
+ AND op_depth = (SELECT MAX(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
/* ### Why can't this query not just use the BASE repository
location values, instead of taking 3 additional parameters?! */
-- STMT_INSERT_WORKING_NODE_COPY_FROM_BASE
-INSERT OR REPLACE INTO WORKING_NODE (
+INSERT OR REPLACE INTO working_node (
wc_id, local_relpath, parent_relpath, presence, kind, checksum,
translated_size, changed_rev, changed_date, changed_author, depth,
symlink_target, last_mod_time, properties, copyfrom_repos_id,
@@ -671,24 +700,25 @@ INSERT OR REPLACE INTO WORKING_NODE (
SELECT wc_id, ?3 AS local_relpath, ?4 AS parent_relpath, ?5 AS presence, kind,
checksum, translated_size, changed_rev, changed_date, changed_author, depth,
symlink_target, last_mod_time, properties, ?6 AS copyfrom_repos_id,
- ?7 AS copyfrom_repos_path, ?8 AS copyfrom_revnum FROM BASE_NODE
+ ?7 AS copyfrom_repos_path, ?8 AS copyfrom_revnum
+FROM base_node
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_WORKING_NODE_COPY_FROM_BASE_1
-insert or replace into NODES (
+INSERT OR REPLACE INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id,
repos_path, revision, presence, depth, kind, changed_revision,
changed_date, changed_author, checksum, properties, translated_size,
last_mod_time, symlink_target )
-select wc_id, ?3 as local_relpath, ?4 as op_depth, ?5 as parent_relpath,
- ?6 as repos_id, ?7 as repos_path, ?8 as revision, ?9 as presence, depth,
+SELECT wc_id, ?3 AS local_relpath, ?4 AS op_depth, ?5 AS parent_relpath,
+ ?6 AS repos_id, ?7 AS repos_path, ?8 AS revision, ?9 AS presence, depth,
kind, changed_revision, changed_date, changed_author, checksum, properties,
translated_size, last_mod_time, symlink_target
-from NODES
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING
-INSERT OR REPLACE INTO WORKING_NODE (
+INSERT OR REPLACE INTO working_node (
wc_id, local_relpath, parent_relpath, presence, kind, checksum,
translated_size, changed_rev, changed_date, changed_author, depth,
symlink_target, last_mod_time, properties, copyfrom_repos_id,
@@ -696,165 +726,176 @@ INSERT OR REPLACE INTO WORKING_NODE (
SELECT wc_id, ?3 AS local_relpath, ?4 AS parent_relpath, ?5 AS presence, kind,
checksum, translated_size, changed_rev, changed_date, changed_author, depth,
symlink_target, last_mod_time, properties, ?6 AS copyfrom_repos_id,
- ?7 AS copyfrom_repos_path, ?8 AS copyfrom_revnum FROM WORKING_NODE
+ ?7 AS copyfrom_repos_path, ?8 AS copyfrom_revnum
+FROM working_node
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING_1
-insert or replace into NODES (
+INSERT OR REPLACE INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
revision, presence, depth, kind, changed_revision, changed_date,
changed_author, checksum, properties, translated_size, last_mod_time,
symlink_target )
-select wc_id, ?3 as local_relpath, ?4 as op_depth, ?5 as parent_relpath,
- ?6 as repos_id, ?7 as repos_path, ?8 as revision, ?9 as presence, depth,
+SELECT wc_id, ?3 AS local_relpath, ?4 AS op_depth, ?5 AS parent_relpath,
+ ?6 AS repos_id, ?7 AS repos_path, ?8 AS revision, ?9 AS presence, depth,
kind, changed_revision, changed_date, changed_author, checksum, properties,
translated_size, last_mod_time, symlink_target
-from NODES
-where wc_id = ?1 and local_relpath = ?2
-order by op_depth desc
-limit 1;
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0
+ORDER BY op_depth DESC
+LIMIT 1;
-- STMT_INSERT_ACTUAL_NODE_FROM_ACTUAL_NODE
-INSERT OR REPLACE INTO ACTUAL_NODE (
+INSERT OR REPLACE INTO actual_node (
wc_id, local_relpath, parent_relpath, properties,
conflict_old, conflict_new, conflict_working,
prop_reject, changelist, text_mod, tree_conflict_data )
SELECT wc_id, ?3 AS local_relpath, ?4 AS parent_relpath, properties,
conflict_old, conflict_new, conflict_working,
- prop_reject, changelist, text_mod, tree_conflict_data FROM ACTUAL_NODE
+ prop_reject, changelist, text_mod, tree_conflict_data
+FROM actual_node
WHERE wc_id = ?1 AND local_relpath = ?2;
--- STMT_SELECT_SUBDIR
-SELECT 1 FROM BASE_NODE WHERE wc_id = ?1 and local_relpath = ?2 and kind = 'subdir'
-UNION
-SELECT 0 FROM WORKING_NODE WHERE wc_id = ?1 and local_relpath = ?2 and kind = 'subdir';
-
-- STMT_UPDATE_BASE_REVISION
-UPDATE BASE_NODE SET revnum=?3
+UPDATE base_node SET revnum = ?3
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_BASE_REVISION_1
-update nodes set revision = ?3
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET revision = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_BASE_REPOS
-UPDATE BASE_NODE SET repos_id = ?3, repos_relpath = ?4
+UPDATE base_node SET repos_id = ?3, repos_relpath = ?4
WHERE wc_id = ?1 AND local_relpath = ?2;
-- STMT_UPDATE_BASE_REPOS_1
-update nodes set repos_id = ?3, repos_path = ?4
-where wc_id = ?1 and local_relpath = ?2 and op_depth = 0;
+UPDATE nodes SET repos_id = ?3, repos_path = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
/* ------------------------------------------------------------------------- */
/* these are used in entries.c */
-- STMT_INSERT_BASE_NODE_FOR_ENTRY
-insert or replace into base_node (
+INSERT OR REPLACE INTO base_node (
wc_id, local_relpath, repos_id, repos_relpath, parent_relpath,
presence,
revnum, kind, checksum, translated_size, changed_rev, changed_date,
changed_author, depth, last_mod_time, properties)
-values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
?15, ?16);
-- STMT_INSERT_BASE_NODE_FOR_ENTRY_1
/* The BASE tree has a fixed op_depth '0' */
-insert or replace into nodes (
+INSERT OR REPLACE INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
revision, presence, kind, checksum,
changed_revision, changed_date, changed_author, depth, properties,
translated_size, last_mod_time )
-values (?1, ?2, 0, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13,
+VALUES (?1, ?2, 0, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13,
?14, ?15, ?16 );
-- STMT_INSERT_WORKING_NODE
-insert or replace into working_node (
+INSERT OR REPLACE INTO working_node (
wc_id, local_relpath, parent_relpath, presence, kind,
copyfrom_repos_id,
copyfrom_repos_path, copyfrom_revnum, moved_here, moved_to, checksum,
translated_size, changed_rev, changed_date, changed_author, depth,
last_mod_time, properties, keep_local, symlink_target)
-values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
?15, ?16, ?17, ?18, ?19, ?20);
-- STMT_INSERT_WORKING_NODE_DATA_1
-insert or replace into node_data (
+INSERT OR REPLACE INTO node_data (
wc_id, local_relpath, op_depth, parent_relpath, presence, kind,
original_repos_id, original_repos_path, original_revision, checksum,
changed_revision, changed_date, changed_author, depth, properties,
symlink_target )
-values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9,
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9,
?10, ?11, ?12, ?13, ?14, ?15, ?16 );
-- STMT_INSERT_WORKING_NODE_DATA_2
-insert or replace into working_node (
+INSERT OR REPLACE INTO working_node (
wc_id, local_relpath, parent_relpath, moved_here, moved_to, translated_size,
last_mod_time, keep_local )
-values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8 );
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8 );
-- STMT_INSERT_ACTUAL_NODE
-insert or replace into actual_node (
+INSERT OR REPLACE INTO actual_node (
wc_id, local_relpath, parent_relpath, properties, conflict_old,
conflict_new,
conflict_working, prop_reject, changelist, text_mod,
tree_conflict_data)
-values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11);
-
--- STMT_SELECT_KEEP_LOCAL_FLAG
-select keep_local from working_node
-where wc_id = ?1 and local_relpath = ?2;
-
--- STMT_UPDATE_KEEP_LOCAL_FLAG
-update working_node set keep_local= ?3
-where wc_id = ?1 and local_relpath = ?2;
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11);
-- STMT_SELECT_NOT_PRESENT
-select 1 from base_node
-where wc_id = ?1 and local_relpath = ?2 and presence = 'not-present';
+SELECT 1 FROM base_node
+WHERE wc_id = ?1 AND local_relpath = ?2 AND presence = 'not-present';
+
+-- STMT_SELECT_NOT_PRESENT_1
+SELECT 1 FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND presence = 'not-present'
+ AND op_depth = 0;
-- STMT_SELECT_FILE_EXTERNAL
-select file_external from base_node
-where wc_id = ?1 and local_relpath = ?2;
+SELECT file_external FROM base_node
+WHERE wc_id = ?1 AND local_relpath = ?2;
+
+-- STMT_SELECT_FILE_EXTERNAL_1
+SELECT file_external FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-- STMT_UPDATE_FILE_EXTERNAL
-update base_node set file_external = ?3
-where wc_id = ?1 and local_relpath = ?2;
+UPDATE base_node SET file_external = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
+
+-- STMT_UPDATE_FILE_EXTERNAL_1
+UPDATE nodes SET file_external = ?3
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
/* ------------------------------------------------------------------------- */
/* these are used in upgrade.c */
-- STMT_SELECT_OLD_TREE_CONFLICT
-select wc_id, local_relpath, tree_conflict_data
-from actual_node
-where tree_conflict_data is not null;
+SELECT wc_id, local_relpath, tree_conflict_data
+FROM actual_node
+WHERE tree_conflict_data IS NOT NULL;
-- STMT_INSERT_NEW_CONFLICT
-insert into conflict_victim (
+INSERT INTO conflict_victim (
wc_id, local_relpath, parent_relpath, node_kind, conflict_kind,
property_name, conflict_action, conflict_reason, operation,
left_repos_id, left_repos_relpath, left_peg_rev, left_kind,
right_repos_id, right_repos_relpath, right_peg_rev, right_kind)
-values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15,
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15,
?16, ?17);
-- STMT_ERASE_OLD_CONFLICTS
-update actual_node set tree_conflict_data = null;
+UPDATE actual_node SET tree_conflict_data = NULL;
-- STMT_SELECT_ALL_FILES
/* Should this select on wc_id as well? */
-SELECT local_relpath FROM BASE_NODE
+SELECT local_relpath FROM base_node
WHERE kind = 'file' AND parent_relpath = ?1
UNION
-SELECT local_relpath FROM WORKING_NODE
+SELECT local_relpath FROM working_node
WHERE kind = 'file' AND parent_relpath = ?1;
-- STMT_PLAN_PROP_UPGRADE
-SELECT 0, presence, wc_id FROM BASE_NODE WHERE local_relpath = ?1
+SELECT 0, presence, wc_id FROM base_node WHERE local_relpath = ?1
+UNION ALL
+SELECT 1, presence, wc_id FROM working_node WHERE local_relpath = ?1;
+
+-- STMT_PLAN_PROP_UPGRADE_1
+SELECT 0, nodes_base.presence, nodes_base.wc_id FROM nodes nodes_base
+WHERE nodes_base.local_relpath = ?1 AND nodes_base.op_depth = 0
UNION ALL
-SELECT 1, presence, wc_id FROM WORKING_NODE WHERE local_relpath = ?1;
+SELECT 1, nodes_work.presence, nodes_work.wc_id FROM nodes nodes_work
+WHERE nodes_work.local_relpath = ?1
+ AND nodes_work.op_depth = (SELECT MAX(op_depth) FROM nodes
+ WHERE local_relpath = ?1 AND op_depth > 0);
/* ------------------------------------------------------------------------- */