You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/11/04 21:48:30 UTC
svn commit: r1031230 [9/21] - in /subversion/branches/py-tests-as-modules:
./ build/ build/ac-macros/ build/win32/ contrib/client-side/ notes/
notes/http-and-webdav/ notes/wc-ng/ subversion/bindings/ctypes-python/csvn/
subversion/bindings/javahl/native...
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/copy.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/copy.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/copy.c Thu Nov 4 20:48:21 2010
@@ -46,7 +46,8 @@
/*** Code. ***/
-/* Make a copy of SRC_ABSPATH under a temporary name in the directory
+/* Make a copy of the filesystem node (or tree if RECURSIVE) at
+ SRC_ABSPATH under a temporary name in the directory
TMPDIR_ABSPATH and return the absolute path of the copy in
*DST_ABSPATH. Return the node kind of SRC_ABSPATH in *KIND. If
SRC_ABSPATH doesn't exist then set *DST_ABSPATH to NULL to indicate
@@ -88,6 +89,10 @@ copy_to_tmpdir(const char **dst_abspath,
### handle the directory case and b) we need to be able to remove
### the cleanup before queueing the move work item. */
+ /* Set DST_ABSPATH to a temporary unique path. If *KIND is file, leave a
+ file there and then overwrite it; otherwise leave no node on disk at
+ that path. In the latter case, something else might use that path
+ before we get around to using it a moment later, but never mind. */
SVN_ERR(svn_io_open_unique_file3(NULL, dst_abspath, tmpdir_abspath,
delete_when, scratch_pool, scratch_pool));
@@ -115,10 +120,82 @@ copy_to_tmpdir(const char **dst_abspath,
}
-/* A replacement for both copy_file_administratively and
- copy_added_file_administratively. Not yet fully working. Relies
- on in-db-props. SRC_ABSPATH is a versioned file but the filesystem
- node might not be a file.
+/* If SRC_ABSPATH and DST_ABSPATH use different pristine stores, copy the
+ pristine text of SRC_ABSPATH (if there is one) into the pristine text
+ store connected to DST_ABSPATH. This will only happen when copying into
+ a separate WC such as an external directory.
+ */
+static svn_error_t *
+copy_pristine_text_if_necessary(svn_wc__db_t *db,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool)
+{
+ const svn_checksum_t *checksum;
+
+ SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ &checksum,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ db, src_abspath,
+ scratch_pool, scratch_pool));
+ if (checksum)
+ {
+ svn_boolean_t present;
+ svn_stream_t *src_pristine, *tmp_pristine;
+ const char *tmp_pristine_abspath;
+ const svn_checksum_t *sha1_checksum, *md5_checksum;
+ const char *tmpdir_abspath;
+
+ /* If it's already in DST_ABSPATH's pristine store, we're done. */
+ SVN_ERR(svn_wc__db_pristine_check(&present, db, dst_abspath, checksum,
+ scratch_pool));
+ if (present)
+ return SVN_NO_ERROR;
+
+ if (checksum->kind == svn_checksum_md5)
+ {
+ md5_checksum = checksum;
+ SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db,
+ src_abspath, checksum,
+ scratch_pool, scratch_pool));
+ }
+ else
+ {
+ sha1_checksum = checksum;
+ SVN_ERR(svn_wc__db_pristine_get_md5(&md5_checksum, db,
+ src_abspath, checksum,
+ scratch_pool, scratch_pool));
+ }
+
+ SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath, db, dst_abspath,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_wc__db_pristine_read(&src_pristine, db,
+ src_abspath, sha1_checksum,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_stream_open_unique(&tmp_pristine, &tmp_pristine_abspath,
+ tmpdir_abspath, svn_io_file_del_none,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_stream_copy3(src_pristine, tmp_pristine,
+ cancel_func, cancel_baton,
+ scratch_pool));
+ SVN_ERR(svn_wc__db_pristine_install(db, tmp_pristine_abspath,
+ sha1_checksum, md5_checksum,
+ scratch_pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
+/* Copy the versioned file SRC_ABSPATH in DB to the path DST_ABSPATH in DB.
+ If METADATA_ONLY is true, copy only the versioned metadata,
+ otherwise copy both the versioned metadata and the filesystem node (even
+ if it is the wrong kind, and recursively if it is a dir).
This also works for versioned symlinks that are stored in the db as
svn_wc__db_kind_file with svn:special set. */
@@ -136,72 +213,42 @@ copy_versioned_file(svn_wc__db_t *db,
svn_skel_t *work_items = NULL;
const char *dir_abspath = svn_dirent_dirname(dst_abspath, scratch_pool);
const char *tmpdir_abspath;
- svn_stream_t *src_pristine;
const char *tmp_dst_abspath;
svn_node_kind_t kind;
SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath, db, dst_abspath,
scratch_pool, scratch_pool));
- /* This goes away when we centralise, but until then we might need
- to do a cross-db pristine copy. */
- if (strcmp(svn_dirent_dirname(src_abspath, scratch_pool),
- svn_dirent_dirname(dst_abspath, scratch_pool)))
- {
- const svn_checksum_t *checksum;
-
- SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- &checksum,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
- db, src_abspath,
- scratch_pool, scratch_pool));
- if (checksum)
- {
- svn_stream_t *tmp_pristine;
- const char *tmp_pristine_abspath;
- const svn_checksum_t *sha1_checksum, *md5_checksum;
-
- if (checksum->kind == svn_checksum_md5)
- {
- md5_checksum = checksum;
- SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db,
- src_abspath, checksum,
- scratch_pool, scratch_pool));
- }
- else
- {
- sha1_checksum = checksum;
- SVN_ERR(svn_wc__db_pristine_get_md5(&md5_checksum, db,
- src_abspath, checksum,
- scratch_pool, scratch_pool));
- }
- SVN_ERR(svn_wc__db_pristine_read(&src_pristine, db,
- src_abspath, sha1_checksum,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_stream_open_unique(&tmp_pristine, &tmp_pristine_abspath,
- tmpdir_abspath, svn_io_file_del_none,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_stream_copy3(src_pristine, tmp_pristine,
- cancel_func, cancel_baton,
- scratch_pool));
- SVN_ERR(svn_wc__db_pristine_install(db, tmp_pristine_abspath,
- sha1_checksum, md5_checksum,
- scratch_pool));
- }
- }
+ /* In case we are copying from one WC to another (e.g. an external dir),
+ ensure the destination WC has a copy of the pristine text. */
+ SVN_ERR(copy_pristine_text_if_necessary(db, src_abspath, dst_abspath,
+ cancel_func, cancel_baton,
+ scratch_pool));
+ /* Prepare a temp copy of the filesystem node. It is usually a file, but
+ copy recursively if it's a dir. */
if (!metadata_only)
{
SVN_ERR(copy_to_tmpdir(&tmp_dst_abspath, &kind, src_abspath,
tmpdir_abspath,
TRUE, /* recursive */
cancel_func, cancel_baton, scratch_pool));
+
if (tmp_dst_abspath)
{
svn_skel_t *work_item;
+ /* Remove 'read-only' from the destination file; it's a local add. */
+ {
+ const svn_string_t *needs_lock;
+ SVN_ERR(svn_wc__internal_propget(&needs_lock, db, src_abspath,
+ SVN_PROP_NEEDS_LOCK,
+ scratch_pool, scratch_pool));
+ if (needs_lock)
+ SVN_ERR(svn_io_set_file_read_write(tmp_dst_abspath,
+ FALSE, scratch_pool));
+ }
+
SVN_ERR(svn_wc__wq_build_file_move(&work_item, db,
tmp_dst_abspath, dst_abspath,
scratch_pool, scratch_pool));
@@ -209,6 +256,8 @@ copy_versioned_file(svn_wc__db_t *db,
}
}
+ /* Copy the (single) node's metadata, and move the new filesystem node
+ into place. */
SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath,
work_items, scratch_pool));
SVN_ERR(svn_wc__wq_run(db, dir_abspath,
@@ -225,6 +274,10 @@ copy_versioned_file(svn_wc__db_t *db,
return SVN_NO_ERROR;
}
+/* Copy the versioned dir SRC_ABSPATH in DB to the path DST_ABSPATH in DB,
+ recursively. If METADATA_ONLY is true, copy only the versioned metadata,
+ otherwise copy both the versioned metadata and the filesystem nodes (even
+ if they are the wrong kind, and including unversioned children). */
static svn_error_t *
copy_versioned_dir(svn_wc__db_t *db,
const char *src_abspath,
@@ -246,6 +299,7 @@ copy_versioned_dir(svn_wc__db_t *db,
apr_pool_t *iterpool;
int i;
+ /* Prepare a temp copy of the single filesystem node (usually a dir). */
if (!metadata_only)
{
SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath, db,
@@ -266,6 +320,8 @@ copy_versioned_dir(svn_wc__db_t *db,
}
}
+ /* Copy the (single) node's metadata, and move the new filesystem node
+ into place. */
SVN_ERR(svn_wc__db_op_copy(db, src_abspath, dst_abspath,
work_items, scratch_pool));
SVN_ERR(svn_wc__wq_run(db, dir_abspath,
@@ -281,8 +337,8 @@ copy_versioned_dir(svn_wc__db_t *db,
}
if (!metadata_only && kind == svn_node_dir)
- /* All children, versioned and unversioned. We're only interested in the
- names of the children, so we can pass TRUE as the only_check_type
+ /* All filesystem children, versioned and unversioned. We're only
+ interested in their names, so we can pass TRUE as the only_check_type
param. */
SVN_ERR(svn_io_get_dirents3(&children, src_abspath, TRUE,
scratch_pool, scratch_pool));
@@ -330,9 +386,9 @@ copy_versioned_dir(svn_wc__db_t *db,
apr_hash_set(children, child_name, APR_HASH_KEY_STRING, NULL);
}
+ /* Copy all the remaining filesystem children, which are unversioned. */
if (!metadata_only && kind == svn_node_dir)
{
- /* All the remaining children are unversioned. */
apr_hash_index_t *hi;
for (hi = apr_hash_first(scratch_pool, children); hi;
@@ -377,6 +433,119 @@ copy_versioned_dir(svn_wc__db_t *db,
}
+#ifdef SVN_WC__OP_DEPTH
+/*
+A plan for copying a versioned node, recursively, with proper op-depths.
+
+Each DB change mentioned in a separate step is intended to change the WC
+from one valid state to another and must be exectuted within a DB txn.
+Several such changes can be batched together in a bigger txn if we don't
+want clients to be able to see intermediate states.
+
+TODO: We will probably want to notify all copied paths rather than just the
+ root path, some time in the future. It may be difficult to get the list
+ of visited paths directly, because the metadata copying is performed
+ within a single SQL statement. We could walk the destination tree after
+ copying, taking care to include any 'excluded' nodes but ignore any
+ 'deleted' paths that may be left over from a replaced sub-tree.
+
+copy_versioned_tree:
+ # Copy a versioned file/dir SRC_PATH to DST_PATH, recursively.
+
+ # This function takes care to copy both the metadata tree and the disk
+ # tree as they are, even if they are different node kinds and so different
+ # tree shapes.
+
+ src_op_depth = working_op_depth_of(src_path)
+ src_depth = relpath_depth(src_path)
+ dst_depth = relpath_depth(dst_path)
+
+ # The source tree has in the NODES table, by design:
+ # - zero or more rows below SRC_OP_DEPTH (these are uninteresting);
+ # - one or more rows at SRC_OP_DEPTH;
+ # - no rows with SRC_OP_DEPTH < row.op_depth <= SRC_DEPTH;
+ # - zero or more rows above SRC_DEPTH (modifications);
+ # and SRC_OP_DEPTH <= SRC_DEPTH.
+
+ Copy single NODES row from src_path@src_op_depth to dst_path@dst_depth.
+ Copy all rows of descendent paths in == src_op_depth to == dst_depth.
+ Copy all rows of descendent paths in > src_depth to > dst_depth,
+ adjusting op_depth by (dst_depth - src_depth).
+
+ Copy disk node recursively (if it exists, and whatever its kind).
+ Copy ACTUAL_NODE rows (props and any other actual metadata).
+
+ # ### Are there no scenarios in which we would want to decrease dst_depth
+ # and so subsume the destination into an existing op? I guess not.
+
+*/
+
+/* Copy the working version of the versioned tree at SRC_ABSPATH to
+ * DST_ABSPATH, recursively. If METADATA_ONLY is true, then don't copy it
+ * on disk, only in metadata, and don't care whether it already exists on
+ * disk. */
+static svn_error_t *
+copy_versioned_tree(svn_wc__db_t *db,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_boolean_t metadata_only,
+ 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_skel_t *work_item = NULL;
+
+ /* Prepare a copy of the on-disk tree (if it exists, and whatever its kind),
+ * in a temporary location. */
+ if (! metadata_only)
+ {
+ const char *tmpdir_abspath;
+ const char *tmp_dst_abspath;
+ svn_node_kind_t kind;
+
+ SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath, db, dst_abspath,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(copy_to_tmpdir(&tmp_dst_abspath, &kind, src_abspath,
+ tmpdir_abspath,
+ TRUE, /* recursive */
+ cancel_func, cancel_baton,
+ scratch_pool));
+ if (tmp_dst_abspath)
+ {
+ SVN_ERR(svn_wc__wq_build_file_move(&work_item, db,
+ tmp_dst_abspath, dst_abspath,
+ scratch_pool, scratch_pool));
+ }
+ }
+
+ /* Copy single NODES row from src_path@src_op_depth to dst_path@dst_depth. */
+ /* Copy all rows of descendent paths in == src_op_depth to == dst_depth. */
+ /* Copy all rows of descendent paths in > src_depth to > dst_depth,
+ adjusting op_depth by (dst_depth - src_depth). */
+ /* Copy ACTUAL_NODE rows (props and any other actual metadata). */
+ SVN_ERR(svn_wc__db_op_copy_tree(db, src_abspath, dst_abspath,
+ work_item, scratch_pool));
+
+ SVN_ERR(svn_wc__wq_run(db, dst_abspath, cancel_func, cancel_baton,
+ scratch_pool));
+
+ /* Notify */
+ if (notify_func)
+ {
+ svn_wc_notify_t *notify
+ = svn_wc_create_notify(dst_abspath, svn_wc_notify_add,
+ scratch_pool);
+ notify->kind = svn_node_dir;
+ (*notify_func)(notify_baton, notify, scratch_pool);
+ }
+
+ return SVN_NO_ERROR;
+}
+#endif
+
/* Public Interface */
@@ -392,15 +561,16 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
apr_pool_t *scratch_pool)
{
svn_wc__db_t *db = wc_ctx->db;
- svn_node_kind_t src_kind;
svn_wc__db_kind_t src_db_kind;
const char *dstdir_abspath;
-
+
SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
dstdir_abspath = svn_dirent_dirname(dst_abspath, scratch_pool);
+ /* Ensure DSTDIR_ABSPATH belongs to the same repository as SRC_ABSPATH;
+ throw an error if not. */
{
svn_wc__db_status_t src_status, dstdir_status;
const char *src_repos_root_url, *dst_repos_root_url;
@@ -481,6 +651,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
SVN_ERR_WC_INVALID_SCHEDULE, NULL,
_("Cannot copy to '%s' as it is scheduled for deletion"),
svn_dirent_local_style(dst_abspath, scratch_pool));
+ /* ### should report dstdir_abspath instead of dst_abspath? */
}
/* TODO(#2843): Rework the error report. */
@@ -528,16 +699,13 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
}
}
- SVN_ERR(svn_io_check_path(src_abspath, &src_kind, scratch_pool));
-
+ /* Check that the target path is not obstructed, if required. */
if (!metadata_only)
{
svn_node_kind_t dst_kind;
- /* This is the error checking from copy_file_administratively
- but converted to wc-ng. It's not in copy_file since this
- checking only needs to happen at the root of the copy and not
- when called recursively. */
+ /* (We need only to check the root of the copy, not every path inside
+ copy_versioned_file/_dir.) */
SVN_ERR(svn_io_check_path(dst_abspath, &dst_kind, scratch_pool));
if (dst_kind != svn_node_none)
return svn_error_createf(SVN_ERR_ENTRY_EXISTS, NULL,
@@ -546,6 +714,17 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
scratch_pool));
}
+#ifdef SVN_WC__OP_DEPTH
+ if (svn_wc__db_same_db(db, src_abspath, dst_abspath, scratch_pool))
+ {
+ SVN_ERR(copy_versioned_tree(db, src_abspath, dst_abspath,
+ metadata_only,
+ cancel_func, cancel_baton,
+ notify_func, notify_baton,
+ scratch_pool));
+ }
+ else
+#endif
if (src_db_kind == svn_wc__db_kind_file
|| src_db_kind == svn_wc__db_kind_symlink)
{
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/deprecated.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/deprecated.c Thu Nov 4 20:48:21 2010
@@ -2064,7 +2064,6 @@ svn_wc_parse_externals_description2(apr_
{
apr_array_header_t *list;
apr_pool_t *subpool = svn_pool_create(pool);
- int i;
SVN_ERR(svn_wc_parse_externals_description3(externals_p ? &list : NULL,
parent_directory, desc,
@@ -2072,6 +2071,8 @@ svn_wc_parse_externals_description2(apr_
if (externals_p)
{
+ int i;
+
*externals_p = apr_array_make(pool, list->nelts,
sizeof(svn_wc_external_item_t *));
for (i = 0; i < list->nelts; i++)
@@ -2103,7 +2104,6 @@ svn_wc_parse_externals_description(apr_h
apr_pool_t *pool)
{
apr_array_header_t *list;
- int i;
SVN_ERR(svn_wc_parse_externals_description2(externals_p ? &list : NULL,
parent_directory, desc, pool));
@@ -2111,6 +2111,8 @@ svn_wc_parse_externals_description(apr_h
/* Store all of the items into the hash if that was requested. */
if (externals_p)
{
+ int i;
+
*externals_p = apr_hash_make(pool);
for (i = 0; i < list->nelts; i++)
{
@@ -2727,7 +2729,6 @@ svn_wc_add_repos_file3(const char *dst_p
copyfrom_url,
copyfrom_rev,
cancel_func, cancel_baton,
- notify_func, notify_baton,
pool));
return svn_error_return(svn_wc_context_destroy(wc_ctx));
@@ -2945,7 +2946,6 @@ svn_wc_get_update_editor3(svn_revnum_t *
allow_unver_obstructions,
diff3_cmd,
preserved_exts,
- fetch_func, fetch_baton,
conflict_func, conflict_baton,
external_func, eb,
cancel_func, cancel_baton,
@@ -3062,7 +3062,6 @@ svn_wc_get_switch_editor3(svn_revnum_t *
allow_unver_obstructions,
diff3_cmd,
preserved_exts,
- NULL, NULL,
conflict_func, conflict_baton,
external_func, eb,
cancel_func, cancel_baton,
@@ -3366,12 +3365,16 @@ svn_wc_relocate3(const char *path,
const char *local_abspath;
svn_wc_context_t *wc_ctx;
+ if (! recurse)
+ svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, 0,
+ _("Non-recursive relocation not supported"));
+
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
svn_wc__adm_get_db(adm_access),
pool));
- SVN_ERR(svn_wc_relocate4(wc_ctx, local_abspath, from, to, recurse,
+ SVN_ERR(svn_wc_relocate4(wc_ctx, local_abspath, from, to,
validator, validator_baton, pool));
return svn_error_return(svn_wc_context_destroy(wc_ctx));
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/entries.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/entries.c Thu Nov 4 20:48:21 2010
@@ -487,7 +487,7 @@ get_base_info_for_deleted(svn_wc_entry_t
static svn_error_t *
read_one_entry(const svn_wc_entry_t **new_entry,
svn_wc__db_t *db,
- apr_uint64_t wc_id,
+ apr_int64_t wc_id,
const char *dir_abspath,
const char *name,
const svn_wc_entry_t *parent_entry,
@@ -601,7 +601,10 @@ read_one_entry(const svn_wc_entry_t **ne
a subdirectory "over" a not-present directory. The read_info()
will return information out of the wc.db in the subdir. We
need to detect this situation and create a DELETED entry
- instead. */
+ instead.
+
+ ### Does this still happen? The regression tests passed when
+ the NODES query was erroneously accessing BASE_NODE. */
if (kind == svn_wc__db_kind_dir)
{
svn_sqlite__db_t *sdb;
@@ -709,44 +712,16 @@ read_one_entry(const svn_wc_entry_t **ne
}
else
{
- /* If we are reading child directories, then we need to
- correctly populate the DELETED flag. WC_DB normally
- wants to provide all of a directory's metadata from
- its own area. But this information is stored only in
- the parent directory, so we need to call a custom API
- to fetch this value.
-
- ### we should start generating BASE_NODE rows for THIS_DIR
- ### in the subdir. future step because it is harder. */
- if (kind == svn_wc__db_kind_dir && *entry->name != '\0')
- {
- SVN_ERR(svn_wc__db_temp_is_dir_deleted(&entry->deleted,
- &entry->revision,
- db, entry_abspath,
- scratch_pool));
- }
- if (entry->deleted)
- {
- /* There was a DELETED marker in the parent, meaning
- that we truly are shadowing a base node. It isn't
- called a 'replace' though (the BASE is pretending
- not to exist). */
- entry->schedule = svn_wc_schedule_add;
- }
- else
- {
- /* There was NOT a 'not-present' BASE_NODE in the parent
- directory. And there is no BASE_NODE in this directory.
- Therefore, we are looking at some kind of add/copy
- rather than a replace. */
-
- /* ### if this looks like a plain old add, then rev=0. */
- if (!SVN_IS_VALID_REVNUM(entry->copyfrom_rev)
- && !SVN_IS_VALID_REVNUM(entry->cmt_rev))
- entry->revision = 0;
+ /* There is NO 'not-present' BASE_NODE for this node.
+ Therefore, we are looking at some kind of add/copy
+ rather than a replace. */
+
+ /* ### if this looks like a plain old add, then rev=0. */
+ if (!SVN_IS_VALID_REVNUM(entry->copyfrom_rev)
+ && !SVN_IS_VALID_REVNUM(entry->cmt_rev))
+ entry->revision = 0;
- entry->schedule = svn_wc_schedule_add;
- }
+ entry->schedule = svn_wc_schedule_add;
}
/* If we don't have "real" data from the entry (obstruction),
@@ -1093,7 +1068,7 @@ read_entries_new(apr_hash_t **result_ent
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
int i;
const svn_wc_entry_t *parent_entry;
- apr_uint64_t wc_id = 1; /* ### hacky. should remove. */
+ apr_int64_t wc_id = 1; /* ### hacky. should remove. */
entries = apr_hash_make(result_pool);
@@ -1148,7 +1123,7 @@ read_entry_pair(const svn_wc_entry_t **p
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- apr_uint64_t wc_id = 1; /* ### hacky. should remove. */
+ apr_int64_t wc_id = 1; /* ### hacky. should remove. */
SVN_ERR(read_one_entry(parent_entry, db, wc_id, dir_abspath,
"" /* name */,
@@ -1541,77 +1516,9 @@ insert_base_node(svn_sqlite__db_t *sdb,
{
svn_sqlite__stmt_t *stmt;
-#ifndef SVN_WC__NODES_ONLY
- /* ### NODE_DATA when switching to NODE_DATA, replace the
- query below with STMT_INSERT_BASE_NODE_DATA_FOR_ENTRY_1
- and adjust the parameters bound. Can't do that yet. */
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_INSERT_BASE_NODE_FOR_ENTRY));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 1, base_node->wc_id));
- SVN_ERR(svn_sqlite__bind_text(stmt, 2, base_node->local_relpath));
-
- if (base_node->repos_id)
- {
- SVN_ERR(svn_sqlite__bind_int64(stmt, 3, base_node->repos_id));
- SVN_ERR(svn_sqlite__bind_text(stmt, 4, base_node->repos_relpath));
- }
-
- if (base_node->parent_relpath)
- SVN_ERR(svn_sqlite__bind_text(stmt, 5, base_node->parent_relpath));
-
- if (base_node->presence == svn_wc__db_status_not_present)
- SVN_ERR(svn_sqlite__bind_text(stmt, 6, "not-present"));
- else if (base_node->presence == svn_wc__db_status_normal)
- SVN_ERR(svn_sqlite__bind_text(stmt, 6, "normal"));
- else if (base_node->presence == svn_wc__db_status_absent)
- SVN_ERR(svn_sqlite__bind_text(stmt, 6, "absent"));
- else if (base_node->presence == svn_wc__db_status_incomplete)
- SVN_ERR(svn_sqlite__bind_text(stmt, 6, "incomplete"));
- else if (base_node->presence == svn_wc__db_status_excluded)
- SVN_ERR(svn_sqlite__bind_text(stmt, 6, "excluded"));
-
- SVN_ERR(svn_sqlite__bind_int64(stmt, 7, base_node->revision));
-
- /* ### kind might be "symlink" or "unknown" */
- if (base_node->kind == svn_node_none)
- SVN_ERR(svn_sqlite__bind_text(stmt, 5, "unknown"));
- else
- SVN_ERR(svn_sqlite__bind_text(stmt, 8,
- svn_node_kind_to_word(base_node->kind)));
-
- if (base_node->checksum)
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 9, base_node->checksum,
- scratch_pool));
-
- if (base_node->translated_size != SVN_INVALID_FILESIZE)
- SVN_ERR(svn_sqlite__bind_int64(stmt, 10, base_node->translated_size));
-
- /* ### strictly speaking, changed_rev should be valid for present nodes. */
- if (SVN_IS_VALID_REVNUM(base_node->changed_rev))
- SVN_ERR(svn_sqlite__bind_int64(stmt, 11, base_node->changed_rev));
- if (base_node->changed_date)
- SVN_ERR(svn_sqlite__bind_int64(stmt, 12, base_node->changed_date));
- if (base_node->changed_author)
- SVN_ERR(svn_sqlite__bind_text(stmt, 13, base_node->changed_author));
-
- SVN_ERR(svn_sqlite__bind_text(stmt, 14, svn_depth_to_word(base_node->depth)));
-
- SVN_ERR(svn_sqlite__bind_int64(stmt, 15, base_node->last_mod_time));
-
- if (base_node->properties)
- SVN_ERR(svn_sqlite__bind_properties(stmt, 16, base_node->properties,
- scratch_pool));
-
- /* Execute and reset the insert clause. */
- SVN_ERR(svn_sqlite__insert(NULL, stmt));
-
-#endif
-#ifdef SVN_WC__NODES
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_INSERT_BASE_NODE_FOR_ENTRY_1));
-
SVN_ERR(svn_sqlite__bindf(stmt, "issisr",
base_node->wc_id,
base_node->local_relpath,
@@ -1664,8 +1571,6 @@ insert_base_node(svn_sqlite__db_t *sdb,
/* Execute and reset the insert clause. */
SVN_ERR(svn_sqlite__insert(NULL, stmt));
-
-#endif
return SVN_NO_ERROR;
}
@@ -1677,141 +1582,58 @@ insert_working_node(svn_sqlite__db_t *sd
{
svn_sqlite__stmt_t *stmt;
- /* ### NODE_DATA when switching to NODE_DATA, replace the
- query below with STMT_INSERT_WORKING_NODE_DATA_2
- and adjust the parameters bound. Can't do that yet. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_WORKING_NODE));
-
- SVN_ERR(svn_sqlite__bind_int64(stmt, 1, working_node->wc_id));
- SVN_ERR(svn_sqlite__bind_text(stmt, 2, working_node->local_relpath));
- SVN_ERR(svn_sqlite__bind_text(stmt, 3, working_node->parent_relpath));
-
- /* ### need rest of values */
- if (working_node->presence == svn_wc__db_status_normal)
- SVN_ERR(svn_sqlite__bind_text(stmt, 4, "normal"));
- else if (working_node->presence == svn_wc__db_status_not_present)
- SVN_ERR(svn_sqlite__bind_text(stmt, 4, "not-present"));
- else if (working_node->presence == svn_wc__db_status_base_deleted)
- SVN_ERR(svn_sqlite__bind_text(stmt, 4, "base-deleted"));
- else if (working_node->presence == svn_wc__db_status_incomplete)
- SVN_ERR(svn_sqlite__bind_text(stmt, 4, "incomplete"));
- else if (working_node->presence == svn_wc__db_status_excluded)
- SVN_ERR(svn_sqlite__bind_text(stmt, 4, "excluded"));
-
- if (working_node->kind == svn_node_none)
- SVN_ERR(svn_sqlite__bind_text(stmt, 5, "unknown"));
- else
- SVN_ERR(svn_sqlite__bind_text(stmt, 5,
- svn_node_kind_to_word(working_node->kind)));
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_NODE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isisnnnnsnrisnnni",
+ working_node->wc_id, working_node->local_relpath,
+ (working_node->parent_relpath == NULL
+ ? (apr_int64_t)1 : (apr_int64_t)2),
+ working_node->parent_relpath,
+ /* Setting depth for files? */
+ svn_depth_to_word(working_node->depth),
+ working_node->changed_rev,
+ working_node->changed_date,
+ working_node->changed_author,
+ working_node->last_mod_time));
if (working_node->copyfrom_repos_path)
{
- SVN_ERR(svn_sqlite__bind_int64(stmt, 6,
+ SVN_ERR(svn_sqlite__bind_int64(stmt, 5,
working_node->copyfrom_repos_id));
- SVN_ERR(svn_sqlite__bind_text(stmt, 7,
+ SVN_ERR(svn_sqlite__bind_text(stmt, 6,
working_node->copyfrom_repos_path));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 8, working_node->copyfrom_revnum));
+ SVN_ERR(svn_sqlite__bind_int64(stmt, 7, working_node->copyfrom_revnum));
}
- if (working_node->moved_here)
- SVN_ERR(svn_sqlite__bind_int(stmt, 9, working_node->moved_here));
-
- if (working_node->moved_to)
- SVN_ERR(svn_sqlite__bind_text(stmt, 10, working_node->moved_to));
-
- if (working_node->checksum)
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 11, working_node->checksum,
- scratch_pool));
-
- if (working_node->translated_size != SVN_INVALID_FILESIZE)
- SVN_ERR(svn_sqlite__bind_int64(stmt, 12, working_node->translated_size));
-
- if (SVN_IS_VALID_REVNUM(working_node->changed_rev))
- SVN_ERR(svn_sqlite__bind_int64(stmt, 13, working_node->changed_rev));
- if (working_node->changed_date)
- SVN_ERR(svn_sqlite__bind_int64(stmt, 14, working_node->changed_date));
- if (working_node->changed_author)
- SVN_ERR(svn_sqlite__bind_text(stmt, 15, working_node->changed_author));
-
- SVN_ERR(svn_sqlite__bind_text(stmt, 16,
- svn_depth_to_word(working_node->depth)));
-
- SVN_ERR(svn_sqlite__bind_int64(stmt, 17, working_node->last_mod_time));
-
- if (working_node->properties)
- SVN_ERR(svn_sqlite__bind_properties(stmt, 18, working_node->properties,
- scratch_pool));
-
- SVN_ERR(svn_sqlite__bind_int64(stmt, 19, working_node->keep_local));
-
- /* ### we should bind 'symlink_target' (20) as appropriate. */
-
- /* Execute and reset the insert clause. */
- SVN_ERR(svn_sqlite__insert(NULL, stmt));
-
-#ifdef SVN_WC__NODE_DATA
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_INSERT_WORKING_NODE_DATA_1));
-
- SVN_ERR(svn_sqlite__bind_int64(stmt, 1, working_node->wc_id));
- SVN_ERR(svn_sqlite__bind_text(stmt, 2, working_node->local_relpath));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 3,
- (*working_node->local_relpath == '\0') ? 1 : 2));
- SVN_ERR(svn_sqlite__bind_text(stmt, 4, working_node->parent_relpath));
-
- /* ### need rest of values */
if (working_node->presence == svn_wc__db_status_normal)
- SVN_ERR(svn_sqlite__bind_text(stmt, 5, "normal"));
+ SVN_ERR(svn_sqlite__bind_text(stmt, 8, "normal"));
else if (working_node->presence == svn_wc__db_status_not_present)
- SVN_ERR(svn_sqlite__bind_text(stmt, 5, "not-present"));
+ SVN_ERR(svn_sqlite__bind_text(stmt, 8, "not-present"));
else if (working_node->presence == svn_wc__db_status_base_deleted)
- SVN_ERR(svn_sqlite__bind_text(stmt, 5, "base-deleted"));
+ SVN_ERR(svn_sqlite__bind_text(stmt, 8, "base-deleted"));
else if (working_node->presence == svn_wc__db_status_incomplete)
- SVN_ERR(svn_sqlite__bind_text(stmt, 5, "incomplete"));
+ SVN_ERR(svn_sqlite__bind_text(stmt, 8, "incomplete"));
else if (working_node->presence == svn_wc__db_status_excluded)
- SVN_ERR(svn_sqlite__bind_text(stmt, 5, "excluded"));
+ SVN_ERR(svn_sqlite__bind_text(stmt, 8, "excluded"));
if (working_node->kind == svn_node_none)
- SVN_ERR(svn_sqlite__bind_text(stmt, 6, "unknown"));
+ SVN_ERR(svn_sqlite__bind_text(stmt, 10, "unknown"));
else
- SVN_ERR(svn_sqlite__bind_text(stmt, 6,
+ SVN_ERR(svn_sqlite__bind_text(stmt, 10,
svn_node_kind_to_word(working_node->kind)));
- if (working_node->copyfrom_repos_path)
- {
- SVN_ERR(svn_sqlite__bind_int64(stmt, 7,
- working_node->copyfrom_repos_id));
- SVN_ERR(svn_sqlite__bind_text(stmt, 8,
- working_node->copyfrom_repos_path));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 9, working_node->copyfrom_revnum));
- }
-
- if (working_node->checksum)
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 10, working_node->checksum,
+ if (working_node->kind == svn_node_file)
+ SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, working_node->checksum,
scratch_pool));
- if (SVN_IS_VALID_REVNUM(working_node->changed_rev))
- SVN_ERR(svn_sqlite__bind_int64(stmt, 11, working_node->changed_rev));
- if (working_node->changed_date)
- SVN_ERR(svn_sqlite__bind_int64(stmt, 12, working_node->changed_date));
- if (working_node->changed_author)
- SVN_ERR(svn_sqlite__bind_text(stmt, 13, working_node->changed_author));
-
- SVN_ERR(svn_sqlite__bind_text(stmt, 14,
- svn_depth_to_word(working_node->depth)));
-
if (working_node->properties)
SVN_ERR(svn_sqlite__bind_properties(stmt, 15, working_node->properties,
scratch_pool));
- /* ### we should bind 'symlink_target' (16) as appropriate. */
+ if (working_node->translated_size != SVN_INVALID_FILESIZE)
+ SVN_ERR(svn_sqlite__bind_int64(stmt, 16, working_node->translated_size));
- /* Execute and reset the insert clause. */
SVN_ERR(svn_sqlite__insert(NULL, stmt));
-#endif
-
return SVN_NO_ERROR;
}
@@ -2176,7 +1998,7 @@ write_entry(svn_wc__db_t *db,
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_UPDATE_FILE_EXTERNAL));
SVN_ERR(svn_sqlite__bindf(stmt, "iss",
- (apr_uint64_t)1 /* wc_id */,
+ (apr_int64_t)1 /* wc_id */,
entry->name,
str));
SVN_ERR(svn_sqlite__step_done(stmt));
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/node.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/node.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/node.c Thu Nov 4 20:48:21 2010
@@ -1122,14 +1122,22 @@ svn_wc__node_get_lock_info(const char **
apr_pool_t *scratch_pool)
{
svn_wc__db_lock_t *lock;
+ svn_error_t *err;
- SVN_ERR(svn_wc__db_read_info(NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, &lock,
- wc_ctx->db, local_abspath,
- result_pool, scratch_pool));
+ err = svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ &lock,
+ wc_ctx->db, local_abspath,
+ result_pool, scratch_pool);
+
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ return svn_error_return(err);
+
+ svn_error_clear(err);
+ lock = NULL;
+ }
if (lock_token)
*lock_token = lock ? lock->token : NULL;
if (lock_owner)
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/old-and-busted.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/old-and-busted.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/old-and-busted.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/old-and-busted.c Thu Nov 4 20:48:21 2010
@@ -442,7 +442,7 @@ svn_wc__serialize_file_external(const ch
SVN_ERR(opt_revision_to_string(&s1, path, peg_rev, pool));
SVN_ERR(opt_revision_to_string(&s2, path, rev, pool));
- s = apr_pstrcat(pool, s1, ":", s2, ":", path, NULL);
+ s = apr_pstrcat(pool, s1, ":", s2, ":", path, (char *)NULL);
}
else
s = NULL;
@@ -1194,7 +1194,6 @@ svn_wc__read_entries_old(apr_hash_t **en
char *curp;
const char *endp;
svn_wc_entry_t *entry;
- int entryno, entries_format;
svn_stream_t *stream;
svn_string_t *buf;
@@ -1216,6 +1215,7 @@ svn_wc__read_entries_old(apr_hash_t **en
result_pool, scratch_pool));
else
{
+ int entryno, entries_format;
const char *val;
/* Read the format line from the entries file. In case we're in the
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/props.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/props.c Thu Nov 4 20:48:21 2010
@@ -139,30 +139,9 @@ svn_wc__get_prejfile_abspath(const char
static svn_error_t *
immediate_install_props(svn_wc__db_t *db,
const char *local_abspath,
- svn_wc__db_kind_t kind,
apr_hash_t *working_props,
apr_pool_t *scratch_pool)
{
- apr_hash_t *base_props;
-
- /* ### no pristines should be okay. */
- SVN_ERR_W(svn_wc__db_read_pristine_props(&base_props, db, local_abspath,
- scratch_pool, scratch_pool),
- _("Failed to load pristine properties"));
-
- /* Check if the props are modified. If no changes, then wipe out
- the ACTUAL props. No pristines defined means that any ACTUAL
- props are okay, so go ahead and set them. */
- if (base_props != NULL)
- {
- apr_array_header_t *prop_diffs;
-
- SVN_ERR(svn_prop_diffs(&prop_diffs, working_props, base_props,
- scratch_pool));
- if (prop_diffs->nelts == 0)
- working_props = NULL;
- }
-
SVN_ERR(svn_wc__db_op_set_props(db, local_abspath,
working_props,
NULL /* conflict */,
@@ -350,7 +329,6 @@ svn_wc__perform_props_merge(svn_wc_notif
{
svn_wc__db_status_t status;
svn_boolean_t have_base;
- apr_array_header_t *prop_diffs;
SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -365,41 +343,18 @@ svn_wc__perform_props_merge(svn_wc_notif
SVN_ERR(svn_wc__db_temp_base_set_props(db, local_abspath,
new_base_props, pool));
- /* Check if the props are modified. */
- SVN_ERR(svn_prop_diffs(&prop_diffs, actual_props, new_base_props, pool));
-
- /* Save the actual properties file if it differs from base. */
- if (prop_diffs->nelts == 0)
- SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, NULL, NULL, NULL,
- pool));
- else
- SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, actual_props,
- NULL, NULL, pool));
+ SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, actual_props,
+ NULL, NULL, pool));
}
#else
if (base_merge)
return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
U_("base_merge=TRUE is no longer supported"));
- {
- apr_array_header_t *prop_diffs;
-
- SVN_ERR(svn_prop_diffs(&prop_diffs, new_actual_props, new_base_props,
- pool));
-
- /* Save the actual properties file if it differs from base. */
- if (prop_diffs->nelts == 0)
- new_actual_props = NULL; /* Remove actual properties*/
-
- /* For the old school: write the properties into the "working"
- (aka ACTUAL) location. Note that PROPS may be NULL, indicating
- a removal of the props file. */
-
- SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, new_actual_props,
- NULL /* conflict */,
- NULL /* work_item */,
- pool));
- }
+ SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, new_actual_props,
+ NULL /* conflict */,
+ NULL /* work_item */,
+ pool));
#endif
SVN_ERR(svn_wc__wq_run(db, local_abspath,
@@ -1622,7 +1577,8 @@ svn_wc__merge_props(svn_wc_notify_state_
SVN_ERR(svn_wc__wq_tmp_build_set_property_conflict_marker(
&work_item,
db, local_abspath,
- svn_dirent_basename(reject_path, NULL),
+ svn_dirent_basename(reject_path,
+ NULL),
scratch_pool, scratch_pool));
SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, scratch_pool));
@@ -2185,7 +2141,7 @@ svn_wc__internal_propset(svn_wc__db_t *d
/* Drop it right onto the disk. We don't need loggy since we aren't
coordinating this change with anything else. */
- SVN_ERR(immediate_install_props(db, local_abspath, kind, prophash,
+ SVN_ERR(immediate_install_props(db, local_abspath, prophash,
scratch_pool));
if (notify_func)
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/relocate.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/relocate.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/relocate.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/relocate.c Thu Nov 4 20:48:21 2010
@@ -76,17 +76,45 @@ svn_wc_relocate4(svn_wc_context_t *wc_ct
const char *local_abspath,
const char *from,
const char *to,
- svn_boolean_t recurse,
svn_wc_relocation_validator3_t validator,
void *validator_baton,
apr_pool_t *scratch_pool)
{
svn_wc__db_kind_t kind;
const char *repos_relpath;
- const char *old_repos_root;
- const char *old_url;
- const char *new_repos_root;
+ const char *old_repos_root, *old_url;
+ const char *new_repos_root, *new_url;
+ int from_len, old_url_len;
const char *uuid;
+ svn_boolean_t is_wc_root;
+
+ SVN_ERR(svn_wc__strictly_is_wc_root(&is_wc_root, wc_ctx, local_abspath,
+ scratch_pool));
+ if (! is_wc_root)
+ {
+ const char *wcroot_abspath;
+ svn_error_t *err;
+
+ err = svn_wc__db_get_wcroot(&wcroot_abspath, wc_ctx->db,
+ local_abspath, scratch_pool, scratch_pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return svn_error_createf(
+ SVN_ERR_WC_INVALID_OP_ON_CWD, NULL,
+ _("Cannot relocate '%s' as it is not the root of a working copy"),
+ svn_dirent_local_style(local_abspath, scratch_pool));
+ }
+ else
+ {
+ return svn_error_createf(
+ SVN_ERR_WC_INVALID_OP_ON_CWD, NULL,
+ _("Cannot relocate '%s' as it is not the root of a working copy; "
+ "try relocating '%s' instead"),
+ svn_dirent_local_style(local_abspath, scratch_pool),
+ svn_dirent_local_style(wcroot_abspath, scratch_pool));
+ }
+ }
SVN_ERR(svn_wc__db_read_info(NULL, &kind, NULL, &repos_relpath,
&old_repos_root, &uuid,
@@ -101,59 +129,30 @@ svn_wc_relocate4(svn_wc_context_t *wc_ct
_("Cannot relocate a single file"));
old_url = svn_uri_join(old_repos_root, repos_relpath, scratch_pool);
- if (strcmp(old_url, from) != 0)
- return svn_error_create(SVN_ERR_WC_INVALID_RELOCATION, NULL,
- _("Given source URL invalid"));
+ old_url_len = strlen(old_url);
+ from_len = strlen(from);
+ if ((from_len > old_url_len) || (strncmp(old_url, from, strlen(from)) != 0))
+ return svn_error_createf(SVN_ERR_WC_INVALID_RELOCATION, NULL,
+ _("Invalid source URL prefix: '%s' (does not "
+ "overlap target's URL '%s')"),
+ from, old_url);
+
+ if (old_url_len == from_len)
+ new_url = to;
+ else
+ new_url = apr_pstrcat(scratch_pool, to, old_url + from_len, NULL);
+ if (! svn_path_is_url(new_url))
+ return svn_error_createf(SVN_ERR_WC_INVALID_RELOCATION, NULL,
+ _("Invalid destination URL: '%s'"), new_url);
- new_repos_root = uri_remove_components(to, repos_relpath, scratch_pool);
+ new_repos_root = uri_remove_components(new_url, repos_relpath, scratch_pool);
if (!new_repos_root)
return svn_error_createf(SVN_ERR_WC_INVALID_RELOCATION, NULL,
- _("Given destination URL invalid: '%s'"), to);
-
- SVN_ERR(validator(validator_baton, uuid, to, new_repos_root, scratch_pool));
-
- /* ### FIXME: This will ultimately cause the DAV cache to be
- recursively cleared, which is great in the recursive case, but
- overreaching otherwise. Granted, this only affects performance,
- and that only for DAV RA implementations that rely on the DAV
- cache. */
- SVN_ERR(svn_wc__db_global_relocate(wc_ctx->db, local_abspath, new_repos_root,
- scratch_pool));
-
- if (!recurse)
- {
- /* This gets sticky. We need to do the above relocation, and then
- relocate each of the children *back* to the original location. Ugh.
- */
- const apr_array_header_t *children;
- apr_pool_t *iterpool;
- int i;
-
- SVN_ERR(svn_wc__db_read_children(&children, wc_ctx->db, local_abspath,
- scratch_pool, scratch_pool));
- iterpool = svn_pool_create(scratch_pool);
- for (i = 0; i < children->nelts; i++)
- {
- const char *child = APR_ARRAY_IDX(children, i, const char *);
- const char *child_abspath;
- const char *child_from;
- const char *child_to;
-
- svn_pool_clear(iterpool);
- child_abspath = svn_dirent_join(local_abspath, child, iterpool);
-
- /* We invert the "from" and "to" because we're switching the
- children back to the original location. */
- child_from = svn_uri_join(to, child, iterpool);
- child_to = svn_uri_join(from, child, iterpool);
-
- SVN_ERR(svn_wc_relocate4(wc_ctx, child_abspath, child_from,
- child_to, TRUE, validator, validator_baton,
- iterpool));
- }
+ _("Invalid destination URL: '%s'"), new_url);
- svn_pool_destroy(iterpool);
- }
+ SVN_ERR(validator(validator_baton, uuid, new_url, new_repos_root, scratch_pool));
- return SVN_NO_ERROR;
+ return svn_error_return(svn_wc__db_global_relocate(wc_ctx->db, local_abspath,
+ new_repos_root,
+ scratch_pool));
}
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/status.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/status.c Thu Nov 4 20:48:21 2010
@@ -233,6 +233,115 @@ 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 *mutable
+ = apr_palloc(scratch_pool, sizeof(struct svn_wc__db_info_t));
+
+ SVN_ERR(svn_wc__db_read_info(&mutable->status, &mutable->kind,
+ &mutable->revnum, &mutable->repos_relpath,
+ &mutable->repos_root_url, NULL,
+ &mutable->changed_rev,
+ &mutable->changed_date,
+ &mutable->changed_author,
+ &mutable->last_mod_time,
+ &mutable->depth, NULL,
+ &mutable->translated_size, NULL,
+ &mutable->changelist, NULL, NULL, NULL, NULL,
+ &mutable->props_mod,
+ &mutable->have_base, NULL,
+ &mutable->conflicted, &mutable->lock,
+ db, local_abspath,
+ result_pool, scratch_pool));
+
+ if (mutable->status == svn_wc__db_status_deleted)
+ mutable->has_props = FALSE;
+ else if (mutable->props_mod)
+ {
+ mutable->has_props = TRUE;
+#ifdef HAVE_SYMLINK
+ SVN_ERR(svn_wc__get_translate_info(NULL, NULL, NULL, &mutable->special,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+#endif
+ }
+ else
+ {
+ apr_hash_t *properties;
+
+ SVN_ERR(svn_wc__db_read_pristine_props(&properties, db, local_abspath,
+ scratch_pool, scratch_pool));
+ mutable->has_props = (properties && !!apr_hash_count(properties));
+#ifdef HAVE_SYMLINK
+ mutable->special = (mutable->has_props
+ && apr_hash_get(properties, SVN_PROP_SPECIAL,
+ APR_HASH_KEY_STRING));
+#endif
+ }
+
+ *info = mutable;
+
+ return SVN_NO_ERROR;
+}
+
+/* Return *REPOS_RELPATH and *REPOS_ROOT_URL for LOCAL_ABSPATH using
+ information in INFO if available, falling back on
+ PARENT_REPOS_RELPATH and PARENT_REPOS_ROOT_URL if available, and
+ finally falling back on querying DB. */
+static svn_error_t *
+get_repos_root_url_relpath(const char **repos_relpath,
+ const char **repos_root_url,
+ const struct svn_wc__db_info_t *info,
+ const char *parent_repos_relpath,
+ const char *parent_repos_root_url,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ if (info->repos_relpath && info->repos_root_url)
+ {
+ *repos_relpath = info->repos_relpath;
+ *repos_root_url = info->repos_root_url;
+ }
+ else if (parent_repos_relpath && parent_repos_root_url)
+ {
+ *repos_relpath = svn_relpath_join(parent_repos_relpath,
+ svn_dirent_basename(local_abspath,
+ NULL),
+ scratch_pool);
+ *repos_root_url = parent_repos_root_url;
+ }
+ else if (info->status == svn_wc__db_status_added)
+ {
+ SVN_ERR(svn_wc__db_scan_addition(NULL, NULL,
+ repos_relpath, repos_root_url,
+ NULL, NULL, NULL, NULL, NULL,
+ db, local_abspath,
+ result_pool, scratch_pool));
+ }
+ else if (info->have_base)
+ {
+ SVN_ERR(svn_wc__db_scan_base_repos(repos_relpath, repos_root_url, NULL,
+ db, local_abspath,
+ result_pool, scratch_pool));
+ }
+ else
+ {
+ *repos_relpath = NULL;
+ *repos_root_url = NULL;
+ }
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
internal_status(svn_wc_status3_t **status,
svn_wc__db_t *db,
@@ -262,6 +371,7 @@ assemble_status(svn_wc_status3_t **statu
const char *local_abspath,
const char *parent_repos_root_url,
const char *parent_repos_relpath,
+ const struct svn_wc__db_info_t *info,
const svn_io_dirent2_t *dirent,
svn_boolean_t get_all,
const svn_lock_t *repos_lock,
@@ -269,76 +379,32 @@ assemble_status(svn_wc_status3_t **statu
apr_pool_t *scratch_pool)
{
svn_wc_status3_t *stat;
- svn_wc__db_status_t db_status;
- svn_wc__db_kind_t db_kind;
- const char *repos_relpath;
- const char *repos_root_url;
svn_boolean_t switched_p = FALSE;
- svn_boolean_t prop_modified_p;
- svn_wc__db_lock_t *lock;
- svn_revnum_t revision;
- svn_revnum_t changed_rev;
- const char *changed_author;
- apr_time_t changed_date;
- const char *changelist;
- svn_boolean_t have_base;
- svn_boolean_t conflicted;
svn_boolean_t copied = FALSE;
- svn_filesize_t translated_size;
- apr_time_t last_mod_time;
- svn_depth_t depth;
+ svn_boolean_t conflicted;
svn_error_t *err;
+ const char *repos_relpath;
+ const char *repos_root_url;
/* Defaults for two main variables. */
enum svn_wc_status_kind node_status = svn_wc_status_normal;
enum svn_wc_status_kind text_status = svn_wc_status_normal;
enum svn_wc_status_kind prop_status = svn_wc_status_none;
- SVN_ERR(svn_wc__db_read_info(&db_status, &db_kind, &revision,
- &repos_relpath, &repos_root_url, NULL,
- &changed_rev, &changed_date,
- &changed_author, &last_mod_time, &depth, NULL,
- &translated_size, NULL, &changelist, NULL, NULL,
- NULL, NULL, &prop_modified_p, &have_base, NULL,
- &conflicted, &lock, db, local_abspath,
- result_pool, scratch_pool));
- if (!repos_relpath)
- {
- /* The node is not switched, so imply from parent if possible */
-
- if (parent_repos_relpath != NULL)
- repos_relpath = svn_relpath_join(parent_repos_relpath,
- svn_dirent_basename(local_abspath,
- NULL),
- result_pool);
- else if (db_status == svn_wc__db_status_added)
- SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, &repos_relpath,
- &repos_root_url, NULL, NULL, NULL,
- NULL, NULL,
- db, local_abspath,
- result_pool, scratch_pool));
- else if (have_base)
- SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath,
- &repos_root_url, NULL,
- db, local_abspath,
- result_pool, scratch_pool));
+ if (!info)
+ SVN_ERR(read_info(&info, local_abspath, db, result_pool, scratch_pool));
- switched_p = FALSE;
- }
- else if (!parent_repos_relpath)
+ if (!info->repos_relpath || !parent_repos_relpath)
switched_p = FALSE;
else
{
/* A node is switched if it doesn't have the implied repos_relpath */
-
- const char *name = svn_relpath_is_child(parent_repos_relpath, repos_relpath, NULL);
+ const char *name = svn_relpath_is_child(parent_repos_relpath,
+ info->repos_relpath, NULL);
switched_p = !name || (strcmp(name, svn_dirent_basename(local_abspath, NULL)) != 0);
}
- if (!repos_root_url && parent_repos_root_url)
- repos_root_url = apr_pstrdup(result_pool, parent_repos_root_url);
-
/* Examine whether our target is missing or obstructed or missing.
While we are not completely in single-db mode yet, data about
@@ -347,14 +413,14 @@ assemble_status(svn_wc_status3_t **statu
mode these obstructions are no longer reported and we have
to detect obstructions by looking at the on disk status in DIRENT.
*/
- if (db_kind == svn_wc__db_kind_dir)
+ if (info->kind == svn_wc__db_kind_dir)
{
- if (db_status == svn_wc__db_status_incomplete)
+ if (info->status == svn_wc__db_status_incomplete)
{
/* Highest precedence. */
node_status = svn_wc_status_incomplete;
}
- else if (db_status == svn_wc__db_status_deleted)
+ else if (info->status == svn_wc__db_status_deleted)
{
node_status = svn_wc_status_deleted;
@@ -374,7 +440,7 @@ assemble_status(svn_wc_status3_t **statu
}
else
{
- if (db_status == svn_wc__db_status_deleted)
+ if (info->status == svn_wc__db_status_deleted)
{
node_status = svn_wc_status_deleted;
@@ -400,13 +466,11 @@ assemble_status(svn_wc_status3_t **statu
It means that no further information is available, and we should skip
all this work. */
if (node_status == svn_wc_status_normal
- || (node_status == svn_wc_status_missing && db_kind != svn_wc__db_kind_dir))
+ || (node_status == svn_wc_status_missing
+ && info->kind != svn_wc__db_kind_dir))
{
svn_boolean_t has_props;
svn_boolean_t text_modified_p = FALSE;
-#ifdef HAVE_SYMLINK
- svn_boolean_t wc_special;
-#endif /* HAVE_SYMLINK */
/* Implement predecence rules: */
@@ -415,43 +479,30 @@ assemble_status(svn_wc_status3_t **statu
precedence over M. */
/* Does the node have props? */
- if (db_status == svn_wc__db_status_deleted)
+ if (info->status == svn_wc__db_status_deleted)
has_props = FALSE; /* Not interesting */
- else if (prop_modified_p)
+ else if (info->props_mod)
has_props = TRUE;
else
- {
- apr_hash_t *props;
-
- SVN_ERR(svn_wc__db_read_pristine_props(&props, db, local_abspath,
- scratch_pool, scratch_pool));
+ has_props = info->has_props;
- has_props = (props != NULL && apr_hash_count(props) > 0);
- }
if (has_props)
prop_status = svn_wc_status_normal;
/* If the entry has a properties, see if it has local changes. */
if (has_props)
- prop_status = prop_modified_p ? svn_wc_status_modified
+ prop_status = info->props_mod ? svn_wc_status_modified
: svn_wc_status_normal;
-#ifdef HAVE_SYMLINK
- if (has_props)
- SVN_ERR(svn_wc__get_translate_info(NULL, NULL, NULL,
- &wc_special,
- db, local_abspath,
- scratch_pool, scratch_pool));
- else
- wc_special = FALSE;
-#endif /* HAVE_SYMLINK */
+ /* ### Don't read properties twice! Cache wc_special in
+ svn_wc__db_read_children_info. */
/* If the entry is a file, check for textual modifications */
if (node_status != svn_wc_status_missing
- && (db_kind == svn_wc__db_kind_file
- || db_kind == svn_wc__db_kind_symlink)
+ && (info->kind == svn_wc__db_kind_file
+ || info->kind == svn_wc__db_kind_symlink)
#ifdef HAVE_SYMLINK
- && (wc_special == (dirent && dirent->special))
+ && (info->special == (dirent && dirent->special))
#endif /* HAVE_SYMLINK */
)
{
@@ -463,8 +514,8 @@ assemble_status(svn_wc_status3_t **statu
if (dirent
&& dirent->filesize != SVN_INVALID_FILESIZE
&& dirent->mtime != 0
- && translated_size == dirent->filesize
- && last_mod_time == dirent->mtime)
+ && info->translated_size == dirent->filesize
+ && info->last_mod_time == dirent->mtime)
text_modified_p = FALSE;
else
{
@@ -488,14 +539,16 @@ assemble_status(svn_wc_status3_t **statu
}
}
#ifdef HAVE_SYMLINK
- else if (wc_special != (dirent && dirent->special))
+ else if (info->special != (dirent && dirent->special))
node_status = svn_wc_status_obstructed;
#endif /* HAVE_SYMLINK */
+
if (text_modified_p)
text_status = svn_wc_status_modified;
}
+ conflicted = info->conflicted;
if (conflicted)
{
svn_boolean_t text_conflicted, prop_conflicted, tree_conflicted;
@@ -517,7 +570,7 @@ assemble_status(svn_wc_status3_t **statu
of medium precedence. They also override any C or M that may
be in the prop_status field at this point, although they do not
override a C text status.*/
- if (db_status == svn_wc__db_status_added)
+ if (info->status == svn_wc__db_status_added)
{
svn_wc_schedule_t schedule;
SVN_ERR(svn_wc__internal_node_get_schedule(&schedule, &copied,
@@ -546,21 +599,26 @@ assemble_status(svn_wc_status3_t **statu
|| (node_status == svn_wc_status_normal))
&& (! switched_p)
- && (! lock)
+ && (! info->lock)
&& (! repos_lock)
- && (! changelist)
+ && (! info->changelist)
&& (! conflicted))
{
*status = NULL;
return SVN_NO_ERROR;
}
+ SVN_ERR(get_repos_root_url_relpath(&repos_relpath, &repos_root_url, info,
+ parent_repos_relpath,
+ parent_repos_root_url,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
/* 6. Build and return a status structure. */
stat = apr_pcalloc(result_pool, sizeof(**status));
- switch (db_kind)
+ switch (info->kind)
{
case svn_wc__db_kind_dir:
stat->kind = svn_node_dir;
@@ -573,7 +631,7 @@ assemble_status(svn_wc_status3_t **statu
default:
stat->kind = svn_node_unknown;
}
- stat->depth = depth;
+ stat->depth = info->depth;
stat->node_status = node_status;
stat->text_status = text_status;
stat->prop_status = prop_status;
@@ -583,24 +641,24 @@ assemble_status(svn_wc_status3_t **statu
stat->switched = switched_p;
stat->copied = copied;
stat->repos_lock = repos_lock;
- stat->revision = revision;
- stat->changed_rev = changed_rev;
- stat->changed_author = changed_author;
- stat->changed_date = changed_date;
+ stat->revision = info->revnum;
+ stat->changed_rev = info->changed_rev;
+ stat->changed_author = info->changed_author;
+ stat->changed_date = info->changed_date;
stat->ood_kind = svn_node_none;
stat->ood_changed_rev = SVN_INVALID_REVNUM;
stat->ood_changed_date = 0;
stat->ood_changed_author = NULL;
- if (lock)
+ if (info->lock)
{
svn_lock_t *lck = apr_pcalloc(result_pool, sizeof(*lck));
lck->path = repos_relpath;
- lck->token = lock->token;
- lck->owner = lock->owner;
- lck->comment = lock->comment;
- lck->creation_date = lock->date;
+ lck->token = info->lock->token;
+ lck->owner = info->lock->owner;
+ lck->comment = info->lock->comment;
+ lck->creation_date = info->lock->date;
stat->lock = lck;
}
else
@@ -608,7 +666,7 @@ assemble_status(svn_wc_status3_t **statu
stat->conflicted = conflicted;
stat->versioned = TRUE;
- stat->changelist = changelist;
+ stat->changelist = info->changelist;
stat->repos_root_url = repos_root_url;
stat->repos_relpath = repos_relpath;
@@ -699,6 +757,7 @@ send_status_structure(const struct walk_
const char *local_abspath,
const char *parent_repos_root_url,
const char *parent_repos_relpath,
+ const struct svn_wc__db_info_t *info,
const svn_io_dirent2_t *dirent,
svn_boolean_t get_all,
svn_wc_status_func4_t status_func,
@@ -711,30 +770,13 @@ send_status_structure(const struct walk_
/* Check for a repository lock. */
if (wb->repos_locks)
{
- const char *repos_relpath;
- svn_wc__db_status_t status;
- svn_boolean_t have_base;
-
- SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, &repos_relpath, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, &have_base, NULL, NULL, NULL,
- wb->db, local_abspath,
- scratch_pool, scratch_pool));
-
- /* A switched path can be deleted: check the right relpath */
- if (status == svn_wc__db_status_deleted && have_base)
- SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, NULL,
- NULL, wb->db, local_abspath,
- scratch_pool, scratch_pool));
-
- if (!repos_relpath && parent_repos_relpath)
- repos_relpath = svn_relpath_join(parent_repos_relpath,
- svn_dirent_basename(local_abspath,
- NULL),
- scratch_pool);
-
+ const char *repos_relpath, *repos_root_url;
+ SVN_ERR(get_repos_root_url_relpath(&repos_relpath, &repos_root_url,
+ info, parent_repos_relpath,
+ parent_repos_root_url,
+ wb->db, local_abspath,
+ scratch_pool, scratch_pool));
if (repos_relpath)
{
/* repos_lock still uses the deprecated filesystem absolute path
@@ -748,7 +790,7 @@ send_status_structure(const struct walk_
SVN_ERR(assemble_status(&statstruct, wb->db, local_abspath,
parent_repos_root_url, parent_repos_relpath,
- dirent, get_all,
+ info, dirent, get_all,
repos_lock, scratch_pool, scratch_pool));
if (statstruct && status_func)
@@ -910,6 +952,7 @@ get_dir_status(const struct walk_status_
svn_boolean_t skip_this_dir,
const char *parent_repos_root_url,
const char *parent_repos_relpath,
+ const struct svn_wc__db_info_t *dir_info,
const svn_io_dirent2_t *dirent,
const apr_array_header_t *ignores,
svn_depth_t depth,
@@ -931,6 +974,7 @@ handle_dir_entry(const struct walk_statu
svn_wc__db_kind_t db_kind,
const char *dir_repos_root_url,
const char *dir_repos_relpath,
+ const struct svn_wc__db_info_t *entry_info,
svn_io_dirent2_t *dirent,
const apr_array_header_t *ignores,
svn_depth_t depth,
@@ -963,6 +1007,7 @@ handle_dir_entry(const struct walk_statu
{
SVN_ERR(get_dir_status(wb, local_abspath, NULL, FALSE,
dir_repos_root_url, dir_repos_relpath,
+ entry_info,
dirent, ignores, depth, get_all, no_ignore,
status_func, status_baton, cancel_func,
cancel_baton,
@@ -975,7 +1020,7 @@ handle_dir_entry(const struct walk_statu
SVN_ERR(send_status_structure(wb, local_abspath,
dir_repos_root_url,
dir_repos_relpath,
- dirent, get_all,
+ entry_info, dirent, get_all,
status_func, status_baton, pool));
}
}
@@ -985,7 +1030,7 @@ handle_dir_entry(const struct walk_statu
SVN_ERR(send_status_structure(wb, local_abspath,
dir_repos_root_url,
dir_repos_relpath,
- dirent, get_all,
+ entry_info, dirent, get_all,
status_func, status_baton, pool));
}
@@ -1067,6 +1112,7 @@ get_dir_status(const struct walk_status_
svn_boolean_t skip_this_dir,
const char *parent_repos_root_url,
const char *parent_repos_relpath,
+ const struct svn_wc__db_info_t *dir_info,
const svn_io_dirent2_t *dirent,
const apr_array_header_t *ignore_patterns,
svn_depth_t depth,
@@ -1083,29 +1129,20 @@ get_dir_status(const struct walk_status_
const char *dir_repos_relpath;
apr_hash_t *dirents, *nodes, *conflicts, *all_children;
apr_array_header_t *patterns = NULL;
- svn_wc__db_status_t dir_status;
- svn_depth_t dir_depth;
apr_pool_t *iterpool, *subpool = svn_pool_create(scratch_pool);
svn_error_t *err;
- /* See if someone wants to cancel this operation. */
if (cancel_func)
SVN_ERR(cancel_func(cancel_baton));
if (depth == svn_depth_unknown)
depth = svn_depth_infinity;
- /* Make our iteration pool. */
iterpool = svn_pool_create(subpool);
- /* Load list of childnodes. */
- {
- const apr_array_header_t *child_nodes;
-
- SVN_ERR(svn_wc__db_read_children(&child_nodes, wb->db, local_abspath,
- iterpool, iterpool));
- SVN_ERR(svn_hash_from_cstring_keys(&nodes, child_nodes, subpool));
- }
+ SVN_ERR(svn_wc__db_read_children_info(&nodes, &conflicts,
+ wb->db, local_abspath,
+ subpool, iterpool));
err = svn_io_get_dirents3(&dirents, local_abspath, FALSE, subpool, subpool);
if (err
@@ -1118,77 +1155,36 @@ get_dir_status(const struct walk_status_
else
SVN_ERR(err);
- SVN_ERR(svn_wc__db_read_info(&dir_status, NULL, NULL, &dir_repos_relpath,
- &dir_repos_root_url, NULL, NULL, NULL, NULL,
- NULL, &dir_depth, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, wb->db, local_abspath, scratch_pool,
- scratch_pool));
-
- if (dir_repos_relpath == NULL)
- {
- if (parent_repos_root_url != NULL)
- {
- dir_repos_root_url = parent_repos_root_url;
- dir_repos_relpath = svn_relpath_join(
- parent_repos_relpath,
- svn_dirent_basename(local_abspath, NULL),
- scratch_pool);
- }
- else if (dir_status != svn_wc__db_status_deleted
- && dir_status != svn_wc__db_status_added)
- SVN_ERR(svn_wc__db_scan_base_repos(&dir_repos_relpath,
- &dir_repos_root_url,
- NULL, wb->db, local_abspath,
- scratch_pool, scratch_pool));
- else
- {
- dir_repos_relpath = NULL;
- dir_repos_root_url = NULL;
- }
- }
-
+ if (!dir_info)
+ SVN_ERR(read_info(&dir_info, local_abspath, wb->db,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(get_repos_root_url_relpath(&dir_repos_relpath, &dir_repos_root_url,
+ dir_info, parent_repos_relpath,
+ parent_repos_root_url,
+ wb->db, local_abspath,
+ scratch_pool, scratch_pool));
if (selected == NULL)
{
- const apr_array_header_t *victims;
- /* Create a hash containing all children */
+ /* Create a hash containing all children. The source hashes
+ don't all map the same types, but only the keys of the result
+ hash are subsequently used. */
all_children = apr_hash_overlay(subpool, nodes, dirents);
-
- SVN_ERR(svn_wc__db_read_conflict_victims(&victims,
- wb->db, local_abspath,
- iterpool, iterpool));
-
- SVN_ERR(svn_hash_from_cstring_keys(&conflicts, victims, subpool));
-
- /* Optimize for the no-tree-conflict case */
if (apr_hash_count(conflicts) > 0)
all_children = apr_hash_overlay(subpool, conflicts, all_children);
}
else
{
- const svn_wc_conflict_description2_t *tc;
- const char *selected_abspath;
-
- conflicts = apr_hash_make(subpool);
+ /* Create a hash containing just selected */
all_children = apr_hash_make(subpool);
-
apr_hash_set(all_children, selected, APR_HASH_KEY_STRING, selected);
-
- selected_abspath = svn_dirent_join(local_abspath, selected, iterpool);
-
- SVN_ERR(svn_wc__db_op_read_tree_conflict(&tc, wb->db, selected_abspath,
- iterpool, iterpool));
-
- /* Note this path if a tree conflict is present. */
- if (tc != NULL)
- apr_hash_set(conflicts, selected, APR_HASH_KEY_STRING, "");
}
/* If "this dir" has "svn:externals" property set on it, send the name and
value to wc->external_func along with this directory's depth. (Also,
we want to track the externals internally so we can report status more
accurately.) */
- SVN_ERR(handle_externals(wb, local_abspath, dir_depth, iterpool));
+ SVN_ERR(handle_externals(wb, local_abspath, dir_info->depth, iterpool));
if (!selected)
{
@@ -1197,7 +1193,7 @@ get_dir_status(const struct walk_status_
SVN_ERR(send_status_structure(wb, local_abspath,
parent_repos_root_url,
parent_repos_relpath,
- dirent, get_all,
+ dir_info, dirent, get_all,
status_func, status_baton,
iterpool));
@@ -1215,6 +1211,7 @@ get_dir_status(const struct walk_status_
apr_ssize_t klen;
const char *node_abspath;
svn_io_dirent2_t *dirent_p;
+ const struct svn_wc__db_info_t *info;
svn_pool_clear(iterpool);
@@ -1224,32 +1221,24 @@ get_dir_status(const struct walk_status_
dirent_p = apr_hash_get(dirents, key, klen);
- if (apr_hash_get(nodes, key, klen))
+ info = apr_hash_get(nodes, key, klen);
+ if (info)
{
- /* Versioned node */
- svn_wc__db_status_t node_status;
- svn_wc__db_kind_t node_kind;
-
- SVN_ERR(svn_wc__db_read_info(&node_status, &node_kind, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- wb->db, node_abspath, iterpool, iterpool));
-
- if (node_status != svn_wc__db_status_not_present
- && node_status != svn_wc__db_status_excluded
- && node_status != svn_wc__db_status_absent)
+ if (info->status != svn_wc__db_status_not_present
+ && info->status != svn_wc__db_status_excluded
+ && info->status != svn_wc__db_status_absent)
{
- if (depth == svn_depth_files && node_kind == svn_wc__db_kind_dir)
+ if (depth == svn_depth_files && info->kind == svn_wc__db_kind_dir)
continue;
/* Handle this entry (possibly recursing). */
SVN_ERR(handle_dir_entry(wb,
node_abspath,
- node_status,
- node_kind,
+ info->status,
+ info->kind,
dir_repos_root_url,
dir_repos_relpath,
+ info,
dirent_p,
ignore_patterns,
depth == svn_depth_infinity
@@ -1592,6 +1581,7 @@ make_dir_baton(void **dir_baton,
SVN_ERR(get_dir_status(&eb->wb, local_abspath, NULL, TRUE,
status_in_parent->repos_root_url,
status_in_parent->repos_relpath,
+ NULL,
NULL /* dirent */, ignores,
d->depth == svn_depth_files
? svn_depth_files
@@ -1765,6 +1755,7 @@ handle_statii(struct edit_baton *eb,
SVN_ERR(get_dir_status(&eb->wb,
local_abspath, NULL, TRUE,
dir_repos_root_url, dir_repos_relpath,
+ NULL,
NULL /* dirent */,
ignores, depth, eb->get_all, eb->no_ignore,
status_func, status_baton,
@@ -2033,7 +2024,7 @@ close_directory(void *dir_baton,
{
SVN_ERR(get_dir_status(&eb->wb,
eb->target_abspath, NULL, TRUE,
- NULL, NULL, NULL /* dirent */,
+ NULL, NULL, NULL, NULL /* dirent */,
eb->ignores,
eb->default_depth,
eb->get_all, eb->no_ignore,
@@ -2415,7 +2406,7 @@ svn_wc_walk_status(svn_wc_context_t *wc_
anchor_abspath,
target_name,
skip_root,
- NULL, NULL, /* parent info */
+ NULL, NULL, NULL, /* parent info */
dirent,
ignore_patterns,
depth,
@@ -2553,6 +2544,7 @@ internal_status(svn_wc_status3_t **statu
return svn_error_return(assemble_status(status, db, local_abspath,
parent_repos_root_url,
parent_repos_relpath,
+ NULL,
dirent,
TRUE /* get_all */,
NULL /* repos_lock */,
Modified: subversion/branches/py-tests-as-modules/subversion/libsvn_wc/translate.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/subversion/libsvn_wc/translate.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/subversion/libsvn_wc/translate.c (original)
+++ subversion/branches/py-tests-as-modules/subversion/libsvn_wc/translate.c Thu Nov 4 20:48:21 2010
@@ -376,6 +376,7 @@ svn_wc__maybe_set_read_only(svn_boolean_
apr_pool_t *scratch_pool)
{
const svn_string_t *needs_lock;
+ svn_wc__db_status_t status;
svn_wc__db_lock_t *lock;
svn_error_t *err;
@@ -384,7 +385,7 @@ svn_wc__maybe_set_read_only(svn_boolean_
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
- err = svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL,
+ err = svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
@@ -399,6 +400,11 @@ svn_wc__maybe_set_read_only(svn_boolean_
else if (err)
return svn_error_return(err);
else if (lock)
+ /* ### Is this "we have the lock?" */
+ return SVN_NO_ERROR;
+
+ /* Files that aren't in the repository yet should be left writable. */
+ if (status == svn_wc__db_status_added)
return SVN_NO_ERROR;
SVN_ERR(svn_wc__internal_propget(&needs_lock, db, local_abspath,