You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/06/27 17:13:42 UTC
svn commit: r1354571 [23/37] - in /subversion/branches/master-passphrase: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ contrib/client-side/emacs/ contrib/server-side/ notes/
notes/api-errata/1.8/ notes/directory-i...
Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/status.c?rev=1354571&r1=1354570&r2=1354571&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/status.c Wed Jun 27 15:12:37 2012
@@ -41,6 +41,7 @@
#include "svn_config.h"
#include "svn_time.h"
#include "svn_hash.h"
+#include "svn_sorts.h"
#include "svn_private_config.h"
@@ -949,6 +950,9 @@ send_status_structure(const struct walk_
IGNORES is a list of patterns to include; typically this will
be the default ignores as, for example, specified in a config file.
+ If MAY_HAVE_PROPS is false, local_abspath is assumed to have no
+ properties.
+
LOCAL_ABSPATH and DB control how to access the ignore information.
Allocate results in RESULT_POOL, temporary stuffs in SCRATCH_POOL.
@@ -960,11 +964,13 @@ collect_ignore_patterns(apr_array_header
svn_wc__db_t *db,
const char *local_abspath,
const apr_array_header_t *ignores,
+ svn_boolean_t may_have_props,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
int i;
const svn_string_t *value;
+ apr_hash_t *props;
/* ### assert we are passed a directory? */
@@ -978,9 +984,18 @@ collect_ignore_patterns(apr_array_header
ignore);
}
+ if (!may_have_props)
+ return SVN_NO_ERROR;
+
/* Then add any svn:ignore globs to the PATTERNS array. */
- SVN_ERR(svn_wc__internal_propget(&value, db, local_abspath, SVN_PROP_IGNORE,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__db_read_props(&props, db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ if (!props)
+ return SVN_NO_ERROR;
+
+ value = apr_hash_get(props, SVN_PROP_IGNORE, APR_HASH_KEY_STRING);
+
if (value != NULL)
svn_cstring_split_append(*patterns, value->data, "\n\r", FALSE,
result_pool);
@@ -1120,6 +1135,8 @@ get_dir_status(const struct walk_status_
* DIR_REPOS_* should reflect LOCAL_ABSPATH's parent URL, i.e. LOCAL_ABSPATH's
* URL treated with svn_uri_dirname(). ### TODO verify this (externals)
*
+ * DIR_HAS_PROPS is a boolean indicating whether PARENT_ABSPATH has properties.
+ *
* If *COLLECTED_IGNORE_PATTERNS is NULL and ignore patterns are needed in
* this call, *COLLECTED_IGNORE_PATTERNS will be set to an apr_array_header_t*
* containing all ignore patterns, as returned by collect_ignore_patterns() on
@@ -1140,6 +1157,7 @@ one_child_status(const struct walk_statu
const char *dir_repos_root_url,
const char *dir_repos_relpath,
const char *dir_repos_uuid,
+ svn_boolean_t dir_has_props,
svn_boolean_t unversioned_tree_conflicted,
apr_array_header_t **collected_ignore_patterns,
const apr_array_header_t *ignore_patterns,
@@ -1227,6 +1245,7 @@ one_child_status(const struct walk_statu
if (ignore_patterns && ! *collected_ignore_patterns)
SVN_ERR(collect_ignore_patterns(collected_ignore_patterns, wb->db,
parent_abspath, ignore_patterns,
+ dir_has_props,
result_pool, scratch_pool));
SVN_ERR(send_unversioned_item(wb,
@@ -1280,14 +1299,16 @@ get_dir_status(const struct walk_status_
void *cancel_baton,
apr_pool_t *scratch_pool)
{
- apr_hash_index_t *hi;
const char *dir_repos_root_url;
const char *dir_repos_relpath;
const char *dir_repos_uuid;
+ svn_boolean_t dir_has_props;
apr_hash_t *dirents, *nodes, *conflicts, *all_children;
+ apr_array_header_t *sorted_children;
apr_array_header_t *collected_ignore_patterns = NULL;
apr_pool_t *iterpool, *subpool = svn_pool_create(scratch_pool);
svn_error_t *err;
+ int i;
if (cancel_func)
SVN_ERR(cancel_func(cancel_baton));
@@ -1368,21 +1389,28 @@ get_dir_status(const struct walk_status_
if (depth == svn_depth_empty)
return SVN_NO_ERROR;
+ dir_has_props = (dir_info->had_props || dir_info->props_mod);
+
/* Walk all the children of this directory. */
- for (hi = apr_hash_first(subpool, all_children); hi; hi = apr_hash_next(hi))
+ sorted_children = svn_sort__hash(all_children,
+ svn_sort_compare_items_lexically,
+ subpool);
+ for (i = 0; i < sorted_children->nelts; i++)
{
const void *key;
apr_ssize_t klen;
+ svn_sort__item_t item;
const char *child_abspath;
svn_io_dirent2_t *child_dirent;
const struct svn_wc__db_info_t *child_info;
svn_pool_clear(iterpool);
- apr_hash_this(hi, &key, &klen, NULL);
+ item = APR_ARRAY_IDX(sorted_children, i, svn_sort__item_t);
+ key = item.key;
+ klen = item.klen;
child_abspath = svn_dirent_join(local_abspath, key, iterpool);
-
child_dirent = apr_hash_get(dirents, key, klen);
child_info = apr_hash_get(nodes, key, klen);
@@ -1394,6 +1422,7 @@ get_dir_status(const struct walk_status_
dir_repos_root_url,
dir_repos_relpath,
dir_repos_uuid,
+ dir_has_props,
apr_hash_get(conflicts, key, klen) != NULL,
&collected_ignore_patterns,
ignore_patterns,
@@ -1480,6 +1509,7 @@ get_child_status(const struct walk_statu
dir_repos_root_url,
dir_repos_relpath,
dir_repos_uuid,
+ (dir_info->had_props || dir_info->props_mod),
FALSE, /* unversioned_tree_conflicted */
&collected_ignore_patterns,
ignore_patterns,
@@ -1553,7 +1583,6 @@ tweak_statushash(void *baton,
svn_boolean_t is_dir_baton,
svn_wc__db_t *db,
const char *local_abspath,
- svn_boolean_t is_dir,
enum svn_wc_status_kind repos_node_status,
enum svn_wc_status_kind repos_text_status,
enum svn_wc_status_kind repos_prop_status,
@@ -1642,7 +1671,7 @@ tweak_statushash(void *baton,
isn't available. */
if (statstruct->repos_node_status == svn_wc_status_deleted)
{
- statstruct->ood_kind = is_dir ? svn_node_dir : svn_node_file;
+ statstruct->ood_kind = statstruct->kind;
/* Pre 1.5 servers don't provide the revision a path was deleted.
So we punt and use the last committed revision of the path's
@@ -2038,16 +2067,13 @@ delete_entry(const char *path,
struct dir_baton *db = parent_baton;
struct edit_baton *eb = db->edit_baton;
const char *local_abspath = svn_dirent_join(eb->anchor_abspath, path, pool);
- svn_kind_t kind;
/* Note: when something is deleted, it's okay to tweak the
statushash immediately. No need to wait until close_file or
close_dir, because there's no risk of having to honor the 'added'
flag. We already know this item exists in the working copy. */
-
- SVN_ERR(svn_wc__db_read_kind(&kind, eb->db, local_abspath, FALSE, pool));
SVN_ERR(tweak_statushash(db, db, TRUE, eb->db,
- local_abspath, kind == svn_kind_dir,
+ local_abspath,
svn_wc_status_deleted, 0, 0, revision, NULL, pool));
/* Mark the parent dir -- it lost an entry (unless that parent dir
@@ -2056,7 +2082,6 @@ delete_entry(const char *path,
if (db->parent_baton && (! *eb->target_basename))
SVN_ERR(tweak_statushash(db->parent_baton, db, TRUE,eb->db,
db->local_abspath,
- kind == svn_kind_dir,
svn_wc_status_modified, svn_wc_status_modified,
0, SVN_INVALID_REVNUM, NULL, pool));
@@ -2179,7 +2204,7 @@ close_directory(void *dir_baton,
/* ### When we add directory locking, we need to find a
### directory lock here. */
SVN_ERR(tweak_statushash(pb, db, TRUE, eb->db, db->local_abspath,
- TRUE, repos_node_status, repos_text_status,
+ repos_node_status, repos_text_status,
repos_prop_status, SVN_INVALID_REVNUM, NULL,
pool));
}
@@ -2424,7 +2449,7 @@ close_file(void *file_baton,
}
return tweak_statushash(fb, NULL, FALSE, fb->edit_baton->db,
- fb->local_abspath, FALSE, repos_node_status,
+ fb->local_abspath, repos_node_status,
repos_text_status, repos_prop_status,
SVN_INVALID_REVNUM, repos_lock, pool);
}
@@ -2619,9 +2644,6 @@ svn_wc__internal_walk_status(svn_wc__db_
wb.repos_root = NULL;
wb.repos_locks = NULL;
- SVN_ERR(svn_wc__db_externals_defined_below(&wb.externals, db, local_abspath,
- scratch_pool, scratch_pool));
-
/* Use the caller-provided ignore patterns if provided; the build-time
configured defaults otherwise. */
if (!ignore_patterns)
@@ -2643,7 +2665,12 @@ svn_wc__internal_walk_status(svn_wc__db_
}
else
return svn_error_trace(err);
+
+ wb.externals = apr_hash_make(scratch_pool);
}
+ else
+ SVN_ERR(svn_wc__db_externals_defined_below(&wb.externals, db, local_abspath,
+ scratch_pool, scratch_pool));
SVN_ERR(svn_io_stat_dirent(&dirent, local_abspath, TRUE,
scratch_pool, scratch_pool));
@@ -2673,15 +2700,27 @@ svn_wc__internal_walk_status(svn_wc__db_
/* It may be a file or an unversioned item. And this is an explicit
* target, so no ignoring. An unversioned item (file or dir) shows a
* status like '?', and can yield a tree conflicted path. */
- SVN_ERR(get_child_status(&wb,
- local_abspath,
- info,
- dirent,
- ignore_patterns,
- get_all,
- status_func, status_baton,
- cancel_func, cancel_baton,
- scratch_pool));
+ err = get_child_status(&wb,
+ local_abspath,
+ info,
+ dirent,
+ ignore_patterns,
+ get_all,
+ status_func, status_baton,
+ cancel_func, cancel_baton,
+ scratch_pool);
+
+ if (!info && err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+ {
+ /* The parent is also not versioned, but it is not nice to show
+ an error about a path a user didn't intend to touch. */
+ svn_error_clear(err);
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+ _("The node '%s' was not found."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
+ SVN_ERR(err);
}
return SVN_NO_ERROR;
@@ -2937,6 +2976,6 @@ svn_wc_get_ignores2(apr_array_header_t *
SVN_ERR(svn_wc_get_default_ignores(&default_ignores, config, scratch_pool));
return svn_error_trace(collect_ignore_patterns(patterns, wc_ctx->db,
local_abspath,
- default_ignores,
+ default_ignores, TRUE,
result_pool, scratch_pool));
}
Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/tree_conflicts.c?rev=1354571&r1=1354570&r2=1354571&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/tree_conflicts.c Wed Jun 27 15:12:37 2012
@@ -158,15 +158,18 @@ read_node_version_info(const svn_wc_conf
_("Invalid version info in tree conflict "
"description"));
- repos_root = apr_pstrmemdup(result_pool,
- skel->children->next->data,
- skel->children->next->len);
+ repos_root = apr_pstrmemdup(scratch_pool,
+ skel->children->next->data,
+ skel->children->next->len);
if (*repos_root == '\0')
{
*version_info = NULL;
return SVN_NO_ERROR;
}
+ /* Apply the Subversion 1.7+ url canonicalization rules to a pre 1.7 url */
+ repos_root = svn_uri_canonicalize(repos_root, result_pool);
+
peg_rev = SVN_STR_TO_REV(apr_pstrmemdup(scratch_pool,
skel->children->next->next->data,
skel->children->next->next->len));
Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/update_editor.c?rev=1354571&r1=1354570&r2=1354571&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/update_editor.c Wed Jun 27 15:12:37 2012
@@ -50,6 +50,7 @@
#include "translate.h"
#include "workqueue.h"
+#include "private/svn_subr_private.h"
#include "private/svn_wc_private.h"
/* Checks whether a svn_wc__db_status_t indicates whether a node is
present in a working copy. Used by the editor implementation */
@@ -961,8 +962,7 @@ window_handler(svn_txdelta_window_t *win
{
/* Tell the file baton about the new text base's checksums. */
fb->new_text_base_md5_checksum =
- svn_checksum__from_digest(hb->new_text_base_md5_digest,
- svn_checksum_md5, fb->pool);
+ svn_checksum__from_digest_md5(hb->new_text_base_md5_digest, fb->pool);
fb->new_text_base_sha1_checksum =
svn_checksum_dup(hb->new_text_base_sha1_checksum, fb->pool);
@@ -1302,6 +1302,7 @@ create_tree_conflict(svn_wc_conflict_des
apr_pool_t *result_pool, apr_pool_t *scratch_pool)
{
const char *repos_root_url = NULL;
+ const char *repos_uuid = NULL;
const char *left_repos_relpath;
svn_revnum_t left_revision;
svn_node_kind_t left_kind;
@@ -1348,7 +1349,8 @@ create_tree_conflict(svn_wc_conflict_des
SVN_ERR(svn_wc__db_scan_addition(&added_status, NULL,
&added_repos_relpath,
&repos_root_url,
- NULL, NULL, NULL, NULL, NULL, NULL,
+ &repos_uuid,
+ NULL, NULL, NULL, NULL, NULL,
NULL, eb->db, local_abspath,
result_pool, scratch_pool));
@@ -1365,6 +1367,7 @@ create_tree_conflict(svn_wc_conflict_des
left_revision = SVN_INVALID_REVNUM;
left_repos_relpath = NULL;
repos_root_url = eb->repos_root;
+ repos_uuid = eb->repos_uuid;
}
else
{
@@ -1384,12 +1387,11 @@ create_tree_conflict(svn_wc_conflict_des
&left_revision,
&left_repos_relpath,
&repos_root_url,
- NULL, NULL, NULL, NULL, NULL, NULL,
+ &repos_uuid,
+ NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
- eb->db,
- local_abspath,
- result_pool,
- scratch_pool));
+ eb->db, local_abspath,
+ result_pool, scratch_pool));
/* Translate the node kind. */
if (base_kind == svn_kind_file
|| base_kind == svn_kind_symlink)
@@ -1441,18 +1443,20 @@ create_tree_conflict(svn_wc_conflict_des
* Send an 'empty' left revision. */
src_left_version = NULL;
else
- src_left_version = svn_wc_conflict_version_create(repos_root_url,
- left_repos_relpath,
- left_revision,
- left_kind,
+ src_left_version = svn_wc_conflict_version_create2(repos_root_url,
+ repos_uuid,
+ left_repos_relpath,
+ left_revision,
+ left_kind,
+ result_pool);
+
+ src_right_version = svn_wc_conflict_version_create2(repos_root_url,
+ repos_uuid,
+ right_repos_relpath,
+ *eb->target_revision,
+ their_node_kind,
result_pool);
- src_right_version = svn_wc_conflict_version_create(repos_root_url,
- right_repos_relpath,
- *eb->target_revision,
- their_node_kind,
- result_pool);
-
*pconflict = svn_wc_conflict_description_create_tree2(
local_abspath, conflict_node_kind,
eb->switch_relpath ?
@@ -3888,7 +3892,6 @@ merge_file(svn_skel_t **work_items,
struct dir_baton *pb = fb->dir_baton;
svn_boolean_t is_locally_modified;
enum svn_wc_merge_outcome_t merge_outcome = svn_wc_merge_unchanged;
- svn_skel_t *work_item;
const char *working_abspath = fb->moved_to_abspath ? fb->moved_to_abspath
: fb->local_abspath;
@@ -4059,26 +4062,6 @@ merge_file(svn_skel_t **work_items,
}
}
- /* Installing from a pristine will handle timestamps and recording.
- However, if we are NOT creating a new working copy file, then create
- work items to handle the recording of the timestamp and working-size. */
- if (!*install_pristine
- && !is_locally_modified)
- {
- apr_time_t set_date = 0;
-
- if (eb->use_commit_times && last_changed_date != 0)
- {
- set_date = last_changed_date;
- }
-
- SVN_ERR(svn_wc__wq_build_record_fileinfo(&work_item,
- eb->db, working_abspath,
- set_date,
- result_pool, scratch_pool));
- *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
- }
-
/* Set the returned content state. */
/* This is kind of interesting. Even if no new text was
@@ -4560,23 +4543,32 @@ close_file(void *file_baton,
/* Send a notification to the callback function. (Skip notifications
about files which were already notified for another reason.) */
- if (eb->notify_func && !fb->already_notified && fb->edited)
+ if (eb->notify_func && !fb->already_notified
+ && (fb->edited || lock_state == svn_wc_notify_lock_state_unlocked))
{
svn_wc_notify_t *notify;
svn_wc_notify_action_t action = svn_wc_notify_update_update;
- if (fb->shadowed)
- action = fb->adding_file
- ? svn_wc_notify_update_shadowed_add
- : svn_wc_notify_update_shadowed_update;
- else if (fb->obstruction_found || fb->add_existed)
+ if (fb->edited)
{
- if (content_state != svn_wc_notify_state_conflicted)
- action = svn_wc_notify_exists;
+ if (fb->shadowed)
+ action = fb->adding_file
+ ? svn_wc_notify_update_shadowed_add
+ : svn_wc_notify_update_shadowed_update;
+ else if (fb->obstruction_found || fb->add_existed)
+ {
+ if (content_state != svn_wc_notify_state_conflicted)
+ action = svn_wc_notify_exists;
+ }
+ else if (fb->adding_file)
+ {
+ action = svn_wc_notify_update_add;
+ }
}
- else if (fb->adding_file)
+ else
{
- action = svn_wc_notify_update_add;
+ SVN_ERR_ASSERT(lock_state == svn_wc_notify_lock_state_unlocked);
+ action = svn_wc_notify_update_broken_lock;
}
/* If the file was moved-away, notify for the moved-away node.
Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/upgrade.c?rev=1354571&r1=1354570&r2=1354571&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/upgrade.c Wed Jun 27 15:12:37 2012
@@ -792,7 +792,7 @@ migrate_tree_conflict_data(svn_sqlite__d
all of them into the new schema. */
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_SELECT_OLD_TREE_CONFLICT));
+ STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT));
/* Get all the existing tree conflict data. */
SVN_ERR(svn_sqlite__step(&have_row, stmt));
@@ -819,7 +819,8 @@ migrate_tree_conflict_data(svn_sqlite__d
SVN_ERR(svn_sqlite__reset(stmt));
/* Erase all the old tree conflict data. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_ERASE_OLD_CONFLICTS));
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ STMT_UPGRADE_21_ERASE_OLD_CONFLICTS));
SVN_ERR(svn_sqlite__step_done(stmt));
svn_pool_destroy(iterpool);
@@ -1211,7 +1212,7 @@ bump_to_27(void *baton, svn_sqlite__db_t
svn_boolean_t have_row;
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_HAS_ACTUAL_NODES_CONFLICTS));
+ STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
SVN_ERR(svn_sqlite__reset(stmt));
if (have_row)
@@ -1544,7 +1545,9 @@ svn_wc__upgrade_sdb(int *result_format,
int start_format,
apr_pool_t *scratch_pool)
{
- struct bump_baton bb = { wcroot_abspath };
+ struct bump_baton bb;
+
+ bb.wcroot_abspath = wcroot_abspath;
if (start_format < SVN_WC__WC_NG_VERSION /* 12 */)
return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/util.c?rev=1354571&r1=1354570&r2=1354571&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/util.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/util.c Wed Jun 27 15:12:37 2012
@@ -285,24 +285,27 @@ svn_wc__conflict_description2_dup(const
}
svn_wc_conflict_version_t *
-svn_wc_conflict_version_create(const char *repos_url,
- const char *path_in_repos,
- svn_revnum_t peg_rev,
- svn_node_kind_t node_kind,
- apr_pool_t *pool)
+svn_wc_conflict_version_create2(const char *repos_url,
+ const char *repos_uuid,
+ const char *repos_relpath,
+ svn_revnum_t revision,
+ svn_node_kind_t kind,
+ apr_pool_t *result_pool)
{
svn_wc_conflict_version_t *version;
- version = apr_pcalloc(pool, sizeof(*version));
+ version = apr_pcalloc(result_pool, sizeof(*version));
- SVN_ERR_ASSERT_NO_RETURN(svn_uri_is_canonical(repos_url, pool) &&
- svn_relpath_is_canonical(path_in_repos) &&
- SVN_IS_VALID_REVNUM(peg_rev));
+ SVN_ERR_ASSERT_NO_RETURN(svn_uri_is_canonical(repos_url, result_pool)
+ && svn_relpath_is_canonical(repos_relpath)
+ && SVN_IS_VALID_REVNUM(revision)
+ /* ### repos_uuid can be NULL :( */);
version->repos_url = repos_url;
- version->peg_rev = peg_rev;
- version->path_in_repos = path_in_repos;
- version->node_kind = node_kind;
+ version->peg_rev = revision;
+ version->path_in_repos = repos_relpath;
+ version->node_kind = kind;
+ version->repos_uuid = repos_uuid;
return version;
}
@@ -310,7 +313,7 @@ svn_wc_conflict_version_create(const cha
svn_wc_conflict_version_t *
svn_wc_conflict_version_dup(const svn_wc_conflict_version_t *version,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
svn_wc_conflict_version_t *new_version;
@@ -318,16 +321,20 @@ svn_wc_conflict_version_dup(const svn_wc
if (version == NULL)
return NULL;
- new_version = apr_pcalloc(pool, sizeof(*new_version));
+ new_version = apr_pcalloc(result_pool, sizeof(*new_version));
/* Shallow copy all members. */
*new_version = *version;
if (version->repos_url)
- new_version->repos_url = apr_pstrdup(pool, version->repos_url);
+ new_version->repos_url = apr_pstrdup(result_pool, version->repos_url);
if (version->path_in_repos)
- new_version->path_in_repos = apr_pstrdup(pool, version->path_in_repos);
+ new_version->path_in_repos = apr_pstrdup(result_pool,
+ version->path_in_repos);
+
+ if (version->repos_uuid)
+ new_version->repos_uuid = apr_pstrdup(result_pool, version->repos_uuid);
return new_version;
}
@@ -546,7 +553,9 @@ svn_wc__fetch_kind_func(svn_kind_t *kind
const char *local_abspath = svn_dirent_join(sfb->base_abspath, path,
scratch_pool);
- SVN_ERR(svn_wc__db_read_kind(kind, sfb->db, local_abspath, FALSE,
+ SVN_ERR(svn_wc__db_read_kind(kind, sfb->db, local_abspath,
+ FALSE /* allow_missing */,
+ FALSE /* show_hidden */,
scratch_pool));
return SVN_NO_ERROR;
Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/wc-metadata.sql?rev=1354571&r1=1354570&r2=1354571&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/wc-metadata.sql Wed Jun 27 15:12:37 2012
@@ -107,7 +107,8 @@ CREATE TABLE PRISTINE (
md5_checksum TEXT NOT NULL
);
-
+CREATE INDEX I_PRISTINE_MD5 ON PRISTINE (md5_checksum);
+
/* ------------------------------------------------------------------------- */
/* The ACTUAL_NODE table describes text changes and property changes
@@ -169,7 +170,10 @@ CREATE TABLE ACTUAL_NODE (
/* stsp: This is meant for text conflicts, right? What about property
conflicts? Why do we need these in a column to refer to the
pristine store? Can't we just parse the checksums from
- conflict_data as well? */
+ conflict_data as well?
+ rhuijben: Because that won't allow triggers to handle refcounts.
+ We would have to scan all conflict skels before cleaning up the
+ a single file from the pristine stor */
older_checksum TEXT REFERENCES PRISTINE (checksum),
left_checksum TEXT REFERENCES PRISTINE (checksum),
right_checksum TEXT REFERENCES PRISTINE (checksum),
@@ -462,24 +466,22 @@ CREATE TABLE NODES (
node does not have any dav-cache. */
dav_cache BLOB,
- /* 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,
-
+ /* Is there a file external in this location. NULL if there
+ is no file external, otherwise '1' */
+ /* ### Originally we had a wc-1.0 like skel in this place, so we
+ ### check for NULL.
+ ### In Subversion 1.7 we defined this column as TEXT, but Sqlite
+ ### only uses this information for deciding how to optimize
+ ### anyway. */
+ file_external INTEGER,
PRIMARY KEY (wc_id, local_relpath, op_depth)
);
CREATE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath, op_depth);
+/* I_NODES_MOVED is introduced in format 30 */
+CREATE UNIQUE INDEX I_NODES_MOVED ON NODES (wc_id, moved_to, op_depth);
/* Many queries have to filter the nodes table to pick only that version
of each node with the highest (most "current") op_depth. This view
@@ -497,7 +499,7 @@ CREATE VIEW NODES_CURRENT AS
AND n2.local_relpath = n.local_relpath);
/* Many queries have to filter the nodes table to pick only that version
- of each node with the base (least "current") op_depth. This view
+ of each node with the BASE ("as checked out") op_depth. This view
does the heavy lifting for such queries. */
CREATE VIEW NODES_BASE AS
SELECT * FROM nodes
@@ -628,6 +630,15 @@ PRAGMA user_version = 20;
-- STMT_UPGRADE_TO_21
PRAGMA user_version = 21;
+/* For format 21 bump code */
+-- STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT
+SELECT wc_id, local_relpath, tree_conflict_data
+FROM actual_node
+WHERE tree_conflict_data IS NOT NULL
+
+/* For format 21 bump code */
+-- STMT_UPGRADE_21_ERASE_OLD_CONFLICTS
+UPDATE actual_node SET tree_conflict_data = NULL
/* ------------------------------------------------------------------------- */
@@ -698,6 +709,15 @@ PRAGMA user_version = 26;
-- STMT_UPGRADE_TO_27
PRAGMA user_version = 27;
+/* For format 27 bump code */
+-- STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS
+SELECT 1 FROM actual_node
+WHERE NOT ((prop_reject IS NULL) AND (conflict_old IS NULL)
+ AND (conflict_new IS NULL) AND (conflict_working IS NULL)
+ AND (tree_conflict_data IS NULL))
+LIMIT 1
+
+
/* ------------------------------------------------------------------------- */
/* Format 28 involves no schema changes, it only converts MD5 pristine
@@ -753,6 +773,20 @@ PRAGMA user_version = 29;
/* ------------------------------------------------------------------------- */
+/* Format 30 currently just contains some nice to haves that should be included
+ with the next format bump */
+-- STMT_UPGRADE_TO_30
+CREATE UNIQUE INDEX IF NOT EXISTS I_NODES_MOVED
+ON NODES (wc_id, moved_to, op_depth);
+
+CREATE INDEX IF NOT EXISTS I_PRISTINE_MD5 ON PRISTINE (md5_checksum);
+
+/* Just to be sure clear out file external skels from pre 1.7.0 development
+ working copies that were never updated by 1.7.0+ style clients */
+UPDATE nodes SET file_external=1 WHERE file_external IS NOT NULL;
+
+/* ------------------------------------------------------------------------- */
+
/* Format YYY introduces new handling for conflict information. */
-- format: YYY
@@ -765,9 +799,9 @@ PRAGMA user_version = 29;
number will be, however, so we're just marking it as 99 for now. */
-- format: 99
-/* TODO: Rename the "absent" presence value to "server-excluded" before
- the 1.7 release. wc_db.c and this file have references to "absent" which
- still need to be changed to "server-excluded". */
+/* TODO: Rename the "absent" presence value to "server-excluded". wc_db.c
+ and this file have references to "absent" which still need to be changed
+ to "server-excluded". */
/* TODO: Un-confuse *_revision column names in the EXTERNALS table to
"-r<operative> foo@<peg>", as suggested by the patch attached to
http://svn.haxx.se/dev/archive-2011-09/0478.shtml */
Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/wc-queries.sql?rev=1354571&r1=1354570&r2=1354571&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/wc-queries.sql Wed Jun 27 15:12:37 2012
@@ -51,14 +51,14 @@ ORDER BY op_depth DESC
-- STMT_SELECT_BASE_NODE
SELECT repos_id, repos_path, presence, kind, revision, checksum,
translated_size, changed_revision, changed_date, changed_author, depth,
- symlink_target, last_mod_time, properties, file_external IS NOT NULL
+ symlink_target, last_mod_time, properties, file_external
FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
-- STMT_SELECT_BASE_NODE_WITH_LOCK
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, file_external IS NOT NULL,
+ depth, symlink_target, last_mod_time, properties, file_external,
/* All the columns until now must match those returned by
STMT_SELECT_BASE_NODE. The implementation of svn_wc__db_base_get_info()
assumes that these columns are followed by the lock information) */
@@ -70,7 +70,7 @@ WHERE wc_id = ?1 AND local_relpath = ?2
-- STMT_SELECT_BASE_CHILDREN_INFO
SELECT local_relpath, nodes.repos_id, nodes.repos_path, presence, kind,
- revision, depth, file_external IS NOT NULL,
+ revision, depth, file_external,
lock_token, lock_owner, lock_comment, lock_date
FROM nodes
LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id
@@ -125,11 +125,10 @@ WHERE wc_id = ?1 AND local_relpath = ?2
SELECT op_depth, 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, local_relpath, moved_here, moved_to,
- file_external IS NOT NULL
+ lock_comment, lock_date, local_relpath, moved_here, moved_to, file_external
FROM nodes
LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id
- AND nodes.repos_path = lock.repos_relpath
+ AND nodes.repos_path = lock.repos_relpath AND op_depth = 0
WHERE wc_id = ?1 AND parent_relpath = ?2
-- STMT_SELECT_NODE_CHILDREN_WALKER_INFO
@@ -174,23 +173,23 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
SELECT 1 FROM nodes
WHERE wc_id = ?1 AND parent_relpath = ?2
AND (op_depth > ?3 OR (op_depth = ?3 AND presence != 'base-deleted'))
-UNION
+UNION ALL
SELECT 1 FROM ACTUAL_NODE
WHERE wc_id = ?1 AND parent_relpath = ?2
+/* Delete the nodes shadowed by local_relpath. Not valid for the wc-root */
-- STMT_DELETE_SHADOWED_RECURSIVE
DELETE FROM nodes
WHERE wc_id = ?1
- AND (local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
AND (op_depth < ?3
OR (op_depth = ?3 AND presence = 'base-deleted'))
+/* Get not-present descendants of a copied node. Not valid for the wc-root */
-- STMT_SELECT_NOT_PRESENT_DESCENDANTS
SELECT local_relpath FROM nodes
WHERE wc_id = ?1 AND op_depth = ?3
- AND (parent_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
AND presence == 'not-present'
-- STMT_COMMIT_DESCENDANT_TO_BASE
@@ -259,15 +258,14 @@ INSERT OR REPLACE INTO lock
lock_date)
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
+/* Not valid for the working copy root */
-- STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE
SELECT nodes.repos_id, nodes.repos_path, lock_token
FROM nodes
LEFT JOIN lock ON nodes.repos_id = lock.repos_id
AND nodes.repos_path = lock.repos_relpath
WHERE wc_id = ?1 AND op_depth = 0
- AND (?2 = ''
- OR local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
-- STMT_INSERT_WCROOT
INSERT INTO wcroot (local_abspath)
@@ -281,23 +279,47 @@ WHERE wc_id = ?1 AND local_relpath = ?2
SELECT dav_cache FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
+-- STMT_SELECT_DELETION_INFO
+SELECT (SELECT b.presence FROM nodes AS b
+ WHERE b.wc_id = ?1 AND b.local_relpath = ?2 AND b.op_depth = 0),
+ work.presence, work.op_depth
+FROM nodes_current AS work
+WHERE work.wc_id = ?1 AND work.local_relpath = ?2 AND work.op_depth > 0
+LIMIT 1
+
+-- STMT_SELECT_DELETION_INFO_SCAN
/* ### FIXME. modes_move.moved_to IS NOT NULL works when there is
only one move but we need something else when there are several. */
--- STMT_SELECT_DELETION_INFO
-SELECT nodes_base.presence, nodes_work.presence, nodes_move.moved_to,
- nodes_work.op_depth
-FROM nodes AS nodes_work
-LEFT OUTER JOIN nodes nodes_move ON nodes_move.wc_id = nodes_work.wc_id
- AND nodes_move.local_relpath = nodes_work.local_relpath
- AND nodes_move.moved_to IS NOT NULL
-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)
+SELECT (SELECT b.presence FROM nodes AS b
+ WHERE b.wc_id = ?1 AND b.local_relpath = ?2 AND b.op_depth = 0),
+ work.presence, work.op_depth, moved.moved_to
+FROM nodes_current AS work
+LEFT OUTER JOIN nodes AS moved
+ ON moved.wc_id = work.wc_id
+ AND moved.local_relpath = work.local_relpath
+ AND moved.moved_to IS NOT NULL
+WHERE work.wc_id = ?1 AND work.local_relpath = ?2 AND work.op_depth > 0
+LIMIT 1
+
+-- STMT_SELECT_OP_DEPTH_MOVED_TO
+SELECT op_depth, moved_to, repos_path, revision
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2
+ AND op_depth <= (SELECT MIN(op_depth) FROM nodes
+ WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3)
+ORDER BY op_depth DESC
+-- STMT_SELECT_MOVED_TO
+SELECT moved_to
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3
+
+-- STMT_SELECT_MOVED_HERE
+SELECT moved_here, presence, repos_path, revision
+FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth >= ?3
+ORDER BY op_depth
+
-- STMT_DELETE_LOCK
DELETE FROM lock
WHERE repos_id = ?1 AND repos_relpath = ?2
@@ -305,17 +327,20 @@ WHERE repos_id = ?1 AND repos_relpath =
-- 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 (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
-- STMT_RECURSIVE_UPDATE_NODE_REPO
UPDATE nodes SET repos_id = ?4, dav_cache = NULL
-WHERE wc_id = ?1
- AND repos_id = ?3
- AND (?2 = ''
- OR local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+/* ### The Sqlite optimizer needs help here ###
+ * WHERE wc_id = ?1
+ * AND repos_id = ?3
+ * AND (local_relpath = ?2
+ * OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))*/
+WHERE (wc_id = ?1 AND local_relpath = ?2 AND repos_id = ?3)
+ OR (wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+ AND repos_id = ?3)
+
-- STMT_UPDATE_LOCK_REPOS_ID
UPDATE lock SET repos_id = ?2
@@ -327,6 +352,10 @@ 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_NODE_FILEINFO_OPDEPTH
+UPDATE nodes SET translated_size = ?3, last_mod_time = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?5
+
-- STMT_UPDATE_ACTUAL_TREE_CONFLICTS
UPDATE actual_node SET tree_conflict_data = ?3
WHERE wc_id = ?1 AND local_relpath = ?2
@@ -357,9 +386,13 @@ INSERT INTO actual_node (
VALUES (?1, ?2, ?3, ?4)
-- STMT_UPDATE_ACTUAL_CHANGELISTS
-UPDATE actual_node SET changelist = ?2
-WHERE wc_id = ?1 AND local_relpath IN
-(SELECT local_relpath FROM targets_list WHERE kind = 'file' AND wc_id = ?1)
+UPDATE actual_node SET changelist = ?3
+WHERE wc_id = ?1
+ AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND local_relpath = (SELECT local_relpath FROM targets_list AS t
+ WHERE wc_id = ?1
+ AND t.local_relpath = actual_node.local_relpath
+ AND kind = 'file')
-- STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST
UPDATE actual_node SET changelist = NULL
@@ -368,7 +401,11 @@ UPDATE actual_node SET changelist = NULL
-- STMT_MARK_SKIPPED_CHANGELIST_DIRS
/* 7 corresponds to svn_wc_notify_skip */
INSERT INTO changelist_list (wc_id, local_relpath, notify, changelist)
-SELECT wc_id, local_relpath, 7, ?1 FROM targets_list WHERE kind = 'dir'
+SELECT wc_id, local_relpath, 7, ?3
+FROM targets_list
+WHERE wc_id = ?1
+ AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND kind = 'dir'
-- STMT_RESET_ACTUAL_WITH_CHANGELIST
REPLACE INTO actual_node (
@@ -380,53 +417,31 @@ DROP TABLE IF EXISTS changelist_list;
CREATE TEMPORARY TABLE changelist_list (
wc_id INTEGER NOT NULL,
local_relpath TEXT NOT NULL,
- notify INTEGER,
- changelist TEXT NOT NULL
- );
-CREATE INDEX changelist_list_index ON changelist_list(wc_id, local_relpath);
-/* We have four cases upon which we wish to notify. The first is easy:
-
- Action Notification
- ------ ------------
- INSERT ACTUAL cl-set
-
- The others are a bit more complex:
- Action Old CL New CL Notification
- ------ ------ ------ ------------
- UPDATE ACTUAL NULL NOT NULL cl-set
- UPDATE ACTUAL NOT NULL NOT NULL cl-set
- UPDATE ACTUAL NOT NULL NULL cl-clear
-
-Of the following triggers, the first address the first case, and the second
-two address the last three cases.
+ notify INTEGER NOT NULL,
+ changelist TEXT NOT NULL,
+ /* Order NOTIFY descending to make us show clears (27) before adds (26) */
+ PRIMARY KEY (wc_id, local_relpath, notify DESC)
+)
+
+/* Create notify items for when a node is removed from a changelist and
+ when a node is added to a changelist. Make sure nothing is notified
+ if there were no changes.
*/
-DROP TRIGGER IF EXISTS trigger_changelist_list_actual_cl_insert;
-CREATE TEMPORARY TRIGGER trigger_changelist_list_actual_cl_insert
-BEFORE INSERT ON actual_node
-BEGIN
- /* 26 corresponds to svn_wc_notify_changelist_set */
- INSERT INTO changelist_list(wc_id, local_relpath, notify, changelist)
- VALUES (NEW.wc_id, NEW.local_relpath, 26, NEW.changelist);
-END;
-DROP TRIGGER IF EXISTS trigger_changelist_list_actual_cl_clear;
-CREATE TEMPORARY TRIGGER trigger_changelist_list_actual_cl_clear
-BEFORE UPDATE ON actual_node
-WHEN OLD.changelist IS NOT NULL AND
- (OLD.changelist != NEW.changelist OR NEW.changelist IS NULL)
-BEGIN
- /* 27 corresponds to svn_wc_notify_changelist_clear */
- INSERT INTO changelist_list(wc_id, local_relpath, notify, changelist)
- VALUES (OLD.wc_id, OLD.local_relpath, 27, OLD.changelist);
-END;
-DROP TRIGGER IF EXISTS trigger_changelist_list_actual_cl_set;
-CREATE TEMPORARY TRIGGER trigger_changelist_list_actual_cl_set
+-- STMT_CREATE_CHANGELIST_TRIGGER
+DROP TRIGGER IF EXISTS trigger_changelist_list_change;
+CREATE TEMPORARY TRIGGER trigger_changelist_list_change
BEFORE UPDATE ON actual_node
-WHEN NEW.CHANGELIST IS NOT NULL AND
- (OLD.changelist != NEW.changelist OR OLD.changelist IS NULL)
+WHEN old.changelist IS NOT new.changelist
BEGIN
- /* 26 corresponds to svn_wc_notify_changelist_set */
- INSERT INTO changelist_list(wc_id, local_relpath, notify, changelist)
- VALUES (NEW.wc_id, NEW.local_relpath, 26, NEW.changelist);
+ /* 27 corresponds to svn_wc_notify_changelist_clear */
+ INSERT INTO changelist_list(wc_id, local_relpath, notify, changelist)
+ SELECT old.wc_id, old.local_relpath, 27, old.changelist
+ WHERE old.changelist is NOT NULL;
+
+ /* 26 corresponds to svn_wc_notify_changelist_set */
+ INSERT INTO changelist_list(wc_id, local_relpath, notify, changelist)
+ SELECT new.wc_id, new.local_relpath, 26, new.changelist
+ WHERE new.changelist IS NOT NULL;
END
-- STMT_INSERT_CHANGELIST_LIST
@@ -443,7 +458,7 @@ DROP TABLE IF EXISTS targets_list
-- STMT_SELECT_CHANGELIST_LIST
SELECT wc_id, local_relpath, notify, changelist
FROM changelist_list
-ORDER BY wc_id, local_relpath
+ORDER BY wc_id, local_relpath ASC, notify DESC
-- STMT_CREATE_TARGETS_LIST
DROP TABLE IF EXISTS targets_list;
@@ -451,10 +466,9 @@ CREATE TEMPORARY TABLE targets_list (
wc_id INTEGER NOT NULL,
local_relpath TEXT NOT NULL,
parent_relpath TEXT,
- kind TEXT NOT NULL
+ kind TEXT NOT NULL,
+ PRIMARY KEY (wc_id, local_relpath)
);
-CREATE INDEX targets_list_kind
- ON targets_list (kind)
/* need more indicies? */
-- STMT_DROP_TARGETS_LIST
@@ -463,52 +477,59 @@ DROP TABLE IF EXISTS targets_list
-- STMT_INSERT_TARGET
INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
SELECT wc_id, local_relpath, parent_relpath, kind
-FROM nodes_current WHERE wc_id = ?1 AND local_relpath = ?2
+FROM nodes_current
+WHERE wc_id = ?1
+ AND local_relpath = ?2
-- STMT_INSERT_TARGET_DEPTH_FILES
INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
SELECT wc_id, local_relpath, parent_relpath, kind
FROM nodes_current
-WHERE wc_id = ?1 AND ((parent_relpath = ?2 AND kind = 'file')
- OR local_relpath = ?2)
+WHERE wc_id = ?1
+ AND parent_relpath = ?2
+ AND kind = 'file'
-- STMT_INSERT_TARGET_DEPTH_IMMEDIATES
INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
SELECT wc_id, local_relpath, parent_relpath, kind
FROM nodes_current
-WHERE wc_id = ?1 AND (parent_relpath = ?2 OR local_relpath = ?2)
+WHERE wc_id = ?1
+ AND parent_relpath = ?2
-- STMT_INSERT_TARGET_DEPTH_INFINITY
INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
SELECT wc_id, local_relpath, parent_relpath, kind
FROM nodes_current
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
-- STMT_INSERT_TARGET_WITH_CHANGELIST
INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind
FROM actual_node AS A JOIN nodes_current AS N
ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath
- WHERE N.wc_id = ?1 AND A.changelist = ?3 AND N.local_relpath = ?2
+ WHERE N.wc_id = ?1
+ AND N.local_relpath = ?2
+ AND A.changelist = ?3
-- STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES
INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind
FROM actual_node AS A JOIN nodes_current AS N
ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath
- WHERE N.wc_id = ?1 AND A.changelist = ?3
- AND ((N.parent_relpath = ?2 AND kind = 'file') OR N.local_relpath = ?2)
+ WHERE N.wc_id = ?1
+ AND N.parent_relpath = ?2
+ AND kind = 'file'
+ AND A.changelist = ?3
-- STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES
INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
SELECT N.wc_id, N.local_relpath, N.parent_relpath, N.kind
FROM actual_node AS A JOIN nodes_current AS N
ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath
- WHERE N.wc_id = ?1 AND A.changelist = ?3
- AND (N.parent_relpath = ?2 OR N.local_relpath = ?2)
+ WHERE N.wc_id = ?1
+ AND N.parent_relpath = ?2
+ AND A.changelist = ?3
-- STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY
INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind)
@@ -516,13 +537,12 @@ SELECT N.wc_id, N.local_relpath, N.paren
FROM actual_node AS A JOIN nodes_current AS N
ON A.wc_id = N.wc_id AND A.local_relpath = N.local_relpath
WHERE N.wc_id = ?1
- AND (?2 = ''
- OR N.local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(N.local_relpath, ?2))
- AND A.changelist = ?3
+ AND IS_STRICT_DESCENDANT_OF(N.local_relpath, ?2)
+ AND A.changelist = ?3
--- STMT_SELECT_TARGETS
-SELECT local_relpath, parent_relpath from targets_list
+/* Only used by commented dump_targets() in wc_db.c */
+/*-- STMT_SELECT_TARGETS
+SELECT local_relpath, parent_relpath from targets_list*/
-- STMT_INSERT_ACTUAL_EMPTIES
INSERT OR IGNORE INTO actual_node (
@@ -550,6 +570,7 @@ WHERE wc_id = ?1 AND local_relpath = ?2
-- STMT_DELETE_ACTUAL_EMPTIES
DELETE FROM actual_node
WHERE wc_id = ?1
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
AND properties IS NULL
AND conflict_old IS NULL
AND conflict_new IS NULL
@@ -582,11 +603,10 @@ WHERE wc_id = ?1 AND local_relpath = ?2
DELETE FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2
--- STMT_DELETE_NODES_RECURSIVE
+-- STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE
DELETE FROM nodes
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND op_depth >= ?3
@@ -594,11 +614,11 @@ WHERE wc_id = ?1
DELETE FROM actual_node
WHERE wc_id = ?1 AND local_relpath = ?2
+/* Will not delete recursive when run on the wcroot */
-- STMT_DELETE_ACTUAL_NODE_RECURSIVE
DELETE FROM actual_node
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
-- STMT_DELETE_ACTUAL_NODE_WITHOUT_CONFLICT
@@ -618,8 +638,7 @@ WHERE wc_id = ?1
-- STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE
DELETE FROM actual_node
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND (changelist IS NULL
OR NOT EXISTS (SELECT 1 FROM nodes_current c
@@ -654,8 +673,7 @@ SET properties = NULL,
left_checksum = NULL,
right_checksum = NULL
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
-- STMT_UPDATE_NODE_BASE_DEPTH
@@ -723,10 +741,17 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
AND (conflict_new IS NULL) AND (conflict_working IS NULL)
AND (tree_conflict_data IS NULL))
--- STMT_SELECT_CONFLICT_MARKER_FILES
-SELECT prop_reject, conflict_old, conflict_new, conflict_working
+-- STMT_SELECT_CONFLICT_MARKER_FILES1
+SELECT prop_reject
+FROM actual_node
+WHERE wc_id = ?1 AND local_relpath = ?2
+ AND ((prop_reject IS NOT NULL) OR (conflict_old IS NOT NULL)
+ OR (conflict_new IS NOT NULL) OR (conflict_working IS NOT NULL))
+
+-- STMT_SELECT_CONFLICT_MARKER_FILES2
+SELECT prop_reject
FROM actual_node
-WHERE wc_id = ?1 AND (local_relpath = ?2 OR parent_relpath = ?2)
+WHERE wc_id = ?1 AND parent_relpath = ?2
AND ((prop_reject IS NOT NULL) OR (conflict_old IS NOT NULL)
OR (conflict_new IS NOT NULL) OR (conflict_working IS NOT NULL))
@@ -764,9 +789,8 @@ WHERE wc_id = ?1 AND local_dir_relpath =
-- STMT_SELECT_ANCESTOR_WCLOCKS
SELECT local_dir_relpath, locked_levels FROM wc_lock
WHERE wc_id = ?1
- AND ((local_dir_relpath <= ?2 AND local_dir_relpath >= ?3)
+ AND ((local_dir_relpath >= ?3 AND local_dir_relpath <= ?2)
OR local_dir_relpath = '')
-ORDER BY local_dir_relpath DESC
-- STMT_DELETE_WC_LOCK
DELETE FROM wc_lock
@@ -774,7 +798,8 @@ WHERE wc_id = ?1 AND local_dir_relpath =
-- STMT_FIND_WC_LOCK
SELECT local_dir_relpath FROM wc_lock
-WHERE wc_id = ?1 AND local_dir_relpath LIKE ?2 ESCAPE '#'
+WHERE wc_id = ?1
+ AND IS_STRICT_DESCENDANT_OF(local_dir_relpath, ?2)
-- STMT_DELETE_WC_LOCK_ORPHAN
DELETE FROM wc_lock
@@ -786,8 +811,7 @@ AND NOT EXISTS (SELECT 1 FROM nodes
-- STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE
DELETE FROM wc_lock
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_dir_relpath = ?2
+ AND (local_dir_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_dir_relpath, ?2))
AND NOT EXISTS (SELECT 1 FROM nodes
WHERE nodes.wc_id = ?1
@@ -852,78 +876,66 @@ SELECT wc_id, local_relpath, ?3 /*op_dep
FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
+/* Not valid on the wc-root */
-- STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE
UPDATE nodes SET op_depth = ?3 + 1
WHERE wc_id = ?1
- AND (?2 = ''
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
AND op_depth = ?3
-- STMT_DOES_NODE_EXIST
SELECT 1 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2
LIMIT 1
--- STMT_HAS_SERVER_EXCLUDED_NODES
+-- STMT_HAS_SERVER_EXCLUDED_DESCENDANTS
SELECT local_relpath FROM nodes
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
AND op_depth = 0 AND presence = 'absent'
LIMIT 1
-/* ### Select all server-excluded nodes. */
--- STMT_SELECT_ALL_SERVER_EXCLUDED_NODES
+/* Select all excluded nodes. Not valid on the WC-root */
+-- STMT_SELECT_ALL_EXCLUDED_DESCENDANTS
SELECT local_relpath FROM nodes
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
AND op_depth = 0
- AND presence = 'absent'
+ AND (presence = 'absent' OR presence = 'excluded')
--- STMT_INSERT_WORKING_NODE_COPY_FROM_BASE
+/* Creates a copy from one top level NODE to a different location */
+-- STMT_INSERT_WORKING_NODE_COPY_FROM
INSERT OR REPLACE INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id,
repos_path, revision, presence, depth, moved_here, kind, changed_revision,
changed_date, changed_author, checksum, properties, translated_size,
last_mod_time, symlink_target, moved_to )
-SELECT src.wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
- src.repos_id, src.repos_path, src.revision, ?6 /*presence*/, src.depth,
- ?7/*moved_here*/, src.kind, src.changed_revision, src.changed_date,
- src.changed_author, src.checksum, src.properties, src.translated_size,
- src.last_mod_time, src.symlink_target, dst.moved_to
-FROM nodes AS src
-LEFT OUTER JOIN nodes_current dst ON dst.wc_id = src.wc_id
- AND dst.local_relpath = ?3 AND dst.op_depth = ?4
-WHERE src.wc_id = ?1 AND src.local_relpath = ?2 AND src.op_depth = 0
+SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
+ repos_id, repos_path, revision, ?6 /*presence*/, depth,
+ ?7/*moved_here*/, kind, changed_revision, changed_date,
+ changed_author, checksum, properties, translated_size,
+ last_mod_time, symlink_target,
+ (SELECT dst.moved_to FROM nodes AS dst
+ WHERE dst.wc_id = ?1
+ AND dst.local_relpath = ?3
+ AND dst.op_depth = ?4)
+FROM nodes_current
+WHERE wc_id = ?1 AND local_relpath = ?2
--- STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING
+-- STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH
INSERT OR REPLACE INTO nodes (
wc_id, local_relpath, op_depth, parent_relpath, repos_id,
repos_path, revision, presence, depth, moved_here, kind, changed_revision,
changed_date, changed_author, checksum, properties, translated_size,
last_mod_time, symlink_target, moved_to )
-SELECT src.wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
- src.repos_id, src.repos_path, src.revision, ?6 /*presence*/, src.depth,
- ?7 /*moved_here*/, src.kind, src.changed_revision, src.changed_date,
- src.changed_author, src.checksum, src.properties, src.translated_size,
- src.last_mod_time, src.symlink_target, dst.moved_to
-FROM nodes_current AS src
-LEFT OUTER JOIN nodes_current dst ON dst.wc_id = src.wc_id
- AND dst.local_relpath = ?3 AND dst.op_depth = ?4
-WHERE src.wc_id = ?1 AND src.local_relpath = ?2 AND src.op_depth > 0
-
--- STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH
-INSERT OR REPLACE INTO nodes (
- wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
- revision, presence, depth, moved_here, kind, changed_revision, changed_date,
- changed_author, checksum, properties, translated_size, last_mod_time,
- symlink_target )
SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
- repos_id, repos_path, revision, ?6 /*presence*/, depth, ?7 /*moved_here*/,
- kind, changed_revision, changed_date, changed_author, checksum,
- properties, translated_size, last_mod_time, symlink_target
+ repos_id, repos_path, revision, ?6 /*presence*/, depth,
+ ?7 /*moved_here*/, kind, changed_revision, changed_date,
+ changed_author, checksum, properties, translated_size,
+ last_mod_time, symlink_target,
+ (SELECT dst.moved_to FROM nodes AS dst
+ WHERE dst.wc_id = ?1
+ AND dst.local_relpath = ?3
+ AND dst.op_depth = ?4)
FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?8
@@ -977,55 +989,76 @@ LIMIT 1
* inside an unversioned dir, because commit still breaks on those.
* Once that's been fixed, the conditions below "--->8---" become obsolete. */
-- STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW
-SELECT local_relpath, kind, repos_id, def_repos_relpath, repository.root
-FROM externals
-LEFT OUTER JOIN repository ON repository.id = externals.repos_id
-WHERE wc_id = ?1
- AND def_revision IS NULL
- AND repos_id = (SELECT repos_id FROM nodes
- WHERE nodes.local_relpath = ?2)
- AND ( ((NOT ?3)
- AND (?2 = ''
- /* Want only the cildren of e.local_relpath;
- * externals can't have a local_relpath = ''. */
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2)))
- OR
- ((?3)
- AND parent_relpath = ?2) )
+SELECT local_relpath, kind, def_repos_relpath,
+ (SELECT root FROM repository AS r
+ WHERE r.id = e.repos_id)
+FROM externals AS e
+WHERE e.wc_id = ?1
+ AND IS_STRICT_DESCENDANT_OF(e.local_relpath, ?2)
+ AND e.def_revision IS NULL
+ AND e.repos_id = (SELECT repos_id
+ FROM nodes AS n
+ WHERE n.wc_id = ?1
+ AND n.local_relpath = ''
+ AND n.op_depth = 0)
+ AND ( (NOT ?3) OR (parent_relpath = ?2) )
/* ------>8----- */
AND (EXISTS (SELECT 1 FROM nodes
- WHERE nodes.wc_id = externals.wc_id
- AND nodes.local_relpath = externals.parent_relpath))
+ WHERE nodes.wc_id = e.wc_id
+ AND nodes.local_relpath = e.parent_relpath))
-- STMT_SELECT_EXTERNALS_DEFINED
SELECT local_relpath, def_local_relpath
FROM externals
-WHERE wc_id = ?1
- AND (?2 = ''
- OR def_local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(def_local_relpath, ?2))
-
--- STMT_UPDATE_EXTERNAL_FILEINFO
-UPDATE externals SET recorded_size = ?3, recorded_mod_time = ?4
-WHERE wc_id = ?1 AND local_relpath = ?2
+/* ### The Sqlite optimizer needs help here ###
+ * WHERE wc_id = ?1
+ * AND (def_local_relpath = ?2
+ * OR IS_STRICT_DESCENDANT_OF(def_local_relpath, ?2)) */
+WHERE (wc_id = ?1 AND def_local_relpath = ?2)
+ OR (wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(def_local_relpath, ?2))
-- STMT_DELETE_EXTERNAL
DELETE FROM externals
WHERE wc_id = ?1 AND local_relpath = ?2
-- STMT_SELECT_EXTERNAL_PROPERTIES
+/* ### It would be nice if Sqlite would handle
+ * SELECT IFNULL((SELECT properties FROM actual_node a
+ * WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath),
+ * properties),
+ * local_relpath, depth
+ * FROM nodes_current n
+ * WHERE wc_id = ?1
+ * AND (local_relpath = ?2
+ * OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ * AND kind = 'dir' AND presence IN ('normal', 'incomplete')
+ * ### But it would take a double table scan execution plan for it.
+ * ### Maybe there is something else going on? */
SELECT IFNULL((SELECT properties FROM actual_node a
WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath),
properties),
local_relpath, depth
-FROM nodes n
-WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
- AND kind = 'dir' AND presence='normal'
- AND op_depth=(SELECT MAX(op_depth) FROM nodes o
- WHERE o.wc_id = ?1 AND o.local_relpath = n.local_relpath)
+FROM nodes_current n
+WHERE wc_id = ?1 AND local_relpath = ?2
+ AND kind = 'dir' AND presence IN ('normal', 'incomplete')
+UNION ALL
+SELECT IFNULL((SELECT properties FROM actual_node a
+ WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath),
+ properties),
+ local_relpath, depth
+FROM nodes_current n
+WHERE wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+ AND kind = 'dir' AND presence IN ('normal', 'incomplete')
+
+-- STMT_SELECT_CURRENT_PROPS_RECURSIVE
+/* ### Ugly OR to make sqlite use the proper optimizations */
+SELECT IFNULL((SELECT properties FROM actual_node a
+ WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath),
+ properties),
+ local_relpath
+FROM nodes_current n
+WHERE (wc_id = ?1 AND local_relpath = ?2)
+ OR (wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
/* ------------------------------------------------------------------------- */
@@ -1052,16 +1085,8 @@ INSERT INTO actual_node (
wc_id, local_relpath, conflict_data, parent_relpath)
VALUES (?1, ?2, ?3, ?4)
--- STMT_SELECT_OLD_TREE_CONFLICT
-SELECT wc_id, local_relpath, tree_conflict_data
-FROM actual_node
-WHERE tree_conflict_data IS NOT NULL
-
--- STMT_ERASE_OLD_CONFLICTS
-UPDATE actual_node SET tree_conflict_data = NULL
-
-- STMT_SELECT_ALL_FILES
-SELECT DISTINCT local_relpath FROM nodes
+SELECT local_relpath FROM nodes_current
WHERE wc_id = ?1 AND parent_relpath = ?2 AND kind = 'file'
-- STMT_UPDATE_NODE_PROPS
@@ -1072,71 +1097,61 @@ WHERE wc_id = ?1 AND local_relpath = ?2
SELECT 1 FROM nodes WHERE op_depth > 0
LIMIT 1
--- STMT_HAS_ACTUAL_NODES_CONFLICTS
-SELECT 1 FROM actual_node
-WHERE NOT ((prop_reject IS NULL) AND (conflict_old IS NULL)
- AND (conflict_new IS NULL) AND (conflict_working IS NULL)
- AND (tree_conflict_data IS NULL))
-LIMIT 1
-
-/* ------------------------------------------------------------------------- */
-/* PROOF OF CONCEPT: Complex queries for callback walks, caching results
- in a temporary table. */
+/* --------------------------------------------------------------------------
+ * Complex queries for callback walks, caching results in a temporary table.
+ *
+ * These target table are then used for joins against NODES, or for reporting
+ */
--- STMT_CREATE_NODE_PROPS_CACHE
-DROP TABLE IF EXISTS temp__node_props_cache;
-CREATE TEMPORARY TABLE temp__node_props_cache (
- local_Relpath TEXT NOT NULL,
+-- STMT_CREATE_TARGET_PROP_CACHE
+DROP TABLE IF EXISTS target_prop_cache;
+CREATE TEMPORARY TABLE target_prop_cache (
+ local_relpath TEXT NOT NULL PRIMARY KEY,
kind TEXT NOT NULL,
properties BLOB
- );
+);
/* ### Need index?
CREATE UNIQUE INDEX temp__node_props_cache_unique
ON temp__node_props_cache (local_relpath) */
--- STMT_CACHE_NODE_PROPS
-INSERT INTO temp__node_props_cache(local_relpath, kind, properties)
- SELECT local_relpath, kind, properties FROM nodes_current
- WHERE wc_id = ?1
- AND local_relpath IN (SELECT local_relpath FROM targets_list)
- AND presence IN ('normal', 'incomplete')
-
--- STMT_CACHE_ACTUAL_PROPS
-UPDATE temp__node_props_cache
- SET properties=
- IFNULL((SELECT properties FROM actual_node a
- WHERE a.wc_id = ?1
- AND a.local_relpath = temp__node_props_cache.local_relpath),
- properties)
-
--- STMT_CACHE_NODE_BASE_PROPS
-INSERT INTO temp__node_props_cache (local_relpath, kind, properties)
- SELECT local_relpath, kind, properties FROM nodes_base
- WHERE wc_id = ?1
- AND local_relpath IN (SELECT local_relpath FROM targets_list)
- AND presence IN ('normal', 'incomplete')
-
--- STMT_CACHE_NODE_PRISTINE_PROPS
-INSERT INTO temp__node_props_cache(local_relpath, kind, properties)
- SELECT local_relpath, kind,
- IFNULL((SELECT properties FROM nodes nn
- WHERE n.presence = 'base-deleted'
- AND nn.wc_id = n.wc_id
- AND nn.local_relpath = n.local_relpath
- AND nn.op_depth < n.op_depth
- ORDER BY op_depth DESC),
- properties)
- FROM nodes_current n
- WHERE wc_id = ?1
- AND local_relpath IN (SELECT local_relpath FROM targets_list)
- AND presence IN ('normal', 'incomplete', 'base-deleted')
+-- STMT_CACHE_TARGET_PROPS
+INSERT INTO target_prop_cache(local_relpath, kind, properties)
+ SELECT n.local_relpath, n.kind,
+ IFNULL((SELECT properties FROM actual_node AS a
+ WHERE a.wc_id = n.wc_id
+ AND a.local_relpath = n.local_relpath),
+ n.properties)
+ FROM targets_list AS t
+ JOIN nodes_current AS n ON t.wc_id= n.wc_id
+ AND t.local_relpath = n.local_relpath
+ WHERE t.wc_id = ?1
+ AND (presence='normal' OR presence='incomplete')
+
+-- STMT_CACHE_TARGET_PRISTINE_PROPS
+INSERT INTO target_prop_cache(local_relpath, kind, properties)
+ SELECT n.local_relpath, n.kind,
+ CASE n.presence
+ WHEN 'base-deleted'
+ THEN (SELECT properties FROM nodes AS p
+ WHERE p.wc_id = n.wc_id
+ AND p.local_relpath = n.local_relpath
+ AND p.op_depth < n.op_depth
+ ORDER BY p.op_depth DESC /* LIMIT 1 */)
+ ELSE properties END
+ FROM targets_list AS t
+ JOIN nodes_current AS n ON t.wc_id= n.wc_id
+ AND t.local_relpath = n.local_relpath
+ WHERE t.wc_id = ?1
+ AND (presence = 'normal'
+ OR presence = 'incomplete'
+ OR presence = 'base-deleted')
--- STMT_SELECT_RELEVANT_PROPS_FROM_CACHE
-SELECT local_relpath, properties FROM temp__node_props_cache
+-- STMT_SELECT_ALL_TARGET_PROP_CACHE
+SELECT local_relpath, properties FROM target_prop_cache
ORDER BY local_relpath
--- STMT_DROP_NODE_PROPS_CACHE
-DROP TABLE IF EXISTS temp__node_props_cache;
+-- STMT_DROP_TARGET_PROP_CACHE
+DROP TABLE IF EXISTS target_prop_cache;
-- STMT_CREATE_REVERT_LIST
@@ -1207,7 +1222,7 @@ ORDER BY actual DESC
-- STMT_SELECT_REVERT_LIST_COPIED_CHILDREN
SELECT local_relpath, kind
FROM revert_list
-WHERE local_relpath LIKE ?1 ESCAPE '#'
+WHERE IS_STRICT_DESCENDANT_OF(local_relpath, ?1)
AND op_depth >= ?2
AND repos_id IS NOT NULL
ORDER BY local_relpath
@@ -1218,13 +1233,15 @@ DELETE FROM revert_list WHERE local_relp
-- STMT_SELECT_REVERT_LIST_RECURSIVE
SELECT DISTINCT local_relpath
FROM revert_list
-WHERE (local_relpath = ?1 OR local_relpath LIKE ?2 ESCAPE '#')
+WHERE (local_relpath = ?1
+ OR IS_STRICT_DESCENDANT_OF(local_relpath, ?1))
AND (notify OR actual = 0)
ORDER BY local_relpath
-- STMT_DELETE_REVERT_LIST_RECURSIVE
DELETE FROM revert_list
-WHERE local_relpath = ?1 OR local_relpath LIKE ?2 ESCAPE '#'
+WHERE (local_relpath = ?1
+ OR IS_STRICT_DESCENDANT_OF(local_relpath, ?1))
-- STMT_DROP_REVERT_LIST
DROP TABLE IF EXISTS revert_list
@@ -1237,14 +1254,18 @@ CREATE TEMPORARY TABLE delete_list (
local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE
)
-/* This matches the selection in STMT_INSERT_DELETE_FROM_NODE_RECURSIVE */
+/* This matches the selection in STMT_INSERT_DELETE_FROM_NODE_RECURSIVE.
+ A subquery is used instead of nodes_current to avoid a table scan */
-- STMT_INSERT_DELETE_LIST
INSERT INTO delete_list(local_relpath)
-SELECT local_relpath FROM nodes_current
+SELECT local_relpath FROM nodes AS n
WHERE wc_id = ?1
AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND op_depth >= ?3
+ AND op_depth = (SELECT MAX(s.op_depth) FROM nodes AS s
+ WHERE s.wc_id = ?1
+ AND s.local_relpath = n.local_relpath)
AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
-- STMT_SELECT_DELETE_LIST
@@ -1263,9 +1284,8 @@ DROP TABLE IF EXISTS delete_list
SELECT MIN(revision), MAX(revision),
MIN(changed_revision), MAX(changed_revision) FROM nodes
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ AND (local_relpath = ?2
+ OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND presence IN ('normal', 'incomplete')
AND file_external IS NULL
AND op_depth = 0
@@ -1273,8 +1293,7 @@ SELECT MIN(revision), MAX(revision),
-- STMT_HAS_SPARSE_NODES
SELECT 1 FROM nodes
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND op_depth = 0
AND (presence IN ('absent', 'excluded')
@@ -1285,8 +1304,7 @@ LIMIT 1
-- STMT_SUBTREE_HAS_TREE_MODIFICATIONS
SELECT 1 FROM nodes
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND op_depth > 0
LIMIT 1
@@ -1294,8 +1312,7 @@ LIMIT 1
-- STMT_SUBTREE_HAS_PROP_MODIFICATIONS
SELECT 1 FROM actual_node
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND properties IS NOT NULL
LIMIT 1
@@ -1372,8 +1389,7 @@ LIMIT 1
-- STMT_SELECT_BASE_FILES_RECURSIVE
SELECT local_relpath, translated_size, last_mod_time FROM nodes AS n
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
+ AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND op_depth = 0
AND kind='file'
Modified: subversion/branches/master-passphrase/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_wc/wc.h?rev=1354571&r1=1354570&r2=1354571&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_wc/wc.h Wed Jun 27 15:12:37 2012
@@ -627,12 +627,16 @@ svn_wc__internal_get_origin(svn_boolean_
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-/* Internal version of svn_wc__node_get_commit_base_rev */
+/* Internal version of svn_wc__node_get_commit_base() */
svn_error_t *
-svn_wc__internal_get_commit_base_rev(svn_revnum_t *commit_base_revision,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *scratch_pool);
+svn_wc__internal_get_commit_base(svn_revnum_t *commit_base_revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
+ const char **repos_uuid,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Internal version of svn_wc__node_get_repos_info() */