You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/03/26 15:41:37 UTC
svn commit: r1581868 - in
/subversion/branches/remote-only-status/subversion: include/
include/private/ libsvn_client/ libsvn_wc/ tests/libsvn_client/
Author: brane
Date: Wed Mar 26 14:41:36 2014
New Revision: 1581868
URL: http://svn.apache.org/r1581868
Log:
On the remote-only-status branch: Revise the svn_client_status API.
* subversion/include/svn_client.h
(svn_client_status6): New; updated docstring from previous version.
(svn_client_status5): Deprecate.
* subversion/include/private/svn_wc_private.h
(svn_wc__get_status_editor): Add ignore_local_mods parameter.
* subversion/libsvn_client/status.c
(svn_client_status6): Renamed from svn_client_status5.
Renamed parameter 'update' to 'check_out_of_date' and added
parameter 'ignore_local_mods'.
(do_external_status): Renamed parameter 'update' to 'check_out_of_date'
and added parameter 'ignore_local_mods'. Calls svn_client_status6.
* subversion/libsvn_client/deprecated.c
(svn_client_status5): Implement backwards-compat wrapper for the revised API.
* subversion/libsvn_wc/status.c
(struct edit_baton): New member 'ignore_local_mods'
(internal_status, tweak_statushash): New parameter 'ignore_local_mods'.
Update all callers.
(svn_wc__get_status_editor): New parameter 'ignore_local_mods'.
(internal_status): New parameter 'ignore_local_mods'.
Tweak implementation to (temporarily) work when it's set.
(svn_wc_status3): Update call to internal_status().
* subversion/libsvn_wc/deprecated.c
(svn_wc_get_status_editor5): Invoke svn_wc__get_status_editor with
ignore_local_mods = FALSE.
* subversion/tests/libsvn_client/client-test.c
(test_remote_only_status,
remote_only_status_receiver,
status_to_char, compare_status_paths): New test case and helper functions.
(test_funcs): Add test_remote_only_status, marked as XFAIL.
Modified:
subversion/branches/remote-only-status/subversion/include/private/svn_wc_private.h
subversion/branches/remote-only-status/subversion/include/svn_client.h
subversion/branches/remote-only-status/subversion/libsvn_client/deprecated.c
subversion/branches/remote-only-status/subversion/libsvn_client/status.c
subversion/branches/remote-only-status/subversion/libsvn_wc/deprecated.c
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/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/remote-only-status/subversion/include/private/svn_wc_private.h?rev=1581868&r1=1581867&r2=1581868&view=diff
==============================================================================
--- subversion/branches/remote-only-status/subversion/include/private/svn_wc_private.h (original)
+++ subversion/branches/remote-only-status/subversion/include/private/svn_wc_private.h Wed Mar 26 14:41:36 2014
@@ -1306,8 +1306,8 @@ svn_wc__resolve_relative_external_url(co
*
* Assuming the target is a directory, then:
*
- * - If @a get_all is FALSE, then only locally-modified entries will be
- * returned. If TRUE, then all entries will be returned.
+ * - If @a get_all is @c FALSE, then only locally-modified entries will be
+ * returned. If @c TRUE, then all entries will be returned.
*
* - If @a depth is #svn_depth_empty, a status structure will
* be returned for the target only; if #svn_depth_files, for the
@@ -1322,6 +1322,11 @@ svn_wc__resolve_relative_external_url(co
* If the given @a depth is incompatible with the depth found in a
* working copy directory, the found depth always governs.
*
+ * If @a ignore_local_mods is set, local modifications will be ignored
+ * and only the difference between the @c BASE version and the remote
+ * repository will be reported.
+ * ### TODO: describe interaction with @a get_all.
+ *
* If @a no_ignore is set, statuses that would typically be ignored
* will instead be reported.
*
@@ -1356,6 +1361,7 @@ svn_wc__get_status_editor(const svn_delt
const char *target_basename,
svn_depth_t depth,
svn_boolean_t get_all,
+ svn_boolean_t ignore_local_mods,
svn_boolean_t no_ignore,
svn_boolean_t depth_as_sticky,
svn_boolean_t server_performs_filtering,
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=1581868&r1=1581867&r2=1581868&view=diff
==============================================================================
--- subversion/branches/remote-only-status/subversion/include/svn_client.h (original)
+++ subversion/branches/remote-only-status/subversion/include/svn_client.h Wed Mar 26 14:41:36 2014
@@ -2501,12 +2501,17 @@ typedef svn_error_t *(*svn_client_status
* retrieve only "interesting" entries (local mods and/or
* out of date).
*
- * - If @a update is set, contact the repository and augment the
- * status structures with information about out-of-dateness (with
- * respect to @a revision). Also, if @a result_rev is not @c NULL,
- * set @a *result_rev to the actual revision against which the
- * working copy was compared (@a *result_rev is not meaningful unless
- * @a update is set).
+ * - If @a check_out_of_date is set, contact the repository and
+ * augment the status structures with information about
+ * out-of-dateness (with respect to @a revision). Also, if @a
+ * result_rev is not @c NULL, set @a *result_rev to the actual
+ * revision against which the working copy was compared (@a
+ * *result_rev is not meaningful unless @a check_out_of_date is
+ * set).
+ *
+ * - If @a ignore_local_mods is set, do not take local
+ * modifications into account. This parameter will be ignored
+ * unless @a check_out_of_date is also set.
*
* 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
@@ -2537,8 +2542,34 @@ typedef svn_error_t *(*svn_client_status
*
* All temporary allocations are performed in @a scratch_pool.
*
+ * @since New in 1.9.
+ */
+svn_error_t *
+svn_client_status6(svn_revnum_t *result_rev,
+ svn_client_ctx_t *ctx,
+ const char *path,
+ const svn_opt_revision_t *revision,
+ svn_depth_t depth,
+ svn_boolean_t get_all,
+ svn_boolean_t check_out_of_date, /* RENAMED FROM: 'update' */
+ svn_boolean_t ignore_local_mods, /* NEW */
+ svn_boolean_t no_ignore,
+ svn_boolean_t ignore_externals,
+ svn_boolean_t depth_as_sticky,
+ const apr_array_header_t *changelists,
+ svn_client_status_func_t status_func,
+ void *status_baton,
+ apr_pool_t *scratch_pool);
+
+
+/**
+ * Same as svn_client_status6(), but with @a check_out_of_date set to
+ * @a update and @a ignore_local_mods set to @c FALSE.
+ *
* @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_client_status5(svn_revnum_t *result_rev,
svn_client_ctx_t *ctx,
Modified: subversion/branches/remote-only-status/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/remote-only-status/subversion/libsvn_client/deprecated.c?rev=1581868&r1=1581867&r2=1581868&view=diff
==============================================================================
--- subversion/branches/remote-only-status/subversion/libsvn_client/deprecated.c (original)
+++ subversion/branches/remote-only-status/subversion/libsvn_client/deprecated.c Wed Mar 26 14:41:36 2014
@@ -2207,6 +2207,28 @@ svn_client_proplist(apr_array_header_t *
/*** From status.c ***/
+svn_error_t *
+svn_client_status5(svn_revnum_t *result_rev,
+ svn_client_ctx_t *ctx,
+ const char *path,
+ const svn_opt_revision_t *revision,
+ svn_depth_t depth,
+ svn_boolean_t get_all,
+ svn_boolean_t update,
+ svn_boolean_t no_ignore,
+ svn_boolean_t ignore_externals,
+ svn_boolean_t depth_as_sticky,
+ const apr_array_header_t *changelists,
+ svn_client_status_func_t status_func,
+ void *status_baton,
+ apr_pool_t *scratch_pool)
+{
+ return svn_client_status6(result_rev, ctx, path, revision, depth,
+ get_all, update, TRUE, no_ignore,
+ ignore_externals, depth_as_sticky, changelists,
+ status_func, status_baton, scratch_pool);
+}
+
struct status4_wrapper_baton
{
svn_wc_context_t *wc_ctx;
Modified: subversion/branches/remote-only-status/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/remote-only-status/subversion/libsvn_client/status.c?rev=1581868&r1=1581867&r2=1581868&view=diff
==============================================================================
--- subversion/branches/remote-only-status/subversion/libsvn_client/status.c (original)
+++ subversion/branches/remote-only-status/subversion/libsvn_client/status.c Wed Mar 26 14:41:36 2014
@@ -247,7 +247,8 @@ do_external_status(svn_client_ctx_t *ctx
apr_hash_t *external_map,
svn_depth_t depth,
svn_boolean_t get_all,
- svn_boolean_t update,
+ svn_boolean_t check_out_of_date,
+ svn_boolean_t ignore_local_mods,
svn_boolean_t no_ignore,
const apr_array_header_t *changelists,
const char *anchor_abspath,
@@ -315,8 +316,9 @@ do_external_status(svn_client_ctx_t *ctx
}
/* And then do the status. */
- SVN_ERR(svn_client_status5(NULL, ctx, status_path, &opt_rev, depth,
- get_all, update, no_ignore,
+ SVN_ERR(svn_client_status6(NULL, ctx, status_path, &opt_rev, depth,
+ get_all, check_out_of_date,
+ ignore_local_mods, no_ignore,
FALSE /* ignore_exernals */,
FALSE /* depth_as_sticky */,
changelists, status_func, status_baton,
@@ -333,13 +335,14 @@ do_external_status(svn_client_ctx_t *ctx
svn_error_t *
-svn_client_status5(svn_revnum_t *result_rev,
+svn_client_status6(svn_revnum_t *result_rev,
svn_client_ctx_t *ctx,
const char *path,
const svn_opt_revision_t *revision,
svn_depth_t depth,
svn_boolean_t get_all,
- svn_boolean_t update,
+ svn_boolean_t check_out_of_date,
+ svn_boolean_t ignore_local_mods,
svn_boolean_t no_ignore,
svn_boolean_t ignore_externals,
svn_boolean_t depth_as_sticky,
@@ -374,7 +377,7 @@ svn_client_status5(svn_revnum_t *result_
SVN_ERR(svn_dirent_get_absolute(&target_abspath, path, pool));
- if (update)
+ if (check_out_of_date)
{
/* The status editor only works on directories, so get the ancestor
if necessary */
@@ -442,7 +445,7 @@ svn_client_status5(svn_revnum_t *result_
/* If we want to know about out-of-dateness, we crawl the working copy and
let the RA layer drive the editor for real. Otherwise, we just close the
edit. :-) */
- if (update)
+ if (check_out_of_date)
{
svn_ra_session_t *ra_session;
const char *URL;
@@ -472,14 +475,14 @@ svn_client_status5(svn_revnum_t *result_
SVN_RA_CAPABILITY_DEPTH, pool));
SVN_ERR(svn_wc__get_status_editor(&editor, &edit_baton, &set_locks_baton,
- &edit_revision, ctx->wc_ctx,
- dir_abspath, target_basename,
- depth, get_all,
- no_ignore, depth_as_sticky,
- server_supports_depth,
- ignores, tweak_status, &sb,
- ctx->cancel_func, ctx->cancel_baton,
- pool, pool));
+ &edit_revision, ctx->wc_ctx,
+ dir_abspath, target_basename,
+ depth, get_all, ignore_local_mods,
+ no_ignore, depth_as_sticky,
+ server_supports_depth,
+ ignores, tweak_status, &sb,
+ ctx->cancel_func, ctx->cancel_baton,
+ pool, pool));
/* Verify that URL exists in HEAD. If it doesn't, this can save
@@ -614,7 +617,8 @@ svn_client_status5(svn_revnum_t *result_
SVN_ERR(do_external_status(ctx, external_map,
depth, get_all,
- update, no_ignore, changelists,
+ check_out_of_date, ignore_local_mods,
+ no_ignore, changelists,
sb.anchor_abspath, sb.anchor_relpath,
status_func, status_baton, pool));
}
Modified: subversion/branches/remote-only-status/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/remote-only-status/subversion/libsvn_wc/deprecated.c?rev=1581868&r1=1581867&r2=1581868&view=diff
==============================================================================
--- subversion/branches/remote-only-status/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/remote-only-status/subversion/libsvn_wc/deprecated.c Wed Mar 26 14:41:36 2014
@@ -2897,9 +2897,9 @@ svn_wc_get_status_editor5(const svn_delt
wc_ctx,
anchor_abspath,
target_basename,
- depth,
- get_all, no_ignore,
- depth_as_sticky,
+ depth, get_all,
+ FALSE, /* ignore_local_mods */
+ no_ignore, depth_as_sticky,
server_performs_filtering,
ignore_patterns,
status_func, status_baton,
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=1581868&r1=1581867&r2=1581868&view=diff
==============================================================================
--- subversion/branches/remote-only-status/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/remote-only-status/subversion/libsvn_wc/status.c Wed Mar 26 14:41:36 2014
@@ -107,6 +107,10 @@ struct edit_baton
/* Do we want all statuses (instead of just the interesting ones) ? */
svn_boolean_t get_all;
+ /* Ignore all local modifications; only check for differences
+ between the BASE tree and the repository. */
+ svn_boolean_t ignore_local_mods;
+
/* Ignore the svn:ignores. */
svn_boolean_t no_ignore;
@@ -335,6 +339,7 @@ static svn_error_t *
internal_status(svn_wc_status3_t **status,
svn_wc__db_t *db,
const char *local_abspath,
+ svn_boolean_t ignore_local_mods,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
@@ -1502,6 +1507,7 @@ tweak_statushash(void *baton,
void *this_dir_baton,
svn_boolean_t is_dir_baton,
svn_wc__db_t *db,
+ svn_boolean_t ignore_local_mods,
const char *local_abspath,
enum svn_wc_status_kind repos_node_status,
enum svn_wc_status_kind repos_text_status,
@@ -1541,8 +1547,8 @@ tweak_statushash(void *baton,
return SVN_NO_ERROR;
/* Use the public API to get a statstruct, and put it into the hash. */
- SVN_ERR(internal_status(&statstruct, db, local_abspath, pool,
- scratch_pool));
+ SVN_ERR(internal_status(&statstruct, db, local_abspath,
+ ignore_local_mods, pool, scratch_pool));
statstruct->repos_lock = repos_lock;
svn_hash_sets(statushash, apr_pstrdup(pool, local_abspath), statstruct);
}
@@ -2001,7 +2007,7 @@ delete_entry(const char *path,
statushash immediately. No need to wait until close_file or
close_dir, because there's no risk of having to honor the 'added'
flag. We already know this item exists in the working copy. */
- SVN_ERR(tweak_statushash(db, db, TRUE, eb->db,
+ SVN_ERR(tweak_statushash(db, db, TRUE, eb->db, eb->ignore_local_mods,
local_abspath,
svn_wc_status_deleted, 0, 0, revision, NULL, pool));
@@ -2009,7 +2015,8 @@ delete_entry(const char *path,
is the root node and we're not supposed to report on the root
node). */
if (db->parent_baton && (! *eb->target_basename))
- SVN_ERR(tweak_statushash(db->parent_baton, db, TRUE,eb->db,
+ SVN_ERR(tweak_statushash(db->parent_baton, db, TRUE,
+ eb->db, eb->ignore_local_mods,
db->local_abspath,
svn_wc_status_modified, svn_wc_status_modified,
0, SVN_INVALID_REVNUM, NULL, pool));
@@ -2133,7 +2140,9 @@ close_directory(void *dir_baton,
{
/* ### When we add directory locking, we need to find a
### directory lock here. */
- SVN_ERR(tweak_statushash(pb, db, TRUE, eb->db, db->local_abspath,
+ SVN_ERR(tweak_statushash(pb, db, TRUE,
+ eb->db, eb->ignore_local_mods,
+ db->local_abspath,
repos_node_status, repos_text_status,
repos_prop_status, SVN_INVALID_REVNUM, NULL,
scratch_pool));
@@ -2385,6 +2394,7 @@ close_file(void *file_baton,
}
return tweak_statushash(fb, NULL, FALSE, fb->edit_baton->db,
+ fb->edit_baton->ignore_local_mods,
fb->local_abspath, repos_node_status,
repos_text_status, repos_prop_status,
SVN_INVALID_REVNUM, repos_lock, pool);
@@ -2433,6 +2443,7 @@ svn_wc__get_status_editor(const svn_delt
const char *target_basename,
svn_depth_t depth,
svn_boolean_t get_all,
+ svn_boolean_t ignore_local_mods,
svn_boolean_t no_ignore,
svn_boolean_t depth_as_sticky,
svn_boolean_t server_performs_filtering,
@@ -2458,6 +2469,7 @@ svn_wc__get_status_editor(const svn_delt
eb->target_revision = edit_revision;
eb->db = wc_ctx->db;
eb->get_all = get_all;
+ eb->ignore_local_mods = ignore_local_mods;
eb->no_ignore = no_ignore;
eb->status_func = status_func;
eb->status_baton = status_baton;
@@ -2472,7 +2484,7 @@ svn_wc__get_status_editor(const svn_delt
eb->wb.db = wc_ctx->db;
eb->wb.target_abspath = eb->target_abspath;
- eb->wb.ignore_text_mods = FALSE;
+ eb->wb.ignore_text_mods = ignore_local_mods;
eb->wb.repos_locks = NULL;
eb->wb.repos_root = NULL;
@@ -2497,7 +2509,7 @@ svn_wc__get_status_editor(const svn_delt
/* The edit baton's status structure maps to PATH, and the editor
have to be aware of whether that is the anchor or the target. */
SVN_ERR(internal_status(&(eb->anchor_status), wc_ctx->db, anchor_abspath,
- result_pool, scratch_pool));
+ FALSE, result_pool, scratch_pool));
/* Construct an editor. */
tree_editor->set_target_revision = set_target_revision;
@@ -2768,6 +2780,7 @@ static svn_error_t *
internal_status(svn_wc_status3_t **status,
svn_wc__db_t *db,
const char *local_abspath,
+ svn_boolean_t ignore_local_mods,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -2784,20 +2797,31 @@ internal_status(svn_wc_status3_t **statu
err = svn_wc__db_read_single_info(&info, db, local_abspath,
scratch_pool, scratch_pool);
- if (err)
- {
- if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
- return svn_error_trace(err);
+ if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ return svn_error_trace(err);
- svn_error_clear(err);
- info = NULL;
- SVN_ERR(svn_io_stat_dirent2(&dirent, local_abspath, FALSE, TRUE,
- scratch_pool, scratch_pool));
+ /* FIXME: Must do something quite a bit smarter here. This is just
+ a stopgap to avoid crashing when ignore_local_mods is set. */
+ if (ignore_local_mods)
+ {
+ dirent = NULL;
+ info = NULL;
}
else
- SVN_ERR(stat_wc_dirent_case_sensitive(&dirent, db, local_abspath,
- scratch_pool, scratch_pool));
+ {
+ if (err)
+ {
+ svn_error_clear(err);
+ info = NULL;
+
+ SVN_ERR(svn_io_stat_dirent2(&dirent, local_abspath, FALSE, TRUE,
+ scratch_pool, scratch_pool));
+ }
+ else
+ SVN_ERR(stat_wc_dirent_case_sensitive(&dirent, db, local_abspath,
+ scratch_pool, scratch_pool));
+ }
if (!info
|| info->kind == svn_node_unknown
@@ -2861,8 +2885,8 @@ svn_wc_status3(svn_wc_status3_t **status
apr_pool_t *scratch_pool)
{
return svn_error_trace(
- internal_status(status, wc_ctx->db, local_abspath, result_pool,
- scratch_pool));
+ internal_status(status, wc_ctx->db, local_abspath, FALSE,
+ result_pool, scratch_pool));
}
svn_wc_status3_t *
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=1581868&r1=1581867&r2=1581868&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 Wed Mar 26 14:41:36 2014
@@ -826,6 +826,155 @@ test_suggest_mergesources(const svn_test
return SVN_NO_ERROR;
}
+
+/* FIXME: temporary */
+static char
+status_to_char(enum svn_wc_status_kind status)
+{
+
+ switch (status)
+ {
+ case svn_wc_status_none: return '.';
+ case svn_wc_status_unversioned: return '?';
+ case svn_wc_status_normal: return '-';
+ case svn_wc_status_added: return 'A';
+ case svn_wc_status_missing: return '!';
+ case svn_wc_status_incomplete: return ':';
+ case svn_wc_status_deleted: return 'D';
+ case svn_wc_status_replaced: return 'R';
+ case svn_wc_status_modified: return 'M';
+ case svn_wc_status_merged: return 'G';
+ case svn_wc_status_conflicted: return 'C';
+ case svn_wc_status_obstructed: return '~';
+ case svn_wc_status_ignored: return 'I';
+ case svn_wc_status_external: return 'X';
+ default: return '*';
+ }
+}
+
+/* FIXME: temporary */
+static int
+compare_status_paths(const void *a, const void *b)
+{
+ const svn_client_status_t *const *const sta = a;
+ const svn_client_status_t *const *const stb = b;
+ return svn_path_compare_paths((*sta)->local_abspath, (*stb)->local_abspath);
+}
+
+static svn_error_t *
+remote_only_status_receiver(void *baton, const char *path,
+ const svn_client_status_t *status,
+ apr_pool_t *scratch_pool)
+{
+ apr_array_header_t *results = baton;
+ APR_ARRAY_PUSH(results, const svn_client_status_t *) =
+ svn_client_status_dup(status, results->pool);
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_remote_only_status(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+ const char *repos_url;
+ const char *wc_path;
+ const char *zeta_path;
+ svn_client_ctx_t *ctx;
+ svn_client_mtcc_t *mtcc;
+ apr_array_header_t *results;
+ svn_opt_revision_t rev;
+ svn_revnum_t result_rev;
+ svn_stream_t *contents = svn_stream_from_string(
+ svn_string_create("modified\n", pool), pool);
+ svn_stream_mark_t *start;
+ int i;
+
+ SVN_ERR(svn_stream_mark(contents, &start, pool));
+
+ /* Create a filesytem and repository containing the Greek tree. */
+ SVN_ERR(create_greek_repos(&repos_url, "test-remote-only-status", opts, pool));
+
+ SVN_ERR(svn_client_create_context(&ctx, pool));
+
+ /* Make some modifications in the repository, creating revision 2. */
+ SVN_ERR(svn_client_mtcc_create(&mtcc, repos_url, -1, ctx, pool, pool));
+ SVN_ERR(svn_stream_seek(contents, start));
+ SVN_ERR(svn_client_mtcc_add_update_file("iota",
+ contents, NULL, NULL, NULL,
+ mtcc, pool));
+ SVN_ERR(svn_stream_seek(contents, start));
+ SVN_ERR(svn_client_mtcc_add_update_file("A/B/lambda",
+ contents, NULL, NULL, NULL,
+ mtcc, pool));
+ SVN_ERR(svn_client_mtcc_commit(NULL, NULL, NULL, mtcc, pool));
+
+ /* Check out a sparse root @r1 of the repository */
+ wc_path = svn_test_data_path("test-remote-only-status-wc", pool);
+ /*svn_test_add_dir_cleanup(wc_path);*/
+ SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool));
+
+ rev.kind = svn_opt_revision_number;
+ rev.value.number = 1;
+ SVN_ERR(svn_client_checkout3(NULL, repos_url, wc_path,
+ &rev, &rev, svn_depth_immediates,
+ FALSE, FALSE, ctx, pool));
+
+ /* Add a local file; this is a double-check to make sure that
+ remote-only status ignores local changes. */
+ zeta_path = svn_dirent_join(wc_path, "zeta", pool);
+ SVN_ERR(svn_io_file_create_empty(zeta_path, pool));
+ SVN_ERR(svn_client_add5(zeta_path, svn_depth_unknown,
+ FALSE, FALSE, FALSE, FALSE,
+ ctx, pool));
+
+ /* Now run the remote-only status. */
+ results = apr_array_make(pool, 3, sizeof(const svn_client_status_t *));
+ rev.kind = svn_opt_revision_head;
+ SVN_ERR(svn_client_status6(
+ &result_rev, ctx, wc_path, &rev, svn_depth_unknown,
+ TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, NULL,
+ remote_only_status_receiver, results, pool));
+
+ SVN_TEST_ASSERT(result_rev == 2);
+
+ qsort(results->elts, results->nelts, results->elt_size,
+ compare_status_paths);
+ for (i = 0; i < results->nelts; ++i)
+ {
+ const svn_client_status_t *st =
+ APR_ARRAY_IDX(results, i, const svn_client_status_t *);
+
+ const char *relpath =
+ svn_dirent_skip_ancestor(wc_path, st->local_abspath);
+ if (!relpath)
+ relpath = st->local_abspath;
+
+ /* FIXME: temporary */
+ printf("%c%c%c %2ld %c%c%c %2ld %s\n",
+ status_to_char(st->node_status),
+ status_to_char(st->text_status),
+ status_to_char(st->prop_status),
+ (long)st->revision,
+
+ status_to_char(st->repos_node_status),
+ status_to_char(st->repos_text_status),
+ status_to_char(st->repos_prop_status),
+ (long)st->ood_changed_rev,
+
+ (*relpath ? relpath : "."));
+
+ SVN_TEST_ASSERT(st->revision == 1);
+ SVN_TEST_ASSERT(st->ood_changed_rev == 2);
+ SVN_TEST_ASSERT(st->node_status == svn_wc_status_normal);
+ /* FIXME: svn_wc_status_none? */
+ if (0 == strcmp(relpath, "iota"))
+ SVN_TEST_ASSERT(st->repos_node_status == svn_wc_status_modified);
+ else
+ SVN_TEST_ASSERT(st->repos_node_status == svn_wc_status_none);
+ }
+
+ return SVN_NO_ERROR;
+}
+
/* ========================================================================== */
@@ -848,6 +997,8 @@ static struct svn_test_descriptor_t test
SVN_TEST_OPTS_PASS(test_youngest_common_ancestor, "test youngest_common_ancestor"),
SVN_TEST_OPTS_PASS(test_suggest_mergesources,
"test svn_client_suggest_merge_sources"),
+ SVN_TEST_OPTS_XFAIL(test_remote_only_status,
+ "test svn_client_status6 with ignore_local_mods"),
SVN_TEST_NULL
};