Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/upgrade.c URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/upgrade.c?rev=1231318&r1=1231317&r2=1231318&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/libsvn_wc/upgrade.c (original) +++ subversion/branches/revprop-packing/subversion/libsvn_wc/upgrade.c Fri Jan 13 21:40:26 2012 @@ -614,8 +614,7 @@ ensure_repos_info(svn_wc_entry_t *entry, for (hi = apr_hash_first(scratch_pool, repos_cache); hi; hi = apr_hash_next(hi)) { - if (svn_uri__is_child(svn__apr_hash_index_key(hi), entry->url, - scratch_pool)) + if (svn_uri__is_ancestor(svn__apr_hash_index_key(hi), entry->url)) { if (!entry->repos) entry->repos = svn__apr_hash_index_key(hi); @@ -1404,6 +1403,7 @@ upgrade_to_wcng(void **dir_baton, svn_wc_entry_t *this_dir; const char *old_wcroot_abspath, *dir_relpath; apr_hash_t *text_bases_info; + svn_error_t *err; /* Don't try to mess with the WC if there are old log files left. */ @@ -1475,11 +1475,18 @@ upgrade_to_wcng(void **dir_baton, data->sdb, scratch_pool, scratch_pool)); /***** ENTRIES - WRITE *****/ - SVN_ERR(svn_wc__write_upgraded_entries(dir_baton, parent_baton, db, data->sdb, - data->repos_id, data->wc_id, - dir_abspath, data->root_abspath, - entries, text_bases_info, - result_pool, scratch_pool)); + err = svn_wc__write_upgraded_entries(dir_baton, parent_baton, db, data->sdb, + data->repos_id, data->wc_id, + dir_abspath, data->root_abspath, + entries, text_bases_info, + result_pool, scratch_pool); + if (err && err->apr_err == SVN_ERR_WC_CORRUPT) + return svn_error_quick_wrap(err, + _("This working copy is corrupt and " + "cannot be upgraded. Please check out " + "a new working copy.")); + else + SVN_ERR(err); /***** WC PROPS *****/ /* If we don't know precisely where the wcprops are, ignore them. */ @@ -1985,3 +1992,44 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx, return SVN_NO_ERROR; } +svn_error_t * +svn_wc__upgrade_add_external_info(svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_node_kind_t kind, + 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_kind_t db_kind; + switch (kind) + { + case svn_node_dir: + db_kind = svn_kind_dir; + break; + + case svn_node_file: + db_kind = svn_kind_file; + break; + + case svn_node_unknown: + db_kind = svn_kind_unknown; + break; + + default: + SVN_ERR_MALFUNCTION(); + } + + SVN_ERR(svn_wc__db_upgrade_insert_external(wc_ctx->db, local_abspath, + db_kind, + svn_dirent_dirname(local_abspath, + scratch_pool), + def_local_abspath, repos_relpath, + repos_root_url, repos_uuid, + def_peg_revision, def_revision, + scratch_pool)); + return SVN_NO_ERROR; +}
Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/util.c URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/util.c?rev=1231318&r1=1231317&r2=1231318&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/libsvn_wc/util.c (original) +++ subversion/branches/revprop-packing/subversion/libsvn_wc/util.c Fri Jan 13 21:40:26 2012 @@ -150,8 +150,8 @@ svn_wc_dup_notify(const svn_wc_notify_t } svn_error_t * -svn_wc_external_item_create(const svn_wc_external_item2_t **item, - apr_pool_t *pool) +svn_wc_external_item2_create(svn_wc_external_item2_t **item, + apr_pool_t *pool) { *item = apr_pcalloc(pool, sizeof(svn_wc_external_item2_t)); return SVN_NO_ERROR; @@ -533,3 +533,104 @@ svn_wc__status2_from_3(svn_wc_status2_t return SVN_NO_ERROR; } + + +svn_error_t * +svn_wc__fetch_kind_func(svn_kind_t *kind, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *scratch_pool) +{ + struct svn_wc__shim_fetch_baton_t *sfb = baton; + const char *local_abspath = svn_dirent_join(sfb->base_abspath, path, + scratch_pool); + + SVN_ERR(svn_wc__db_read_kind(kind, sfb->db, local_abspath, FALSE, + scratch_pool)); + + return SVN_NO_ERROR; +} + + +svn_error_t * +svn_wc__fetch_props_func(apr_hash_t **props, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + struct svn_wc__shim_fetch_baton_t *sfb = baton; + const char *local_abspath = svn_dirent_join(sfb->base_abspath, path, + scratch_pool); + svn_error_t *err; + + if (sfb->fetch_base) + err = svn_wc__db_base_get_props(props, sfb->db, local_abspath, result_pool, + scratch_pool); + else + err = svn_wc__db_read_props(props, sfb->db, local_abspath, + result_pool, scratch_pool); + + /* If the path doesn't exist, just return an empty set of props. */ + if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND) + { + svn_error_clear(err); + *props = apr_hash_make(result_pool); + } + else if (err) + return svn_error_trace(err); + + return SVN_NO_ERROR; +} + + +svn_error_t * +svn_wc__fetch_base_func(const char **filename, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + struct svn_wc__shim_fetch_baton_t *sfb = baton; + svn_stream_t *contents; + svn_stream_t *file_stream; + const char *tmp_filename; + const svn_checksum_t *checksum; + svn_error_t *err; + const char *local_abspath = svn_dirent_join(sfb->base_abspath, path, + scratch_pool); + + err = svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, &checksum, + NULL, NULL, NULL, NULL, sfb->db, + local_abspath, scratch_pool, scratch_pool); + if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND) + { + svn_error_clear(err); + *filename = NULL; + return SVN_NO_ERROR; + } + else if (err) + return svn_error_trace(err); + + if (checksum == NULL) + { + *filename = NULL; + return SVN_NO_ERROR; + } + + SVN_ERR(svn_wc__db_pristine_read(&contents, NULL, sfb->db, local_abspath, + checksum, scratch_pool, scratch_pool)); + + SVN_ERR(svn_stream_open_unique(&file_stream, &tmp_filename, NULL, + svn_io_file_del_on_pool_cleanup, + scratch_pool, scratch_pool)); + SVN_ERR(svn_stream_copy3(contents, file_stream, NULL, NULL, scratch_pool)); + + *filename = apr_pstrdup(result_pool, tmp_filename); + + return SVN_NO_ERROR; +} Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/wc-metadata.sql URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/wc-metadata.sql?rev=1231318&r1=1231317&r2=1231318&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/libsvn_wc/wc-metadata.sql (original) +++ subversion/branches/revprop-packing/subversion/libsvn_wc/wc-metadata.sql Fri Jan 13 21:40:26 2012 @@ -23,12 +23,11 @@ /* * the KIND column in these tables has one of the following values - * (documented in the corresponding C type #svn_wc__db_kind_t): + * (documented in the corresponding C type #svn_kind_t): * "file" * "dir" * "symlink" * "unknown" - * "subdir" * * the PRESENCE column in these tables has one of the following values * (see also the C type #svn_wc__db_status_t): @@ -384,8 +383,9 @@ CREATE TABLE NODES ( perhaps add a column called "moved_from". */ /* Boolean value, specifying if this node was moved here (rather than just - copied). The source of the move is implied by a different node with - a moved_to column pointing at this node. */ + copied). This is set on all the nodes in the moved tree. The source of + the move is implied by a different node with a moved_to column pointing + at the root node of the moved tree. */ moved_here INTEGER, /* If the underlying node was moved away (rather than just deleted), this @@ -540,7 +540,7 @@ CREATE TABLE EXTERNALS ( local_relpath TEXT NOT NULL, /* The working copy root can't be recorded as an external in itself - so this will never be NULL. */ + so this will never be NULL. ### ATM only inserted, never queried */ parent_relpath TEXT NOT NULL, /* Repository location fields */ @@ -767,6 +767,12 @@ PRAGMA user_version = 29; /* TODO: Rename the "absent" presence value to "server-excluded" before the 1.7 release. wc_db.c and this file have references to "absent" which still need to be changed to "server-excluded". */ +/* TODO: Un-confuse *_revision column names in the EXTERNALS table to + "-r<operative> foo@<peg>", as suggested by the patch attached to + http://svn.haxx.se/dev/archive-2011-09/0478.shtml */ +/* TODO: Remove column parent_relpath from EXTERNALS. We're not using it and + never will. It's not interesting like in the NODES table: the external's + parent path may be *anything*: unversioned, "behind" a another WC... */ /* Now "drop" the tree_conflict_data column from actual_node. */ CREATE TABLE ACTUAL_NODE_BACKUP ( Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/wc-queries.sql URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/wc-queries.sql?rev=1231318&r1=1231317&r2=1231318&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/libsvn_wc/wc-queries.sql (original) +++ subversion/branches/revprop-packing/subversion/libsvn_wc/wc-queries.sql Fri Jan 13 21:40:26 2012 @@ -127,20 +127,17 @@ WHERE wc_id = ?1 AND local_relpath = ?2 SELECT op_depth, nodes.repos_id, nodes.repos_path, presence, kind, revision, checksum, translated_size, changed_revision, changed_date, changed_author, depth, symlink_target, last_mod_time, properties, lock_token, lock_owner, - lock_comment, lock_date, local_relpath, moved_here, moved_to + lock_comment, lock_date, local_relpath, moved_here, moved_to, + file_external IS NOT NULL FROM nodes LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id AND nodes.repos_path = lock.repos_relpath WHERE wc_id = ?1 AND parent_relpath = ?2 -- STMT_SELECT_NODE_CHILDREN_WALKER_INFO -/* ### See comment at STMT_SELECT_NODE_CHILDREN_INFO. - ### Should C code handle GROUP BY local_relpath ORDER BY op_depths DESC? */ SELECT local_relpath, op_depth, presence, kind -FROM nodes +FROM nodes_current WHERE wc_id = ?1 AND parent_relpath = ?2 -GROUP BY local_relpath -ORDER BY op_depth DESC -- STMT_SELECT_ACTUAL_CHILDREN_INFO SELECT prop_reject, changelist, conflict_old, conflict_new, @@ -173,6 +170,7 @@ VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, -- STMT_SELECT_OP_DEPTH_CHILDREN SELECT local_relpath FROM nodes WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = ?3 + AND (?3 != 0 OR file_external is NULL) -- STMT_SELECT_GE_OP_DEPTH_CHILDREN SELECT 1 FROM nodes @@ -794,14 +792,19 @@ WHERE wc_id = ?1 -- STMT_APPLY_CHANGES_TO_BASE_NODE /* translated_size and last_mod_time are not mentioned here because they will - be tweaked after the working-file is installed. - ### what to do about file_external? */ + be tweaked after the working-file is installed. When we replace an existing + BASE node (read: bump), preserve its file_external status. */ INSERT OR REPLACE INTO nodes ( wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, revision, presence, depth, kind, changed_revision, changed_date, - changed_author, checksum, properties, dav_cache, symlink_target ) + changed_author, checksum, properties, dav_cache, symlink_target, + file_external ) VALUES (?1, ?2, 0, - ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16) + ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, + (SELECT file_external FROM nodes + WHERE wc_id = ?1 + AND local_relpath = ?2 + AND op_depth = 0)) -- STMT_INSTALL_WORKING_NODE_FOR_DELETE INSERT OR REPLACE INTO nodes ( @@ -949,13 +952,43 @@ VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, -- STMT_SELECT_EXTERNAL_INFO SELECT presence, kind, def_local_relpath, repos_id, - def_repos_relpath, def_operational_revision, def_revision, presence + def_repos_relpath, def_operational_revision, def_revision FROM externals WHERE wc_id = ?1 AND local_relpath = ?2 LIMIT 1 --- STMT_SELECT_EXTERNAL_CHILDREN -SELECT local_relpath -FROM externals WHERE wc_id = ?1 AND parent_relpath = ?2 +/* Select all committable externals, i.e. only unpegged ones on the same + * repository as the target path ?2, that are defined by WC ?1 to + * live below the target path. It does not matter which ancestor has the + * svn:externals definition, only the local path at which the external is + * supposed to be checked out is queried. + * Arguments: + * ?1: wc_id. + * ?2: the target path, local relpath inside ?1. + * ?3: boolean, if 1 return immediate children of ?2 only. + * + * ### NOTE: This statement deliberately removes file externals that live + * inside an unversioned dir, because commit still breaks on those. + * Once that's been fixed, the conditions below "--->8---" become obsolete. */ +-- STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW +SELECT local_relpath, kind, repos_id, def_repos_relpath, repository.root +FROM externals +LEFT OUTER JOIN repository ON repository.id = externals.repos_id +WHERE wc_id = ?1 + AND def_revision IS NULL + AND repos_id = (SELECT repos_id FROM nodes + WHERE nodes.local_relpath = ?2) + AND ( ((NOT ?3) + AND (?2 = '' + /* Want only the cildren of e.local_relpath; + * externals can't have a local_relpath = ''. */ + OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))) + OR + ((?3) + AND parent_relpath = ?2) ) + /* ------>8----- */ + AND (EXISTS (SELECT 1 FROM nodes + WHERE nodes.wc_id = externals.wc_id + AND nodes.local_relpath = externals.parent_relpath)) -- STMT_SELECT_EXTERNALS_DEFINED SELECT local_relpath, def_local_relpath @@ -1194,21 +1227,18 @@ DROP TABLE IF EXISTS delete_list; CREATE TEMPORARY TABLE delete_list ( /* ### we should put the wc_id in here in case a delete spans multiple ### working copies. queries, etc will need to be adjusted. */ - local_relpath TEXT PRIMARY KEY NOT NULL + local_relpath TEXT PRIMARY KEY NOT NULL UNIQUE ) /* This matches the selection in STMT_INSERT_DELETE_FROM_NODE_RECURSIVE */ -- STMT_INSERT_DELETE_LIST INSERT INTO delete_list(local_relpath) -SELECT local_relpath FROM nodes n +SELECT local_relpath FROM nodes_current WHERE wc_id = ?1 AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2)) AND op_depth >= ?3 AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent') - AND op_depth = (SELECT MAX(op_depth) FROM nodes s - WHERE s.wc_id = n.wc_id - AND s.local_relpath = n.local_relpath) -- STMT_SELECT_DELETE_LIST SELECT local_relpath FROM delete_list @@ -1376,7 +1406,7 @@ WHERE wc_id = ?1 AND op_depth = 0 /* Queries for verification. */ -- STMT_SELECT_ALL_NODES -SELECT op_depth, local_relpath, parent_relpath FROM nodes +SELECT op_depth, local_relpath, parent_relpath, file_external FROM nodes WHERE wc_id == ?1 /* ------------------------------------------------------------------------- */ Modified: subversion/branches/revprop-packing/subversion/libsvn_wc/wc.h URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_wc/wc.h?rev=1231318&r1=1231317&r2=1231318&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/libsvn_wc/wc.h (original) +++ subversion/branches/revprop-packing/subversion/libsvn_wc/wc.h Fri Jan 13 21:40:26 2012 @@ -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 @@ -622,6 +620,7 @@ svn_wc__internal_get_origin(svn_boolean_ const char **repos_relpath, const char **repos_root_url, const char **repos_uuid, + const char **copy_root_abspath, svn_wc__db_t *db, const char *local_abspath, svn_boolean_t scan_deleted, @@ -680,7 +679,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, @@ -726,6 +725,41 @@ svn_wc__perform_file_merge(svn_skel_t ** apr_pool_t *scratch_pool); +/* Couple of random helpers for the Ev2 shims. + ### These will eventually be obsoleted and removed. */ +struct svn_wc__shim_fetch_baton_t +{ + svn_wc__db_t *db; + const char *base_abspath; + svn_boolean_t fetch_base; +}; + +/* Using a BATON of struct shim_fetch_baton, return KIND for PATH. */ +svn_error_t * +svn_wc__fetch_kind_func(svn_kind_t *kind, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *scratch_pool); + +/* Using a BATON of struct shim_fetch_baton, return PROPS for PATH. */ +svn_error_t * +svn_wc__fetch_props_func(apr_hash_t **props, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/* Using a BATON of struct shim_fetch_baton, return a delta base for PATH. */ +svn_error_t * +svn_wc__fetch_base_func(const char **filename, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + #ifdef __cplusplus } #endif /* __cplusplus */
