You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ar...@apache.org on 2011/11/21 08:08:07 UTC
svn commit: r1204374 [20/29] - in /subversion/branches/svn-bisect: ./ build/
build/ac-macros/ build/generator/ build/generator/templates/ build/win32/
contrib/client-side/ contrib/client-side/emacs/ notes/ notes/wc-ng/
subversion/bindings/javahl/native...
Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/wc.h?rev=1204374&r1=1204373&r2=1204374&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/wc.h Mon Nov 21 07:07:56 2011
@@ -149,7 +149,7 @@ extern "C" {
* The bump to 29 renamed the pristine files from '<SHA1>' to '<SHA1>.svn-base'
* and introduced the EXTERNALS store. Bumped in r1129286.
*
- * == 1.7.x shipped with format ???
+ * == 1.7.x shipped with format 29
*
* Please document any further format changes here.
*/
@@ -350,10 +350,8 @@ svn_wc__prop_array_to_hash(const apr_arr
*
* If EXACT_COMPARISON is FALSE, translate LOCAL_ABSPATH's EOL
* style and keywords to repository-normal form according to its properties,
- * and compare the result with the text base. If COMPARE_TEXTBASES is
- * TRUE, translate the text base's EOL style and keywords to working-copy
- * form according to LOCAL_ABSPATH's properties, and compare the
- * result with LOCAL_ABSPATH. Usually, EXACT_COMPARISON should be FALSE.
+ * and compare the result with the text base.
+ * Usually, EXACT_COMPARISON should be FALSE.
*
* If LOCAL_ABSPATH does not exist, consider it unmodified. If it exists
* but is not under revision control (not even scheduled for
@@ -680,7 +678,7 @@ svn_wc__wipe_postupgrade(const char *dir
*/
svn_error_t *
svn_wc__check_wc_root(svn_boolean_t *wc_root,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_boolean_t *switched,
svn_wc__db_t *db,
const char *local_abspath,
Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/wc_db.c?rev=1204374&r1=1204373&r2=1204374&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/wc_db.c Mon Nov 21 07:07:56 2011
@@ -142,7 +142,7 @@ apr_int64_t svn_wc__db_op_depth_for_upgr
typedef struct insert_base_baton_t {
/* common to all insertions into BASE */
svn_wc__db_status_t status;
- svn_wc__db_kind_t kind;
+ svn_kind_t kind;
apr_int64_t repos_id;
const char *repos_relpath;
svn_revnum_t revision;
@@ -192,7 +192,7 @@ typedef struct insert_base_baton_t {
typedef struct insert_working_baton_t {
/* common to all insertions into WORKING (including NODE_DATA) */
svn_wc__db_status_t presence;
- svn_wc__db_kind_t kind;
+ svn_kind_t kind;
apr_int64_t op_depth;
/* common to all "normal" presence insertions */
@@ -226,7 +226,7 @@ typedef struct insert_working_baton_t {
typedef struct insert_external_baton_t {
/* common to all insertions into EXTERNALS */
- svn_wc__db_kind_t kind;
+ svn_kind_t kind;
svn_wc__db_status_t presence;
/* The repository of the external */
@@ -274,10 +274,10 @@ typedef struct insert_external_baton_t {
static const svn_token_map_t kind_map[] = {
- { "file", svn_wc__db_kind_file },
- { "dir", svn_wc__db_kind_dir },
- { "symlink", svn_wc__db_kind_symlink },
- { "unknown", svn_wc__db_kind_unknown },
+ { "file", svn_kind_file },
+ { "dir", svn_kind_dir },
+ { "symlink", svn_kind_symlink },
+ { "unknown", svn_kind_unknown },
{ NULL }
};
@@ -329,7 +329,7 @@ db_read_pristine_props(apr_hash_t **prop
static svn_error_t *
read_info(svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_revnum_t *revision,
const char **repos_relpath,
apr_int64_t *repos_id,
@@ -781,6 +781,8 @@ insert_base_node(void *baton,
svn_sqlite__stmt_t *stmt;
svn_filesize_t recorded_size = SVN_INVALID_FILESIZE;
apr_int64_t recorded_mod_time;
+ const char *moved_to_relpath = NULL;
+ svn_boolean_t have_row;
/* The directory at the WCROOT has a NULL parent_relpath. Otherwise,
bind the appropriate parent_relpath. */
@@ -798,24 +800,28 @@ insert_base_node(void *baton,
/* ### we can't handle this right now */
SVN_ERR_ASSERT(pibb->conflict == NULL);
- if (pibb->keep_recorded_info)
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_BASE_NODE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ if (have_row)
{
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_BASE_NODE));
-
- SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
- SVN_ERR(svn_sqlite__step_row(stmt));
-
- recorded_size = get_recorded_size(stmt, 6);
- recorded_mod_time = svn_sqlite__column_int64(stmt, 12);
-
- SVN_ERR(svn_sqlite__reset(stmt));
+ /* A BASE node already exists. */
+ if (pibb->keep_recorded_info)
+ {
+ /* Preserve size and modification time if caller asked us to. */
+ recorded_size = get_recorded_size(stmt, 6);
+ recorded_mod_time = svn_sqlite__column_int64(stmt, 12);
+ }
+ /* Always preserve moved-to info. */
+ moved_to_relpath = svn_sqlite__column_text(stmt, 15, scratch_pool);
}
+ SVN_ERR(svn_sqlite__reset(stmt));
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_INSERT_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "isisisr"
"tstr" /* 8 - 11 */
- "isnnnnns", /* 12 - 19 */
+ "isnnnnnsss", /* 12 - 21 */
wcroot->wc_id, /* 1 */
local_relpath, /* 2 */
(apr_int64_t)0, /* op_depth is 0 for base */
@@ -824,17 +830,27 @@ insert_base_node(void *baton,
pibb->repos_relpath,
pibb->revision,
presence_map, pibb->status, /* 8 */
- (pibb->kind == svn_wc__db_kind_dir) ? /* 9 */
+ (pibb->kind == svn_kind_dir) ? /* 9 */
svn_depth_to_word(pibb->depth) : NULL,
kind_map, pibb->kind, /* 10 */
pibb->changed_rev, /* 11 */
pibb->changed_date, /* 12 */
pibb->changed_author, /* 13 */
- (pibb->kind == svn_wc__db_kind_symlink) ?
- pibb->target : NULL)); /* 19 */
+ (pibb->kind == svn_kind_symlink) ?
+ pibb->target : NULL, /* 19 */
+ NULL /* 20 */,
+ moved_to_relpath /* 21 */));
+ if (pibb->kind == svn_kind_file)
+ {
+ if (!pibb->checksum
+ && pibb->status != svn_wc__db_status_not_present
+ && pibb->status != svn_wc__db_status_excluded
+ && pibb->status != svn_wc__db_status_server_excluded)
+ return svn_error_createf(SVN_ERR_WC_CORRUPT, svn_sqlite__reset(stmt),
+ _("The file '%s' has no checksum."),
+ path_for_error_message(wcroot, local_relpath,
+ scratch_pool));
- if (pibb->kind == svn_wc__db_kind_file)
- {
SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, pibb->checksum,
scratch_pool));
@@ -879,7 +895,7 @@ insert_base_node(void *baton,
wcroot->sdb, scratch_pool));
}
- if (pibb->kind == svn_wc__db_kind_dir && pibb->children)
+ if (pibb->kind == svn_kind_dir && pibb->children)
SVN_ERR(insert_incomplete_children(wcroot->sdb, wcroot->wc_id,
local_relpath,
repos_id,
@@ -1011,22 +1027,23 @@ insert_working_node(void *baton,
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_INSERT_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "isisnnntstrisn"
"nnnn" /* properties translated_size last_mod_time dav_cache */
- "s",
+ "snni", /* symlink_target, file_external, moved_to, moved_here */
wcroot->wc_id, local_relpath,
piwb->op_depth,
parent_relpath,
presence_map, piwb->presence,
- (piwb->kind == svn_wc__db_kind_dir)
+ (piwb->kind == svn_kind_dir)
? svn_depth_to_word(piwb->depth) : NULL,
kind_map, piwb->kind,
piwb->changed_rev,
piwb->changed_date,
piwb->changed_author,
/* Note: incomplete nodes may have a NULL target. */
- (piwb->kind == svn_wc__db_kind_symlink)
- ? piwb->target : NULL));
+ (piwb->kind == svn_kind_symlink)
+ ? piwb->target : NULL,
+ (apr_int64_t)piwb->moved_here));
- if (piwb->kind == svn_wc__db_kind_file)
+ if (piwb->kind == svn_kind_file)
{
SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, piwb->checksum,
scratch_pool));
@@ -1047,7 +1064,7 @@ insert_working_node(void *baton,
The children are part of the same op and so have the same op_depth.
(The only time we'd want a different depth is during a recursive
simple add, but we never insert children here during a simple add.) */
- if (piwb->kind == svn_wc__db_kind_dir && piwb->children)
+ if (piwb->kind == svn_kind_dir && piwb->children)
SVN_ERR(insert_incomplete_children(wcroot->sdb, wcroot->wc_id,
local_relpath,
INVALID_REPOS_ID /* inherit repos_id */,
@@ -1057,7 +1074,7 @@ insert_working_node(void *baton,
piwb->op_depth,
scratch_pool));
- if (piwb->kind == svn_wc__db_kind_dir)
+ if (piwb->kind == svn_kind_dir)
{
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_UPDATE_ACTUAL_CLEAR_CHANGELIST));
@@ -1455,7 +1472,7 @@ svn_wc__db_init(svn_wc__db_t *db,
ibb.status = svn_wc__db_status_incomplete;
else
ibb.status = svn_wc__db_status_normal;
- ibb.kind = svn_wc__db_kind_dir;
+ ibb.kind = svn_kind_dir;
ibb.repos_id = repos_id;
ibb.repos_relpath = repos_relpath;
ibb.revision = initial_rev;
@@ -1605,7 +1622,7 @@ svn_wc__db_base_add_directory(svn_wc__db
ibb.repos_uuid = repos_uuid;
ibb.status = svn_wc__db_status_normal;
- ibb.kind = svn_wc__db_kind_dir;
+ ibb.kind = svn_kind_dir;
ibb.repos_relpath = repos_relpath;
ibb.revision = revision;
@@ -1686,7 +1703,7 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
ibb.repos_uuid = repos_uuid;
ibb.status = svn_wc__db_status_normal;
- ibb.kind = svn_wc__db_kind_file;
+ ibb.kind = svn_kind_file;
ibb.repos_relpath = repos_relpath;
ibb.revision = revision;
@@ -1765,7 +1782,7 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
ibb.repos_uuid = repos_uuid;
ibb.status = svn_wc__db_status_normal;
- ibb.kind = svn_wc__db_kind_symlink;
+ ibb.kind = svn_kind_symlink;
ibb.repos_relpath = repos_relpath;
ibb.revision = revision;
@@ -1804,7 +1821,7 @@ add_excluded_or_not_present_node(svn_wc_
const char *repos_root_url,
const char *repos_uuid,
svn_revnum_t revision,
- svn_wc__db_kind_t kind,
+ svn_kind_t kind,
svn_wc__db_status_t status,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
@@ -1876,7 +1893,7 @@ svn_wc__db_base_add_excluded_node(svn_wc
const char *repos_root_url,
const char *repos_uuid,
svn_revnum_t revision,
- svn_wc__db_kind_t kind,
+ svn_kind_t kind,
svn_wc__db_status_t status,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
@@ -1898,7 +1915,7 @@ svn_wc__db_base_add_not_present_node(svn
const char *repos_root_url,
const char *repos_uuid,
svn_revnum_t revision,
- svn_wc__db_kind_t kind,
+ svn_kind_t kind,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
@@ -1975,7 +1992,7 @@ svn_wc__db_base_remove(svn_wc__db_t *db,
DB+LOCAL_ABSPATH and outputting REPOS_ID instead of URL+UUID. */
static svn_error_t *
base_get_info(svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_revnum_t *revision,
const char **repos_relpath,
apr_int64_t *repos_id,
@@ -2005,7 +2022,7 @@ base_get_info(svn_wc__db_status_t *statu
if (have_row)
{
- svn_wc__db_kind_t node_kind = svn_sqlite__column_token(stmt, 3,
+ svn_kind_t node_kind = svn_sqlite__column_token(stmt, 3,
kind_map);
if (kind)
@@ -2022,7 +2039,7 @@ base_get_info(svn_wc__db_status_t *statu
SVN_ERR_ASSERT(!repos_relpath || *repos_relpath);
if (lock)
{
- *lock = lock_from_columns(stmt, 15, 16, 17, 18, result_pool);
+ *lock = lock_from_columns(stmt, 16, 17, 18, 19, result_pool);
}
if (changed_rev)
{
@@ -2039,7 +2056,7 @@ base_get_info(svn_wc__db_status_t *statu
}
if (depth)
{
- if (node_kind != svn_wc__db_kind_dir)
+ if (node_kind != svn_kind_dir)
{
*depth = svn_depth_unknown;
}
@@ -2055,7 +2072,7 @@ base_get_info(svn_wc__db_status_t *statu
}
if (checksum)
{
- if (node_kind != svn_wc__db_kind_file)
+ if (node_kind != svn_kind_file)
{
*checksum = NULL;
}
@@ -2073,7 +2090,7 @@ base_get_info(svn_wc__db_status_t *statu
}
if (target)
{
- if (node_kind != svn_wc__db_kind_symlink)
+ if (node_kind != svn_kind_symlink)
*target = NULL;
else
*target = svn_sqlite__column_text(stmt, 11, result_pool);
@@ -2102,7 +2119,7 @@ base_get_info(svn_wc__db_status_t *statu
svn_error_t *
svn_wc__db_base_get_info(svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_revnum_t *revision,
const char **repos_relpath,
const char **repos_root_url,
@@ -2354,7 +2371,7 @@ svn_wc__db_base_clear_dav_cache_recursiv
DB+LOCAL_ABSPATH and outputting REPOS_ID instead of URL+UUID. */
static svn_error_t *
depth_get_info(svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_revnum_t *revision,
const char **repos_relpath,
apr_int64_t *repos_id,
@@ -2383,7 +2400,7 @@ depth_get_info(svn_wc__db_status_t *stat
if (have_row)
{
- svn_wc__db_kind_t node_kind = svn_sqlite__column_token(stmt, 3,
+ svn_kind_t node_kind = svn_sqlite__column_token(stmt, 3,
kind_map);
if (kind)
@@ -2415,7 +2432,7 @@ depth_get_info(svn_wc__db_status_t *stat
}
if (depth)
{
- if (node_kind != svn_wc__db_kind_dir)
+ if (node_kind != svn_kind_dir)
{
*depth = svn_depth_unknown;
}
@@ -2431,7 +2448,7 @@ depth_get_info(svn_wc__db_status_t *stat
}
if (checksum)
{
- if (node_kind != svn_wc__db_kind_file)
+ if (node_kind != svn_kind_file)
{
*checksum = NULL;
}
@@ -2449,7 +2466,7 @@ depth_get_info(svn_wc__db_status_t *stat
}
if (target)
{
- if (node_kind != svn_wc__db_kind_symlink)
+ if (node_kind != svn_kind_symlink)
*target = NULL;
else
*target = svn_sqlite__column_text(stmt, 11, result_pool);
@@ -2608,8 +2625,8 @@ insert_external_node(void *baton,
else if (status == svn_wc__db_status_normal && !update_root)
return svn_error_create(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL, NULL);
- if (ieb->kind == svn_wc__db_kind_file
- || ieb->kind == svn_wc__db_kind_symlink)
+ if (ieb->kind == svn_kind_file
+ || ieb->kind == svn_kind_symlink)
{
struct insert_base_baton_t ibb;
@@ -2730,7 +2747,7 @@ svn_wc__db_external_add_file(svn_wc__db_
blank_ieb(&ieb);
- ieb.kind = svn_wc__db_kind_file;
+ ieb.kind = svn_kind_file;
ieb.presence = svn_wc__db_status_normal;
ieb.repos_root_url = repos_root_url;
@@ -2814,7 +2831,7 @@ svn_wc__db_external_add_symlink(svn_wc__
blank_ieb(&ieb);
- ieb.kind = svn_wc__db_kind_symlink;
+ ieb.kind = svn_kind_symlink;
ieb.presence = svn_wc__db_status_normal;
ieb.repos_root_url = repos_root_url;
@@ -2887,7 +2904,7 @@ svn_wc__db_external_add_dir(svn_wc__db_t
blank_ieb(&ieb);
- ieb.kind = svn_wc__db_kind_dir;
+ ieb.kind = svn_kind_dir;
ieb.presence = svn_wc__db_status_normal;
ieb.repos_root_url = repos_root_url;
@@ -2964,7 +2981,7 @@ svn_wc__db_external_remove(svn_wc__db_t
svn_error_t *
svn_wc__db_external_read(svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
const char **definining_abspath,
const char **repos_root_url,
const char **repos_uuid,
@@ -3051,6 +3068,64 @@ svn_wc__db_external_read(svn_wc__db_stat
}
svn_error_t *
+svn_wc__db_committable_externals_below(apr_array_header_t **externals,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_boolean_t immediates_only,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_wcroot_t *wcroot;
+ svn_sqlite__stmt_t *stmt;
+ const char *local_relpath;
+ svn_boolean_t have_row;
+ svn_wc__committable_external_info_t *info;
+ svn_kind_t db_kind;
+ apr_array_header_t *result = NULL;
+
+ 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_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW));
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "isi", wcroot->wc_id, local_relpath,
+ (apr_int64_t)(immediates_only ? 1 : 0)));
+
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+
+ if (have_row)
+ result = apr_array_make(result_pool, 0,
+ sizeof(svn_wc__committable_external_info_t *));
+
+ while (have_row)
+ {
+ info = apr_palloc(result_pool, sizeof(*info));
+
+ local_relpath = svn_sqlite__column_text(stmt, 0, NULL);
+ info->local_abspath = svn_dirent_join(wcroot->abspath, local_relpath,
+ result_pool);
+
+ db_kind = svn_sqlite__column_token(stmt, 1, kind_map);
+ SVN_ERR_ASSERT(db_kind == svn_kind_file || db_kind == svn_kind_dir);
+ info->kind = db_kind;
+
+ info->repos_relpath = svn_sqlite__column_text(stmt, 3, result_pool);
+ info->repos_root_url = svn_sqlite__column_text(stmt, 4, result_pool);
+
+ APR_ARRAY_PUSH(result, svn_wc__committable_external_info_t *) = info;
+
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ }
+
+ *externals = result;
+ return svn_error_trace(svn_sqlite__reset(stmt));
+}
+
+svn_error_t *
svn_wc__db_externals_defined_below(apr_hash_t **externals,
svn_wc__db_t *db,
const char *local_abspath,
@@ -3232,7 +3307,7 @@ cross_db_copy(svn_wc__db_wcroot_t *src_w
svn_wc__db_status_t dst_status,
apr_int64_t dst_op_depth,
apr_int64_t dst_np_op_depth,
- svn_wc__db_kind_t kind,
+ svn_kind_t kind,
const apr_array_header_t *children,
apr_int64_t copyfrom_id,
const char *copyfrom_relpath,
@@ -3247,8 +3322,8 @@ cross_db_copy(svn_wc__db_wcroot_t *src_w
apr_hash_t *props;
svn_depth_t depth;
- SVN_ERR_ASSERT(kind == svn_wc__db_kind_file
- || kind == svn_wc__db_kind_dir
+ SVN_ERR_ASSERT(kind == svn_kind_file
+ || kind == svn_kind_dir
);
SVN_ERR(read_info(NULL, NULL, NULL, NULL, NULL,
@@ -3299,7 +3374,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
const char **copyfrom_relpath,
svn_revnum_t *copyfrom_rev,
svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_boolean_t *op_root,
svn_boolean_t *have_work,
svn_wc__db_wcroot_t *wcroot,
@@ -3324,7 +3399,7 @@ get_info_for_copy(apr_int64_t *copyfrom_
adjust the relpath */
const char *parent_relpath, *base_name;
svn_wc__db_status_t parent_status;
- svn_wc__db_kind_t parent_kind;
+ svn_kind_t parent_kind;
svn_boolean_t parent_have_work;
svn_dirent_split(&parent_relpath, &base_name, local_relpath,
@@ -3445,7 +3520,7 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
apr_int64_t copyfrom_id;
apr_int64_t dst_op_depth;
apr_int64_t dst_np_op_depth;
- svn_wc__db_kind_t kind;
+ svn_kind_t kind;
const apr_array_header_t *children;
SVN_ERR(get_info_for_copy(©from_id, ©from_relpath, ©from_rev,
@@ -3456,7 +3531,7 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
copyfrom_relpath, copyfrom_rev,
dst_wcroot, dst_relpath, scratch_pool));
- SVN_ERR_ASSERT(kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_dir);
+ SVN_ERR_ASSERT(kind == svn_kind_file || kind == svn_kind_dir);
/* ### New status, not finished, see notes/wc-ng/copying */
switch (status)
@@ -3517,6 +3592,9 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
src_relpath,
scratch_pool));
default:
+ /* Perhaps we should allow incomplete to incomplete? We can't
+ avoid incomplete working nodes as one step in copying a
+ directory is to add incomplete children. */
return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
_("Cannot handle status of '%s'"),
path_for_error_message(src_wcroot,
@@ -3524,7 +3602,7 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
scratch_pool));
}
- if (kind == svn_wc__db_kind_dir)
+ if (kind == svn_kind_dir)
{
apr_int64_t src_op_depth;
@@ -3587,14 +3665,14 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
The children are part of the same op and so have the same op_depth.
(The only time we'd want a different depth is during a recursive
simple add, but we never insert children here during a simple add.) */
- if (kind == svn_wc__db_kind_dir
+ if (kind == svn_kind_dir
&& dst_presence == svn_wc__db_status_normal)
SVN_ERR(insert_incomplete_children(
dst_wcroot->sdb,
dst_wcroot->wc_id,
dst_relpath,
- INVALID_REPOS_ID /* inherit repos_id */,
- NULL /* inherit repos_path */,
+ copyfrom_id,
+ copyfrom_relpath,
copyfrom_rev,
children,
dst_op_depth,
@@ -3708,7 +3786,7 @@ db_op_copy_shadowed_layer(svn_wc__db_wcr
const apr_array_header_t *children;
apr_pool_t *iterpool;
svn_wc__db_status_t status;
- svn_wc__db_kind_t kind;
+ svn_kind_t kind;
svn_revnum_t node_revision;
const char *node_repos_relpath;
apr_int64_t node_repos_id;
@@ -4170,6 +4248,7 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
const char *original_uuid,
svn_revnum_t original_revision,
const apr_array_header_t *children,
+ svn_boolean_t is_move,
svn_depth_t depth,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
@@ -4195,13 +4274,13 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
blank_iwb(&iwb);
iwb.presence = svn_wc__db_status_normal;
- iwb.kind = svn_wc__db_kind_dir;
+ iwb.kind = svn_kind_dir;
iwb.props = props;
iwb.changed_rev = changed_rev;
iwb.changed_date = changed_date;
iwb.changed_author = changed_author;
- iwb.moved_here = FALSE;
+ iwb.moved_here = is_move;
if (original_root_url != NULL)
{
@@ -4243,6 +4322,7 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
const char *original_uuid,
svn_revnum_t original_revision,
const svn_checksum_t *checksum,
+ svn_boolean_t is_move,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
@@ -4269,13 +4349,13 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
blank_iwb(&iwb);
iwb.presence = svn_wc__db_status_normal;
- iwb.kind = svn_wc__db_kind_file;
+ iwb.kind = svn_kind_file;
iwb.props = props;
iwb.changed_rev = changed_rev;
iwb.changed_date = changed_date;
iwb.changed_author = changed_author;
- iwb.moved_here = FALSE;
+ iwb.moved_here = is_move;
if (original_root_url != NULL)
{
@@ -4338,7 +4418,7 @@ svn_wc__db_op_copy_symlink(svn_wc__db_t
blank_iwb(&iwb);
iwb.presence = svn_wc__db_status_normal;
- iwb.kind = svn_wc__db_kind_symlink;
+ iwb.kind = svn_kind_symlink;
iwb.props = props;
iwb.changed_rev = changed_rev;
@@ -4392,7 +4472,7 @@ svn_wc__db_op_add_directory(svn_wc__db_t
blank_iwb(&iwb);
iwb.presence = svn_wc__db_status_normal;
- iwb.kind = svn_wc__db_kind_dir;
+ iwb.kind = svn_kind_dir;
iwb.op_depth = relpath_depth(local_relpath);
iwb.work_items = work_items;
@@ -4427,7 +4507,7 @@ svn_wc__db_op_add_file(svn_wc__db_t *db,
blank_iwb(&iwb);
iwb.presence = svn_wc__db_status_normal;
- iwb.kind = svn_wc__db_kind_file;
+ iwb.kind = svn_kind_file;
iwb.op_depth = relpath_depth(local_relpath);
iwb.work_items = work_items;
@@ -4461,7 +4541,7 @@ svn_wc__db_op_add_symlink(svn_wc__db_t *
blank_iwb(&iwb);
iwb.presence = svn_wc__db_status_normal;
- iwb.kind = svn_wc__db_kind_symlink;
+ iwb.kind = svn_kind_symlink;
iwb.op_depth = relpath_depth(local_relpath);
iwb.target = target;
@@ -5296,7 +5376,6 @@ op_revert_txn(void *baton,
STMT_CLEAR_MOVED_TO_RELPATH));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
- SVN_ERR(svn_sqlite__reset(stmt));
}
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -5325,6 +5404,8 @@ op_revert_recursive_txn(void *baton,
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
apr_int64_t op_depth;
+ apr_int64_t select_op_depth;
+ svn_boolean_t moved_here;
int affected_rows;
apr_pool_t *iterpool;
@@ -5356,6 +5437,7 @@ op_revert_recursive_txn(void *baton,
}
op_depth = svn_sqlite__column_int64(stmt, 0);
+ moved_here = svn_sqlite__column_boolean(stmt, 15);
SVN_ERR(svn_sqlite__reset(stmt));
if (op_depth > 0 && op_depth != relpath_depth(local_relpath))
@@ -5366,13 +5448,13 @@ op_revert_recursive_txn(void *baton,
local_relpath,
scratch_pool));
- if (!op_depth)
- op_depth = 1; /* Don't delete BASE nodes */
+ /* Don't delete BASE nodes */
+ select_op_depth = op_depth ? op_depth : 1;
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_DELETE_NODES_RECURSIVE));
SVN_ERR(svn_sqlite__bindf(stmt, "isi", wcroot->wc_id,
- local_relpath, op_depth));
+ local_relpath, select_op_depth));
SVN_ERR(svn_sqlite__step_done(stmt));
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -5404,21 +5486,32 @@ op_revert_recursive_txn(void *baton,
while (have_row)
{
const char *moved_here_child_relpath;
+ svn_error_t *err;
svn_pool_clear(iterpool);
moved_here_child_relpath = svn_sqlite__column_text(stmt, 0, iterpool);
- SVN_ERR(clear_moved_to(moved_here_child_relpath, wcroot, iterpool));
+ err = clear_moved_to(moved_here_child_relpath, wcroot, iterpool);
+ if (err)
+ return svn_error_trace(svn_error_compose_create(
+ err,
+ svn_sqlite__reset(stmt)));
+
SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
+ SVN_ERR(svn_sqlite__reset(stmt));
svn_pool_destroy(iterpool);
- /* Clear any moved-to paths of the BASE nodes. */
+ /* Clear potential moved-to pointing at the target node itself. */
+ if (op_depth > 0 && op_depth == relpath_depth(local_relpath)
+ && moved_here)
+ SVN_ERR(clear_moved_to(local_relpath, wcroot, scratch_pool));
+
+ /* Clear any moved-to paths of potentially 'moved-away' nodes. */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_CLEAR_MOVED_TO_RELPATH_RECURSIVE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
- SVN_ERR(svn_sqlite__reset(stmt));
return SVN_NO_ERROR;
}
@@ -5471,6 +5564,8 @@ struct revert_list_read_baton {
const char **conflict_new;
const char **conflict_working;
const char **prop_reject;
+ svn_boolean_t *copied_here;
+ svn_kind_t *kind;
apr_pool_t *result_pool;
};
@@ -5487,6 +5582,8 @@ revert_list_read(void *baton,
*(b->reverted) = FALSE;
*(b->conflict_new) = *(b->conflict_old) = *(b->conflict_working) = NULL;
*(b->prop_reject) = NULL;
+ *(b->copied_here) = FALSE;
+ *(b->kind) = svn_kind_unknown;
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_REVERT_LIST));
@@ -5494,9 +5591,10 @@ revert_list_read(void *baton,
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (have_row)
{
- svn_boolean_t another_row;
+ svn_boolean_t is_actual = (svn_sqlite__column_int64(stmt, 5) != 0);
+ svn_boolean_t another_row = FALSE;
- if (svn_sqlite__column_int64(stmt, 5))
+ if (is_actual)
{
if (!svn_sqlite__column_is_null(stmt, 4))
*(b->reverted) = TRUE;
@@ -5526,11 +5624,19 @@ revert_list_read(void *baton,
b->result_pool);
SVN_ERR(svn_sqlite__step(&another_row, stmt));
- if (another_row)
- *(b->reverted) = TRUE;
}
- else
- *(b->reverted) = TRUE;
+
+ if (!is_actual || another_row)
+ {
+ *(b->reverted) = TRUE;
+ if (!svn_sqlite__column_is_null(stmt, 7))
+ {
+ apr_int64_t op_depth = svn_sqlite__column_int64(stmt, 6);
+ *(b->copied_here) = (op_depth == relpath_depth(local_relpath));
+ }
+ *(b->kind) = svn_sqlite__column_token(stmt, 8, kind_map);
+ }
+
}
SVN_ERR(svn_sqlite__reset(stmt));
@@ -5551,6 +5657,8 @@ svn_wc__db_revert_list_read(svn_boolean_
const char **conflict_new,
const char **conflict_working,
const char **prop_reject,
+ svn_boolean_t *copied_here,
+ svn_kind_t *kind,
svn_wc__db_t *db,
const char *local_abspath,
apr_pool_t *result_pool,
@@ -5560,7 +5668,7 @@ svn_wc__db_revert_list_read(svn_boolean_
const char *local_relpath;
struct revert_list_read_baton b = {reverted, conflict_old, conflict_new,
conflict_working, prop_reject,
- result_pool};
+ copied_here, kind, result_pool};
SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
db, local_abspath, scratch_pool, scratch_pool));
@@ -5571,6 +5679,80 @@ svn_wc__db_revert_list_read(svn_boolean_
return SVN_NO_ERROR;
}
+
+struct revert_list_read_copied_children_baton {
+ const apr_array_header_t **children;
+ apr_pool_t *result_pool;
+};
+
+static svn_error_t *
+revert_list_read_copied_children(void *baton,
+ svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ apr_pool_t *scratch_pool)
+{
+ struct revert_list_read_copied_children_baton *b = baton;
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t have_row;
+ apr_array_header_t *children;
+
+ children =
+ apr_array_make(b->result_pool, 0,
+ sizeof(svn_wc__db_revert_list_copied_child_info_t *));
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_REVERT_LIST_COPIED_CHILDREN));
+ SVN_ERR(svn_sqlite__bindf(stmt, "si",
+ construct_like_arg(local_relpath, scratch_pool),
+ relpath_depth(local_relpath)));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ while (have_row)
+ {
+ svn_wc__db_revert_list_copied_child_info_t *child_info;
+ const char *child_relpath;
+
+ child_info = apr_palloc(b->result_pool, sizeof(*child_info));
+
+ child_relpath = svn_sqlite__column_text(stmt, 0, NULL);
+ child_info->abspath = svn_dirent_join(wcroot->abspath, child_relpath,
+ b->result_pool);
+ child_info->kind = svn_sqlite__column_token(stmt, 1, kind_map);
+ APR_ARRAY_PUSH(
+ children,
+ svn_wc__db_revert_list_copied_child_info_t *) = child_info;
+
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ }
+ SVN_ERR(svn_sqlite__reset(stmt));
+
+ *b->children = children;
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_wc__db_revert_list_read_copied_children(const apr_array_header_t **children,
+ 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;
+ struct revert_list_read_copied_children_baton b = {children, result_pool};
+
+ SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
+ db, local_abspath, scratch_pool, scratch_pool));
+ VERIFY_USABLE_WCROOT(wcroot);
+
+ SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath,
+ revert_list_read_copied_children, &b,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+
svn_error_t *
svn_wc__db_revert_list_notify(svn_wc_notify_func2_t notify_func,
void *notify_baton,
@@ -5790,7 +5972,7 @@ svn_wc__db_op_read_tree_conflict(
struct remove_node_baton
{
svn_revnum_t not_present_rev;
- svn_wc__db_kind_t not_present_kind;
+ svn_kind_t not_present_kind;
};
/* Implements svn_wc__db_txn_callback_t for svn_wc__db_op_remove_node */
@@ -5855,7 +6037,7 @@ svn_error_t *
svn_wc__db_op_remove_node(svn_wc__db_t *db,
const char *local_abspath,
svn_revnum_t not_present_revision,
- svn_wc__db_kind_t not_present_kind,
+ svn_kind_t not_present_kind,
apr_pool_t *scratch_pool)
{
svn_wc__db_wcroot_t *wcroot;
@@ -5997,11 +6179,7 @@ convert_to_working_status(svn_wc__db_sta
|| work_status == svn_wc__db_status_incomplete
|| work_status == svn_wc__db_status_excluded);
- if (work_status == svn_wc__db_status_incomplete)
- {
- *working_status = svn_wc__db_status_incomplete;
- }
- else if (work_status == svn_wc__db_status_excluded)
+ if (work_status == svn_wc__db_status_excluded)
{
*working_status = svn_wc__db_status_excluded;
}
@@ -6016,7 +6194,7 @@ convert_to_working_status(svn_wc__db_sta
*working_status = svn_wc__db_status_deleted;
}
- else /* normal */
+ else /* normal or incomplete */
{
/* The caller should scan upwards to detect whether this
addition has occurred because of a simple addition,
@@ -6087,6 +6265,27 @@ info_below_working(svn_boolean_t *have_b
return SVN_NO_ERROR;
}
+/* Helper function for op_delete_txn */
+static svn_error_t *
+delete_update_movedto(svn_wc__db_wcroot_t *wcroot,
+ const char *child_moved_from_relpath,
+ const char *new_moved_to_relpath,
+ apr_pool_t *scratch_pool)
+{
+ svn_sqlite__stmt_t *stmt;
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_UPDATE_MOVED_TO_RELPATH));
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+ wcroot->wc_id,
+ child_moved_from_relpath,
+ new_moved_to_relpath));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ return SVN_NO_ERROR;
+}
+
struct op_delete_baton_t {
apr_int64_t delete_depth; /* op-depth for root of delete */
@@ -6094,10 +6293,10 @@ struct op_delete_baton_t {
};
static svn_error_t *
-op_delete_txn(void *baton,
- svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- apr_pool_t *scratch_pool)
+delete_node(void *baton,
+ svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ apr_pool_t *scratch_pool)
{
struct op_delete_baton_t *b = baton;
svn_wc__db_status_t status;
@@ -6106,9 +6305,7 @@ op_delete_txn(void *baton,
svn_sqlite__stmt_t *stmt;
apr_int64_t select_depth; /* Depth of what is to be deleted */
svn_boolean_t refetch_depth = FALSE;
- svn_wc__db_kind_t kind;
-
- SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb, STMT_CREATE_DELETE_LIST));
+ svn_kind_t kind;
SVN_ERR(read_info(&status,
&kind, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -6163,13 +6360,12 @@ op_delete_txn(void *baton,
SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id,
moved_from_relpath, b->moved_to_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
- SVN_ERR(svn_sqlite__reset(stmt));
}
/* If a subtree is being moved-away, we need to update moved-to
* information in BASE for all children that were moved into this
* subtree. */
- if (kind == svn_wc__db_kind_dir)
+ if (kind == svn_kind_dir)
{
apr_pool_t *iterpool;
@@ -6228,7 +6424,6 @@ op_delete_txn(void *baton,
{
const char *child_subtree_relpath;
const char *new_moved_to_relpath;
- svn_sqlite__stmt_t *moved_to_stmt;
/* Compute the new moved-to path for this child... */
child_subtree_relpath =
@@ -6240,15 +6435,14 @@ op_delete_txn(void *baton,
svn_relpath_join(b->moved_to_relpath,
child_subtree_relpath, iterpool);
/* ... and update the BASE moved-to record. */
- SVN_ERR(svn_sqlite__get_statement(
- &moved_to_stmt, wcroot->sdb,
- STMT_UPDATE_MOVED_TO_RELPATH));
- SVN_ERR(svn_sqlite__bindf(moved_to_stmt, "iss",
- wcroot->wc_id,
- child_moved_from_relpath,
- new_moved_to_relpath));
- SVN_ERR(svn_sqlite__step(&have_row, moved_to_stmt));
- SVN_ERR(svn_sqlite__reset(moved_to_stmt));
+ err = delete_update_movedto(wcroot, child_moved_from_relpath,
+ new_moved_to_relpath,
+ scratch_pool);
+
+ if (err)
+ return svn_error_trace(svn_error_compose_create(
+ err,
+ svn_sqlite__reset(stmt)));
}
SVN_ERR(svn_sqlite__step(&have_row, stmt));
@@ -6278,6 +6472,33 @@ op_delete_txn(void *baton,
}
select_depth = relpath_depth(local_relpath);
+
+ /* When deleting a moved-here op-root, clear moved-to data at the
+ * pre-move location, transforming the move into a normal delete.
+ * This way, deleting the copied half of a move has the same effect
+ * as reverting it. */
+ if (status == svn_wc__db_status_added ||
+ status == svn_wc__db_status_moved_here)
+ {
+ const char *moved_from_relpath;
+ const char *moved_from_op_root_relpath;
+
+ SVN_ERR(scan_addition(&status, NULL, NULL, NULL, NULL, NULL, NULL,
+ &moved_from_relpath,
+ &moved_from_op_root_relpath,
+ wcroot, local_relpath,
+ scratch_pool, scratch_pool));
+ if (status == svn_wc__db_status_moved_here &&
+ moved_from_relpath && moved_from_op_root_relpath &&
+ strcmp(moved_from_relpath, moved_from_op_root_relpath) == 0)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_CLEAR_MOVED_TO_RELPATH));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id,
+ moved_from_op_root_relpath));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+ }
+ }
}
else
{
@@ -6324,13 +6545,6 @@ op_delete_txn(void *baton,
if (add_work)
{
/* Delete the node at LOCAL_RELPATH, and possibly mark it as moved. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_INSERT_DELETE_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isii",
- wcroot->wc_id, local_relpath,
- select_depth, b->delete_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
-
if (b->moved_to_relpath)
{
/* Record moved-to relpath in BASE. */
@@ -6342,7 +6556,7 @@ op_delete_txn(void *baton,
SVN_ERR(svn_sqlite__step_done(stmt));
}
- /* Delete children, if any. */
+ /* Delete the node and possible descendants. */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_INSERT_DELETE_FROM_NODE_RECURSIVE));
SVN_ERR(svn_sqlite__bindf(stmt, "isii",
@@ -6354,6 +6568,51 @@ op_delete_txn(void *baton,
return SVN_NO_ERROR;
}
+static svn_error_t *
+op_delete_txn(void *baton,
+ svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ apr_pool_t *scratch_pool)
+{
+
+ SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb, STMT_CREATE_DELETE_LIST));
+ SVN_ERR(delete_node(baton, wcroot, local_relpath, scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+
+struct op_delete_many_baton_t {
+ apr_array_header_t *rel_targets;
+} op_delete_many_baton_t;
+
+static svn_error_t *
+op_delete_many_txn(void *baton,
+ svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ apr_pool_t *scratch_pool)
+{
+ struct op_delete_many_baton_t *odmb = baton;
+ int i;
+ apr_pool_t *iterpool;
+
+ SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb, STMT_CREATE_DELETE_LIST));
+ iterpool = svn_pool_create(scratch_pool);
+ for (i = 0; i < odmb->rel_targets->nelts; i++)
+ {
+ const char *target_relpath = APR_ARRAY_IDX(odmb->rel_targets, i,
+ const char *);
+ struct op_delete_baton_t odb;
+
+ svn_pool_clear(iterpool);
+ odb.delete_depth = relpath_depth(target_relpath);
+ odb.moved_to_relpath = NULL;
+ SVN_ERR(delete_node(&odb, wcroot, target_relpath, iterpool));
+ }
+ svn_pool_destroy(iterpool);
+
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
do_delete_notify(void *baton,
@@ -6380,9 +6639,6 @@ do_delete_notify(void *baton,
svn_pool_clear(iterpool);
- if (cancel_func)
- SVN_ERR(cancel_func(cancel_baton));
-
notify_relpath = svn_sqlite__column_text(stmt, 0, NULL);
notify_abspath = svn_dirent_join(wcroot->abspath,
notify_relpath,
@@ -6398,7 +6654,15 @@ do_delete_notify(void *baton,
}
svn_pool_destroy(iterpool);
- return svn_error_trace(svn_sqlite__reset(stmt));
+ SVN_ERR(svn_sqlite__reset(stmt));
+
+ /* We only allow cancellation after notification for all deleted nodes
+ * has happened. The nodes are already deleted so we should notify for
+ * all of them. */
+ if (cancel_func)
+ SVN_ERR(cancel_func(cancel_baton));
+
+ return SVN_NO_ERROR;
}
@@ -6464,11 +6728,72 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
}
+svn_error_t *
+svn_wc__db_op_delete_many(svn_wc__db_t *db,
+ apr_array_header_t *targets,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_wcroot_t *wcroot;
+ const char *local_relpath;
+ struct op_delete_many_baton_t odmb;
+ int i;
+ apr_pool_t *iterpool;
+
+ odmb.rel_targets = apr_array_make(scratch_pool, targets->nelts,
+ sizeof(const char *));
+ iterpool = svn_pool_create(scratch_pool);
+ SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
+ db,
+ APR_ARRAY_IDX(targets, 0,
+ const char *),
+ scratch_pool, iterpool));
+ VERIFY_USABLE_WCROOT(wcroot);
+ for (i = 0; i < targets->nelts; i++)
+ {
+ const char *local_abspath = APR_ARRAY_IDX(targets, i, const char*);
+ svn_wc__db_wcroot_t *target_wcroot;
+
+ svn_pool_clear(iterpool);
+
+ SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&target_wcroot,
+ &local_relpath, db,
+ APR_ARRAY_IDX(targets, i,
+ const char *),
+ scratch_pool, iterpool));
+ VERIFY_USABLE_WCROOT(target_wcroot);
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+ /* Assert that all targets are within the same working copy. */
+ SVN_ERR_ASSERT(wcroot->wc_id == target_wcroot->wc_id);
+
+ APR_ARRAY_PUSH(odmb.rel_targets, const char *) = local_relpath;
+ SVN_ERR(flush_entries(target_wcroot, local_abspath, svn_depth_infinity,
+ iterpool));
+
+ }
+ svn_pool_destroy(iterpool);
+
+ /* Perform the deletion operation (transactionally), perform any
+ notifications necessary, and then clean out our temporary tables. */
+ return svn_error_trace(with_finalization(wcroot, wcroot->abspath,
+ op_delete_many_txn, &odmb,
+ do_delete_notify, NULL,
+ cancel_func, cancel_baton,
+ notify_func, notify_baton,
+ STMT_FINALIZE_DELETE,
+ scratch_pool));
+}
+
+
/* Like svn_wc__db_read_info(), but taking WCROOT+LOCAL_RELPATH instead of
DB+LOCAL_ABSPATH, and outputting repos ids instead of URL+UUID. */
static svn_error_t *
read_info(svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_revnum_t *revision,
const char **repos_relpath,
apr_int64_t *repos_id,
@@ -6527,7 +6852,7 @@ read_info(svn_wc__db_status_t *status,
if (have_info)
{
apr_int64_t op_depth;
- svn_wc__db_kind_t node_kind;
+ svn_kind_t node_kind;
op_depth = svn_sqlite__column_int64(stmt_info, 0);
node_kind = svn_sqlite__column_token(stmt_info, 4, kind_map);
@@ -6586,7 +6911,7 @@ read_info(svn_wc__db_status_t *status,
}
if (depth)
{
- if (node_kind != svn_wc__db_kind_dir)
+ if (node_kind != svn_kind_dir)
{
*depth = svn_depth_unknown;
}
@@ -6604,24 +6929,16 @@ read_info(svn_wc__db_status_t *status,
}
if (checksum)
{
- if (node_kind != svn_wc__db_kind_file)
+ if (node_kind != svn_kind_file)
{
*checksum = NULL;
}
else
{
- svn_error_t *err2;
- err2 = svn_sqlite__column_checksum(checksum, stmt_info, 6,
- result_pool);
- if (err2 != NULL)
- err = svn_error_compose_create(
- err,
- svn_error_createf(
- err->apr_err, err2,
- _("The node '%s' has a corrupt checksum value."),
- path_for_error_message(wcroot, local_relpath,
- scratch_pool)));
+ err = svn_error_compose_create(
+ err, svn_sqlite__column_checksum(checksum, stmt_info, 6,
+ result_pool));
}
}
if (recorded_size)
@@ -6630,7 +6947,7 @@ read_info(svn_wc__db_status_t *status,
}
if (target)
{
- if (node_kind != svn_wc__db_kind_symlink)
+ if (node_kind != svn_kind_symlink)
*target = NULL;
else
*target = svn_sqlite__column_text(stmt_info, 12, result_pool);
@@ -6687,7 +7004,7 @@ read_info(svn_wc__db_status_t *status,
if (op_depth != 0)
*lock = NULL;
else
- *lock = lock_from_columns(stmt_info, 15, 16, 17, 18, result_pool);
+ *lock = lock_from_columns(stmt_info, 16, 17, 18, 19, result_pool);
}
if (have_work)
@@ -6747,7 +7064,7 @@ read_info(svn_wc__db_status_t *status,
if (status)
*status = svn_wc__db_status_normal; /* What! No it's not! */
if (kind)
- *kind = svn_wc__db_kind_unknown;
+ *kind = svn_kind_unknown;
if (revision)
*revision = SVN_INVALID_REVNUM;
if (repos_relpath)
@@ -6804,6 +7121,12 @@ read_info(svn_wc__db_status_t *status,
if (stmt_act != NULL)
err = svn_error_compose_create(err, svn_sqlite__reset(stmt_act));
+ if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ err = svn_error_quick_wrap(err,
+ apr_psprintf(scratch_pool,
+ "Error reading node '%s'",
+ local_relpath));
+
SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt_info)));
return SVN_NO_ERROR;
@@ -6812,7 +7135,7 @@ read_info(svn_wc__db_status_t *status,
svn_error_t *
svn_wc__db_read_info(svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_revnum_t *revision,
const char **repos_relpath,
const char **repos_root_url,
@@ -6883,7 +7206,8 @@ struct read_children_info_baton_t
apr_pool_t *result_pool;
};
-/* What we really want to store about a node */
+/* What we really want to store about a node. This relies on the
+ offset of svn_wc__db_info_t being zero. */
struct read_children_info_item_t
{
struct svn_wc__db_info_t info;
@@ -6945,6 +7269,8 @@ read_children_info(void *baton,
child->status = svn_sqlite__column_token(stmt, 3, presence_map);
if (op_depth != 0)
{
+ if (child->status == svn_wc__db_status_incomplete)
+ child->incomplete = TRUE;
err = convert_to_working_status(&child->status, child->status);
if (err)
SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
@@ -6993,7 +7319,7 @@ read_children_info(void *baton,
child->changed_author = svn_sqlite__column_text(stmt, 10,
result_pool);
- if (child->kind != svn_wc__db_kind_dir)
+ if (child->kind != svn_kind_dir)
child->depth = svn_depth_unknown;
else
{
@@ -7038,23 +7364,34 @@ read_children_info(void *baton,
if (op_depth == 0)
{
+ const char *moved_to_relpath;
+
child_item->info.have_base = TRUE;
- /* Get the lock info. The query only reports lock info in the row at
- * op_depth 0. */
- if (op_depth == 0)
- child_item->info.lock = lock_from_columns(stmt, 15, 16, 17, 18,
- result_pool);
+ /* Get the lock info, available only at op_depth 0. */
+ child_item->info.lock = lock_from_columns(stmt, 15, 16, 17, 18,
+ result_pool);
+
+ /* Moved-to is only stored at op_depth 0. */
+ 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);
+
+ /* FILE_EXTERNAL flag only on op_depth 0. */
+ child_item->info.file_external = svn_sqlite__column_boolean(stmt,
+ 22);
}
else
{
child_item->nr_layers++;
child_item->info.have_more_work = (child_item->nr_layers > 1);
+
+ /* Moved-here can only exist at op_depth > 0. */
+ child_item->info.moved_here = svn_sqlite__column_boolean(stmt, 20);
}
- err = svn_sqlite__step(&have_row, stmt);
- if (err)
- SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
SVN_ERR(svn_sqlite__reset(stmt));
@@ -7108,9 +7445,7 @@ read_children_info(void *baton,
apr_hash_set(conflicts, apr_pstrdup(result_pool, name),
APR_HASH_KEY_STRING, "");
- err = svn_sqlite__step(&have_row, stmt);
- if (err)
- SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
SVN_ERR(svn_sqlite__reset(stmt));
@@ -7151,7 +7486,7 @@ svn_wc__db_read_children_info(apr_hash_t
svn_error_t *
svn_wc__db_read_pristine_info(svn_wc__db_status_t *status,
- svn_wc__db_kind_t *kind,
+ svn_kind_t *kind,
svn_revnum_t *changed_rev,
apr_time_t *changed_date,
const char **changed_author,
@@ -7171,7 +7506,7 @@ svn_wc__db_read_pristine_info(svn_wc__db
svn_error_t *err = NULL;
apr_int64_t op_depth;
svn_wc__db_status_t raw_status;
- svn_wc__db_kind_t node_kind;
+ svn_kind_t node_kind;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -7241,7 +7576,7 @@ svn_wc__db_read_pristine_info(svn_wc__db
}
if (depth)
{
- if (node_kind != svn_wc__db_kind_dir)
+ if (node_kind != svn_kind_dir)
{
*depth = svn_depth_unknown;
}
@@ -7259,7 +7594,7 @@ svn_wc__db_read_pristine_info(svn_wc__db
}
if (checksum)
{
- if (node_kind != svn_wc__db_kind_file)
+ if (node_kind != svn_kind_file)
{
*checksum = NULL;
}
@@ -7285,7 +7620,7 @@ svn_wc__db_read_pristine_info(svn_wc__db
}
if (target)
{
- if (node_kind != svn_wc__db_kind_symlink)
+ if (node_kind != svn_kind_symlink)
*target = NULL;
else
*target = svn_sqlite__column_text(stmt, 12, result_pool);
@@ -7311,7 +7646,6 @@ svn_wc__db_read_children_walker_info(apr
const char *dir_relpath;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
- apr_int64_t op_depth;
SVN_ERR_ASSERT(svn_dirent_is_absolute(dir_abspath));
@@ -7331,13 +7665,10 @@ svn_wc__db_read_children_walker_info(apr
struct svn_wc__db_walker_info_t *child;
const char *child_relpath = svn_sqlite__column_text(stmt, 0, NULL);
const char *name = svn_relpath_basename(child_relpath, NULL);
+ apr_int64_t op_depth = svn_sqlite__column_int(stmt, 1);
svn_error_t *err;
- child = apr_hash_get(*nodes, name, APR_HASH_KEY_STRING);
- if (child == NULL)
- child = apr_palloc(result_pool, sizeof(*child));
-
- op_depth = svn_sqlite__column_int(stmt, 1);
+ child = apr_palloc(result_pool, sizeof(*child));
child->status = svn_sqlite__column_token(stmt, 2, presence_map);
if (op_depth > 0)
{
@@ -7349,9 +7680,7 @@ svn_wc__db_read_children_walker_info(apr
apr_hash_set(*nodes, apr_pstrdup(result_pool, name),
APR_HASH_KEY_STRING, child);
- err = svn_sqlite__step(&have_row, stmt);
- if (err)
- SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
SVN_ERR(svn_sqlite__reset(stmt));
@@ -8405,12 +8734,13 @@ commit_node(void *baton,
const char *changelist = NULL;
const char *parent_relpath;
svn_wc__db_status_t new_presence;
- svn_wc__db_kind_t new_kind;
+ svn_kind_t new_kind;
const char *new_depth_str = NULL;
svn_sqlite__stmt_t *stmt;
apr_int64_t repos_id;
const char *repos_relpath;
apr_int64_t op_depth;
+ svn_wc__db_status_t old_presence;
/* If we are adding a file or directory, then we need to get
repository information from the parent node since "this node" does
@@ -8443,7 +8773,7 @@ commit_node(void *baton,
new_kind = svn_sqlite__column_token(stmt_info, 4, kind_map);
/* What will the new depth be? */
- if (new_kind == svn_wc__db_kind_dir)
+ if (new_kind == svn_kind_dir)
new_depth_str = svn_sqlite__column_text(stmt_info, 11, scratch_pool);
/* Check that the repository information is not being changed. */
@@ -8473,6 +8803,8 @@ commit_node(void *baton,
if (cb->keep_changelist && have_act)
changelist = svn_sqlite__column_text(stmt_act, 1, scratch_pool);
+ old_presence = svn_sqlite__column_token(stmt_info, 3, presence_map);
+
/* ### other stuff? */
SVN_ERR(svn_sqlite__reset(stmt_info));
@@ -8528,8 +8860,10 @@ commit_node(void *baton,
else
parent_relpath = svn_relpath_dirname(local_relpath, scratch_pool);
- /* ### other presences? or reserve that for separate functions? */
- new_presence = svn_wc__db_status_normal;
+ /* Preserve any incomplete status */
+ new_presence = (old_presence == svn_wc__db_status_incomplete
+ ? svn_wc__db_status_incomplete
+ : svn_wc__db_status_normal);
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_APPLY_CHANGES_TO_BASE_NODE));
@@ -8581,7 +8915,7 @@ commit_node(void *baton,
}
}
- if (new_kind == svn_wc__db_kind_dir)
+ if (new_kind == svn_kind_dir)
{
/* When committing a directory, we should have its new children. */
/* ### one day. just not today. */
@@ -8678,7 +9012,7 @@ struct update_baton_t {
svn_error_t *
svn_wc__db_global_update(svn_wc__db_t *db,
const char *local_abspath,
- svn_wc__db_kind_t new_kind,
+ svn_kind_t new_kind,
const char *new_repos_relpath,
svn_revnum_t new_revision,
const apr_hash_t *new_props,
@@ -8815,7 +9149,7 @@ bump_node_revision(svn_wc__db_wcroot_t *
const apr_array_header_t *children;
int i;
svn_wc__db_status_t status;
- svn_wc__db_kind_t db_kind;
+ svn_kind_t db_kind;
svn_revnum_t revision;
const char *repos_relpath;
apr_int64_t repos_id;
@@ -8835,11 +9169,11 @@ bump_node_revision(svn_wc__db_wcroot_t *
/* Skip file externals */
if (update_root
- && db_kind == svn_wc__db_kind_file
+ && db_kind == svn_kind_file
&& !is_root)
return SVN_NO_ERROR;
- if (skip_when_dir && db_kind == svn_wc__db_kind_dir)
+ if (skip_when_dir && db_kind == svn_kind_dir)
return SVN_NO_ERROR;
/* If the node is still marked 'not-present', then the server did not
@@ -8871,7 +9205,7 @@ bump_node_revision(svn_wc__db_wcroot_t *
/* Early out */
if (depth <= svn_depth_empty
- || db_kind != svn_wc__db_kind_dir
+ || db_kind != svn_kind_dir
|| status == svn_wc__db_status_server_excluded
|| status == svn_wc__db_status_excluded
|| status == svn_wc__db_status_not_present)
@@ -8936,7 +9270,7 @@ bump_revisions_post_update(void *baton,
{
struct bump_revisions_baton_t *brb = baton;
svn_wc__db_status_t status;
- svn_wc__db_kind_t kind;
+ svn_kind_t kind;
svn_error_t *err;
apr_int64_t new_repos_id = INVALID_REPOS_ID;
@@ -9331,7 +9665,9 @@ scan_addition_txn(void *baton,
presence = svn_sqlite__column_token(stmt, 1, presence_map);
/* The starting node should exist normally. */
- if (presence != svn_wc__db_status_normal)
+ op_depth = svn_sqlite__column_int64(stmt, 0);
+ if (op_depth == 0 || (presence != svn_wc__db_status_normal
+ && presence != svn_wc__db_status_incomplete))
/* reset the statement as part of the error generation process */
return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS,
svn_sqlite__reset(stmt),
@@ -9345,11 +9681,15 @@ scan_addition_txn(void *baton,
/* Provide the default status; we'll override as appropriate. */
if (sab->status)
- *sab->status = svn_wc__db_status_added;
+ {
+ if (presence == svn_wc__db_status_normal)
+ *sab->status = svn_wc__db_status_added;
+ else
+ *sab->status = svn_wc__db_status_incomplete;
+ }
/* Calculate the op root local path components */
- op_depth = svn_sqlite__column_int64(stmt, 0);
op_root_relpath = local_relpath;
for (i = (int)relpath_depth(local_relpath); i > op_depth; --i)
@@ -9503,6 +9843,7 @@ scan_addition_txn(void *baton,
{
SVN_ERR_ASSERT(*sab->status == svn_wc__db_status_added
|| *sab->status == svn_wc__db_status_copied
+ || *sab->status == svn_wc__db_status_incomplete
|| *sab->status == svn_wc__db_status_moved_here);
if (*sab->status == svn_wc__db_status_added)
{
@@ -9669,6 +10010,7 @@ scan_deletion_txn(void *baton,
svn_wc__db_status_t child_presence;
svn_boolean_t child_has_base = FALSE;
apr_int64_t local_op_depth, op_depth;
+ svn_boolean_t found_moved_to = FALSE;
/* Initialize all the OUT parameters. */
if (sd_baton->base_del_relpath != NULL)
@@ -9755,8 +10097,8 @@ scan_deletion_txn(void *baton,
local_relpath,
scratch_pool));
- /* ### incomplete not handled */
SVN_ERR_ASSERT(work_presence == svn_wc__db_status_normal
+ || work_presence == svn_wc__db_status_incomplete
|| work_presence == svn_wc__db_status_not_present
|| work_presence == svn_wc__db_status_base_deleted);
@@ -9784,7 +10126,7 @@ scan_deletion_txn(void *baton,
|| base_presence == svn_wc__db_status_incomplete
);
-#if 1
+#if 0
/* ### see above comment */
if (base_presence == svn_wc__db_status_incomplete)
base_presence = svn_wc__db_status_normal;
@@ -9795,9 +10137,12 @@ scan_deletion_txn(void *baton,
gimmick, not a real node that may have been deleted. */
}
- if ((sd_baton->moved_to_relpath != NULL
- || sd_baton->moved_to_op_root_relpath != NULL
- || sd_baton->base_del_relpath != NULL)
+ /* Evaluate moved-to information. Once moved-to info has been found, it
+ * must not be overwritten with ancestors' moved-to info. */
+ if ((! found_moved_to)
+ && (sd_baton->moved_to_relpath != NULL
+ || sd_baton->moved_to_op_root_relpath != NULL
+ || sd_baton->base_del_relpath != NULL)
&& !svn_sqlite__column_is_null(stmt, 2 /* moved_to */))
{
const char *moved_to_op_root_relpath;
@@ -9854,6 +10199,8 @@ scan_deletion_txn(void *baton,
svn_error_clear(err);
moved_to_relpath = NULL;
moved_to_op_root_relpath = NULL;
+ if (sd_baton->moved_to_relpath)
+ *sd_baton->moved_to_relpath = NULL;
found_child = FALSE;
}
else
@@ -9888,6 +10235,13 @@ scan_deletion_txn(void *baton,
*sd_baton->moved_to_op_root_relpath = moved_to_op_root_relpath ?
apr_pstrdup(sd_baton->result_pool, moved_to_op_root_relpath)
: NULL;
+
+ /* If all other out parameters are irrelevant, stop scanning.
+ * Happens to be only WORK_DEL_RELPATH. */
+ if (sd_baton->work_del_relpath == NULL)
+ break;
+
+ found_moved_to = TRUE;
}
op_depth = svn_sqlite__column_int64(stmt, 3);
@@ -10011,16 +10365,30 @@ svn_error_t *
svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
apr_int64_t *repos_id,
apr_int64_t *wc_id,
+ svn_wc__db_t *wc_db,
const char *dir_abspath,
const char *repos_root_url,
const char *repos_uuid,
- apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- return svn_error_trace(create_db(sdb, repos_id, wc_id, dir_abspath,
- repos_root_url, repos_uuid,
- SDB_FILE,
- result_pool, scratch_pool));
+ svn_wc__db_wcroot_t *wcroot;
+ SVN_ERR(create_db(sdb, repos_id, wc_id, dir_abspath,
+ repos_root_url, repos_uuid,
+ SDB_FILE,
+ wc_db->state_pool, scratch_pool));
+
+ SVN_ERR(svn_wc__db_pdh_create_wcroot(&wcroot,
+ apr_pstrdup(wc_db->state_pool,
+ dir_abspath),
+ *sdb, *wc_id, FORMAT_FROM_SDB,
+ FALSE /* auto-upgrade */,
+ FALSE /* enforce_empty_wq */,
+ wc_db->state_pool, scratch_pool));
+
+ /* The WCROOT is complete. Stash it into DB. */
+ apr_hash_set(wc_db->dir_data, wcroot->abspath, APR_HASH_KEY_STRING, wcroot);
+
+ return SVN_NO_ERROR;
}
@@ -10081,7 +10449,6 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
apr_int64_t below_op_depth = -1;
svn_wc__db_status_t top_presence;
svn_wc__db_status_t below_presence;
- svn_wc__db_kind_t kind = svn_wc__db_kind_unknown;
int affected_rows;
/* ### working_props: use set_props_txn.
@@ -10118,7 +10485,6 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
{
top_op_depth = svn_sqlite__column_int64(stmt, 0);
top_presence = svn_sqlite__column_token(stmt, 3, presence_map);
- kind = svn_sqlite__column_token(stmt, 4, kind_map);
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (have_row)
{
@@ -10207,56 +10573,83 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
sdb, scratch_pool));
}
- if (kind == svn_wc__db_kind_dir)
- {
- const char *externals;
- apr_hash_t *props = working_props;
-
- if (props == NULL)
- props = base_props;
+ return SVN_NO_ERROR;
+}
- externals = svn_prop_get_value(props, SVN_PROP_EXTERNALS);
+svn_error_t *
+svn_wc__db_upgrade_insert_external(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_kind_t kind,
+ const char *parent_abspath,
+ const char *def_local_abspath,
+ const char *repos_relpath,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t def_peg_revision,
+ svn_revnum_t def_revision,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_wcroot_t *wcroot;
+ const char *def_local_relpath;
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t have_row;
+ apr_int64_t repos_id;
- if (externals != NULL)
- {
- int i;
- apr_array_header_t *ext;
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_EXTERNAL));
+ /* We know only of DEF_LOCAL_ABSPATH that it definitely belongs to "this"
+ * WC, i.e. where the svn:externals prop is set. The external target path
+ * itself may be "hidden behind" other working copies. */
+ SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &def_local_relpath,
+ db, def_local_abspath,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_WCROOT(wcroot);
- SVN_ERR(svn_wc_parse_externals_description3(
- &ext, svn_dirent_join(dir_abspath, local_relpath,
- scratch_pool),
- externals, FALSE, scratch_pool));
- for (i = 0; i < ext->nelts; i++)
- {
- const svn_wc_external_item2_t *item;
- const char *item_relpath;
- item = APR_ARRAY_IDX(ext, i, const svn_wc_external_item2_t *);
- item_relpath = svn_relpath_join(local_relpath, item->target_dir,
- scratch_pool);
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_REPOSITORY));
+ SVN_ERR(svn_sqlite__bindf(stmt, "s", repos_root_url));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
- SVN_ERR(svn_sqlite__bindf(stmt, "isssssis",
- wc_id,
- item_relpath,
- svn_relpath_dirname(item_relpath,
- scratch_pool),
- "normal",
- "unknown",
- local_relpath,
- (apr_int64_t)1, /* repos_id */
- "" /* repos_relpath */));
+ if (have_row)
+ repos_id = svn_sqlite__column_int64(stmt, 0);
+ SVN_ERR(svn_sqlite__reset(stmt));
- SVN_ERR(svn_sqlite__insert(NULL, stmt));
- }
- }
+ if (!have_row)
+ {
+ /* Need to set up a new repository row. */
+ SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
+ wcroot->sdb, scratch_pool));
}
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_INSERT_EXTERNAL));
+
+ /* wc_id, local_relpath, parent_relpath, presence, kind, def_local_relpath,
+ * repos_id, def_repos_relpath, def_operational_revision, def_revision */
+ SVN_ERR(svn_sqlite__bindf(stmt, "issstsis",
+ wcroot->wc_id,
+ svn_dirent_skip_ancestor(wcroot->abspath,
+ local_abspath),
+ svn_dirent_skip_ancestor(wcroot->abspath,
+ parent_abspath),
+ "normal",
+ kind_map, kind,
+ def_local_relpath,
+ repos_id,
+ repos_relpath));
+
+ if (SVN_IS_VALID_REVNUM(def_peg_revision))
+ SVN_ERR(svn_sqlite__bind_revnum(stmt, 9, def_peg_revision));
+
+ if (SVN_IS_VALID_REVNUM(def_revision))
+ SVN_ERR(svn_sqlite__bind_revnum(stmt, 10, def_revision));
+
+ SVN_ERR(svn_sqlite__insert(NULL, stmt));
+
return SVN_NO_ERROR;
}
-
svn_error_t *
svn_wc__db_upgrade_get_repos_id(apr_int64_t *repos_id,
svn_sqlite__db_t *sdb,
@@ -10795,7 +11188,7 @@ svn_wc__db_read_conflicts(const apr_arra
svn_error_t *
-svn_wc__db_read_kind(svn_wc__db_kind_t *kind,
+svn_wc__db_read_kind(svn_kind_t *kind,
svn_wc__db_t *db,
const char *local_abspath,
svn_boolean_t allow_missing,
@@ -10821,7 +11214,7 @@ svn_wc__db_read_kind(svn_wc__db_kind_t *
{
if (allow_missing)
{
- *kind = svn_wc__db_kind_unknown;
+ *kind = svn_kind_unknown;
SVN_ERR(svn_sqlite__reset(stmt_info));
return SVN_NO_ERROR;
}
@@ -11148,7 +11541,7 @@ svn_wc__db_wclock_obtain(svn_wc__db_t *d
svn_wc__db_wclock_t* lock = &APR_ARRAY_IDX(wcroot->owned_locks,
i, svn_wc__db_wclock_t);
- if (svn_relpath__is_ancestor(lock->local_relpath, local_relpath)
+ if (svn_relpath_skip_ancestor(lock->local_relpath, local_relpath)
&& (lock->levels == -1
|| (lock->levels + relpath_depth(lock->local_relpath))
>= depth))
@@ -11213,7 +11606,7 @@ is_wclocked(void *baton,
{
const char *relpath = svn_sqlite__column_text(stmt, 0, NULL);
- if (svn_relpath__is_ancestor(relpath, dir_relpath))
+ if (svn_relpath_skip_ancestor(relpath, dir_relpath))
{
/* Any row here means there can be no locks closer to root
that extend past here. */
@@ -11348,7 +11741,7 @@ wclock_owns_lock(svn_boolean_t *own_lock
svn_wc__db_wclock_t *lock = &APR_ARRAY_IDX(owned_locks, i,
svn_wc__db_wclock_t);
- if (svn_relpath__is_ancestor(lock->local_relpath, local_relpath)
+ if (svn_relpath_skip_ancestor(lock->local_relpath, local_relpath)
&& (lock->levels == -1
|| ((relpath_depth(lock->local_relpath) + lock->levels)
>= lock_level)))
@@ -11404,6 +11797,9 @@ end_directory_update(void *baton,
NULL, NULL, NULL, NULL, NULL, NULL,
wcroot, local_relpath, scratch_pool, scratch_pool));
+ if (base_status == svn_wc__db_status_normal)
+ return SVN_NO_ERROR;
+
SVN_ERR_ASSERT(base_status == svn_wc__db_status_incomplete);
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -11875,7 +12271,7 @@ svn_wc__db_temp_op_set_new_dir_to_incomp
ibb.repos_uuid = repos_uuid;
ibb.status = svn_wc__db_status_incomplete;
- ibb.kind = svn_wc__db_kind_dir;
+ ibb.kind = svn_kind_dir;
ibb.repos_relpath = repos_relpath;
ibb.revision = revision;
ibb.depth = depth;
@@ -11950,8 +12346,8 @@ svn_wc__db_get_not_present_descendants(c
const char *found_relpath = svn_sqlite__column_text(stmt, 0, NULL);
APR_ARRAY_PUSH(paths, const char *)
- = svn_relpath__is_child(local_relpath, found_relpath,
- result_pool);
+ = apr_pstrdup(result_pool, svn_relpath_skip_ancestor(
+ local_relpath, found_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
@@ -12616,7 +13012,7 @@ verify_wcroot(svn_wc__db_wcroot_t *wcroo
/* Verify parent_relpath refers to a row that exists */
/* TODO: Verify there is a suitable parent row - e.g. has op_depth <=
* the child's and a suitable presence */
- if (parent_relpath)
+ if (parent_relpath && svn_sqlite__column_is_null(stmt, 3))
{
svn_sqlite__stmt_t *stmt2;
svn_boolean_t have_a_parent_row;