diff options
Diffstat (limited to 'subversion/libsvn_wc')
| -rw-r--r-- | subversion/libsvn_wc/status.c | 190 | ||||
| -rw-r--r-- | subversion/libsvn_wc/wc-checks.h | 2 | ||||
| -rw-r--r-- | subversion/libsvn_wc/wc-metadata.h | 4 | ||||
| -rw-r--r-- | subversion/libsvn_wc/wc-metadata.sql | 3 | ||||
| -rw-r--r-- | subversion/libsvn_wc/wc-queries.h | 1134 | ||||
| -rw-r--r-- | subversion/libsvn_wc/wc-queries.sql | 36 | ||||
| -rw-r--r-- | subversion/libsvn_wc/wc_db.c | 661 | ||||
| -rw-r--r-- | subversion/libsvn_wc/wc_db.h | 23 | ||||
| -rw-r--r-- | subversion/libsvn_wc/wc_db_wcroot.c | 8 | 
9 files changed, 1236 insertions, 825 deletions
| diff --git a/subversion/libsvn_wc/status.c b/subversion/libsvn_wc/status.c index 1440b2ee5e4a..fa57b0aee5e5 100644 --- a/subversion/libsvn_wc/status.c +++ b/subversion/libsvn_wc/status.c @@ -242,144 +242,7 @@ struct file_baton  /** Code **/ -/* Fill in *INFO with the information it would contain if it were -   obtained from svn_wc__db_read_children_info. */ -static svn_error_t * -read_info(const struct svn_wc__db_info_t **info, -          const char *local_abspath, -          svn_wc__db_t *db, -          apr_pool_t *result_pool, -          apr_pool_t *scratch_pool) -{ -  struct svn_wc__db_info_t *mtb = apr_pcalloc(result_pool, sizeof(*mtb)); -  const svn_checksum_t *checksum; -  const char *original_repos_relpath; - -  SVN_ERR(svn_wc__db_read_info(&mtb->status, &mtb->kind, -                               &mtb->revnum, &mtb->repos_relpath, -                               &mtb->repos_root_url, &mtb->repos_uuid, -                               &mtb->changed_rev, &mtb->changed_date, -                               &mtb->changed_author, &mtb->depth, -                               &checksum, NULL, &original_repos_relpath, NULL, -                               NULL, NULL, &mtb->lock, &mtb->recorded_size, -                               &mtb->recorded_time, &mtb->changelist, -                               &mtb->conflicted, &mtb->op_root, -                               &mtb->had_props, &mtb->props_mod, -                               &mtb->have_base, &mtb->have_more_work, NULL, -                               db, local_abspath, -                               result_pool, scratch_pool)); - -  SVN_ERR(svn_wc__db_wclocked(&mtb->locked, db, local_abspath, scratch_pool)); - -  /* Maybe we have to get some shadowed lock from BASE to make our test suite -     happy... (It might be completely unrelated, but...) */ -  if (mtb->have_base -      && (mtb->status == svn_wc__db_status_added -          || mtb->status == svn_wc__db_status_deleted -          || mtb->kind == svn_node_file)) -    { -      svn_boolean_t update_root; -      svn_wc__db_lock_t **lock_arg = NULL; - -      if (mtb->status == svn_wc__db_status_added -          || mtb->status == svn_wc__db_status_deleted) -        lock_arg = &mtb->lock; - -      SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL, -                                       NULL, NULL, NULL, NULL, NULL, NULL, -                                       lock_arg, NULL, NULL, &update_root, -                                       db, local_abspath, -                                       result_pool, scratch_pool)); - -      mtb->file_external = (update_root && mtb->kind == svn_node_file); - -      if (mtb->status == svn_wc__db_status_deleted) -        { -          const char *moved_to_abspath; -          const char *moved_to_op_root_abspath; - -          /* NOTE: we can't use op-root-ness as a condition here since a base -           * node can be the root of a move and still not be an explicit -           * op-root (having a working node with op_depth == pathelements). -           * -           * Both these (almost identical) situations showcase this: -           *   svn mv a/b bb -           *   svn del a -           * and -           *   svn mv a aa -           *   svn mv aa/b bb -           * In both, 'bb' is moved from 'a/b', but 'a/b' has no op_depth>0 -           * node at all, as its parent 'a' is locally deleted. */ - -          SVN_ERR(svn_wc__db_scan_deletion(NULL, -                                           &moved_to_abspath, -                                           NULL, -                                           &moved_to_op_root_abspath, -                                           db, local_abspath, -                                           scratch_pool, scratch_pool)); -          if (moved_to_abspath != NULL -              && moved_to_op_root_abspath != NULL -              && strcmp(moved_to_abspath, moved_to_op_root_abspath) == 0) -            { -              mtb->moved_to_abspath = apr_pstrdup(result_pool, -                                                  moved_to_abspath); -            } -          /* ### ^^^ THIS SUCKS. For at least two reasons: -           * 1) We scan the node deletion and that's technically not necessary. -           *    We'd be fine to know if this is an actual root of a move. -           * 2) From the elaborately calculated results, we backwards-guess -           *    whether this is a root. -           * It works ok, and this code only gets called when a node is an -           * explicit target of a 'status'. But it would be better to do this -           * differently. -           * We could return moved-to via svn_wc__db_base_get_info() (called -           * just above), but as moved-to is only intended to be returned for -           * roots of a move, that doesn't fit too well. */ -        } -    } - -  /* ### svn_wc__db_read_info() could easily return the moved-here flag. But -   * for now... (The per-dir query for recursive status is far more optimal.) -   * Note that this actually scans around to get the full path, for a bool. -   * This bool then gets returned, later is evaluated, and if true leads to -   * the same paths being scanned again. We'd want to obtain this bool here as -   * cheaply as svn_wc__db_read_children_info() does. */ -  if (mtb->status == svn_wc__db_status_added) -    { -      svn_wc__db_status_t status; -      SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL, -                                       NULL, NULL, NULL, NULL, -                                       db, local_abspath, -                                       result_pool, scratch_pool)); - -      mtb->moved_here = (status == svn_wc__db_status_moved_here); -      mtb->incomplete = (status == svn_wc__db_status_incomplete); -    } - -  mtb->has_checksum = (checksum != NULL); -  mtb->copied = (original_repos_relpath != NULL); - -#ifdef HAVE_SYMLINK -  if (mtb->kind == svn_node_file -      && (mtb->had_props || mtb->props_mod)) -    { -      apr_hash_t *properties; - -      if (mtb->props_mod) -        SVN_ERR(svn_wc__db_read_props(&properties, db, local_abspath, -                                      scratch_pool, scratch_pool)); -      else -        SVN_ERR(svn_wc__db_read_pristine_props(&properties, db, local_abspath, -                                               scratch_pool, scratch_pool)); - -      mtb->special = (NULL != svn_hash_gets(properties, SVN_PROP_SPECIAL)); -    } -#endif -  *info = mtb; - -  return SVN_NO_ERROR; -}  /* Return *REPOS_RELPATH and *REPOS_ROOT_URL for LOCAL_ABSPATH using     information in INFO if available, falling back on @@ -421,13 +284,42 @@ get_repos_root_url_relpath(const char **repos_relpath,                                         db, local_abspath,                                         result_pool, scratch_pool));      } -  else if (info->have_base) +  else if (info->status == svn_wc__db_status_deleted +           && !info->have_more_work +           && info->have_base)      {        SVN_ERR(svn_wc__db_scan_base_repos(repos_relpath, repos_root_url,                                           repos_uuid,                                           db, local_abspath,                                           result_pool, scratch_pool));      } +  else if (info->status == svn_wc__db_status_deleted) +    { +      const char *work_del_abspath; +      const char *add_abspath; + +      /* Handles working DELETE and the special case where there is just +         svn_wc__db_status_not_present in WORKING */ + +      SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, &work_del_abspath, NULL, +                                       db, local_abspath, +                                       scratch_pool, scratch_pool)); + +      /* The parent of what has been deleted must be added */ +      add_abspath = svn_dirent_dirname(work_del_abspath, scratch_pool); + +      SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, repos_relpath, +                                       repos_root_url, repos_uuid, NULL, +                                       NULL, NULL, NULL, +                                       db, add_abspath, +                                       result_pool, scratch_pool)); + +      *repos_relpath = svn_relpath_join(*repos_relpath, +                                        svn_dirent_skip_ancestor( +                                              add_abspath, +                                              local_abspath), +                                        result_pool); +    }    else      {        *repos_relpath = NULL; @@ -493,7 +385,8 @@ assemble_status(svn_wc_status3_t **status,    if (!info) -    SVN_ERR(read_info(&info, local_abspath, db, result_pool, scratch_pool)); +    SVN_ERR(svn_wc__db_read_single_info(&info, db, local_abspath, +                                        result_pool, scratch_pool));    if (!info->repos_relpath || !parent_repos_relpath)      switched_p = FALSE; @@ -799,8 +692,11 @@ assemble_status(svn_wc_status3_t **status,      stat->changelist = apr_pstrdup(result_pool, info->changelist);    stat->moved_from_abspath = moved_from_abspath; -  if (info->moved_to_abspath) -    stat->moved_to_abspath = apr_pstrdup(result_pool, info->moved_to_abspath); + +  /* ### TODO: Handle multiple moved_to values properly */ +  if (info->moved_to) +    stat->moved_to_abspath = apr_pstrdup(result_pool, +                                         info->moved_to->moved_to_abspath);    stat->file_external = info->file_external; @@ -1345,8 +1241,8 @@ get_dir_status(const struct walk_status_baton *wb,      SVN_ERR(err);    if (!dir_info) -    SVN_ERR(read_info(&dir_info, local_abspath, wb->db, -                      scratch_pool, iterpool)); +      SVN_ERR(svn_wc__db_read_single_info(&dir_info, wb->db, local_abspath, +                                          scratch_pool, iterpool));    SVN_ERR(get_repos_root_url_relpath(&dir_repos_relpath, &dir_repos_root_url,                                       &dir_repos_uuid, dir_info, @@ -1506,8 +1402,9 @@ get_child_status(const struct walk_status_baton *wb,    if (dirent->kind == svn_node_none)      dirent = NULL; -  SVN_ERR(read_info(&dir_info, parent_abspath, wb->db, -                    scratch_pool, scratch_pool)); +  SVN_ERR(svn_wc__db_read_single_info(&dir_info, +                                      wb->db, parent_abspath, +                                      scratch_pool, scratch_pool));    SVN_ERR(get_repos_root_url_relpath(&dir_repos_relpath, &dir_repos_root_url,                                       &dir_repos_uuid, dir_info, @@ -2710,7 +2607,8 @@ svn_wc__internal_walk_status(svn_wc__db_t *db,        ignore_patterns = ignores;      } -  err = read_info(&info, local_abspath, db, scratch_pool, scratch_pool); +  err = svn_wc__db_read_single_info(&info, db, local_abspath, +                                    scratch_pool, scratch_pool);    if (err)      { diff --git a/subversion/libsvn_wc/wc-checks.h b/subversion/libsvn_wc/wc-checks.h index 14d7ef3a7552..9fd40bd9fad9 100644 --- a/subversion/libsvn_wc/wc-checks.h +++ b/subversion/libsvn_wc/wc-checks.h @@ -1,4 +1,4 @@ -/* This file is automatically generated from wc-checks.sql and .dist_sandbox/subversion-1.8.8/subversion/libsvn_wc/token-map.h. +/* This file is automatically generated from wc-checks.sql and .dist_sandbox/subversion-1.8.9/subversion/libsvn_wc/token-map.h.   * Do not edit this file -- edit the source and rerun gen-make.py */  #define STMT_VERIFICATION_TRIGGERS 0 diff --git a/subversion/libsvn_wc/wc-metadata.h b/subversion/libsvn_wc/wc-metadata.h index 0ab17d4537d6..e39db8ab6ba1 100644 --- a/subversion/libsvn_wc/wc-metadata.h +++ b/subversion/libsvn_wc/wc-metadata.h @@ -1,4 +1,4 @@ -/* This file is automatically generated from wc-metadata.sql and .dist_sandbox/subversion-1.8.8/subversion/libsvn_wc/token-map.h. +/* This file is automatically generated from wc-metadata.sql and .dist_sandbox/subversion-1.8.9/subversion/libsvn_wc/token-map.h.   * Do not edit this file -- edit the source and rerun gen-make.py */  #define STMT_CREATE_SCHEMA 0 @@ -163,6 +163,8 @@  #define STMT_4_INFO {"STMT_INSTALL_SCHEMA_STATISTICS", NULL}  #define STMT_4 \    "ANALYZE sqlite_master; " \ +  "DELETE FROM sqlite_stat1 " \ +  "WHERE tbl in ('NODES', 'ACTUAL_NODE', 'LOCK', 'WC_LOCK'); " \    "INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES " \    "    ('NODES', 'sqlite_autoindex_NODES_1',               '8000 8000 2 1'); " \    "INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES " \ diff --git a/subversion/libsvn_wc/wc-metadata.sql b/subversion/libsvn_wc/wc-metadata.sql index 848293d2cebb..e4b226e09ea5 100644 --- a/subversion/libsvn_wc/wc-metadata.sql +++ b/subversion/libsvn_wc/wc-metadata.sql @@ -597,6 +597,9 @@ CREATE UNIQUE INDEX I_EXTERNALS_DEFINED ON EXTERNALS (wc_id,  -- STMT_INSTALL_SCHEMA_STATISTICS  ANALYZE sqlite_master; /* Creates empty sqlite_stat1 if necessary */ +DELETE FROM sqlite_stat1 +WHERE tbl in ('NODES', 'ACTUAL_NODE', 'LOCK', 'WC_LOCK'); +  INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES      ('NODES', 'sqlite_autoindex_NODES_1',               '8000 8000 2 1');  INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES diff --git a/subversion/libsvn_wc/wc-queries.h b/subversion/libsvn_wc/wc-queries.h index 0246ee50b99c..3fc6b2fe0f5f 100644 --- a/subversion/libsvn_wc/wc-queries.h +++ b/subversion/libsvn_wc/wc-queries.h @@ -1,4 +1,4 @@ -/* This file is automatically generated from wc-queries.sql and .dist_sandbox/subversion-1.8.8/subversion/libsvn_wc/token-map.h. +/* This file is automatically generated from wc-queries.sql and .dist_sandbox/subversion-1.8.9/subversion/libsvn_wc/token-map.h.   * Do not edit this file -- edit the source and rerun gen-make.py */  #define STMT_SELECT_NODE_INFO 0 @@ -221,7 +221,7 @@  #define STMT_21 \    "DELETE " \    "FROM NODES " \ -  "WHERE wc_id = ?1 AND local_relpath = ?2 " \ +  "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \    ""  #define STMT_DELETE_ACTUAL_FOR_BASE_RECURSIVE 22 @@ -516,9 +516,18 @@    "LIMIT 1 " \    "" -#define STMT_SELECT_OP_DEPTH_MOVED_TO 50 -#define STMT_50_INFO {"STMT_SELECT_OP_DEPTH_MOVED_TO", NULL} +#define STMT_SELECT_MOVED_TO_NODE 50 +#define STMT_50_INFO {"STMT_SELECT_MOVED_TO_NODE", NULL}  #define STMT_50 \ +  "SELECT op_depth, moved_to " \ +  "FROM nodes " \ +  "WHERE wc_id = ?1 AND local_relpath = ?2 AND moved_to IS NOT NULL " \ +  "ORDER BY op_depth DESC " \ +  "" + +#define STMT_SELECT_OP_DEPTH_MOVED_TO 51 +#define STMT_51_INFO {"STMT_SELECT_OP_DEPTH_MOVED_TO", NULL} +#define STMT_51 \    "SELECT op_depth, moved_to, repos_path, revision " \    "FROM nodes " \    "WHERE wc_id = ?1 AND local_relpath = ?2 " \ @@ -527,26 +536,26 @@    "ORDER BY op_depth DESC " \    "" -#define STMT_SELECT_MOVED_TO 51 -#define STMT_51_INFO {"STMT_SELECT_MOVED_TO", NULL} -#define STMT_51 \ +#define STMT_SELECT_MOVED_TO 52 +#define STMT_52_INFO {"STMT_SELECT_MOVED_TO", NULL} +#define STMT_52 \    "SELECT moved_to " \    "FROM nodes " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \    "" -#define STMT_SELECT_MOVED_HERE 52 -#define STMT_52_INFO {"STMT_SELECT_MOVED_HERE", NULL} -#define STMT_52 \ +#define STMT_SELECT_MOVED_HERE 53 +#define STMT_53_INFO {"STMT_SELECT_MOVED_HERE", NULL} +#define STMT_53 \    "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 " \    "" -#define STMT_SELECT_MOVED_BACK 53 -#define STMT_53_INFO {"STMT_SELECT_MOVED_BACK", NULL} -#define STMT_53 \ +#define STMT_SELECT_MOVED_BACK 54 +#define STMT_54_INFO {"STMT_SELECT_MOVED_BACK", NULL} +#define STMT_54 \    "SELECT u.local_relpath, " \    "       u.presence, u.repos_id, u.repos_path, u.revision, " \    "       l.presence, l.repos_id, l.repos_path, l.revision, " \ @@ -572,9 +581,9 @@    "  AND u.op_depth = ?4 " \    "" -#define STMT_DELETE_MOVED_BACK 54 -#define STMT_54_INFO {"STMT_DELETE_MOVED_BACK", NULL} -#define STMT_54 \ +#define STMT_DELETE_MOVED_BACK 55 +#define STMT_55_INFO {"STMT_DELETE_MOVED_BACK", NULL} +#define STMT_55 \    "DELETE FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 " \ @@ -582,71 +591,71 @@    "  AND op_depth = ?3 " \    "" -#define STMT_DELETE_LOCK 55 -#define STMT_55_INFO {"STMT_DELETE_LOCK", NULL} -#define STMT_55 \ +#define STMT_DELETE_LOCK 56 +#define STMT_56_INFO {"STMT_DELETE_LOCK", NULL} +#define STMT_56 \    "DELETE FROM lock " \    "WHERE repos_id = ?1 AND repos_relpath = ?2 " \    "" -#define STMT_DELETE_LOCK_RECURSIVELY 56 -#define STMT_56_INFO {"STMT_DELETE_LOCK_RECURSIVELY", NULL} -#define STMT_56 \ +#define STMT_DELETE_LOCK_RECURSIVELY 57 +#define STMT_57_INFO {"STMT_DELETE_LOCK_RECURSIVELY", NULL} +#define STMT_57 \    "DELETE FROM lock " \    "WHERE repos_id = ?1 AND (repos_relpath = ?2 OR (((repos_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((repos_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    "" -#define STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE 57 -#define STMT_57_INFO {"STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE", NULL} -#define STMT_57 \ +#define STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE 58 +#define STMT_58_INFO {"STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE", NULL} +#define STMT_58 \    "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) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    "" -#define STMT_RECURSIVE_UPDATE_NODE_REPO 58 -#define STMT_58_INFO {"STMT_RECURSIVE_UPDATE_NODE_REPO", NULL} -#define STMT_58 \ +#define STMT_RECURSIVE_UPDATE_NODE_REPO 59 +#define STMT_59_INFO {"STMT_RECURSIVE_UPDATE_NODE_REPO", NULL} +#define STMT_59 \    "UPDATE nodes SET repos_id = ?4, dav_cache = NULL " \    "WHERE (wc_id = ?1 AND local_relpath = ?2 AND repos_id = ?3) " \    "   OR (wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "       AND repos_id = ?3) " \    "" -#define STMT_UPDATE_LOCK_REPOS_ID 59 -#define STMT_59_INFO {"STMT_UPDATE_LOCK_REPOS_ID", NULL} -#define STMT_59 \ +#define STMT_UPDATE_LOCK_REPOS_ID 60 +#define STMT_60_INFO {"STMT_UPDATE_LOCK_REPOS_ID", NULL} +#define STMT_60 \    "UPDATE lock SET repos_id = ?2 " \    "WHERE repos_id = ?1 " \    "" -#define STMT_UPDATE_NODE_FILEINFO 60 -#define STMT_60_INFO {"STMT_UPDATE_NODE_FILEINFO", NULL} -#define STMT_60 \ +#define STMT_UPDATE_NODE_FILEINFO 61 +#define STMT_61_INFO {"STMT_UPDATE_NODE_FILEINFO", NULL} +#define STMT_61 \    "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) " \    "" -#define STMT_INSERT_ACTUAL_CONFLICT 61 -#define STMT_61_INFO {"STMT_INSERT_ACTUAL_CONFLICT", NULL} -#define STMT_61 \ +#define STMT_INSERT_ACTUAL_CONFLICT 62 +#define STMT_62_INFO {"STMT_INSERT_ACTUAL_CONFLICT", NULL} +#define STMT_62 \    "INSERT INTO actual_node (wc_id, local_relpath, conflict_data, parent_relpath) " \    "VALUES (?1, ?2, ?3, ?4) " \    "" -#define STMT_UPDATE_ACTUAL_CONFLICT 62 -#define STMT_62_INFO {"STMT_UPDATE_ACTUAL_CONFLICT", NULL} -#define STMT_62 \ +#define STMT_UPDATE_ACTUAL_CONFLICT 63 +#define STMT_63_INFO {"STMT_UPDATE_ACTUAL_CONFLICT", NULL} +#define STMT_63 \    "UPDATE actual_node SET conflict_data = ?3 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "" -#define STMT_UPDATE_ACTUAL_CHANGELISTS 63 -#define STMT_63_INFO {"STMT_UPDATE_ACTUAL_CHANGELISTS", NULL} -#define STMT_63 \ +#define STMT_UPDATE_ACTUAL_CHANGELISTS 64 +#define STMT_64_INFO {"STMT_UPDATE_ACTUAL_CHANGELISTS", NULL} +#define STMT_64 \    "UPDATE actual_node SET changelist = ?3 " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ @@ -656,16 +665,16 @@    "                         AND kind = 'file') " \    "" -#define STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST 64 -#define STMT_64_INFO {"STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST", NULL} -#define STMT_64 \ +#define STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST 65 +#define STMT_65_INFO {"STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST", NULL} +#define STMT_65 \    "UPDATE actual_node SET changelist = NULL " \    " WHERE wc_id = ?1 AND local_relpath = ?2 " \    "" -#define STMT_MARK_SKIPPED_CHANGELIST_DIRS 65 -#define STMT_65_INFO {"STMT_MARK_SKIPPED_CHANGELIST_DIRS", NULL} -#define STMT_65 \ +#define STMT_MARK_SKIPPED_CHANGELIST_DIRS 66 +#define STMT_66_INFO {"STMT_MARK_SKIPPED_CHANGELIST_DIRS", NULL} +#define STMT_66 \    "INSERT INTO changelist_list (wc_id, local_relpath, notify, changelist) " \    "SELECT wc_id, local_relpath, 7, ?3 " \    "FROM targets_list " \ @@ -674,17 +683,17 @@    "  AND kind = 'dir' " \    "" -#define STMT_RESET_ACTUAL_WITH_CHANGELIST 66 -#define STMT_66_INFO {"STMT_RESET_ACTUAL_WITH_CHANGELIST", NULL} -#define STMT_66 \ +#define STMT_RESET_ACTUAL_WITH_CHANGELIST 67 +#define STMT_67_INFO {"STMT_RESET_ACTUAL_WITH_CHANGELIST", NULL} +#define STMT_67 \    "REPLACE INTO actual_node ( " \    "  wc_id, local_relpath, parent_relpath, changelist) " \    "VALUES (?1, ?2, ?3, ?4) " \    "" -#define STMT_CREATE_CHANGELIST_LIST 67 -#define STMT_67_INFO {"STMT_CREATE_CHANGELIST_LIST", NULL} -#define STMT_67 \ +#define STMT_CREATE_CHANGELIST_LIST 68 +#define STMT_68_INFO {"STMT_CREATE_CHANGELIST_LIST", NULL} +#define STMT_68 \    "DROP TABLE IF EXISTS changelist_list; " \    "CREATE TEMPORARY TABLE changelist_list ( " \    "  wc_id  INTEGER NOT NULL, " \ @@ -695,9 +704,9 @@    ") " \    "" -#define STMT_CREATE_CHANGELIST_TRIGGER 68 -#define STMT_68_INFO {"STMT_CREATE_CHANGELIST_TRIGGER", NULL} -#define STMT_68 \ +#define STMT_CREATE_CHANGELIST_TRIGGER 69 +#define STMT_69_INFO {"STMT_CREATE_CHANGELIST_TRIGGER", NULL} +#define STMT_69 \    "DROP TRIGGER IF EXISTS   trigger_changelist_list_change; " \    "CREATE TEMPORARY TRIGGER trigger_changelist_list_change " \    "BEFORE UPDATE ON actual_node " \ @@ -712,25 +721,25 @@    "END " \    "" -#define STMT_FINALIZE_CHANGELIST 69 -#define STMT_69_INFO {"STMT_FINALIZE_CHANGELIST", NULL} -#define STMT_69 \ +#define STMT_FINALIZE_CHANGELIST 70 +#define STMT_70_INFO {"STMT_FINALIZE_CHANGELIST", NULL} +#define STMT_70 \    "DROP TRIGGER trigger_changelist_list_change; " \    "DROP TABLE changelist_list; " \    "DROP TABLE targets_list " \    "" -#define STMT_SELECT_CHANGELIST_LIST 70 -#define STMT_70_INFO {"STMT_SELECT_CHANGELIST_LIST", NULL} -#define STMT_70 \ +#define STMT_SELECT_CHANGELIST_LIST 71 +#define STMT_71_INFO {"STMT_SELECT_CHANGELIST_LIST", NULL} +#define STMT_71 \    "SELECT wc_id, local_relpath, notify, changelist " \    "FROM changelist_list " \    "ORDER BY wc_id, local_relpath ASC, notify DESC " \    "" -#define STMT_CREATE_TARGETS_LIST 71 -#define STMT_71_INFO {"STMT_CREATE_TARGETS_LIST", NULL} -#define STMT_71 \ +#define STMT_CREATE_TARGETS_LIST 72 +#define STMT_72_INFO {"STMT_CREATE_TARGETS_LIST", NULL} +#define STMT_72 \    "DROP TABLE IF EXISTS targets_list; " \    "CREATE TEMPORARY TABLE targets_list ( " \    "  wc_id  INTEGER NOT NULL, " \ @@ -741,15 +750,15 @@    "  ); " \    "" -#define STMT_DROP_TARGETS_LIST 72 -#define STMT_72_INFO {"STMT_DROP_TARGETS_LIST", NULL} -#define STMT_72 \ +#define STMT_DROP_TARGETS_LIST 73 +#define STMT_73_INFO {"STMT_DROP_TARGETS_LIST", NULL} +#define STMT_73 \    "DROP TABLE targets_list " \    "" -#define STMT_INSERT_TARGET 73 -#define STMT_73_INFO {"STMT_INSERT_TARGET", NULL} -#define STMT_73 \ +#define STMT_INSERT_TARGET 74 +#define STMT_74_INFO {"STMT_INSERT_TARGET", NULL} +#define STMT_74 \    "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \    "SELECT wc_id, local_relpath, parent_relpath, kind " \    "FROM nodes_current " \ @@ -757,9 +766,9 @@    "  AND local_relpath = ?2 " \    "" -#define STMT_INSERT_TARGET_DEPTH_FILES 74 -#define STMT_74_INFO {"STMT_INSERT_TARGET_DEPTH_FILES", NULL} -#define STMT_74 \ +#define STMT_INSERT_TARGET_DEPTH_FILES 75 +#define STMT_75_INFO {"STMT_INSERT_TARGET_DEPTH_FILES", NULL} +#define STMT_75 \    "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \    "SELECT wc_id, local_relpath, parent_relpath, kind " \    "FROM nodes_current " \ @@ -768,9 +777,9 @@    "  AND kind = 'file' " \    "" -#define STMT_INSERT_TARGET_DEPTH_IMMEDIATES 75 -#define STMT_75_INFO {"STMT_INSERT_TARGET_DEPTH_IMMEDIATES", NULL} -#define STMT_75 \ +#define STMT_INSERT_TARGET_DEPTH_IMMEDIATES 76 +#define STMT_76_INFO {"STMT_INSERT_TARGET_DEPTH_IMMEDIATES", NULL} +#define STMT_76 \    "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \    "SELECT wc_id, local_relpath, parent_relpath, kind " \    "FROM nodes_current " \ @@ -778,9 +787,9 @@    "  AND parent_relpath = ?2 " \    "" -#define STMT_INSERT_TARGET_DEPTH_INFINITY 76 -#define STMT_76_INFO {"STMT_INSERT_TARGET_DEPTH_INFINITY", NULL} -#define STMT_76 \ +#define STMT_INSERT_TARGET_DEPTH_INFINITY 77 +#define STMT_77_INFO {"STMT_INSERT_TARGET_DEPTH_INFINITY", NULL} +#define STMT_77 \    "INSERT INTO targets_list(wc_id, local_relpath, parent_relpath, kind) " \    "SELECT wc_id, local_relpath, parent_relpath, kind " \    "FROM nodes_current " \ @@ -788,9 +797,9 @@    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "" -#define STMT_INSERT_TARGET_WITH_CHANGELIST 77 -#define STMT_77_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST", NULL} -#define STMT_77 \ +#define STMT_INSERT_TARGET_WITH_CHANGELIST 78 +#define STMT_78_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST", NULL} +#define STMT_78 \    "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 " \ @@ -800,9 +809,9 @@    "   AND A.changelist = ?3 " \    "" -#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES 78 -#define STMT_78_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES", NULL} -#define STMT_78 \ +#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES 79 +#define STMT_79_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES", NULL} +#define STMT_79 \    "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 " \ @@ -813,9 +822,9 @@    "   AND A.changelist = ?3 " \    "" -#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES 79 -#define STMT_79_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES", NULL} -#define STMT_79 \ +#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES 80 +#define STMT_80_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES", NULL} +#define STMT_80 \    "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 " \ @@ -825,9 +834,9 @@    "  AND A.changelist = ?3 " \    "" -#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY 80 -#define STMT_80_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY", NULL} -#define STMT_80 \ +#define STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY 81 +#define STMT_81_INFO {"STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY", NULL} +#define STMT_81 \    "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 " \ @@ -837,18 +846,18 @@    "   AND A.changelist = ?3 " \    "" -#define STMT_INSERT_ACTUAL_EMPTIES 81 -#define STMT_81_INFO {"STMT_INSERT_ACTUAL_EMPTIES", NULL} -#define STMT_81 \ +#define STMT_INSERT_ACTUAL_EMPTIES 82 +#define STMT_82_INFO {"STMT_INSERT_ACTUAL_EMPTIES", NULL} +#define STMT_82 \    "INSERT OR IGNORE INTO actual_node ( " \    "     wc_id, local_relpath, parent_relpath) " \    "SELECT wc_id, local_relpath, parent_relpath " \    "FROM targets_list " \    "" -#define STMT_DELETE_ACTUAL_EMPTY 82 -#define STMT_82_INFO {"STMT_DELETE_ACTUAL_EMPTY", NULL} -#define STMT_82 \ +#define STMT_DELETE_ACTUAL_EMPTY 83 +#define STMT_83_INFO {"STMT_DELETE_ACTUAL_EMPTY", NULL} +#define STMT_83 \    "DELETE FROM actual_node " \    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "  AND properties IS NULL " \ @@ -860,9 +869,9 @@    "  AND left_checksum IS NULL " \    "" -#define STMT_DELETE_ACTUAL_EMPTIES 83 -#define STMT_83_INFO {"STMT_DELETE_ACTUAL_EMPTIES", NULL} -#define STMT_83 \ +#define STMT_DELETE_ACTUAL_EMPTIES 84 +#define STMT_84_INFO {"STMT_DELETE_ACTUAL_EMPTIES", NULL} +#define STMT_84 \    "DELETE FROM actual_node " \    "WHERE wc_id = ?1 " \    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -875,25 +884,25 @@    "  AND left_checksum IS NULL " \    "" -#define STMT_DELETE_BASE_NODE 84 -#define STMT_84_INFO {"STMT_DELETE_BASE_NODE", NULL} -#define STMT_84 \ +#define STMT_DELETE_BASE_NODE 85 +#define STMT_85_INFO {"STMT_DELETE_BASE_NODE", NULL} +#define STMT_85 \    "DELETE FROM nodes " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \    "" -#define STMT_DELETE_WORKING_NODE 85 -#define STMT_85_INFO {"STMT_DELETE_WORKING_NODE", NULL} -#define STMT_85 \ +#define STMT_DELETE_WORKING_NODE 86 +#define STMT_86_INFO {"STMT_DELETE_WORKING_NODE", NULL} +#define STMT_86 \    "DELETE 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) " \    "" -#define STMT_DELETE_LOWEST_WORKING_NODE 86 -#define STMT_86_INFO {"STMT_DELETE_LOWEST_WORKING_NODE", NULL} -#define STMT_86 \ +#define STMT_DELETE_LOWEST_WORKING_NODE 87 +#define STMT_87_INFO {"STMT_DELETE_LOWEST_WORKING_NODE", NULL} +#define STMT_87 \    "DELETE FROM nodes " \    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "  AND op_depth = (SELECT MIN(op_depth) FROM nodes " \ @@ -901,16 +910,16 @@    "  AND presence = 'base-deleted' " \    "" -#define STMT_DELETE_ALL_LAYERS 87 -#define STMT_87_INFO {"STMT_DELETE_ALL_LAYERS", NULL} -#define STMT_87 \ +#define STMT_DELETE_NODE_ALL_LAYERS 88 +#define STMT_88_INFO {"STMT_DELETE_NODE_ALL_LAYERS", NULL} +#define STMT_88 \    "DELETE FROM nodes " \    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "" -#define STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE 88 -#define STMT_88_INFO {"STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE", NULL} -#define STMT_88 \ +#define STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE 89 +#define STMT_89_INFO {"STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE", NULL} +#define STMT_89 \    "DELETE FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 " \ @@ -918,25 +927,25 @@    "  AND op_depth >= ?3 " \    "" -#define STMT_DELETE_ACTUAL_NODE 89 -#define STMT_89_INFO {"STMT_DELETE_ACTUAL_NODE", NULL} -#define STMT_89 \ +#define STMT_DELETE_ACTUAL_NODE 90 +#define STMT_90_INFO {"STMT_DELETE_ACTUAL_NODE", NULL} +#define STMT_90 \    "DELETE FROM actual_node " \    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "" -#define STMT_DELETE_ACTUAL_NODE_RECURSIVE 90 -#define STMT_90_INFO {"STMT_DELETE_ACTUAL_NODE_RECURSIVE", NULL} -#define STMT_90 \ +#define STMT_DELETE_ACTUAL_NODE_RECURSIVE 91 +#define STMT_91_INFO {"STMT_DELETE_ACTUAL_NODE_RECURSIVE", NULL} +#define STMT_91 \    "DELETE FROM actual_node " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 " \    "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    "" -#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST 91 -#define STMT_91_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST", NULL} -#define STMT_91 \ +#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST 92 +#define STMT_92_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST", NULL} +#define STMT_92 \    "DELETE FROM actual_node " \    "WHERE wc_id = ?1 " \    "  AND local_relpath = ?2 " \ @@ -946,9 +955,9 @@    "                        AND c.kind = 'file')) " \    "" -#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 92 -#define STMT_92_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL} -#define STMT_92 \ +#define STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 93 +#define STMT_93_INFO {"STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL} +#define STMT_93 \    "DELETE FROM actual_node " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 " \ @@ -960,9 +969,9 @@    "                        AND c.kind = 'file')) " \    "" -#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST 93 -#define STMT_93_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST", NULL} -#define STMT_93 \ +#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST 94 +#define STMT_94_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST", NULL} +#define STMT_94 \    "UPDATE actual_node " \    "SET properties = NULL, " \    "    text_mod = NULL, " \ @@ -974,9 +983,9 @@    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "" -#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 94 -#define STMT_94_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL} -#define STMT_94 \ +#define STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE 95 +#define STMT_95_INFO {"STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE", NULL} +#define STMT_95 \    "UPDATE actual_node " \    "SET properties = NULL, " \    "    text_mod = NULL, " \ @@ -990,108 +999,108 @@    "       OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    "" -#define STMT_UPDATE_NODE_BASE_DEPTH 95 -#define STMT_95_INFO {"STMT_UPDATE_NODE_BASE_DEPTH", NULL} -#define STMT_95 \ +#define STMT_UPDATE_NODE_BASE_DEPTH 96 +#define STMT_96_INFO {"STMT_UPDATE_NODE_BASE_DEPTH", NULL} +#define STMT_96 \    "UPDATE nodes SET depth = ?3 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \    "  AND kind='dir' " \    "" -#define STMT_UPDATE_NODE_BASE_PRESENCE 96 -#define STMT_96_INFO {"STMT_UPDATE_NODE_BASE_PRESENCE", NULL} -#define STMT_96 \ +#define STMT_UPDATE_NODE_BASE_PRESENCE 97 +#define STMT_97_INFO {"STMT_UPDATE_NODE_BASE_PRESENCE", NULL} +#define STMT_97 \    "UPDATE nodes SET presence = ?3 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \    "" -#define STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH 97 -#define STMT_97_INFO {"STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH", NULL} -#define STMT_97 \ +#define STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH 98 +#define STMT_98_INFO {"STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH", NULL} +#define STMT_98 \    "UPDATE nodes SET presence = ?3, revision = ?4, repos_path = ?5 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \    "" -#define STMT_LOOK_FOR_WORK 98 -#define STMT_98_INFO {"STMT_LOOK_FOR_WORK", NULL} -#define STMT_98 \ +#define STMT_LOOK_FOR_WORK 99 +#define STMT_99_INFO {"STMT_LOOK_FOR_WORK", NULL} +#define STMT_99 \    "SELECT id FROM work_queue LIMIT 1 " \    "" -#define STMT_INSERT_WORK_ITEM 99 -#define STMT_99_INFO {"STMT_INSERT_WORK_ITEM", NULL} -#define STMT_99 \ +#define STMT_INSERT_WORK_ITEM 100 +#define STMT_100_INFO {"STMT_INSERT_WORK_ITEM", NULL} +#define STMT_100 \    "INSERT INTO work_queue (work) VALUES (?1) " \    "" -#define STMT_SELECT_WORK_ITEM 100 -#define STMT_100_INFO {"STMT_SELECT_WORK_ITEM", NULL} -#define STMT_100 \ +#define STMT_SELECT_WORK_ITEM 101 +#define STMT_101_INFO {"STMT_SELECT_WORK_ITEM", NULL} +#define STMT_101 \    "SELECT id, work FROM work_queue ORDER BY id LIMIT 1 " \    "" -#define STMT_DELETE_WORK_ITEM 101 -#define STMT_101_INFO {"STMT_DELETE_WORK_ITEM", NULL} -#define STMT_101 \ +#define STMT_DELETE_WORK_ITEM 102 +#define STMT_102_INFO {"STMT_DELETE_WORK_ITEM", NULL} +#define STMT_102 \    "DELETE FROM work_queue WHERE id = ?1 " \    "" -#define STMT_INSERT_OR_IGNORE_PRISTINE 102 -#define STMT_102_INFO {"STMT_INSERT_OR_IGNORE_PRISTINE", NULL} -#define STMT_102 \ +#define STMT_INSERT_OR_IGNORE_PRISTINE 103 +#define STMT_103_INFO {"STMT_INSERT_OR_IGNORE_PRISTINE", NULL} +#define STMT_103 \    "INSERT OR IGNORE INTO pristine (checksum, md5_checksum, size, refcount) " \    "VALUES (?1, ?2, ?3, 0) " \    "" -#define STMT_INSERT_PRISTINE 103 -#define STMT_103_INFO {"STMT_INSERT_PRISTINE", NULL} -#define STMT_103 \ +#define STMT_INSERT_PRISTINE 104 +#define STMT_104_INFO {"STMT_INSERT_PRISTINE", NULL} +#define STMT_104 \    "INSERT INTO pristine (checksum, md5_checksum, size, refcount) " \    "VALUES (?1, ?2, ?3, 0) " \    "" -#define STMT_SELECT_PRISTINE 104 -#define STMT_104_INFO {"STMT_SELECT_PRISTINE", NULL} -#define STMT_104 \ +#define STMT_SELECT_PRISTINE 105 +#define STMT_105_INFO {"STMT_SELECT_PRISTINE", NULL} +#define STMT_105 \    "SELECT md5_checksum " \    "FROM pristine " \    "WHERE checksum = ?1 " \    "" -#define STMT_SELECT_PRISTINE_SIZE 105 -#define STMT_105_INFO {"STMT_SELECT_PRISTINE_SIZE", NULL} -#define STMT_105 \ +#define STMT_SELECT_PRISTINE_SIZE 106 +#define STMT_106_INFO {"STMT_SELECT_PRISTINE_SIZE", NULL} +#define STMT_106 \    "SELECT size " \    "FROM pristine " \    "WHERE checksum = ?1 LIMIT 1 " \    "" -#define STMT_SELECT_PRISTINE_BY_MD5 106 -#define STMT_106_INFO {"STMT_SELECT_PRISTINE_BY_MD5", NULL} -#define STMT_106 \ +#define STMT_SELECT_PRISTINE_BY_MD5 107 +#define STMT_107_INFO {"STMT_SELECT_PRISTINE_BY_MD5", NULL} +#define STMT_107 \    "SELECT checksum " \    "FROM pristine " \    "WHERE md5_checksum = ?1 " \    "" -#define STMT_SELECT_UNREFERENCED_PRISTINES 107 -#define STMT_107_INFO {"STMT_SELECT_UNREFERENCED_PRISTINES", NULL} -#define STMT_107 \ +#define STMT_SELECT_UNREFERENCED_PRISTINES 108 +#define STMT_108_INFO {"STMT_SELECT_UNREFERENCED_PRISTINES", NULL} +#define STMT_108 \    "SELECT checksum " \    "FROM pristine " \    "WHERE refcount = 0 " \    "" -#define STMT_DELETE_PRISTINE_IF_UNREFERENCED 108 -#define STMT_108_INFO {"STMT_DELETE_PRISTINE_IF_UNREFERENCED", NULL} -#define STMT_108 \ +#define STMT_DELETE_PRISTINE_IF_UNREFERENCED 109 +#define STMT_109_INFO {"STMT_DELETE_PRISTINE_IF_UNREFERENCED", NULL} +#define STMT_109 \    "DELETE FROM pristine " \    "WHERE checksum = ?1 AND refcount = 0 " \    "" -#define STMT_SELECT_COPY_PRISTINES 109 -#define STMT_109_INFO {"STMT_SELECT_COPY_PRISTINES", NULL} -#define STMT_109 \ +#define STMT_SELECT_COPY_PRISTINES 110 +#define STMT_110_INFO {"STMT_SELECT_COPY_PRISTINES", NULL} +#define STMT_110 \    "SELECT n.checksum, md5_checksum, size " \    "FROM nodes_current n " \    "LEFT JOIN pristine p ON n.checksum = p.checksum " \ @@ -1109,62 +1118,62 @@    "  AND n.checksum IS NOT NULL " \    "" -#define STMT_VACUUM 110 -#define STMT_110_INFO {"STMT_VACUUM", NULL} -#define STMT_110 \ +#define STMT_VACUUM 111 +#define STMT_111_INFO {"STMT_VACUUM", NULL} +#define STMT_111 \    "VACUUM " \    "" -#define STMT_SELECT_CONFLICT_VICTIMS 111 -#define STMT_111_INFO {"STMT_SELECT_CONFLICT_VICTIMS", NULL} -#define STMT_111 \ +#define STMT_SELECT_CONFLICT_VICTIMS 112 +#define STMT_112_INFO {"STMT_SELECT_CONFLICT_VICTIMS", NULL} +#define STMT_112 \    "SELECT local_relpath, conflict_data " \    "FROM actual_node " \    "WHERE wc_id = ?1 AND parent_relpath = ?2 AND " \    "  NOT (conflict_data IS NULL) " \    "" -#define STMT_INSERT_WC_LOCK 112 -#define STMT_112_INFO {"STMT_INSERT_WC_LOCK", NULL} -#define STMT_112 \ +#define STMT_INSERT_WC_LOCK 113 +#define STMT_113_INFO {"STMT_INSERT_WC_LOCK", NULL} +#define STMT_113 \    "INSERT INTO wc_lock (wc_id, local_dir_relpath, locked_levels) " \    "VALUES (?1, ?2, ?3) " \    "" -#define STMT_SELECT_WC_LOCK 113 -#define STMT_113_INFO {"STMT_SELECT_WC_LOCK", NULL} -#define STMT_113 \ +#define STMT_SELECT_WC_LOCK 114 +#define STMT_114_INFO {"STMT_SELECT_WC_LOCK", NULL} +#define STMT_114 \    "SELECT locked_levels FROM wc_lock " \    "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \    "" -#define STMT_SELECT_ANCESTOR_WCLOCKS 114 -#define STMT_114_INFO {"STMT_SELECT_ANCESTOR_WCLOCKS", NULL} -#define STMT_114 \ +#define STMT_SELECT_ANCESTOR_WCLOCKS 115 +#define STMT_115_INFO {"STMT_SELECT_ANCESTOR_WCLOCKS", NULL} +#define STMT_115 \    "SELECT local_dir_relpath, locked_levels FROM wc_lock " \    "WHERE wc_id = ?1 " \    "  AND ((local_dir_relpath >= ?3 AND local_dir_relpath <= ?2) " \    "       OR local_dir_relpath = '') " \    "" -#define STMT_DELETE_WC_LOCK 115 -#define STMT_115_INFO {"STMT_DELETE_WC_LOCK", NULL} -#define STMT_115 \ +#define STMT_DELETE_WC_LOCK 116 +#define STMT_116_INFO {"STMT_DELETE_WC_LOCK", NULL} +#define STMT_116 \    "DELETE FROM wc_lock " \    "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \    "" -#define STMT_FIND_WC_LOCK 116 -#define STMT_116_INFO {"STMT_FIND_WC_LOCK", NULL} -#define STMT_116 \ +#define STMT_FIND_WC_LOCK 117 +#define STMT_117_INFO {"STMT_FIND_WC_LOCK", NULL} +#define STMT_117 \    "SELECT local_dir_relpath FROM wc_lock " \    "WHERE wc_id = ?1 " \    "  AND (((local_dir_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_dir_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "" -#define STMT_DELETE_WC_LOCK_ORPHAN 117 -#define STMT_117_INFO {"STMT_DELETE_WC_LOCK_ORPHAN", NULL} -#define STMT_117 \ +#define STMT_DELETE_WC_LOCK_ORPHAN 118 +#define STMT_118_INFO {"STMT_DELETE_WC_LOCK_ORPHAN", NULL} +#define STMT_118 \    "DELETE FROM wc_lock " \    "WHERE wc_id = ?1 AND local_dir_relpath = ?2 " \    "AND NOT EXISTS (SELECT 1 FROM nodes " \ @@ -1172,9 +1181,9 @@    "                   AND nodes.local_relpath = wc_lock.local_dir_relpath) " \    "" -#define STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE 118 -#define STMT_118_INFO {"STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE", NULL} -#define STMT_118 \ +#define STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE 119 +#define STMT_119_INFO {"STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE", NULL} +#define STMT_119 \    "DELETE FROM wc_lock " \    "WHERE wc_id = ?1 " \    "  AND (local_dir_relpath = ?2 " \ @@ -1184,9 +1193,9 @@    "                     AND nodes.local_relpath = wc_lock.local_dir_relpath) " \    "" -#define STMT_APPLY_CHANGES_TO_BASE_NODE 119 -#define STMT_119_INFO {"STMT_APPLY_CHANGES_TO_BASE_NODE", NULL} -#define STMT_119 \ +#define STMT_APPLY_CHANGES_TO_BASE_NODE 120 +#define STMT_120_INFO {"STMT_APPLY_CHANGES_TO_BASE_NODE", NULL} +#define STMT_120 \    "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, " \ @@ -1200,18 +1209,18 @@    "            AND op_depth = 0)) " \    "" -#define STMT_INSTALL_WORKING_NODE_FOR_DELETE 120 -#define STMT_120_INFO {"STMT_INSTALL_WORKING_NODE_FOR_DELETE", NULL} -#define STMT_120 \ +#define STMT_INSTALL_WORKING_NODE_FOR_DELETE 121 +#define STMT_121_INFO {"STMT_INSTALL_WORKING_NODE_FOR_DELETE", NULL} +#define STMT_121 \    "INSERT OR REPLACE INTO nodes ( " \    "    wc_id, local_relpath, op_depth, " \    "    parent_relpath, presence, kind) " \    "VALUES(?1, ?2, ?3, ?4, 'base-deleted', ?5) " \    "" -#define STMT_DELETE_NO_LOWER_LAYER 121 -#define STMT_121_INFO {"STMT_DELETE_NO_LOWER_LAYER", NULL} -#define STMT_121 \ +#define STMT_DELETE_NO_LOWER_LAYER 122 +#define STMT_122_INFO {"STMT_DELETE_NO_LOWER_LAYER", NULL} +#define STMT_122 \    "DELETE FROM nodes " \    " WHERE wc_id = ?1 " \    "   AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ @@ -1223,9 +1232,9 @@    "                    AND n.presence IN ('normal', 'incomplete')) " \    "" -#define STMT_REPLACE_WITH_BASE_DELETED 122 -#define STMT_122_INFO {"STMT_REPLACE_WITH_BASE_DELETED", NULL} -#define STMT_122 \ +#define STMT_REPLACE_WITH_BASE_DELETED 123 +#define STMT_123_INFO {"STMT_REPLACE_WITH_BASE_DELETED", NULL} +#define STMT_123 \    "INSERT OR REPLACE INTO nodes (wc_id, local_relpath, op_depth, parent_relpath, " \    "                              kind, moved_to, presence) " \    "SELECT wc_id, local_relpath, op_depth, parent_relpath, " \ @@ -1236,9 +1245,9 @@    "   AND op_depth = ?3 " \    "" -#define STMT_INSERT_DELETE_FROM_NODE_RECURSIVE 123 -#define STMT_123_INFO {"STMT_INSERT_DELETE_FROM_NODE_RECURSIVE", NULL} -#define STMT_123 \ +#define STMT_INSERT_DELETE_FROM_NODE_RECURSIVE 124 +#define STMT_124_INFO {"STMT_INSERT_DELETE_FROM_NODE_RECURSIVE", NULL} +#define STMT_124 \    "INSERT INTO nodes ( " \    "    wc_id, local_relpath, op_depth, parent_relpath, presence, kind) " \    "SELECT wc_id, local_relpath, ?4 , parent_relpath, 'base-deleted', " \ @@ -1252,9 +1261,9 @@    "  AND file_external IS NULL " \    "" -#define STMT_INSERT_WORKING_NODE_FROM_BASE_COPY 124 -#define STMT_124_INFO {"STMT_INSERT_WORKING_NODE_FROM_BASE_COPY", NULL} -#define STMT_124 \ +#define STMT_INSERT_WORKING_NODE_FROM_BASE_COPY 125 +#define STMT_125_INFO {"STMT_INSERT_WORKING_NODE_FROM_BASE_COPY", NULL} +#define STMT_125 \    "INSERT INTO nodes ( " \    "    wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, " \    "    revision, presence, depth, kind, changed_revision, changed_date, " \ @@ -1268,9 +1277,9 @@    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \    "" -#define STMT_INSERT_DELETE_FROM_BASE 125 -#define STMT_125_INFO {"STMT_INSERT_DELETE_FROM_BASE", NULL} -#define STMT_125 \ +#define STMT_INSERT_DELETE_FROM_BASE 126 +#define STMT_126_INFO {"STMT_INSERT_DELETE_FROM_BASE", NULL} +#define STMT_126 \    "INSERT INTO nodes ( " \    "    wc_id, local_relpath, op_depth, parent_relpath, presence, kind) " \    "SELECT wc_id, local_relpath, ?3 , parent_relpath, " \ @@ -1279,34 +1288,34 @@    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \    "" -#define STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE 126 -#define STMT_126_INFO {"STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE", NULL} -#define STMT_126 \ +#define STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE 127 +#define STMT_127_INFO {"STMT_UPDATE_OP_DEPTH_INCREASE_RECURSIVE", NULL} +#define STMT_127 \    "UPDATE nodes SET op_depth = ?3 + 1 " \    "WHERE wc_id = ?1 " \    " AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    " AND op_depth = ?3 " \    "" -#define STMT_UPDATE_OP_DEPTH_RECURSIVE 127 -#define STMT_127_INFO {"STMT_UPDATE_OP_DEPTH_RECURSIVE", NULL} -#define STMT_127 \ +#define STMT_UPDATE_OP_DEPTH_RECURSIVE 128 +#define STMT_128_INFO {"STMT_UPDATE_OP_DEPTH_RECURSIVE", NULL} +#define STMT_128 \    "UPDATE nodes SET op_depth = ?4, moved_here = NULL " \    "WHERE wc_id = ?1 " \    " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    " AND op_depth = ?3 " \    "" -#define STMT_DOES_NODE_EXIST 128 -#define STMT_128_INFO {"STMT_DOES_NODE_EXIST", NULL} -#define STMT_128 \ +#define STMT_DOES_NODE_EXIST 129 +#define STMT_129_INFO {"STMT_DOES_NODE_EXIST", NULL} +#define STMT_129 \    "SELECT 1 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2 " \    "LIMIT 1 " \    "" -#define STMT_HAS_SERVER_EXCLUDED_DESCENDANTS 129 -#define STMT_129_INFO {"STMT_HAS_SERVER_EXCLUDED_DESCENDANTS", NULL} -#define STMT_129 \ +#define STMT_HAS_SERVER_EXCLUDED_DESCENDANTS 130 +#define STMT_130_INFO {"STMT_HAS_SERVER_EXCLUDED_DESCENDANTS", NULL} +#define STMT_130 \    "SELECT local_relpath FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -1314,9 +1323,9 @@    "LIMIT 1 " \    "" -#define STMT_SELECT_ALL_EXCLUDED_DESCENDANTS 130 -#define STMT_130_INFO {"STMT_SELECT_ALL_EXCLUDED_DESCENDANTS", NULL} -#define STMT_130 \ +#define STMT_SELECT_ALL_EXCLUDED_DESCENDANTS 131 +#define STMT_131_INFO {"STMT_SELECT_ALL_EXCLUDED_DESCENDANTS", NULL} +#define STMT_131 \    "SELECT local_relpath FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -1324,9 +1333,9 @@    "  AND (presence = 'server-excluded' OR presence = 'excluded') " \    "" -#define STMT_INSERT_WORKING_NODE_COPY_FROM 131 -#define STMT_131_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM", NULL} -#define STMT_131 \ +#define STMT_INSERT_WORKING_NODE_COPY_FROM 132 +#define STMT_132_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM", NULL} +#define STMT_132 \    "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, " \ @@ -1345,9 +1354,9 @@    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "" -#define STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH 132 -#define STMT_132_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH", NULL} -#define STMT_132 \ +#define STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH 133 +#define STMT_133_INFO {"STMT_INSERT_WORKING_NODE_COPY_FROM_DEPTH", NULL} +#define STMT_133 \    "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, " \ @@ -1366,49 +1375,49 @@    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?7 " \    "" -#define STMT_UPDATE_BASE_REVISION 133 -#define STMT_133_INFO {"STMT_UPDATE_BASE_REVISION", NULL} -#define STMT_133 \ +#define STMT_UPDATE_BASE_REVISION 134 +#define STMT_134_INFO {"STMT_UPDATE_BASE_REVISION", NULL} +#define STMT_134 \    "UPDATE nodes SET revision = ?3 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \    "" -#define STMT_UPDATE_BASE_REPOS 134 -#define STMT_134_INFO {"STMT_UPDATE_BASE_REPOS", NULL} -#define STMT_134 \ +#define STMT_UPDATE_BASE_REPOS 135 +#define STMT_135_INFO {"STMT_UPDATE_BASE_REPOS", NULL} +#define STMT_135 \    "UPDATE nodes SET repos_id = ?3, repos_path = ?4 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 " \    "" -#define STMT_ACTUAL_HAS_CHILDREN 135 -#define STMT_135_INFO {"STMT_ACTUAL_HAS_CHILDREN", NULL} -#define STMT_135 \ +#define STMT_ACTUAL_HAS_CHILDREN 136 +#define STMT_136_INFO {"STMT_ACTUAL_HAS_CHILDREN", NULL} +#define STMT_136 \    "SELECT 1 FROM actual_node " \    "WHERE wc_id = ?1 AND parent_relpath = ?2 " \    "LIMIT 1 " \    "" -#define STMT_INSERT_EXTERNAL 136 -#define STMT_136_INFO {"STMT_INSERT_EXTERNAL", NULL} -#define STMT_136 \ +#define STMT_INSERT_EXTERNAL 137 +#define STMT_137_INFO {"STMT_INSERT_EXTERNAL", NULL} +#define STMT_137 \    "INSERT OR REPLACE INTO externals ( " \    "    wc_id, local_relpath, parent_relpath, presence, kind, def_local_relpath, " \    "    repos_id, def_repos_relpath, def_operational_revision, def_revision) " \    "VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10) " \    "" -#define STMT_SELECT_EXTERNAL_INFO 137 -#define STMT_137_INFO {"STMT_SELECT_EXTERNAL_INFO", NULL} -#define STMT_137 \ +#define STMT_SELECT_EXTERNAL_INFO 138 +#define STMT_138_INFO {"STMT_SELECT_EXTERNAL_INFO", NULL} +#define STMT_138 \    "SELECT presence, kind, def_local_relpath, repos_id, " \    "    def_repos_relpath, def_operational_revision, def_revision " \    "FROM externals WHERE wc_id = ?1 AND local_relpath = ?2 " \    "LIMIT 1 " \    "" -#define STMT_DELETE_FILE_EXTERNALS 138 -#define STMT_138_INFO {"STMT_DELETE_FILE_EXTERNALS", NULL} -#define STMT_138 \ +#define STMT_DELETE_FILE_EXTERNALS 139 +#define STMT_139_INFO {"STMT_DELETE_FILE_EXTERNALS", NULL} +#define STMT_139 \    "DELETE FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -1416,26 +1425,26 @@    "  AND file_external IS NOT NULL " \    "" -#define STMT_DELETE_FILE_EXTERNAL_REGISTATIONS 139 -#define STMT_139_INFO {"STMT_DELETE_FILE_EXTERNAL_REGISTATIONS", NULL} -#define STMT_139 \ +#define STMT_DELETE_FILE_EXTERNAL_REGISTATIONS 140 +#define STMT_140_INFO {"STMT_DELETE_FILE_EXTERNAL_REGISTATIONS", NULL} +#define STMT_140 \    "DELETE FROM externals " \    "WHERE wc_id = ?1 " \    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "  AND kind != 'dir' " \    "" -#define STMT_DELETE_EXTERNAL_REGISTATIONS 140 -#define STMT_140_INFO {"STMT_DELETE_EXTERNAL_REGISTATIONS", NULL} -#define STMT_140 \ +#define STMT_DELETE_EXTERNAL_REGISTATIONS 141 +#define STMT_141_INFO {"STMT_DELETE_EXTERNAL_REGISTATIONS", NULL} +#define STMT_141 \    "DELETE FROM externals " \    "WHERE wc_id = ?1 " \    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "" -#define STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW 141 -#define STMT_141_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW", NULL} -#define STMT_141 \ +#define STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW 142 +#define STMT_142_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW", NULL} +#define STMT_142 \    "SELECT local_relpath, kind, def_repos_relpath, " \    "  (SELECT root FROM repository AS r WHERE r.id = e.repos_id) " \    "FROM externals e " \ @@ -1453,9 +1462,9 @@    "                  AND nodes.local_relpath = e.parent_relpath)) " \    "" -#define STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW 142 -#define STMT_142_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW", NULL} -#define STMT_142 \ +#define STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW 143 +#define STMT_143_INFO {"STMT_SELECT_COMMITTABLE_EXTERNALS_IMMEDIATELY_BELOW", NULL} +#define STMT_143 \    "SELECT local_relpath, kind, def_repos_relpath, " \    "  (SELECT root FROM repository AS r WHERE r.id = e.repos_id) " \    "FROM externals e " \ @@ -1474,25 +1483,25 @@    "                  AND nodes.local_relpath = e.parent_relpath)) " \    "" -#define STMT_SELECT_EXTERNALS_DEFINED 143 -#define STMT_143_INFO {"STMT_SELECT_EXTERNALS_DEFINED", NULL} -#define STMT_143 \ +#define STMT_SELECT_EXTERNALS_DEFINED 144 +#define STMT_144_INFO {"STMT_SELECT_EXTERNALS_DEFINED", NULL} +#define STMT_144 \    "SELECT local_relpath, def_local_relpath " \    "FROM externals " \    "WHERE (wc_id = ?1 AND def_local_relpath = ?2) " \    "   OR (wc_id = ?1 AND (((def_local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((def_local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    "" -#define STMT_DELETE_EXTERNAL 144 -#define STMT_144_INFO {"STMT_DELETE_EXTERNAL", NULL} -#define STMT_144 \ +#define STMT_DELETE_EXTERNAL 145 +#define STMT_145_INFO {"STMT_DELETE_EXTERNAL", NULL} +#define STMT_145 \    "DELETE FROM externals " \    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "" -#define STMT_SELECT_EXTERNAL_PROPERTIES 145 -#define STMT_145_INFO {"STMT_SELECT_EXTERNAL_PROPERTIES", NULL} -#define STMT_145 \ +#define STMT_SELECT_EXTERNAL_PROPERTIES 146 +#define STMT_146_INFO {"STMT_SELECT_EXTERNAL_PROPERTIES", NULL} +#define STMT_146 \    "SELECT IFNULL((SELECT properties FROM actual_node a " \    "               WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath), " \    "              properties), " \ @@ -1510,9 +1519,9 @@    "  AND kind = 'dir' AND presence IN ('normal', 'incomplete') " \    "" -#define STMT_SELECT_CURRENT_PROPS_RECURSIVE 146 -#define STMT_146_INFO {"STMT_SELECT_CURRENT_PROPS_RECURSIVE", NULL} -#define STMT_146 \ +#define STMT_SELECT_CURRENT_PROPS_RECURSIVE 147 +#define STMT_147_INFO {"STMT_SELECT_CURRENT_PROPS_RECURSIVE", NULL} +#define STMT_147 \    "SELECT IFNULL((SELECT properties FROM actual_node a " \    "               WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath), " \    "              properties), " \ @@ -1522,57 +1531,57 @@    "   OR (wc_id = ?1 AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    "" -#define STMT_PRAGMA_LOCKING_MODE 147 -#define STMT_147_INFO {"STMT_PRAGMA_LOCKING_MODE", NULL} -#define STMT_147 \ +#define STMT_PRAGMA_LOCKING_MODE 148 +#define STMT_148_INFO {"STMT_PRAGMA_LOCKING_MODE", NULL} +#define STMT_148 \    "PRAGMA locking_mode = exclusive " \    "" -#define STMT_INSERT_ACTUAL_NODE 148 -#define STMT_148_INFO {"STMT_INSERT_ACTUAL_NODE", NULL} -#define STMT_148 \ +#define STMT_INSERT_ACTUAL_NODE 149 +#define STMT_149_INFO {"STMT_INSERT_ACTUAL_NODE", NULL} +#define STMT_149 \    "INSERT OR REPLACE INTO actual_node ( " \    "  wc_id, local_relpath, parent_relpath, properties, changelist, conflict_data) " \    "VALUES (?1, ?2, ?3, ?4, ?5, ?6) " \    "" -#define STMT_UPDATE_ACTUAL_CONFLICT_DATA 149 -#define STMT_149_INFO {"STMT_UPDATE_ACTUAL_CONFLICT_DATA", NULL} -#define STMT_149 \ +#define STMT_UPDATE_ACTUAL_CONFLICT_DATA 150 +#define STMT_150_INFO {"STMT_UPDATE_ACTUAL_CONFLICT_DATA", NULL} +#define STMT_150 \    "UPDATE actual_node SET conflict_data = ?3 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 " \    "" -#define STMT_INSERT_ACTUAL_CONFLICT_DATA 150 -#define STMT_150_INFO {"STMT_INSERT_ACTUAL_CONFLICT_DATA", NULL} -#define STMT_150 \ +#define STMT_INSERT_ACTUAL_CONFLICT_DATA 151 +#define STMT_151_INFO {"STMT_INSERT_ACTUAL_CONFLICT_DATA", NULL} +#define STMT_151 \    "INSERT INTO actual_node (wc_id, local_relpath, conflict_data, parent_relpath) " \    "VALUES (?1, ?2, ?3, ?4) " \    "" -#define STMT_SELECT_ALL_FILES 151 -#define STMT_151_INFO {"STMT_SELECT_ALL_FILES", NULL} -#define STMT_151 \ +#define STMT_SELECT_ALL_FILES 152 +#define STMT_152_INFO {"STMT_SELECT_ALL_FILES", NULL} +#define STMT_152 \    "SELECT local_relpath FROM nodes_current " \    "WHERE wc_id = ?1 AND parent_relpath = ?2 AND kind = 'file' " \    "" -#define STMT_UPDATE_NODE_PROPS 152 -#define STMT_152_INFO {"STMT_UPDATE_NODE_PROPS", NULL} -#define STMT_152 \ +#define STMT_UPDATE_NODE_PROPS 153 +#define STMT_153_INFO {"STMT_UPDATE_NODE_PROPS", NULL} +#define STMT_153 \    "UPDATE nodes SET properties = ?4 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \    "" -#define STMT_PRAGMA_TABLE_INFO_NODES 153 -#define STMT_153_INFO {"STMT_PRAGMA_TABLE_INFO_NODES", NULL} -#define STMT_153 \ +#define STMT_PRAGMA_TABLE_INFO_NODES 154 +#define STMT_154_INFO {"STMT_PRAGMA_TABLE_INFO_NODES", NULL} +#define STMT_154 \    "PRAGMA table_info(\"NODES\") " \    "" -#define STMT_CREATE_TARGET_PROP_CACHE 154 -#define STMT_154_INFO {"STMT_CREATE_TARGET_PROP_CACHE", NULL} -#define STMT_154 \ +#define STMT_CREATE_TARGET_PROP_CACHE 155 +#define STMT_155_INFO {"STMT_CREATE_TARGET_PROP_CACHE", NULL} +#define STMT_155 \    "DROP TABLE IF EXISTS target_prop_cache; " \    "CREATE TEMPORARY TABLE target_prop_cache ( " \    "  local_relpath TEXT NOT NULL PRIMARY KEY, " \ @@ -1581,9 +1590,9 @@    "); " \    "" -#define STMT_CACHE_TARGET_PROPS 155 -#define STMT_155_INFO {"STMT_CACHE_TARGET_PROPS", NULL} -#define STMT_155 \ +#define STMT_CACHE_TARGET_PROPS 156 +#define STMT_156_INFO {"STMT_CACHE_TARGET_PROPS", NULL} +#define STMT_156 \    "INSERT INTO target_prop_cache(local_relpath, kind, properties) " \    " SELECT n.local_relpath, n.kind, " \    "        IFNULL((SELECT properties FROM actual_node AS a " \ @@ -1602,9 +1611,9 @@    "  ORDER BY t.local_relpath " \    "" -#define STMT_CACHE_TARGET_PRISTINE_PROPS 156 -#define STMT_156_INFO {"STMT_CACHE_TARGET_PRISTINE_PROPS", NULL} -#define STMT_156 \ +#define STMT_CACHE_TARGET_PRISTINE_PROPS 157 +#define STMT_157_INFO {"STMT_CACHE_TARGET_PRISTINE_PROPS", NULL} +#define STMT_157 \    "INSERT INTO target_prop_cache(local_relpath, kind, properties) " \    " SELECT n.local_relpath, n.kind, " \    "        CASE n.presence " \ @@ -1629,22 +1638,22 @@    "  ORDER BY t.local_relpath " \    "" -#define STMT_SELECT_ALL_TARGET_PROP_CACHE 157 -#define STMT_157_INFO {"STMT_SELECT_ALL_TARGET_PROP_CACHE", NULL} -#define STMT_157 \ +#define STMT_SELECT_ALL_TARGET_PROP_CACHE 158 +#define STMT_158_INFO {"STMT_SELECT_ALL_TARGET_PROP_CACHE", NULL} +#define STMT_158 \    "SELECT local_relpath, properties FROM target_prop_cache " \    "ORDER BY local_relpath " \    "" -#define STMT_DROP_TARGET_PROP_CACHE 158 -#define STMT_158_INFO {"STMT_DROP_TARGET_PROP_CACHE", NULL} -#define STMT_158 \ +#define STMT_DROP_TARGET_PROP_CACHE 159 +#define STMT_159_INFO {"STMT_DROP_TARGET_PROP_CACHE", NULL} +#define STMT_159 \    "DROP TABLE target_prop_cache; " \    "" -#define STMT_CREATE_REVERT_LIST 159 -#define STMT_159_INFO {"STMT_CREATE_REVERT_LIST", NULL} -#define STMT_159 \ +#define STMT_CREATE_REVERT_LIST 160 +#define STMT_160_INFO {"STMT_CREATE_REVERT_LIST", NULL} +#define STMT_160 \    "DROP TABLE IF EXISTS revert_list; " \    "CREATE TEMPORARY TABLE revert_list ( " \    "   local_relpath TEXT NOT NULL, " \ @@ -1700,26 +1709,26 @@    "END " \    "" -#define STMT_DROP_REVERT_LIST_TRIGGERS 160 -#define STMT_160_INFO {"STMT_DROP_REVERT_LIST_TRIGGERS", NULL} -#define STMT_160 \ +#define STMT_DROP_REVERT_LIST_TRIGGERS 161 +#define STMT_161_INFO {"STMT_DROP_REVERT_LIST_TRIGGERS", NULL} +#define STMT_161 \    "DROP TRIGGER trigger_revert_list_nodes; " \    "DROP TRIGGER trigger_revert_list_actual_delete; " \    "DROP TRIGGER trigger_revert_list_actual_update " \    "" -#define STMT_SELECT_REVERT_LIST 161 -#define STMT_161_INFO {"STMT_SELECT_REVERT_LIST", NULL} -#define STMT_161 \ +#define STMT_SELECT_REVERT_LIST 162 +#define STMT_162_INFO {"STMT_SELECT_REVERT_LIST", NULL} +#define STMT_162 \    "SELECT actual, notify, kind, op_depth, repos_id, conflict_data " \    "FROM revert_list " \    "WHERE local_relpath = ?1 " \    "ORDER BY actual DESC " \    "" -#define STMT_SELECT_REVERT_LIST_COPIED_CHILDREN 162 -#define STMT_162_INFO {"STMT_SELECT_REVERT_LIST_COPIED_CHILDREN", NULL} -#define STMT_162 \ +#define STMT_SELECT_REVERT_LIST_COPIED_CHILDREN 163 +#define STMT_163_INFO {"STMT_SELECT_REVERT_LIST_COPIED_CHILDREN", NULL} +#define STMT_163 \    "SELECT local_relpath, kind " \    "FROM revert_list " \    "WHERE (((local_relpath) > (CASE (?1) WHEN '' THEN '' ELSE (?1) || '/' END)) AND ((local_relpath) < CASE (?1) WHEN '' THEN X'FFFF' ELSE (?1) || '0' END)) " \ @@ -1728,15 +1737,15 @@    "ORDER BY local_relpath " \    "" -#define STMT_DELETE_REVERT_LIST 163 -#define STMT_163_INFO {"STMT_DELETE_REVERT_LIST", NULL} -#define STMT_163 \ +#define STMT_DELETE_REVERT_LIST 164 +#define STMT_164_INFO {"STMT_DELETE_REVERT_LIST", NULL} +#define STMT_164 \    "DELETE FROM revert_list WHERE local_relpath = ?1 " \    "" -#define STMT_SELECT_REVERT_LIST_RECURSIVE 164 -#define STMT_164_INFO {"STMT_SELECT_REVERT_LIST_RECURSIVE", NULL} -#define STMT_164 \ +#define STMT_SELECT_REVERT_LIST_RECURSIVE 165 +#define STMT_165_INFO {"STMT_SELECT_REVERT_LIST_RECURSIVE", NULL} +#define STMT_165 \    "SELECT DISTINCT local_relpath " \    "FROM revert_list " \    "WHERE (local_relpath = ?1 " \ @@ -1745,32 +1754,32 @@    "ORDER BY local_relpath " \    "" -#define STMT_DELETE_REVERT_LIST_RECURSIVE 165 -#define STMT_165_INFO {"STMT_DELETE_REVERT_LIST_RECURSIVE", NULL} -#define STMT_165 \ +#define STMT_DELETE_REVERT_LIST_RECURSIVE 166 +#define STMT_166_INFO {"STMT_DELETE_REVERT_LIST_RECURSIVE", NULL} +#define STMT_166 \    "DELETE FROM revert_list " \    "WHERE (local_relpath = ?1 " \    "       OR (((local_relpath) > (CASE (?1) WHEN '' THEN '' ELSE (?1) || '/' END)) AND ((local_relpath) < CASE (?1) WHEN '' THEN X'FFFF' ELSE (?1) || '0' END))) " \    "" -#define STMT_DROP_REVERT_LIST 166 -#define STMT_166_INFO {"STMT_DROP_REVERT_LIST", NULL} -#define STMT_166 \ +#define STMT_DROP_REVERT_LIST 167 +#define STMT_167_INFO {"STMT_DROP_REVERT_LIST", NULL} +#define STMT_167 \    "DROP TABLE IF EXISTS revert_list " \    "" -#define STMT_CREATE_DELETE_LIST 167 -#define STMT_167_INFO {"STMT_CREATE_DELETE_LIST", NULL} -#define STMT_167 \ +#define STMT_CREATE_DELETE_LIST 168 +#define STMT_168_INFO {"STMT_CREATE_DELETE_LIST", NULL} +#define STMT_168 \    "DROP TABLE IF EXISTS delete_list; " \    "CREATE TEMPORARY TABLE delete_list ( " \    "   local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE " \    "   ) " \    "" -#define STMT_INSERT_DELETE_LIST 168 -#define STMT_168_INFO {"STMT_INSERT_DELETE_LIST", NULL} -#define STMT_168 \ +#define STMT_INSERT_DELETE_LIST 169 +#define STMT_169_INFO {"STMT_INSERT_DELETE_LIST", NULL} +#define STMT_169 \    "INSERT INTO delete_list(local_relpath) " \    "SELECT local_relpath FROM nodes AS n " \    "WHERE wc_id = ?1 " \ @@ -1784,22 +1793,22 @@    "  AND file_external IS NULL " \    "" -#define STMT_SELECT_DELETE_LIST 169 -#define STMT_169_INFO {"STMT_SELECT_DELETE_LIST", NULL} -#define STMT_169 \ +#define STMT_SELECT_DELETE_LIST 170 +#define STMT_170_INFO {"STMT_SELECT_DELETE_LIST", NULL} +#define STMT_170 \    "SELECT local_relpath FROM delete_list " \    "ORDER BY local_relpath " \    "" -#define STMT_FINALIZE_DELETE 170 -#define STMT_170_INFO {"STMT_FINALIZE_DELETE", NULL} -#define STMT_170 \ +#define STMT_FINALIZE_DELETE 171 +#define STMT_171_INFO {"STMT_FINALIZE_DELETE", NULL} +#define STMT_171 \    "DROP TABLE IF EXISTS delete_list " \    "" -#define STMT_CREATE_UPDATE_MOVE_LIST 171 -#define STMT_171_INFO {"STMT_CREATE_UPDATE_MOVE_LIST", NULL} -#define STMT_171 \ +#define STMT_CREATE_UPDATE_MOVE_LIST 172 +#define STMT_172_INFO {"STMT_CREATE_UPDATE_MOVE_LIST", NULL} +#define STMT_172 \    "DROP TABLE IF EXISTS update_move_list; " \    "CREATE TEMPORARY TABLE update_move_list ( " \    "  local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE, " \ @@ -1810,31 +1819,31 @@    "  ) " \    "" -#define STMT_INSERT_UPDATE_MOVE_LIST 172 -#define STMT_172_INFO {"STMT_INSERT_UPDATE_MOVE_LIST", NULL} -#define STMT_172 \ +#define STMT_INSERT_UPDATE_MOVE_LIST 173 +#define STMT_173_INFO {"STMT_INSERT_UPDATE_MOVE_LIST", NULL} +#define STMT_173 \    "INSERT INTO update_move_list(local_relpath, action, kind, content_state, " \    "  prop_state) " \    "VALUES (?1, ?2, ?3, ?4, ?5) " \    "" -#define STMT_SELECT_UPDATE_MOVE_LIST 173 -#define STMT_173_INFO {"STMT_SELECT_UPDATE_MOVE_LIST", NULL} -#define STMT_173 \ +#define STMT_SELECT_UPDATE_MOVE_LIST 174 +#define STMT_174_INFO {"STMT_SELECT_UPDATE_MOVE_LIST", NULL} +#define STMT_174 \    "SELECT local_relpath, action, kind, content_state, prop_state " \    "FROM update_move_list " \    "ORDER BY local_relpath " \    "" -#define STMT_FINALIZE_UPDATE_MOVE 174 -#define STMT_174_INFO {"STMT_FINALIZE_UPDATE_MOVE", NULL} -#define STMT_174 \ +#define STMT_FINALIZE_UPDATE_MOVE 175 +#define STMT_175_INFO {"STMT_FINALIZE_UPDATE_MOVE", NULL} +#define STMT_175 \    "DROP TABLE IF EXISTS update_move_list " \    "" -#define STMT_SELECT_MIN_MAX_REVISIONS 175 -#define STMT_175_INFO {"STMT_SELECT_MIN_MAX_REVISIONS", NULL} -#define STMT_175 \ +#define STMT_SELECT_MIN_MAX_REVISIONS 176 +#define STMT_176_INFO {"STMT_SELECT_MIN_MAX_REVISIONS", NULL} +#define STMT_176 \    "SELECT MIN(revision), MAX(revision), " \    "       MIN(changed_revision), MAX(changed_revision) FROM nodes " \    "  WHERE wc_id = ?1 " \ @@ -1845,9 +1854,9 @@    "    AND op_depth = 0 " \    "" -#define STMT_HAS_SPARSE_NODES 176 -#define STMT_176_INFO {"STMT_HAS_SPARSE_NODES", NULL} -#define STMT_176 \ +#define STMT_HAS_SPARSE_NODES 177 +#define STMT_177_INFO {"STMT_HAS_SPARSE_NODES", NULL} +#define STMT_177 \    "SELECT 1 FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 " \ @@ -1859,9 +1868,9 @@    "LIMIT 1 " \    "" -#define STMT_SUBTREE_HAS_TREE_MODIFICATIONS 177 -#define STMT_177_INFO {"STMT_SUBTREE_HAS_TREE_MODIFICATIONS", NULL} -#define STMT_177 \ +#define STMT_SUBTREE_HAS_TREE_MODIFICATIONS 178 +#define STMT_178_INFO {"STMT_SUBTREE_HAS_TREE_MODIFICATIONS", NULL} +#define STMT_178 \    "SELECT 1 FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 " \ @@ -1870,9 +1879,9 @@    "LIMIT 1 " \    "" -#define STMT_SUBTREE_HAS_PROP_MODIFICATIONS 178 -#define STMT_178_INFO {"STMT_SUBTREE_HAS_PROP_MODIFICATIONS", NULL} -#define STMT_178 \ +#define STMT_SUBTREE_HAS_PROP_MODIFICATIONS 179 +#define STMT_179_INFO {"STMT_SUBTREE_HAS_PROP_MODIFICATIONS", NULL} +#define STMT_179 \    "SELECT 1 FROM actual_node " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 " \ @@ -1881,9 +1890,9 @@    "LIMIT 1 " \    "" -#define STMT_HAS_SWITCHED 179 -#define STMT_179_INFO {"STMT_HAS_SWITCHED", NULL} -#define STMT_179 \ +#define STMT_HAS_SWITCHED 180 +#define STMT_180_INFO {"STMT_HAS_SWITCHED", NULL} +#define STMT_180 \    "SELECT 1 " \    "FROM nodes " \    "WHERE wc_id = ?1 " \ @@ -1895,9 +1904,9 @@    "LIMIT 1 " \    "" -#define STMT_SELECT_BASE_FILES_RECURSIVE 180 -#define STMT_180_INFO {"STMT_SELECT_BASE_FILES_RECURSIVE", NULL} -#define STMT_180 \ +#define STMT_SELECT_BASE_FILES_RECURSIVE 181 +#define STMT_181_INFO {"STMT_SELECT_BASE_FILES_RECURSIVE", NULL} +#define STMT_181 \    "SELECT local_relpath, translated_size, last_mod_time FROM nodes AS n " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 " \ @@ -1908,75 +1917,92 @@    "  AND file_external IS NULL " \    "" -#define STMT_SELECT_MOVED_FROM_RELPATH 181 -#define STMT_181_INFO {"STMT_SELECT_MOVED_FROM_RELPATH", NULL} -#define STMT_181 \ +#define STMT_SELECT_MOVED_FROM_RELPATH 182 +#define STMT_182_INFO {"STMT_SELECT_MOVED_FROM_RELPATH", NULL} +#define STMT_182 \    "SELECT local_relpath, op_depth FROM nodes " \    "WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 " \    "" -#define STMT_UPDATE_MOVED_TO_RELPATH 182 -#define STMT_182_INFO {"STMT_UPDATE_MOVED_TO_RELPATH", NULL} -#define STMT_182 \ +#define STMT_UPDATE_MOVED_TO_RELPATH 183 +#define STMT_183_INFO {"STMT_UPDATE_MOVED_TO_RELPATH", NULL} +#define STMT_183 \    "UPDATE nodes SET moved_to = ?4 " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \    "" -#define STMT_CLEAR_MOVED_TO_RELPATH 183 -#define STMT_183_INFO {"STMT_CLEAR_MOVED_TO_RELPATH", NULL} -#define STMT_183 \ +#define STMT_CLEAR_MOVED_TO_RELPATH 184 +#define STMT_184_INFO {"STMT_CLEAR_MOVED_TO_RELPATH", NULL} +#define STMT_184 \    "UPDATE nodes SET moved_to = NULL " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 " \    "" -#define STMT_CLEAR_MOVED_HERE_RECURSIVE 184 -#define STMT_184_INFO {"STMT_CLEAR_MOVED_HERE_RECURSIVE", NULL} -#define STMT_184 \ +#define STMT_CLEAR_MOVED_HERE_RECURSIVE 185 +#define STMT_185_INFO {"STMT_CLEAR_MOVED_HERE_RECURSIVE", NULL} +#define STMT_185 \    "UPDATE nodes SET moved_here = NULL " \    "WHERE wc_id = ?1 " \    " AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    " AND op_depth = ?3 " \    "" -#define STMT_SELECT_MOVED_HERE_CHILDREN 185 -#define STMT_185_INFO {"STMT_SELECT_MOVED_HERE_CHILDREN", NULL} -#define STMT_185 \ +#define STMT_SELECT_MOVED_HERE_CHILDREN 186 +#define STMT_186_INFO {"STMT_SELECT_MOVED_HERE_CHILDREN", NULL} +#define STMT_186 \    "SELECT moved_to, local_relpath FROM nodes " \    "WHERE wc_id = ?1 AND op_depth > 0 " \    "  AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "" -#define STMT_SELECT_MOVED_FOR_DELETE 186 -#define STMT_186_INFO {"STMT_SELECT_MOVED_FOR_DELETE", NULL} -#define STMT_186 \ -  "SELECT local_relpath, moved_to, op_depth FROM nodes " \ +#define STMT_SELECT_MOVED_FOR_DELETE 187 +#define STMT_187_INFO {"STMT_SELECT_MOVED_FOR_DELETE", NULL} +#define STMT_187 \ +  "SELECT local_relpath, moved_to, op_depth, " \ +  "       (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r " \ +  "        WHERE r.wc_id = ?1 " \ +  "          AND r.local_relpath = n.local_relpath " \ +  "          AND r.op_depth < n.op_depth " \ +  "        ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth " \ +  " FROM nodes n " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \    "  AND moved_to IS NOT NULL " \ -  "  AND op_depth >= (SELECT MAX(op_depth) FROM nodes o " \ -  "                    WHERE o.wc_id = ?1 " \ -  "                      AND o.local_relpath = ?2) " \ +  "  AND op_depth >= ?3 " \    "" -#define STMT_UPDATE_MOVED_TO_DESCENDANTS 187 -#define STMT_187_INFO {"STMT_UPDATE_MOVED_TO_DESCENDANTS", NULL} -#define STMT_187 \ +#define STMT_SELECT_MOVED_FROM_FOR_DELETE 188 +#define STMT_188_INFO {"STMT_SELECT_MOVED_FROM_FOR_DELETE", NULL} +#define STMT_188 \ +  "SELECT local_relpath, op_depth, " \ +  "       (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r " \ +  "        WHERE r.wc_id = ?1 " \ +  "          AND r.local_relpath = n.local_relpath " \ +  "          AND r.op_depth < n.op_depth " \ +  "        ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth " \ +  " FROM nodes n " \ +  "WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 " \ +  "" + +#define STMT_UPDATE_MOVED_TO_DESCENDANTS 189 +#define STMT_189_INFO {"STMT_UPDATE_MOVED_TO_DESCENDANTS", NULL} +#define STMT_189 \    "UPDATE nodes SET moved_to = (CASE WHEN (?2) = '' THEN (CASE WHEN (?3) = '' THEN (moved_to) WHEN (moved_to) = '' THEN (?3) ELSE (?3) || '/' || (moved_to) END) WHEN (?3) = '' THEN (CASE WHEN (?2) = '' THEN (moved_to)  WHEN SUBSTR((moved_to), 1, LENGTH(?2)) = (?2)  THEN CASE WHEN LENGTH(?2) = LENGTH(moved_to) THEN '' WHEN SUBSTR((moved_to), LENGTH(?2)+1, 1) = '/' THEN SUBSTR((moved_to), LENGTH(?2)+2) END END) WHEN SUBSTR((moved_to), 1, LENGTH(?2)) = (?2) THEN CASE WHEN LENGTH(?2) = LENGTH(moved_to) THEN (?3) WHEN SUBSTR((moved_to), LENGTH(?2)+1, 1) = '/' THEN (?3) || SUBSTR((moved_to), LENGTH(?2)+1) END END) " \    " WHERE wc_id = ?1 " \    "   AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "" -#define STMT_CLEAR_MOVED_TO_DESCENDANTS 188 -#define STMT_188_INFO {"STMT_CLEAR_MOVED_TO_DESCENDANTS", NULL} -#define STMT_188 \ +#define STMT_CLEAR_MOVED_TO_DESCENDANTS 190 +#define STMT_190_INFO {"STMT_CLEAR_MOVED_TO_DESCENDANTS", NULL} +#define STMT_190 \    "UPDATE nodes SET moved_to = NULL " \    " WHERE wc_id = ?1 " \    "   AND (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "" -#define STMT_SELECT_MOVED_PAIR2 189 -#define STMT_189_INFO {"STMT_SELECT_MOVED_PAIR2", NULL} -#define STMT_189 \ +#define STMT_SELECT_MOVED_PAIR2 191 +#define STMT_191_INFO {"STMT_SELECT_MOVED_PAIR2", NULL} +#define STMT_191 \    "SELECT local_relpath, moved_to, op_depth FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ @@ -1987,9 +2013,9 @@    "                      AND o.local_relpath = ?2) " \    "" -#define STMT_SELECT_MOVED_PAIR3 190 -#define STMT_190_INFO {"STMT_SELECT_MOVED_PAIR3", NULL} -#define STMT_190 \ +#define STMT_SELECT_MOVED_PAIR3 192 +#define STMT_192_INFO {"STMT_SELECT_MOVED_PAIR3", NULL} +#define STMT_192 \    "SELECT local_relpath, moved_to, op_depth, kind FROM nodes " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 " \    "  AND moved_to IS NOT NULL " \ @@ -2002,9 +2028,9 @@    "ORDER BY local_relpath, op_depth " \    "" -#define STMT_SELECT_MOVED_OUTSIDE 191 -#define STMT_191_INFO {"STMT_SELECT_MOVED_OUTSIDE", NULL} -#define STMT_191 \ +#define STMT_SELECT_MOVED_OUTSIDE 193 +#define STMT_193_INFO {"STMT_SELECT_MOVED_OUTSIDE", NULL} +#define STMT_193 \    "SELECT local_relpath, moved_to, op_depth FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (local_relpath = ?2 OR (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END))) " \ @@ -2013,9 +2039,9 @@    "  AND NOT (((moved_to) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((moved_to) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \    "" -#define STMT_SELECT_OP_DEPTH_MOVED_PAIR 192 -#define STMT_192_INFO {"STMT_SELECT_OP_DEPTH_MOVED_PAIR", NULL} -#define STMT_192 \ +#define STMT_SELECT_OP_DEPTH_MOVED_PAIR 194 +#define STMT_194_INFO {"STMT_SELECT_OP_DEPTH_MOVED_PAIR", NULL} +#define STMT_194 \    "SELECT n.local_relpath, n.moved_to, " \    "       (SELECT o.repos_path FROM nodes AS o " \    "        WHERE o.wc_id = n.wc_id " \ @@ -2028,9 +2054,9 @@    "  AND n.moved_to IS NOT NULL " \    "" -#define STMT_SELECT_MOVED_DESCENDANTS 193 -#define STMT_193_INFO {"STMT_SELECT_MOVED_DESCENDANTS", NULL} -#define STMT_193 \ +#define STMT_SELECT_MOVED_DESCENDANTS 195 +#define STMT_195_INFO {"STMT_SELECT_MOVED_DESCENDANTS", NULL} +#define STMT_195 \    "SELECT n.local_relpath, h.moved_to " \    "FROM nodes n, nodes h " \    "WHERE n.wc_id = ?1 " \ @@ -2046,9 +2072,9 @@    "  AND h.moved_to IS NOT NULL " \    "" -#define STMT_COMMIT_UPDATE_ORIGIN 194 -#define STMT_194_INFO {"STMT_COMMIT_UPDATE_ORIGIN", NULL} -#define STMT_194 \ +#define STMT_COMMIT_UPDATE_ORIGIN 196 +#define STMT_196_INFO {"STMT_COMMIT_UPDATE_ORIGIN", NULL} +#define STMT_196 \    "UPDATE nodes SET repos_id = ?4, " \    "                 repos_path = ?5 || SUBSTR(local_relpath, LENGTH(?2)+1), " \    "                 revision = ?6 " \ @@ -2058,16 +2084,16 @@    "  AND op_depth = ?3 " \    "" -#define STMT_HAS_LAYER_BETWEEN 195 -#define STMT_195_INFO {"STMT_HAS_LAYER_BETWEEN", NULL} -#define STMT_195 \ +#define STMT_HAS_LAYER_BETWEEN 197 +#define STMT_197_INFO {"STMT_HAS_LAYER_BETWEEN", NULL} +#define STMT_197 \    "SELECT 1 FROM NODES " \    "WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 AND op_depth < ?4 " \    "" -#define STMT_SELECT_REPOS_PATH_REVISION 196 -#define STMT_196_INFO {"STMT_SELECT_REPOS_PATH_REVISION", NULL} -#define STMT_196 \ +#define STMT_SELECT_REPOS_PATH_REVISION 198 +#define STMT_198_INFO {"STMT_SELECT_REPOS_PATH_REVISION", NULL} +#define STMT_198 \    "SELECT local_relpath, repos_path, revision FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -2075,16 +2101,16 @@    "ORDER BY local_relpath " \    "" -#define STMT_SELECT_HAS_NON_FILE_CHILDREN 197 -#define STMT_197_INFO {"STMT_SELECT_HAS_NON_FILE_CHILDREN", NULL} -#define STMT_197 \ +#define STMT_SELECT_HAS_NON_FILE_CHILDREN 199 +#define STMT_199_INFO {"STMT_SELECT_HAS_NON_FILE_CHILDREN", NULL} +#define STMT_199 \    "SELECT 1 FROM nodes " \    "WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0 AND kind != 'file' " \    "" -#define STMT_SELECT_HAS_GRANDCHILDREN 198 -#define STMT_198_INFO {"STMT_SELECT_HAS_GRANDCHILDREN", NULL} -#define STMT_198 \ +#define STMT_SELECT_HAS_GRANDCHILDREN 200 +#define STMT_200_INFO {"STMT_SELECT_HAS_GRANDCHILDREN", NULL} +#define STMT_200 \    "SELECT 1 FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (((parent_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((parent_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -2092,33 +2118,33 @@    "  AND file_external IS NULL " \    "" -#define STMT_SELECT_ALL_NODES 199 -#define STMT_199_INFO {"STMT_SELECT_ALL_NODES", NULL} -#define STMT_199 \ +#define STMT_SELECT_ALL_NODES 201 +#define STMT_201_INFO {"STMT_SELECT_ALL_NODES", NULL} +#define STMT_201 \    "SELECT op_depth, local_relpath, parent_relpath, file_external FROM nodes " \    "WHERE wc_id = ?1 " \    "" -#define STMT_SELECT_IPROPS 200 -#define STMT_200_INFO {"STMT_SELECT_IPROPS", NULL} -#define STMT_200 \ +#define STMT_SELECT_IPROPS 202 +#define STMT_202_INFO {"STMT_SELECT_IPROPS", NULL} +#define STMT_202 \    "SELECT inherited_props FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND local_relpath = ?2 " \    "  AND op_depth = 0 " \    "" -#define STMT_UPDATE_IPROP 201 -#define STMT_201_INFO {"STMT_UPDATE_IPROP", NULL} -#define STMT_201 \ +#define STMT_UPDATE_IPROP 203 +#define STMT_203_INFO {"STMT_UPDATE_IPROP", NULL} +#define STMT_203 \    "UPDATE nodes " \    "SET inherited_props = ?3 " \    "WHERE (wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0) " \    "" -#define STMT_SELECT_IPROPS_NODE 202 -#define STMT_202_INFO {"STMT_SELECT_IPROPS_NODE", NULL} -#define STMT_202 \ +#define STMT_SELECT_IPROPS_NODE 204 +#define STMT_204_INFO {"STMT_SELECT_IPROPS_NODE", NULL} +#define STMT_204 \    "SELECT local_relpath, repos_path FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND local_relpath = ?2 " \ @@ -2126,9 +2152,9 @@    "  AND (inherited_props not null) " \    "" -#define STMT_SELECT_IPROPS_RECURSIVE 203 -#define STMT_203_INFO {"STMT_SELECT_IPROPS_RECURSIVE", NULL} -#define STMT_203 \ +#define STMT_SELECT_IPROPS_RECURSIVE 205 +#define STMT_205_INFO {"STMT_SELECT_IPROPS_RECURSIVE", NULL} +#define STMT_205 \    "SELECT local_relpath, repos_path FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND (((local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2) || '/' END)) AND ((local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0' END)) " \ @@ -2136,9 +2162,9 @@    "  AND (inherited_props not null) " \    "" -#define STMT_SELECT_IPROPS_CHILDREN 204 -#define STMT_204_INFO {"STMT_SELECT_IPROPS_CHILDREN", NULL} -#define STMT_204 \ +#define STMT_SELECT_IPROPS_CHILDREN 206 +#define STMT_206_INFO {"STMT_SELECT_IPROPS_CHILDREN", NULL} +#define STMT_206 \    "SELECT local_relpath, repos_path FROM nodes " \    "WHERE wc_id = ?1 " \    "  AND parent_relpath = ?2 " \ @@ -2146,9 +2172,9 @@    "  AND (inherited_props not null) " \    "" -#define STMT_CREATE_SCHEMA 205 -#define STMT_205_INFO {"STMT_CREATE_SCHEMA", NULL} -#define STMT_205 \ +#define STMT_CREATE_SCHEMA 207 +#define STMT_207_INFO {"STMT_CREATE_SCHEMA", NULL} +#define STMT_207 \    "CREATE TABLE REPOSITORY ( " \    "  id INTEGER PRIMARY KEY AUTOINCREMENT, " \    "  root  TEXT UNIQUE NOT NULL, " \ @@ -2213,9 +2239,9 @@    "; " \    "" -#define STMT_CREATE_NODES 206 -#define STMT_206_INFO {"STMT_CREATE_NODES", NULL} -#define STMT_206 \ +#define STMT_CREATE_NODES 208 +#define STMT_208_INFO {"STMT_CREATE_NODES", NULL} +#define STMT_208 \    "CREATE TABLE NODES ( " \    "  wc_id  INTEGER NOT NULL REFERENCES WCROOT (id), " \    "  local_relpath  TEXT NOT NULL, " \ @@ -2255,9 +2281,9 @@    "  WHERE op_depth = 0; " \    "" -#define STMT_CREATE_NODES_TRIGGERS 207 -#define STMT_207_INFO {"STMT_CREATE_NODES_TRIGGERS", NULL} -#define STMT_207 \ +#define STMT_CREATE_NODES_TRIGGERS 209 +#define STMT_209_INFO {"STMT_CREATE_NODES_TRIGGERS", NULL} +#define STMT_209 \    "CREATE TRIGGER nodes_insert_trigger " \    "AFTER INSERT ON nodes " \    "WHEN NEW.checksum IS NOT NULL " \ @@ -2283,9 +2309,9 @@    "END; " \    "" -#define STMT_CREATE_EXTERNALS 208 -#define STMT_208_INFO {"STMT_CREATE_EXTERNALS", NULL} -#define STMT_208 \ +#define STMT_CREATE_EXTERNALS 210 +#define STMT_210_INFO {"STMT_CREATE_EXTERNALS", NULL} +#define STMT_210 \    "CREATE TABLE EXTERNALS ( " \    "  wc_id  INTEGER NOT NULL REFERENCES WCROOT (id), " \    "  local_relpath  TEXT NOT NULL, " \ @@ -2304,10 +2330,12 @@    "                                                      local_relpath); " \    "" -#define STMT_INSTALL_SCHEMA_STATISTICS 209 -#define STMT_209_INFO {"STMT_INSTALL_SCHEMA_STATISTICS", NULL} -#define STMT_209 \ +#define STMT_INSTALL_SCHEMA_STATISTICS 211 +#define STMT_211_INFO {"STMT_INSTALL_SCHEMA_STATISTICS", NULL} +#define STMT_211 \    "ANALYZE sqlite_master; " \ +  "DELETE FROM sqlite_stat1 " \ +  "WHERE tbl in ('NODES', 'ACTUAL_NODE', 'LOCK', 'WC_LOCK'); " \    "INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES " \    "    ('NODES', 'sqlite_autoindex_NODES_1',               '8000 8000 2 1'); " \    "INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES " \ @@ -2325,9 +2353,9 @@    "ANALYZE sqlite_master; " \    "" -#define STMT_UPGRADE_TO_20 210 -#define STMT_210_INFO {"STMT_UPGRADE_TO_20", NULL} -#define STMT_210 \ +#define STMT_UPGRADE_TO_20 212 +#define STMT_212_INFO {"STMT_UPGRADE_TO_20", NULL} +#define STMT_212 \    "UPDATE BASE_NODE SET checksum = (SELECT checksum FROM pristine " \    "                                 WHERE md5_checksum = BASE_NODE.checksum) " \    "WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = BASE_NODE.checksum); " \ @@ -2368,59 +2396,59 @@    "PRAGMA user_version = 20; " \    "" -#define STMT_UPGRADE_TO_21 211 -#define STMT_211_INFO {"STMT_UPGRADE_TO_21", NULL} -#define STMT_211 \ +#define STMT_UPGRADE_TO_21 213 +#define STMT_213_INFO {"STMT_UPGRADE_TO_21", NULL} +#define STMT_213 \    "PRAGMA user_version = 21; " \    "" -#define STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT 212 -#define STMT_212_INFO {"STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT", NULL} -#define STMT_212 \ +#define STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT 214 +#define STMT_214_INFO {"STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT", NULL} +#define STMT_214 \    "SELECT wc_id, local_relpath, tree_conflict_data " \    "FROM actual_node " \    "WHERE tree_conflict_data IS NOT NULL " \    "" -#define STMT_UPGRADE_21_ERASE_OLD_CONFLICTS 213 -#define STMT_213_INFO {"STMT_UPGRADE_21_ERASE_OLD_CONFLICTS", NULL} -#define STMT_213 \ +#define STMT_UPGRADE_21_ERASE_OLD_CONFLICTS 215 +#define STMT_215_INFO {"STMT_UPGRADE_21_ERASE_OLD_CONFLICTS", NULL} +#define STMT_215 \    "UPDATE actual_node SET tree_conflict_data = NULL " \    "" -#define STMT_UPGRADE_TO_22 214 -#define STMT_214_INFO {"STMT_UPGRADE_TO_22", NULL} -#define STMT_214 \ +#define STMT_UPGRADE_TO_22 216 +#define STMT_216_INFO {"STMT_UPGRADE_TO_22", NULL} +#define STMT_216 \    "UPDATE actual_node SET tree_conflict_data = conflict_data; " \    "UPDATE actual_node SET conflict_data = NULL; " \    "PRAGMA user_version = 22; " \    "" -#define STMT_UPGRADE_TO_23 215 -#define STMT_215_INFO {"STMT_UPGRADE_TO_23", NULL} -#define STMT_215 \ +#define STMT_UPGRADE_TO_23 217 +#define STMT_217_INFO {"STMT_UPGRADE_TO_23", NULL} +#define STMT_217 \    "PRAGMA user_version = 23; " \    "" -#define STMT_UPGRADE_23_HAS_WORKING_NODES 216 -#define STMT_216_INFO {"STMT_UPGRADE_23_HAS_WORKING_NODES", NULL} -#define STMT_216 \ +#define STMT_UPGRADE_23_HAS_WORKING_NODES 218 +#define STMT_218_INFO {"STMT_UPGRADE_23_HAS_WORKING_NODES", NULL} +#define STMT_218 \    "SELECT 1 FROM nodes WHERE op_depth > 0 " \    "LIMIT 1 " \    "" -#define STMT_UPGRADE_TO_24 217 -#define STMT_217_INFO {"STMT_UPGRADE_TO_24", NULL} -#define STMT_217 \ +#define STMT_UPGRADE_TO_24 219 +#define STMT_219_INFO {"STMT_UPGRADE_TO_24", NULL} +#define STMT_219 \    "UPDATE pristine SET refcount = " \    "  (SELECT COUNT(*) FROM nodes " \    "   WHERE checksum = pristine.checksum ); " \    "PRAGMA user_version = 24; " \    "" -#define STMT_UPGRADE_TO_25 218 -#define STMT_218_INFO {"STMT_UPGRADE_TO_25", NULL} -#define STMT_218 \ +#define STMT_UPGRADE_TO_25 220 +#define STMT_220_INFO {"STMT_UPGRADE_TO_25", NULL} +#define STMT_220 \    "DROP VIEW IF EXISTS NODES_CURRENT; " \    "CREATE VIEW NODES_CURRENT AS " \    "  SELECT * FROM nodes " \ @@ -2432,9 +2460,9 @@    "PRAGMA user_version = 25; " \    "" -#define STMT_UPGRADE_TO_26 219 -#define STMT_219_INFO {"STMT_UPGRADE_TO_26", NULL} -#define STMT_219 \ +#define STMT_UPGRADE_TO_26 221 +#define STMT_221_INFO {"STMT_UPGRADE_TO_26", NULL} +#define STMT_221 \    "DROP VIEW IF EXISTS NODES_BASE; " \    "CREATE VIEW NODES_BASE AS " \    "  SELECT * FROM nodes " \ @@ -2442,15 +2470,15 @@    "PRAGMA user_version = 26; " \    "" -#define STMT_UPGRADE_TO_27 220 -#define STMT_220_INFO {"STMT_UPGRADE_TO_27", NULL} -#define STMT_220 \ +#define STMT_UPGRADE_TO_27 222 +#define STMT_222_INFO {"STMT_UPGRADE_TO_27", NULL} +#define STMT_222 \    "PRAGMA user_version = 27; " \    "" -#define STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS 221 -#define STMT_221_INFO {"STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS", NULL} -#define STMT_221 \ +#define STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS 223 +#define STMT_223_INFO {"STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS", NULL} +#define STMT_223 \    "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) " \ @@ -2458,18 +2486,18 @@    "LIMIT 1 " \    "" -#define STMT_UPGRADE_TO_28 222 -#define STMT_222_INFO {"STMT_UPGRADE_TO_28", NULL} -#define STMT_222 \ +#define STMT_UPGRADE_TO_28 224 +#define STMT_224_INFO {"STMT_UPGRADE_TO_28", NULL} +#define STMT_224 \    "UPDATE NODES SET checksum = (SELECT checksum FROM pristine " \    "                             WHERE md5_checksum = nodes.checksum) " \    "WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = nodes.checksum); " \    "PRAGMA user_version = 28; " \    "" -#define STMT_UPGRADE_TO_29 223 -#define STMT_223_INFO {"STMT_UPGRADE_TO_29", NULL} -#define STMT_223 \ +#define STMT_UPGRADE_TO_29 225 +#define STMT_225_INFO {"STMT_UPGRADE_TO_29", NULL} +#define STMT_225 \    "DROP TRIGGER IF EXISTS nodes_update_checksum_trigger; " \    "DROP TRIGGER IF EXISTS nodes_insert_trigger; " \    "DROP TRIGGER IF EXISTS nodes_delete_trigger; " \ @@ -2499,9 +2527,9 @@    "PRAGMA user_version = 29; " \    "" -#define STMT_UPGRADE_TO_30 224 -#define STMT_224_INFO {"STMT_UPGRADE_TO_30", NULL} -#define STMT_224 \ +#define STMT_UPGRADE_TO_30 226 +#define STMT_226_INFO {"STMT_UPGRADE_TO_30", NULL} +#define STMT_226 \    "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); " \ @@ -2509,9 +2537,9 @@    "UPDATE nodes SET file_external=1 WHERE file_external IS NOT NULL; " \    "" -#define STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE 225 -#define STMT_225_INFO {"STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE", NULL} -#define STMT_225 \ +#define STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE 227 +#define STMT_227_INFO {"STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE", NULL} +#define STMT_227 \    "SELECT wc_id, local_relpath, " \    "  conflict_old, conflict_working, conflict_new, prop_reject, tree_conflict_data " \    "FROM actual_node " \ @@ -2523,24 +2551,24 @@    "ORDER by wc_id, local_relpath " \    "" -#define STMT_UPGRADE_30_SET_CONFLICT 226 -#define STMT_226_INFO {"STMT_UPGRADE_30_SET_CONFLICT", NULL} -#define STMT_226 \ +#define STMT_UPGRADE_30_SET_CONFLICT 228 +#define STMT_228_INFO {"STMT_UPGRADE_30_SET_CONFLICT", NULL} +#define STMT_228 \    "UPDATE actual_node SET conflict_data = ?3, conflict_old = NULL, " \    "  conflict_working = NULL, conflict_new = NULL, prop_reject = NULL, " \    "  tree_conflict_data = NULL " \    "WHERE wc_id = ?1 and local_relpath = ?2 " \    "" -#define STMT_UPGRADE_TO_31_ALTER_TABLE 227 -#define STMT_227_INFO {"STMT_UPGRADE_TO_31_ALTER_TABLE", NULL} -#define STMT_227 \ +#define STMT_UPGRADE_TO_31_ALTER_TABLE 229 +#define STMT_229_INFO {"STMT_UPGRADE_TO_31_ALTER_TABLE", NULL} +#define STMT_229 \    "ALTER TABLE NODES ADD COLUMN inherited_props BLOB; " \    "" -#define STMT_UPGRADE_TO_31_FINALIZE 228 -#define STMT_228_INFO {"STMT_UPGRADE_TO_31_FINALIZE", NULL} -#define STMT_228 \ +#define STMT_UPGRADE_TO_31_FINALIZE 230 +#define STMT_230_INFO {"STMT_UPGRADE_TO_31_FINALIZE", NULL} +#define STMT_230 \    "DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST; " \    "DROP INDEX IF EXISTS I_EXTERNALS_PARENT; " \    "DROP INDEX I_NODES_PARENT; " \ @@ -2552,9 +2580,9 @@    "PRAGMA user_version = 31; " \    "" -#define STMT_UPGRADE_31_SELECT_WCROOT_NODES 229 -#define STMT_229_INFO {"STMT_UPGRADE_31_SELECT_WCROOT_NODES", NULL} -#define STMT_229 \ +#define STMT_UPGRADE_31_SELECT_WCROOT_NODES 231 +#define STMT_231_INFO {"STMT_UPGRADE_31_SELECT_WCROOT_NODES", NULL} +#define STMT_231 \    "SELECT l.wc_id, l.local_relpath FROM nodes as l " \    "LEFT OUTER JOIN nodes as r " \    "ON l.wc_id = r.wc_id " \ @@ -2566,9 +2594,9 @@    "       OR (l.repos_path IS NOT (CASE WHEN (r.local_relpath) = '' THEN (CASE WHEN (r.repos_path) = '' THEN (l.local_relpath) WHEN (l.local_relpath) = '' THEN (r.repos_path) ELSE (r.repos_path) || '/' || (l.local_relpath) END) WHEN (r.repos_path) = '' THEN (CASE WHEN (r.local_relpath) = '' THEN (l.local_relpath)  WHEN SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) = (r.local_relpath)  THEN CASE WHEN LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN '' WHEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+2) END END) WHEN SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) = (r.local_relpath) THEN CASE WHEN LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN (r.repos_path) WHEN SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN (r.repos_path) || SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1) END END))) " \    "" -#define STMT_UPGRADE_TO_32 230 -#define STMT_230_INFO {"STMT_UPGRADE_TO_32", NULL} -#define STMT_230 \ +#define STMT_UPGRADE_TO_32 232 +#define STMT_232_INFO {"STMT_UPGRADE_TO_32", NULL} +#define STMT_232 \    "DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST; " \    "DROP INDEX IF EXISTS I_EXTERNALS_PARENT; " \    "CREATE INDEX I_EXTERNALS_PARENT ON EXTERNALS (wc_id, parent_relpath); " \ @@ -2621,9 +2649,9 @@    "DROP TABLE ACTUAL_NODE_BACKUP; " \    "" -#define STMT_VERIFICATION_TRIGGERS 231 -#define STMT_231_INFO {"STMT_VERIFICATION_TRIGGERS", NULL} -#define STMT_231 \ +#define STMT_VERIFICATION_TRIGGERS 233 +#define STMT_233_INFO {"STMT_VERIFICATION_TRIGGERS", NULL} +#define STMT_233 \    "CREATE TEMPORARY TRIGGER no_repository_updates BEFORE UPDATE ON repository " \    "BEGIN " \    "  SELECT RAISE(FAIL, 'Updates to REPOSITORY are not allowed.'); " \ @@ -2896,6 +2924,8 @@      STMT_229, \      STMT_230, \      STMT_231, \ +    STMT_232, \ +    STMT_233, \      NULL \    } @@ -3133,5 +3163,7 @@      STMT_229_INFO, \      STMT_230_INFO, \      STMT_231_INFO, \ +    STMT_232_INFO, \ +    STMT_233_INFO, \      {NULL, NULL} \    } diff --git a/subversion/libsvn_wc/wc-queries.sql b/subversion/libsvn_wc/wc-queries.sql index a8388a3a2892..0ced98c79c20 100644 --- a/subversion/libsvn_wc/wc-queries.sql +++ b/subversion/libsvn_wc/wc-queries.sql @@ -191,7 +191,7 @@ WHERE wc_id = ?1  -- STMT_DELETE_NODE  DELETE  FROM NODES -WHERE wc_id = ?1 AND local_relpath = ?2 +WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3  -- STMT_DELETE_ACTUAL_FOR_BASE_RECURSIVE  /* The ACTUAL_NODE applies to BASE, unless there is in at least one op_depth @@ -417,6 +417,12 @@ LEFT OUTER JOIN nodes AS moved  WHERE work.wc_id = ?1 AND work.local_relpath = ?2 AND work.op_depth > 0  LIMIT 1 +-- STMT_SELECT_MOVED_TO_NODE +SELECT op_depth, moved_to +FROM nodes +WHERE wc_id = ?1 AND local_relpath = ?2 AND moved_to IS NOT NULL +ORDER BY op_depth DESC +  -- STMT_SELECT_OP_DEPTH_MOVED_TO  SELECT op_depth, moved_to, repos_path, revision  FROM nodes @@ -711,7 +717,7 @@ WHERE wc_id = ?1 AND local_relpath = ?2                    WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3)    AND presence = MAP_BASE_DELETED --- STMT_DELETE_ALL_LAYERS +-- STMT_DELETE_NODE_ALL_LAYERS  DELETE FROM nodes  WHERE wc_id = ?1 AND local_relpath = ?2 @@ -1503,7 +1509,6 @@ WHERE wc_id = ?1    AND presence=MAP_NORMAL    AND file_external IS NULL -/* ### FIXME: op-depth?  What about multiple moves? */  -- STMT_SELECT_MOVED_FROM_RELPATH  SELECT local_relpath, op_depth FROM nodes  WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 @@ -1530,14 +1535,31 @@ SELECT moved_to, local_relpath FROM nodes  WHERE wc_id = ?1 AND op_depth > 0    AND IS_STRICT_DESCENDANT_OF(moved_to, ?2) +/* If the node is moved here (r.moved_here = 1) we are really interested in +   where the node was moved from. To obtain that we need the op_depth, but +   this form of select only allows a single return value */  -- STMT_SELECT_MOVED_FOR_DELETE -SELECT local_relpath, moved_to, op_depth FROM nodes +SELECT local_relpath, moved_to, op_depth, +       (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r +        WHERE r.wc_id = ?1 +          AND r.local_relpath = n.local_relpath +          AND r.op_depth < n.op_depth +        ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth + FROM nodes n  WHERE wc_id = ?1    AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))    AND moved_to IS NOT NULL -  AND op_depth >= (SELECT MAX(op_depth) FROM nodes o -                    WHERE o.wc_id = ?1 -                      AND o.local_relpath = ?2) +  AND op_depth >= ?3 + +-- STMT_SELECT_MOVED_FROM_FOR_DELETE +SELECT local_relpath, op_depth, +       (SELECT CASE WHEN r.moved_here THEN r.op_depth END FROM nodes r +        WHERE r.wc_id = ?1 +          AND r.local_relpath = n.local_relpath +          AND r.op_depth < n.op_depth +        ORDER BY r.op_depth DESC LIMIT 1) AS moved_here_op_depth + FROM nodes n +WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0  -- STMT_UPDATE_MOVED_TO_DESCENDANTS  UPDATE nodes SET moved_to = RELPATH_SKIP_JOIN(?2, ?3, moved_to) diff --git a/subversion/libsvn_wc/wc_db.c b/subversion/libsvn_wc/wc_db.c index 7d038cf57fb3..81056c9a4a6a 100644 --- a/subversion/libsvn_wc/wc_db.c +++ b/subversion/libsvn_wc/wc_db.c @@ -627,6 +627,10 @@ svn_wc__db_extend_parent_delete(svn_wc__db_wcroot_t *wcroot,     When removing a node if the parent has a higher working node then     the parent node and this node are both deleted or replaced and any     delete over this node must be removed. + +   This function (like most wcroot functions) assumes that its caller +   only uses this function within an sqlite transaction if atomic +   behavior is needed.   */  svn_error_t *  svn_wc__db_retract_parent_delete(svn_wc__db_wcroot_t *wcroot, @@ -635,14 +639,60 @@ svn_wc__db_retract_parent_delete(svn_wc__db_wcroot_t *wcroot,                                   apr_pool_t *scratch_pool)  {    svn_sqlite__stmt_t *stmt; +  svn_boolean_t have_row; +  int working_depth; +  svn_wc__db_status_t presence; +  const char *moved_to;    SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, -                                    STMT_DELETE_LOWEST_WORKING_NODE)); +                                    STMT_SELECT_LOWEST_WORKING_NODE));    SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,                              op_depth)); -  SVN_ERR(svn_sqlite__step_done(stmt)); +  SVN_ERR(svn_sqlite__step(&have_row, stmt)); -  return SVN_NO_ERROR; +  if (!have_row) +    return svn_error_trace(svn_sqlite__reset(stmt)); + +  working_depth = svn_sqlite__column_int(stmt, 0); +  presence = svn_sqlite__column_token(stmt, 1, presence_map); +  moved_to = svn_sqlite__column_text(stmt, 3, scratch_pool); + +  SVN_ERR(svn_sqlite__reset(stmt)); + +  if (moved_to) +    { +      /* Turn the move into a copy to keep the NODES table valid */ +      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, +                                        STMT_CLEAR_MOVED_HERE_RECURSIVE)); +      SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, +                                moved_to, relpath_depth(moved_to))); +      SVN_ERR(svn_sqlite__step_done(stmt)); + +      /* This leaves just the moved_to information on the origin, +         which we will remove in the next step */ +    } + +  if (presence == svn_wc__db_status_base_deleted) +    { +      /* Nothing left to shadow; remove the base-deleted node */ +      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_DELETE_NODE)); +    } +  else if (moved_to) +    { +      /* Clear moved to information, as this node is no longer base-deleted */ +      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, +                                        STMT_CLEAR_MOVED_TO_RELPATH)); +      } +  else +    { +      /* Nothing to update */ +      return SVN_NO_ERROR; +    } + +  SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, +                            working_depth)); + +  return svn_error_trace(svn_sqlite__update(NULL, stmt));  } @@ -4076,8 +4126,9 @@ get_info_for_copy(apr_int64_t *copyfrom_id,                    svn_wc__db_status_t *status,                    svn_node_kind_t *kind,                    svn_boolean_t *op_root, -                  svn_wc__db_wcroot_t *wcroot, +                  svn_wc__db_wcroot_t *src_wcroot,                    const char *local_relpath, +                  svn_wc__db_wcroot_t *dst_wcroot,                    apr_pool_t *result_pool,                    apr_pool_t *scratch_pool)  { @@ -4094,7 +4145,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id,                      NULL /* have_base */,                      NULL /* have_more_work */,                      NULL /* have_work */, -                    wcroot, local_relpath, result_pool, scratch_pool)); +                    src_wcroot, local_relpath, result_pool, scratch_pool));    if (op_root)      *op_root = is_op_root; @@ -4109,7 +4160,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id,                         scratch_pool);        SVN_ERR(get_info_for_copy(copyfrom_id, copyfrom_relpath, copyfrom_rev,                                  NULL, NULL, NULL, -                                wcroot, parent_relpath, +                                src_wcroot, parent_relpath, dst_wcroot,                                  scratch_pool, scratch_pool));        if (*copyfrom_relpath)          *copyfrom_relpath = svn_relpath_join(*copyfrom_relpath, base_name, @@ -4118,7 +4169,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id,    else if (node_status == svn_wc__db_status_added)      {        SVN_ERR(scan_addition(&node_status, NULL, NULL, NULL, NULL, NULL, NULL, -                            NULL, NULL, NULL, wcroot, local_relpath, +                            NULL, NULL, NULL, src_wcroot, local_relpath,                              scratch_pool, scratch_pool));      }    else if (node_status == svn_wc__db_status_deleted && is_op_root) @@ -4127,7 +4178,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id,        SVN_ERR(scan_deletion_txn(&base_del_relpath, NULL,                                  &work_del_relpath, -                                NULL, wcroot, local_relpath, +                                NULL, src_wcroot, local_relpath,                                  scratch_pool, scratch_pool));        if (work_del_relpath)          { @@ -4140,7 +4191,8 @@ get_info_for_copy(apr_int64_t *copyfrom_id,            SVN_ERR(scan_addition(NULL, &op_root_relpath,                                  NULL, NULL, /* repos_* */                                  copyfrom_relpath, copyfrom_id, copyfrom_rev, -                                NULL, NULL, NULL, wcroot, parent_del_relpath, +                                NULL, NULL, NULL, +                                src_wcroot, parent_del_relpath,                                  scratch_pool, scratch_pool));            *copyfrom_relpath              = svn_relpath_join(*copyfrom_relpath, @@ -4155,7 +4207,7 @@ get_info_for_copy(apr_int64_t *copyfrom_id,                                                      copyfrom_id, NULL, NULL,                                                      NULL, NULL, NULL, NULL,                                                      NULL, NULL, NULL, NULL, -                                                    wcroot, local_relpath, +                                                    src_wcroot, local_relpath,                                                      result_pool,                                                      scratch_pool));          } @@ -4177,6 +4229,24 @@ get_info_for_copy(apr_int64_t *copyfrom_id,    if (status)      *status = node_status; +  if (src_wcroot != dst_wcroot && *copyfrom_relpath) +    { +      const char *repos_root_url; +      const char *repos_uuid; + +      /* Pass the right repos-id for the destination db. We can't just use +         the id of the source database, as this value can change after +         relocation (and perhaps also when we start storing multiple +         working copies in a single db)! */ + +      SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid, +                                          src_wcroot->sdb, *copyfrom_id, +                                          scratch_pool)); + +      SVN_ERR(create_repos_id(copyfrom_id, repos_root_url, repos_uuid, +                              dst_wcroot->sdb, scratch_pool)); +    } +    return SVN_NO_ERROR;  } @@ -4336,8 +4406,9 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcroot,    const apr_array_header_t *children;    SVN_ERR(get_info_for_copy(©from_id, ©from_relpath, ©from_rev, -                            &status, &kind, &op_root, src_wcroot, -                            src_relpath, scratch_pool, scratch_pool)); +                            &status, &kind, &op_root, +                            src_wcroot, src_relpath, dst_wcroot, +                            scratch_pool, scratch_pool));    SVN_ERR(op_depth_for_copy(&dst_op_depth, &dst_np_op_depth,                              &dst_parent_op_depth, @@ -4562,21 +4633,6 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcroot,      }    else      { -      if (copyfrom_relpath) -        { -          const char *repos_root_url; -          const char *repos_uuid; - -          /* Pass the right repos-id for the destination db! */ - -          SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid, -                                              src_wcroot->sdb, copyfrom_id, -                                              scratch_pool)); - -          SVN_ERR(create_repos_id(©from_id, repos_root_url, repos_uuid, -                                  dst_wcroot->sdb, scratch_pool)); -        } -        SVN_ERR(cross_db_copy(src_wcroot, src_relpath, dst_wcroot,                              dst_relpath, dst_presence, dst_op_depth,                              dst_np_op_depth, kind, @@ -7176,7 +7232,7 @@ remove_node_txn(svn_boolean_t *left_changes,    if (local_relpath[0] != '\0')      {        SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, -                                        STMT_DELETE_NODE)); +                                        STMT_DELETE_NODE_ALL_LAYERS));        SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));        SVN_ERR(svn_sqlite__step_done(stmt));      } @@ -7487,8 +7543,86 @@ struct moved_node_t {    /* The op-depth of the deleted node at the source of the move. */    int op_depth; + +  /* When >= 1 the op_depth at which local_relpath was moved to its +     location. Used to find its original location outside the delete */ +  int moved_from_depth;  }; +/* Helper function to resolve the original location of local_relpath at OP_DEPTH +   before it was moved into the tree rooted at ROOT_RELPATH. */ +static svn_error_t * +resolve_moved_from(const char **moved_from_relpath, +                   int *moved_from_op_depth, +                   svn_wc__db_wcroot_t *wcroot, +                   const char *root_relpath, +                   const char *local_relpath, +                   int op_depth, +                   apr_pool_t *result_pool, +                   apr_pool_t *scratch_pool) +{ +  const char *suffix = ""; +  svn_sqlite__stmt_t *stmt; +  const char *m_from_relpath; +  int m_from_op_depth; +  int m_move_from_depth; +  svn_boolean_t have_row; + +  while (relpath_depth(local_relpath) > op_depth) +    { +      const char *name; +      svn_relpath_split(&local_relpath, &name, local_relpath, scratch_pool); +      suffix = svn_relpath_join(suffix, name, scratch_pool); +    } + +  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, +                                    STMT_SELECT_MOVED_FROM_FOR_DELETE)); +  SVN_ERR(svn_sqlite__bindf(stmt, "is", +                            wcroot->wc_id, local_relpath)); +  SVN_ERR(svn_sqlite__step(&have_row, stmt)); + +  if (!have_row) +    { +      /* assert(have_row); */ +      *moved_from_relpath = NULL; +      *moved_from_op_depth = -1; + +      SVN_ERR(svn_sqlite__reset(stmt)); + +      return SVN_NO_ERROR; +    } + +  m_from_relpath = svn_sqlite__column_text(stmt, 0, scratch_pool); +  m_from_op_depth = svn_sqlite__column_int(stmt, 1); +  m_move_from_depth = svn_sqlite__column_int(stmt, 2); + +  SVN_ERR(svn_sqlite__reset(stmt)); + +  if (! svn_relpath_skip_ancestor(root_relpath, m_from_relpath)) +    { +      *moved_from_relpath = svn_relpath_join(m_from_relpath, suffix, +                                             result_pool); +      *moved_from_op_depth = m_from_op_depth; /* ### Ok? */ +      return SVN_NO_ERROR; +    } +  else if (!m_move_from_depth) +    { +      *moved_from_relpath = NULL; +      *moved_from_op_depth = -1; +      return SVN_NO_ERROR; +    } + +  return svn_error_trace( +        resolve_moved_from(moved_from_relpath, +                           moved_from_op_depth, +                           wcroot, +                           root_relpath, +                           svn_relpath_join(m_from_relpath, suffix, +                                            scratch_pool), +                           m_move_from_depth, +                           result_pool, scratch_pool)); +} +  static svn_error_t *  delete_node(void *baton,              svn_wc__db_wcroot_t *wcroot, @@ -7500,19 +7634,70 @@ delete_node(void *baton,    svn_boolean_t have_row, op_root;    svn_boolean_t add_work = FALSE;    svn_sqlite__stmt_t *stmt; -  int select_depth; /* Depth of what is to be deleted */ -  svn_boolean_t refetch_depth = FALSE; +  int working_op_depth; /* Depth of what is to be deleted */ +  int keep_op_depth = 0; /* Depth of what is below what is deleted */    svn_node_kind_t kind;    apr_array_header_t *moved_nodes = NULL; -  int delete_depth = relpath_depth(local_relpath); +  int delete_op_depth = relpath_depth(local_relpath); -  SVN_ERR(read_info(&status, -                    &kind, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -                    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -                    &op_root, NULL, NULL, -                    NULL, NULL, NULL, -                    wcroot, local_relpath, -                    scratch_pool, scratch_pool)); +  assert(*local_relpath); /* Can't delete wcroot */ + +  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, +                                    STMT_SELECT_NODE_INFO)); +  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); +  SVN_ERR(svn_sqlite__step(&have_row, stmt)); + +  if (!have_row) +    { +      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, +                               svn_sqlite__reset(stmt), +                               _("The node '%s' was not found."), +                               path_for_error_message(wcroot, +                                                      local_relpath, +                                                      scratch_pool)); +    } + +  working_op_depth = svn_sqlite__column_int(stmt, 0); +  status = svn_sqlite__column_token(stmt, 3, presence_map); +  kind = svn_sqlite__column_token(stmt, 4, kind_map); + +  if (working_op_depth < delete_op_depth) +    { +      op_root = FALSE; +      add_work = TRUE; +      keep_op_depth = working_op_depth; +    } +  else +    { +      op_root = TRUE; + +      SVN_ERR(svn_sqlite__step(&have_row, stmt)); + +      if (have_row) +        { +          svn_wc__db_status_t below_status; +          int below_op_depth; + +          below_op_depth = svn_sqlite__column_int(stmt, 0); +          below_status = svn_sqlite__column_token(stmt, 3, presence_map); + +          if (below_status != svn_wc__db_status_not_present +              && below_status != svn_wc__db_status_base_deleted) +            { +              add_work = TRUE; +              keep_op_depth = below_op_depth; +            } +          else +            keep_op_depth = 0; +        } +      else +        keep_op_depth = -1; +    } + +  SVN_ERR(svn_sqlite__reset(stmt)); + +  if (working_op_depth != 0) /* WORKING */ +    SVN_ERR(convert_to_working_status(&status, status));    if (status == svn_wc__db_status_deleted        || status == svn_wc__db_status_not_present) @@ -7591,6 +7776,7 @@ delete_node(void *baton,                                                           part, scratch_pool);            moved_node->op_depth = move_op_depth;            moved_node->moved_to_relpath = b->moved_to_relpath; +          moved_node->moved_from_depth = -1;            APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node;          } @@ -7602,8 +7788,9 @@ delete_node(void *baton,             * possibly because of a nested move operation. */            moved_node = apr_palloc(scratch_pool, sizeof(struct moved_node_t));            moved_node->local_relpath = local_relpath; -          moved_node->op_depth = delete_depth; +          moved_node->op_depth = delete_op_depth;            moved_node->moved_to_relpath = b->moved_to_relpath; +          moved_node->moved_from_depth = -1;            APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node;          } @@ -7618,24 +7805,18 @@ delete_node(void *baton,                                               b->moved_to_relpath));        SVN_ERR(svn_sqlite__update(NULL, stmt));      } -  else -    { -      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, -                                        STMT_CLEAR_MOVED_TO_DESCENDANTS)); -      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, -                                            local_relpath)); -      SVN_ERR(svn_sqlite__update(NULL, stmt)); -    }    /* Find children that were moved out of the subtree rooted at this node.     * We'll need to update their op-depth columns because their deletion     * is now implied by the deletion of their parent (i.e. this node). */      {        apr_pool_t *iterpool; +      int i;        SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,                                          STMT_SELECT_MOVED_FOR_DELETE)); -      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); +      SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath, +                                delete_op_depth));        SVN_ERR(svn_sqlite__step(&have_row, stmt));        iterpool = svn_pool_create(scratch_pool); @@ -7645,52 +7826,85 @@ delete_node(void *baton,            const char *child_relpath = svn_sqlite__column_text(stmt, 0, NULL);            const char *mv_to_relpath = svn_sqlite__column_text(stmt, 1, NULL);            int child_op_depth = svn_sqlite__column_int(stmt, 2); +          int moved_from_depth = -1;            svn_boolean_t fixup = FALSE; -          if (!b->moved_to_relpath +          if (! b->moved_to_relpath                && ! svn_relpath_skip_ancestor(local_relpath, mv_to_relpath))              { -              /* Update the op-depth of an moved node below this tree */ -              fixup = TRUE; -              child_op_depth = delete_depth; -            } -          else if (b->moved_to_relpath -                   && delete_depth == child_op_depth) -            { -              /* Update the op-depth of a tree shadowed by this tree */ -              fixup = TRUE; -              child_op_depth = delete_depth; -            } -          else if (b->moved_to_relpath -                   && child_op_depth >= delete_depth -                   && !svn_relpath_skip_ancestor(local_relpath, mv_to_relpath)) -            { -              /* Update the move destination of something that is now moved -                 away further */ +              /* a NULL moved_here_depth will be reported as 0 */ +              int moved_here_depth = svn_sqlite__column_int(stmt, 3); -              child_relpath = svn_relpath_skip_ancestor(local_relpath, child_relpath); +              /* Plain delete. Fixup move information of descendants that were +                 moved here, or that were moved out */ -              if (child_relpath) +              if (moved_here_depth >= delete_op_depth)                  { -                  child_relpath = svn_relpath_join(b->moved_to_relpath, child_relpath, scratch_pool); +                  /* The move we recorded here must be moved to the location +                     this node had before it was moved here. -                  if (child_op_depth > delete_depth -                      && svn_relpath_skip_ancestor(local_relpath, child_relpath)) -                    child_op_depth = delete_depth; -                  else -                    child_op_depth = relpath_depth(child_relpath); +                     This might contain multiple steps when the node was moved +                     in several places within the to be deleted tree */ + +                  /* ### TODO: Add logic */ +                  fixup = TRUE; +                  moved_from_depth = moved_here_depth; +                } +              else +                { +                  /* Update the op-depth of an moved away node that was +                     registered as moved by the records that we are about +                     to delete */ +                  fixup = TRUE; +                  child_op_depth = delete_op_depth; +                } +            } +          else if (b->moved_to_relpath) +            { +              /* The node is moved to a new location */ +              if (delete_op_depth == child_op_depth) +                { +                  /* Update the op-depth of a tree shadowed by this tree */                    fixup = TRUE; +                  /*child_op_depth = delete_depth;*/ +                } +              else if (child_op_depth >= delete_op_depth +                       && !svn_relpath_skip_ancestor(local_relpath, +                                                     mv_to_relpath)) +                { +                  /* Update the move destination of something that is now moved +                     away further */ + +                  child_relpath = svn_relpath_skip_ancestor(local_relpath, +                                                            child_relpath); + +                  if (child_relpath) +                    { +                      child_relpath = svn_relpath_join(b->moved_to_relpath, +                                                       child_relpath, +                                                       scratch_pool); + +                      if (child_op_depth > delete_op_depth +                           && svn_relpath_skip_ancestor(local_relpath, +                                                        child_relpath)) +                        child_op_depth = delete_op_depth; +                      else +                        child_op_depth = relpath_depth(child_relpath); + +                      fixup = TRUE; +                    }                  }              }            if (fixup)              { -              mn = apr_pcalloc(scratch_pool, sizeof(struct moved_node_t)); +              mn = apr_palloc(scratch_pool, sizeof(struct moved_node_t));                mn->local_relpath = apr_pstrdup(scratch_pool, child_relpath);                mn->moved_to_relpath = apr_pstrdup(scratch_pool, mv_to_relpath);                mn->op_depth = child_op_depth; +              mn->moved_from_depth = moved_from_depth;                if (!moved_nodes)                  moved_nodes = apr_array_make(scratch_pool, 1, @@ -7700,58 +7914,67 @@ delete_node(void *baton,            SVN_ERR(svn_sqlite__step(&have_row, stmt));          } -      svn_pool_destroy(iterpool);        SVN_ERR(svn_sqlite__reset(stmt)); -    } - -  if (op_root) -    { -      svn_boolean_t below_base; -      svn_boolean_t below_work; -      svn_wc__db_status_t below_status; -      /* Use STMT_SELECT_NODE_INFO directly instead of read_info plus -         info_below_working */ -      SVN_ERR(info_below_working(&below_base, &below_work, &below_status, -                                 wcroot, local_relpath, -1, scratch_pool)); -      if ((below_base || below_work) -          && below_status != svn_wc__db_status_not_present -          && below_status != svn_wc__db_status_deleted) +      for (i = 0; moved_nodes && (i < moved_nodes->nelts); i++)          { -          add_work = TRUE; -          refetch_depth = TRUE; +          struct moved_node_t *mn = APR_ARRAY_IDX(moved_nodes, i, +                                                  struct moved_node_t *); + +          if (mn->moved_from_depth > 0) +            { +              svn_pool_clear(iterpool); + +              SVN_ERR(resolve_moved_from(&mn->local_relpath, &mn->op_depth, +                                         wcroot, local_relpath, +                                         mn->local_relpath, +                                         mn->moved_from_depth, +                                         scratch_pool, iterpool)); + +              if (!mn->local_relpath) +                svn_sort__array_delete(moved_nodes, i--, 1); +            }          } -      select_depth = relpath_depth(local_relpath); +      svn_pool_destroy(iterpool);      } -  else + +  if (!b->moved_to_relpath)      { -      add_work = TRUE; -      if (status != svn_wc__db_status_normal) -        SVN_ERR(op_depth_of(&select_depth, wcroot, local_relpath)); -      else -        select_depth = 0; /* Deleting BASE node */ +      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, +                                        STMT_CLEAR_MOVED_TO_DESCENDANTS)); +      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, +                                local_relpath)); +      SVN_ERR(svn_sqlite__update(NULL, stmt)); + +      if (op_root) +        { +          SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, +                                            STMT_CLEAR_MOVED_TO_FROM_DEST)); +          SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, +                                    local_relpath)); + +          SVN_ERR(svn_sqlite__update(NULL, stmt)); +        }      } +    /* ### Put actual-only nodes into the list? */    if (b->notify)      {        SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,                                          STMT_INSERT_DELETE_LIST));        SVN_ERR(svn_sqlite__bindf(stmt, "isd", -                                wcroot->wc_id, local_relpath, select_depth)); +                                wcroot->wc_id, local_relpath, working_op_depth));        SVN_ERR(svn_sqlite__step_done(stmt));      }    SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,                                      STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE));    SVN_ERR(svn_sqlite__bindf(stmt, "isd", -                            wcroot->wc_id, local_relpath, delete_depth)); +                            wcroot->wc_id, local_relpath, delete_op_depth));    SVN_ERR(svn_sqlite__step_done(stmt)); -  if (refetch_depth) -    SVN_ERR(op_depth_of(&select_depth, wcroot, local_relpath)); -    /* Delete ACTUAL_NODE rows, but leave those that have changelist       and a NODES row. */    SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, @@ -7781,7 +8004,7 @@ delete_node(void *baton,                                   STMT_INSERT_DELETE_FROM_NODE_RECURSIVE));        SVN_ERR(svn_sqlite__bindf(stmt, "isdd",                                  wcroot->wc_id, local_relpath, -                                select_depth, delete_depth)); +                                keep_op_depth, delete_op_depth));        SVN_ERR(svn_sqlite__step_done(stmt));      } @@ -8680,7 +8903,11 @@ read_children_info(svn_wc__db_wcroot_t *wcroot,            else              child->op_root = (op_depth == relpath_depth(child_relpath)); -          svn_hash_sets(nodes, apr_pstrdup(result_pool, name), child); +          if (op_depth && child->op_root) +            child_item->info.moved_here = svn_sqlite__column_boolean(stmt, 20); + +          if (new_child) +            svn_hash_sets(nodes, apr_pstrdup(result_pool, name), child);          }        if (op_depth == 0) @@ -8702,18 +8929,48 @@ read_children_info(svn_wc__db_wcroot_t *wcroot,            child_item->nr_layers++;            child_item->info.have_more_work = (child_item->nr_layers > 1); -          /* Moved-to can only exist at op_depth > 0. */ -          /* ### Should we really do this for every layer where op_depth > 0 -                 in undefined order? */ + +          /* A local_relpath can be moved multiple times at different op +             depths and it really depends on the caller what is interesting. +             We provide a simple linked list with the moved_from information */ +            moved_to_relpath = svn_sqlite__column_text(stmt, 21, NULL);            if (moved_to_relpath) -            child_item->info.moved_to_abspath = -              svn_dirent_join(wcroot->abspath, moved_to_relpath, result_pool); +            { +              struct svn_wc__db_moved_to_info_t *moved_to; +              struct svn_wc__db_moved_to_info_t **next; +              const char *shadow_op_relpath; +              int cur_op_depth; + +              moved_to = apr_pcalloc(result_pool, sizeof(*moved_to)); +              moved_to->moved_to_abspath = svn_dirent_join(wcroot->abspath, +                                                           moved_to_relpath, +                                                           result_pool); -          /* Moved-here can only exist at op_depth > 0. */ -          /* ### Should we really do this for every layer where op_depth > 0 -                 in undefined order? */ -          child_item->info.moved_here = svn_sqlite__column_boolean(stmt, 20); +              cur_op_depth = relpath_depth(child_relpath); +              shadow_op_relpath = child_relpath; + +              while (cur_op_depth > op_depth) +                { +                  shadow_op_relpath = svn_relpath_dirname(shadow_op_relpath, +                                                          scratch_pool); +                  cur_op_depth--; +                } + +              moved_to->shadow_op_root_abspath = +                        svn_dirent_join(wcroot->abspath, shadow_op_relpath, +                                        result_pool); + +              next = &child_item->info.moved_to; + +              while (*next && +                     0 < strcmp((*next)->shadow_op_root_abspath, +                                moved_to->shadow_op_root_abspath)) +                next = &((*next)->next); + +              moved_to->next = *next; +              *next = moved_to; +            }          }        SVN_ERR(svn_sqlite__step(&have_row, stmt)); @@ -8801,6 +9058,178 @@ svn_wc__db_read_children_info(apr_hash_t **nodes,    return SVN_NO_ERROR;  } +static svn_error_t * +db_read_props(apr_hash_t **props, +              svn_wc__db_wcroot_t *wcroot, +              const char *local_relpath, +              apr_pool_t *result_pool, +              apr_pool_t *scratch_pool); + +static svn_error_t * +read_single_info(const struct svn_wc__db_info_t **info, +                 svn_wc__db_wcroot_t *wcroot, +                 const char *local_relpath, +                 apr_pool_t *result_pool, +                 apr_pool_t *scratch_pool) +{ +  struct svn_wc__db_info_t *mtb; +  apr_int64_t repos_id; +  const svn_checksum_t *checksum; +  const char *original_repos_relpath; +  svn_boolean_t have_work; + +  mtb = apr_pcalloc(result_pool, sizeof(*mtb)); + +  SVN_ERR(read_info(&mtb->status, &mtb->kind, &mtb->revnum, +                    &mtb->repos_relpath, &repos_id, &mtb->changed_rev, +                    &mtb->changed_date, &mtb->changed_author, &mtb->depth, +                    &checksum, NULL, &original_repos_relpath, NULL, NULL, +                    &mtb->lock, &mtb->recorded_size, &mtb->recorded_time, +                    &mtb->changelist, &mtb->conflicted, &mtb->op_root, +                    &mtb->had_props, &mtb->props_mod, &mtb->have_base, +                    &mtb->have_more_work, &have_work, +                    wcroot, local_relpath, +                    result_pool, scratch_pool)); + +  /* Query the same rows in the database again for move information */ +  if (have_work && (mtb->have_base || mtb->have_more_work)) +    { +      svn_sqlite__stmt_t *stmt; +      svn_boolean_t have_row; +      const char *cur_relpath = NULL; +      int cur_op_depth; + +      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, +                                        STMT_SELECT_MOVED_TO_NODE)); +      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath)); + +      SVN_ERR(svn_sqlite__step(&have_row, stmt)); + +      while (have_row) +        { +          struct svn_wc__db_moved_to_info_t *move; +          int op_depth = svn_sqlite__column_int(stmt, 0); +          const char *moved_to_relpath = svn_sqlite__column_text(stmt, 1, NULL); + +          move = apr_pcalloc(result_pool, sizeof(*move)); +          move->moved_to_abspath = svn_dirent_join(wcroot->abspath, +                                                   moved_to_relpath, +                                                   result_pool); + +          if (!cur_relpath) +            { +              cur_relpath = local_relpath; +              cur_op_depth = relpath_depth(cur_relpath); +            } +          while (cur_op_depth > op_depth) +            { +              cur_relpath = svn_relpath_dirname(cur_relpath, scratch_pool); +              cur_op_depth--; +            } +          move->shadow_op_root_abspath = svn_dirent_join(wcroot->abspath, +                                                         cur_relpath, +                                                         result_pool); + +          move->next = mtb->moved_to; +          mtb->moved_to = move; + +          SVN_ERR(svn_sqlite__step(&have_row, stmt)); +        } + +      SVN_ERR(svn_sqlite__reset(stmt)); +    } + +  /* Maybe we have to get some shadowed lock from BASE to make our test suite +     happy... (It might be completely unrelated, but...) +     This queries the same BASE row again, joined to the lock table */ +  if (mtb->have_base && (have_work || mtb->kind == svn_node_file)) +    { +      svn_boolean_t update_root; +      svn_wc__db_lock_t **lock_arg = NULL; + +      if (have_work) +        lock_arg = &mtb->lock; + +      SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL, NULL, NULL, +                                                NULL, NULL, NULL, NULL, NULL, +                                                NULL, lock_arg, NULL, NULL, +                                                &update_root, +                                                wcroot, local_relpath, +                                                result_pool, scratch_pool)); + +      mtb->file_external = (update_root && mtb->kind == svn_node_file); +    } + +  if (mtb->status == svn_wc__db_status_added) +    { +      svn_wc__db_status_t status; + +      SVN_ERR(scan_addition(&status, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +                            NULL, NULL, +                            wcroot, local_relpath, +                            result_pool, scratch_pool)); + +      mtb->moved_here = (status == svn_wc__db_status_moved_here); +      mtb->incomplete = (status == svn_wc__db_status_incomplete); +    } + +#ifdef HAVE_SYMLINK +  if (mtb->kind == svn_node_file +      && (mtb->had_props || mtb->props_mod)) +    { +      apr_hash_t *properties; + +      if (mtb->props_mod) +        SVN_ERR(db_read_props(&properties, +                              wcroot, local_relpath, +                              scratch_pool, scratch_pool)); +      else +        SVN_ERR(db_read_pristine_props(&properties, wcroot, local_relpath, +                                       TRUE /* deleted_ok */, +                                       scratch_pool, scratch_pool)); + +      mtb->special = (NULL != svn_hash_gets(properties, SVN_PROP_SPECIAL)); +    } +#endif + +  mtb->has_checksum = (checksum != NULL); +  mtb->copied = (original_repos_relpath != NULL); + +  SVN_ERR(svn_wc__db_fetch_repos_info(&mtb->repos_root_url, &mtb->repos_uuid, +                                      wcroot->sdb, repos_id, result_pool)); + +  if (mtb->kind == svn_node_dir) +    SVN_ERR(is_wclocked(&mtb->locked, wcroot, local_relpath, scratch_pool)); + +  *info = mtb; + +  return SVN_NO_ERROR; +} + +svn_error_t * +svn_wc__db_read_single_info(const struct svn_wc__db_info_t **info, +                            svn_wc__db_t *db, +                            const char *local_abspath, +                            apr_pool_t *result_pool, +                            apr_pool_t *scratch_pool) +{ +  svn_wc__db_wcroot_t *wcroot; +  const char *local_relpath; + +  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); + +  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db, +                                                local_abspath, +                                                scratch_pool, scratch_pool)); +  VERIFY_USABLE_WCROOT(wcroot); + +  SVN_WC__DB_WITH_TXN(read_single_info(info, wcroot, local_relpath, +                                       result_pool, scratch_pool), +                      wcroot); + +  return SVN_NO_ERROR; +} +  svn_error_t *  svn_wc__db_read_pristine_info(svn_wc__db_status_t *status,                                svn_node_kind_t *kind, @@ -10730,7 +11159,7 @@ commit_node(svn_wc__db_wcroot_t *wcroot,           if we need to remove shadowed layers below our descendants. */        SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, -                                        STMT_DELETE_ALL_LAYERS)); +                                        STMT_DELETE_NODE_ALL_LAYERS));        SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));        SVN_ERR(svn_sqlite__update(&affected_rows, stmt)); diff --git a/subversion/libsvn_wc/wc_db.h b/subversion/libsvn_wc/wc_db.h index a4ed3f976d60..b0914942416b 100644 --- a/subversion/libsvn_wc/wc_db.h +++ b/subversion/libsvn_wc/wc_db.h @@ -1909,6 +1909,16 @@ svn_wc__db_read_info(svn_wc__db_status_t *status,  /* ### derived */                       apr_pool_t *result_pool,                       apr_pool_t *scratch_pool); +/* Structure used as linked list in svn_wc__db_info_t to describe all nodes +   in this location that were moved to another location */ +struct svn_wc__db_moved_to_info_t +{ +  const char *moved_to_abspath; +  const char *shadow_op_root_abspath; + +  struct svn_wc__db_moved_to_info_t *next; +}; +  /* Structure returned by svn_wc__db_read_children_info.  Only has the     fields needed by status. */  struct svn_wc__db_info_t { @@ -1945,7 +1955,10 @@ struct svn_wc__db_info_t {    svn_wc__db_lock_t *lock;  /* Repository file lock */    svn_boolean_t incomplete; /* TRUE if a working node is incomplete */ -  const char *moved_to_abspath; /* Only on op-roots. See svn_wc_status3_t. */ +  struct svn_wc__db_moved_to_info_t *moved_to; /* A linked list of locations +                                                 where nodes at this path +                                                 are moved to. Highest layers +                                                 first */    svn_boolean_t moved_here;     /* Only on op-roots. */    svn_boolean_t file_external; @@ -1967,6 +1980,14 @@ svn_wc__db_read_children_info(apr_hash_t **nodes,                                apr_pool_t *result_pool,                                apr_pool_t *scratch_pool); +/* Like svn_wc__db_read_children_info, but only gets an info node for the root +   element. */ +svn_error_t * +svn_wc__db_read_single_info(const struct svn_wc__db_info_t **info, +                            svn_wc__db_t *db, +                            const char *local_abspath, +                            apr_pool_t *result_pool, +                            apr_pool_t *scratch_pool);  /* Structure returned by svn_wc__db_read_walker_info.  Only has the     fields needed by svn_wc__internal_walk_children(). */ diff --git a/subversion/libsvn_wc/wc_db_wcroot.c b/subversion/libsvn_wc/wc_db_wcroot.c index 21173e50cfa2..d801451f613e 100644 --- a/subversion/libsvn_wc/wc_db_wcroot.c +++ b/subversion/libsvn_wc/wc_db_wcroot.c @@ -690,8 +690,12 @@ try_symlink_as_dir:            svn_error_clear(err);            *wcroot = NULL;          } -      else -        SVN_ERR(err); +      else if (err) +        { +          /* Close handle if we are not going to use it to support +             upgrading with exclusive wc locking. */ +          return svn_error_compose_create(err, svn_sqlite__close(sdb)); +        }      }    else      { | 
