Hmm, so to clarify: without --show-tree-conflicts the "C" shows up in
the first column; with --show-tree-conflicts normal status information
isn't shown at all, and only the tree conflict descriptions are?
--dave
On Dec 19, 2007 9:44 AM, <stsp@tigris.org> wrote:
> Author: stsp
> Date: Wed Dec 19 09:44:01 2007
> New Revision: 28567
>
> Log:
> On the tree-conflicts branch, make 'svn status' aware of tree conflicts.
>
> This includes making 'svn status' print a 'C' in the first column
> for tree-conflicted directories, and adding the ability to query
> tree conflict information via 'svn status --show-tree-conflicts'.
> The shorthand "svn status -t" was added for new option because we
> expect it to be used interactively a lot.
>
> 'svn status --show-tree-conflicts' does not yet work with '--xml',
> this is still a todo item.
>
> * subversion/include/svn_wc.h
> (svn_wc_status2_t): Add new member tree_status.
> * subversion/libsvn_wc/status.c
> (dir_baton): Add new member tree_conflicted.
> (assemble_status): Initilise new tree_status member of svn_wc_status2_t, and
> use svn_wc_conflicted_p2 to handle tree conflicts.
> (is_sendable_status): Send tree-conflict information if applicable.
> (close_directory): Set tree_status to svn_wc_status_conflicted if a
> tree conflict was detected.
> * subversion/tests/cmdline/update_tests.py
> (tree_conflicts_in_updated_files): Change expected output of 'svn status',
> it now prints a C for tree-conflicted directories.
> * subversion/svn/cl.h
> (svn_cl__opt_state_t): Add new member show_tree_conflicts.
> (svn_cl__print_commit_info): Add new parameter show_tree_conflicts and
> document it.
> * subversion/svn/status.c
> (print_status): Add new parameter show_tree_conflicts. If the latter
> is true, use API functions in libsvn_wc that were recently added on
> this branch to get possibly localised human readable tree conflict
> descriptions and print them.
> (svn_cl__print_status): Add new parameter show_tree_conflicts, pass
> its value down to print_status.
> * subversion/svn/main.c
> (svn_cl__options): Add new option --show-tree-conflicts (alias '-t').
> (svn_cl__cmd_table): Add new option to 'svn status' subcommand.
> (main): Handle new option. Add comment about '-t' implying '-v' because
> of the way svn_wc_client3 currently works.
> * subversion/svn/status-cmd.c
> (status_baton): Add new member show_tree_conflicts.
> (print_status_normal_or_xml): Pass new member in status_baton as
> parameter to svn_cl__print_status.
> (svn_cl__status): Initialise new show_tree_conflicts member of status_baton.
>
>
> Modified:
> branches/tree-conflicts/subversion/include/svn_wc.h
> branches/tree-conflicts/subversion/libsvn_wc/status.c
> branches/tree-conflicts/subversion/svn/cl.h
> branches/tree-conflicts/subversion/svn/main.c
> branches/tree-conflicts/subversion/svn/status-cmd.c
> branches/tree-conflicts/subversion/svn/status.c
> branches/tree-conflicts/subversion/tests/cmdline/update_tests.py
>
> Modified: branches/tree-conflicts/subversion/include/svn_wc.h
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/include/svn_wc.h?pathrev=28567&r1=28566&r2=28567
> ==============================================================================
> --- branches/tree-conflicts/subversion/include/svn_wc.h (original)
> +++ branches/tree-conflicts/subversion/include/svn_wc.h Wed Dec 19 09:44:01 2007
> @@ -2293,6 +2293,11 @@
>
> /** @} */
>
> + /** The entry's tree-conflict status.
> + * @since New in 1.6
> + */
> + enum svn_wc_status_kind tree_status;
> +
> /* NOTE! Please update svn_wc_dup_status2() when adding new fields here. */
> } svn_wc_status2_t;
>
>
> Modified: branches/tree-conflicts/subversion/libsvn_wc/status.c
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/libsvn_wc/status.c?pathrev=28567&r1=28566&r2=28567
> ==============================================================================
> --- branches/tree-conflicts/subversion/libsvn_wc/status.c (original)
> +++ branches/tree-conflicts/subversion/libsvn_wc/status.c Wed Dec 19 09:44:01 2007
> @@ -158,6 +158,10 @@
> apr_time_t ood_last_cmt_date;
> svn_node_kind_t ood_kind;
> const char *ood_last_cmt_author;
> +
> + /* This means (in terms of 'svn status') that some child is involved in
> + a tree conflict. */
> + svn_boolean_t tree_conflicted;
> };
>
>
> @@ -300,6 +304,7 @@
> stat->locked = FALSE;
> stat->copied = FALSE;
> stat->switched = FALSE;
> + stat->tree_status = svn_wc_status_none;
>
> /* If this path has no entry, but IS present on disk, it's
> unversioned. If this file is being explicitly ignored (due
> @@ -403,7 +408,7 @@
> if (entry->prejfile || entry->conflict_old ||
> entry->conflict_new || entry->conflict_wrk)
> {
> - svn_boolean_t text_conflict_p, prop_conflict_p;
> + svn_boolean_t text_conflict_p, prop_conflict_p, tree_conflict_p;
> const char *parent_dir;
>
> if (entry->kind == svn_node_dir)
> @@ -411,13 +416,16 @@
> else /* non-directory, that's all we need to know */
> parent_dir = svn_path_dirname(path, pool);
>
> - SVN_ERR(svn_wc_conflicted_p(&text_conflict_p, &prop_conflict_p,
> - parent_dir, entry, pool));
> + SVN_ERR(svn_wc_conflicted_p2(&text_conflict_p, &prop_conflict_p,
> + &tree_conflict_p, parent_dir, entry,
> + pool));
>
> if (text_conflict_p)
> final_text_status = svn_wc_status_conflicted;
> if (prop_conflict_p)
> final_prop_status = svn_wc_status_conflicted;
> + if (tree_conflict_p)
> + final_text_status = svn_wc_status_conflicted;
> }
>
> /* 2. Possibly overwrite the text_status variable with "scheduled"
> @@ -518,6 +526,7 @@
> stat->ood_last_cmt_date = 0;
> stat->ood_kind = svn_node_none;
> stat->ood_last_cmt_author = NULL;
> + stat->tree_status = svn_wc_status_none;
>
> *status = stat;
>
> @@ -1379,13 +1388,16 @@
> if (status->text_status == svn_wc_status_unversioned)
> return TRUE;
>
> - /* If the text or property states are interesting, send it. */
> + /* If the text, property or tree state is interesting, send it. */
> if ((status->text_status != svn_wc_status_none)
> && (status->text_status != svn_wc_status_normal))
> return TRUE;
> if ((status->prop_status != svn_wc_status_none)
> && (status->prop_status != svn_wc_status_normal))
> return TRUE;
> + if ((status->tree_status != svn_wc_status_none)
> + && (status->tree_status != svn_wc_status_normal))
> + return TRUE;
>
> /* If it's locked or switched, send it. */
> if (status->locked)
> @@ -1746,6 +1758,9 @@
> eb->anchor_status->ood_last_cmt_author =
> apr_pstrdup(pool, db->ood_last_cmt_author);
> }
> +
> + if (eb->anchor_status->entry->tree_conflict_data)
> + eb->anchor_status->tree_status = svn_wc_status_conflicted;
> }
> }
>
>
> Modified: branches/tree-conflicts/subversion/svn/cl.h
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/svn/cl.h?pathrev=28567&r1=28566&r2=28567
> ==============================================================================
> --- branches/tree-conflicts/subversion/svn/cl.h (original)
> +++ branches/tree-conflicts/subversion/svn/cl.h Wed Dec 19 09:44:01 2007
> @@ -163,6 +163,7 @@
> svn_boolean_t use_merge_history; /* use/display extra merge information */
> svn_cl__accept_t accept_which; /* how to handle conflicts */
> const char *from_source; /* merge source to query (svn mergeinfo) */
> + svn_boolean_t show_tree_conflicts; /* display tree conflict information */
> } svn_cl__opt_state_t;
>
>
> @@ -299,13 +300,19 @@
> unversioned items found in the working copy.
>
> When DETAILED is set, and REPOS_LOCKS is set, treat missing repository locks
> - as broken WC locks. */
> + as broken WC locks.
> +
> + If SHOW_TREE_CONFLICTS is set, print localized human-readable
> + descriptions of tree conflicts for tree-conflicted directories.
> +
> + */
> svn_error_t *svn_cl__print_status(const char *path,
> svn_wc_status2_t *status,
> svn_boolean_t detailed,
> svn_boolean_t show_last_committed,
> svn_boolean_t skip_unrecognized,
> svn_boolean_t repos_locks,
> + svn_boolean_t show_tree_conflicts,
> apr_pool_t *pool);
>
>
>
> Modified: branches/tree-conflicts/subversion/svn/main.c
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/svn/main.c?pathrev=28567&r1=28566&r2=28567
> ==============================================================================
> --- branches/tree-conflicts/subversion/svn/main.c (original)
> +++ branches/tree-conflicts/subversion/svn/main.c Wed Dec 19 09:44:01 2007
> @@ -255,6 +255,8 @@
> " '" SVN_CL__ACCEPT_LAUNCH "')")},
> {"from-source", opt_from_source, 1,
> N_("query a particular merge source URL\n")},
> + {"show-tree-conflicts", 't', 0,
> + N_("show tree conflicts in directories, if any.\n")},
> {0, 0, 0, 0},
> };
>
> @@ -838,7 +840,7 @@
> " 965 687 joe wc/zig.c\n"
> " Status against revision: 981\n"),
> { 'u', 'v', 'N', opt_depth, 'q', opt_no_ignore, opt_incremental, opt_xml,
> - opt_ignore_externals, opt_changelist} },
> + opt_ignore_externals, opt_changelist, 't'} },
>
> { "switch", svn_cl__switch, {"sw"}, N_
> ("Update the working copy to a different URL.\n"
> @@ -1426,6 +1428,12 @@
> err = svn_utf_cstring_to_utf8(&path_utf8, opt_arg, pool);
> opt_state.from_source = svn_path_canonicalize(path_utf8, pool);
> break;
> + case 't':
> + opt_state.show_tree_conflicts = TRUE;
> + /* '-t' implies '-v', otherwise svn_wc_client3() won't return
> + the entries we need. This hack isn't user-visible. */
> + opt_state.verbose = TRUE;
> + break;
> default:
> /* Hmmm. Perhaps this would be a good place to squirrel away
> opts that commands like svn diff might need. Hmmm indeed. */
>
> Modified: branches/tree-conflicts/subversion/svn/status-cmd.c
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/svn/status-cmd.c?pathrev=28567&r1=28566&r2=28567
> ==============================================================================
> --- branches/tree-conflicts/subversion/svn/status-cmd.c (original)
> +++ branches/tree-conflicts/subversion/svn/status-cmd.c Wed Dec 19 09:44:01 2007
> @@ -47,6 +47,7 @@
> svn_boolean_t show_last_committed;
> svn_boolean_t skip_unrecognized;
> svn_boolean_t repos_locks;
> + svn_boolean_t show_tree_conflicts;
> apr_pool_t *pool;
>
> apr_hash_t *cached_changelists;
> @@ -119,6 +120,7 @@
> sb->show_last_committed,
> sb->skip_unrecognized,
> sb->repos_locks,
> + sb->show_tree_conflicts,
> sb->pool);
>
> if (err)
> @@ -282,6 +284,7 @@
> sb.pool = subpool;
> sb.cached_changelists = master_cl_hash;
> sb.cl_pool = pool;
> + sb.show_tree_conflicts = opt_state->show_tree_conflicts;
>
> for (i = 0; i < targets->nelts; i++)
> {
>
> Modified: branches/tree-conflicts/subversion/svn/status.c
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/svn/status.c?pathrev=28567&r1=28566&r2=28567
> ==============================================================================
> --- branches/tree-conflicts/subversion/svn/status.c (original)
> +++ branches/tree-conflicts/subversion/svn/status.c Wed Dec 19 09:44:01 2007
> @@ -87,10 +87,18 @@
> svn_boolean_t detailed,
> svn_boolean_t show_last_committed,
> svn_boolean_t repos_locks,
> + svn_boolean_t show_tree_conflicts,
> svn_wc_status2_t *status,
> apr_pool_t *pool)
> {
> - if (detailed)
> + /* To signal that a directory contains tree conflicts, we "hijack"
> + * the text status column if it is blank. */
> + if (status->entry
> + && (status->entry->kind == svn_node_dir)
> + && (status->text_status == svn_wc_status_normal))
> + status->text_status = status->tree_status;
> +
> + if (detailed && ! show_tree_conflicts)
> {
> char ood_status, lock_status;
> const char *working_rev;
> @@ -180,17 +188,53 @@
> working_rev,
> path));
> }
> - else
> - SVN_ERR
> - (svn_cmdline_printf(pool, "%c%c%c%c%c%c %s\n",
> - generate_status_code(status->text_status),
> - generate_status_code(status->prop_status),
> - status->locked ? 'L' : ' ',
> - status->copied ? '+' : ' ',
> - status->switched ? 'S' : ' ',
> - ((status->entry && status->entry->lock_token)
> - ? 'K' : ' '),
> - path));
> + else if (! show_tree_conflicts)
> + {
> + SVN_ERR
> + (svn_cmdline_printf(pool, "%c%c%c%c%c%c %s\n",
> + generate_status_code(status->text_status),
> + generate_status_code(status->prop_status),
> + status->locked ? 'L' : ' ',
> + status->copied ? '+' : ' ',
> + status->switched ? 'S' : ' ',
> + ((status->entry && status->entry->lock_token)
> + ? 'K' : ' '),
> + path));
> +
> + }
> + else if (show_tree_conflicts
> + && status->entry
> + && status->entry->kind == svn_node_dir)
> + {
> + int i;
> + svn_wc_conflict_description_t *tree_conflict;
> + apr_array_header_t *tree_conflicts = apr_array_make(pool, 4,
> + sizeof(svn_wc_conflict_description_t *));
> + svn_stringbuf_t *tree_conflict_descs = svn_stringbuf_create("", pool);
> +
> + SVN_ERR(svn_wc_read_tree_conflicts_from_entry(tree_conflicts,
> + status->entry,
> + pool));
> + for (i = 0; i < tree_conflicts->nelts; i++)
> + {
> + tree_conflict = APR_ARRAY_IDX(tree_conflicts, i,
> + svn_wc_conflict_description_t *);
> + SVN_ERR(svn_wc_append_human_readable_tree_conflict_description(
> + tree_conflict_descs,
> + tree_conflict,
> + pool));
> + svn_stringbuf_appendcstr(tree_conflict_descs, "\n");
> + }
> +
> + if (tree_conflict_descs->len > 0)
> + {
> +
> + svn_cmdline_printf(pool,
> + "==== Tree conflicts in '%s' ===\n%s",
> + svn_path_local_style(path, pool),
> + tree_conflict_descs->data);
> + }
> + }
>
> SVN_ERR(svn_cmdline_fflush(stdout));
>
> @@ -320,6 +364,7 @@
> svn_boolean_t show_last_committed,
> svn_boolean_t skip_unrecognized,
> svn_boolean_t repos_locks,
> + svn_boolean_t show_tree_conflicts,
> apr_pool_t *pool)
> {
> if (! status
> @@ -329,6 +374,6 @@
> return SVN_NO_ERROR;
>
> return print_status(svn_path_local_style(path, pool),
> - detailed, show_last_committed, repos_locks, status,
> - pool);
> + detailed, show_last_committed, repos_locks,
> + show_tree_conflicts, status, pool);
> }
>
> Modified: branches/tree-conflicts/subversion/tests/cmdline/update_tests.py
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/tests/cmdline/update_tests.py?pathrev=28567&r1=28566&r2=28567
> ==============================================================================
> --- branches/tree-conflicts/subversion/tests/cmdline/update_tests.py (original)
> +++ branches/tree-conflicts/subversion/tests/cmdline/update_tests.py Wed Dec 19 09:44:01 2007
> @@ -3830,7 +3830,7 @@
> 'tiger' : Item("This is the file 'tau'.\n"),
> })
> expected_status = wc.State(G2, {
> - '' : Item(status=' ', wc_rev=2),
> + '' : Item(status='C ', wc_rev=2),
> 'pi' : Item(status='D ', wc_rev=2),
> 'pig' : Item(status='A ', wc_rev='-', copied='+'),
> 'rhino' : Item(status=' ', wc_rev=2),
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
>
--
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Dec 19 20:29:31 2007