Author: brane
Date: Tue Apr 1 10:41:29 2014
New Revision: 1583599
URL: http://svn.apache.org/r1583599
Log:
On the remote-only-status branch: Do not report local replacements.
* subversion/include/svn_client.h (svn_client_status6): Update docstring.
* subversion/libsvn_wc/status.c (assemble_status): Ignore local adds.
Report local replacements as deletions of the working node.
(get_dir_status): Remove redundant (and incorrect) filter for additions.
* subversion/tests/libsvn_client/client-test.c (test_remote_only_status):
Extend test case with an example of a local replacement.
Modified:
subversion/branches/remote-only-status/subversion/include/svn_client.h
subversion/branches/remote-only-status/subversion/libsvn_wc/status.c
subversion/branches/remote-only-status/subversion/tests/libsvn_client/client-test.c
Modified: subversion/branches/remote-only-status/subversion/include/svn_client.h
URL:
http://svn.apache.org/viewvc/subversion/branches/remote-only-status/subversion/include/svn_client.h?rev=1583599&r1=1583598&r2=1583599&view=diff
==============================================================================
--- subversion/branches/remote-only-status/subversion/include/svn_client.h
(original)
+++ subversion/branches/remote-only-status/subversion/include/svn_client.h Tue
Apr 1 10:41:29 2014
@@ -2512,6 +2512,13 @@ typedef svn_error_t *(*svn_client_status
* - If @a check_working_copy is not set, do not scan the working
* copy for locally modified and missing files. This parameter
* will be ignored unless @a check_out_of_date is set.
+ * When set, the status report will be different in the following
+ * details:
+ *
+ * -- Local modifications, missing nodes and locally added nodes
+ * will not be reported.
+ * -- Locally replaced nodes will be reported as deletions of
+ * the original node instead of as replacements.
*
* If @a no_ignore is @c FALSE, don't report any file or directory (or
* recurse into any directory) that is found by recursion (as opposed to
Modified: subversion/branches/remote-only-status/subversion/libsvn_wc/status.c
URL:
http://svn.apache.org/viewvc/subversion/branches/remote-only-status/subversion/libsvn_wc/status.c?rev=1583599&r1=1583598&r2=1583599&view=diff
==============================================================================
--- subversion/branches/remote-only-status/subversion/libsvn_wc/status.c
(original)
+++ subversion/branches/remote-only-status/subversion/libsvn_wc/status.c Tue
Apr 1 10:41:29 2014
@@ -573,7 +573,42 @@ assemble_status(svn_wc_status3_t **statu
if (below_working != svn_wc__db_status_not_present
&& below_working != svn_wc__db_status_deleted)
{
- node_status = svn_wc_status_replaced;
+ if (check_working_copy)
+ node_status = svn_wc_status_replaced;
+ else
+ {
+ /* This is a remote-only walk; report the
+ base node info instead of the replacement. */
+ const char *target;
+ const svn_checksum_t *checksum;
+ struct svn_wc__db_info_t *base_info =
+ apr_palloc(scratch_pool, sizeof(*base_info));
+ memcpy(base_info, info, sizeof(*base_info));
+ SVN_ERR(svn_wc__db_read_pristine_info(
+ &base_info->status,
+ &base_info->kind,
+ &base_info->changed_rev,
+ &base_info->changed_date,
+ &base_info->changed_author,
+ &base_info->depth,
+ &checksum, &target,
+ &base_info->had_props, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__db_base_get_info(
+ NULL, NULL, &base_info->revnum,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+ base_info->has_checksum = (checksum != NULL);
+#ifdef HAVE_SYMLINK
+ base_info->special = (target != NULL);
+#endif
+ node_status = svn_wc_status_deleted;
+ info = base_info;
+ }
}
else
node_status = svn_wc_status_added;
@@ -610,6 +645,16 @@ assemble_status(svn_wc_status3_t **statu
&& prop_status != svn_wc_status_none)
node_status = prop_status;
+
+ /* Ignore local additions in remote-only mode */
+ if (!check_working_copy
+ && node_status == svn_wc_status_added
+ && !moved_from_abspath)
+ {
+ *status = NULL;
+ return SVN_NO_ERROR;
+ }
+
/* 5. Easy out: unless we're fetching -every- node, don't bother
to allocate a struct for an uninteresting node.
@@ -1352,11 +1397,6 @@ get_dir_status(const struct walk_status_
child_dirent = apr_hash_get(dirents, key, klen);
child_info = apr_hash_get(nodes, key, klen);
- /* If this is a remote-only status walk, ignore locally added nodes. */
- if (!wb->check_working_copy && child_info
- && child_info->status == svn_wc__db_status_added)
- continue;
-
SVN_ERR(one_child_status(wb,
child_abspath,
local_abspath,
Modified:
subversion/branches/remote-only-status/subversion/tests/libsvn_client/client-test.c
URL:
http://svn.apache.org/viewvc/subversion/branches/remote-only-status/subversion/tests/libsvn_client/client-test.c?rev=1583599&r1=1583598&r2=1583599&view=diff
==============================================================================
---
subversion/branches/remote-only-status/subversion/tests/libsvn_client/client-test.c
(original)
+++
subversion/branches/remote-only-status/subversion/tests/libsvn_client/client-test.c
Tue Apr 1 10:41:29 2014
@@ -890,7 +890,7 @@ test_remote_only_status(const svn_test_o
+1, svn_wc_status_normal, svn_wc_status_normal, svn_wc_status_none,
+2, svn_wc_status_modified, svn_wc_status_modified, svn_wc_status_none },
{ "B",
- +1, svn_wc_status_normal, svn_wc_status_normal, svn_wc_status_none,
+ +1, svn_wc_status_deleted, svn_wc_status_normal, svn_wc_status_none,
+2, svn_wc_status_none, svn_wc_status_none, svn_wc_status_none },
{ "C",
+1, svn_wc_status_normal, svn_wc_status_normal, svn_wc_status_none,
@@ -970,6 +970,15 @@ test_remote_only_status(const svn_test_o
FALSE, FALSE, FALSE, FALSE,
ctx, pool));
+ /* Replace a local dir */
+ local_path = svn_dirent_join(wc_path, "B", pool);
+ targets = apr_array_make(pool, 1, sizeof(const char*));
+ APR_ARRAY_PUSH(targets, const char*) = local_path;
+ SVN_ERR(svn_client_delete4(targets, FALSE, FALSE, NULL, NULL, NULL,
+ ctx, pool));
+ SVN_ERR(svn_client_mkdir4(targets, FALSE, NULL, NULL, NULL,
+ ctx, pool));
+
/* Modify a local dir's props */
local_path = svn_dirent_join(wc_path, "D", pool);
targets = apr_array_make(pool, 1, sizeof(const char*));