[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r28767 - in branches/tree-conflicts/subversion: include libsvn_client libsvn_wc svn svn/schema

From: David Glasser <glasser_at_davidglasser.net>
Date: Sun, 6 Jan 2008 23:10:43 -0500

I think moving this to 'svn info', and not requiring an extra flag, is
the right idea.

However, I think a lot of scripts, for better or for worse, try to do
some parsing of svn info non-XML output. Even though it's not
actually an officially supported format, it would be nice to keep the
"key: value" syntax to some degree. Perhaps indent the tree conflict
lines so they can't be confused with other fields? And can a single
tree conflict desc be multiple lines, or is it just that there can be
more than one? If the latter, maybe just have a bunch of "Tree
conflict: " lines?

(And is "tree conflict" going to be the official UI-level name for
this? I guess so.)

--dave

On Jan 6, 2008 3:41 PM, <stsp_at_tigris.org> wrote:
> Author: stsp
> Date: Sun Jan 6 12:41:32 2008
> New Revision: 28767
>
> Log:
> On the tree-conflicts branch, teach svn info about tree conflicts.
>
> This includes XML output as well as output of human readable tree
> conflict descriptions. The latter used to be triggered by passing
> a '--show-tree-conflicts' (or '-t') flag to 'svn status'. This flag
> has been removed from 'svn status' in favour of having 'svn info'
> print tree conflict descriptions unconditionally.
>
> * subversion/include/svn_wc.h
> (svn_wc_append_tree_conflict_info_xml): New function.
>
> * subversion/include/svn_client.h
> (svn_info_t): Add new member tree_conflicts.
>
> * subversion/libsvn_wc/tree_conflicts.c
> (svn_wc_append_tree_conflict_info_xml): Implement.
>
> * subversion/libsvn_client/info.c
> (build_info_from_dirent, build_info_from_entry):
> Track new member of svn_into_t.
>
> * subversion/svn/schema/info.rnc: Include tree conflicts elements.
>
> * subversion/svn/info-cmd.c
> (print_info_xml): Print XML info about tree conflicts.
> (print_info): Print human readable descriptions of tree conflicts.
>
>
> Modified:
> branches/tree-conflicts/subversion/include/svn_client.h
> branches/tree-conflicts/subversion/include/svn_wc.h
> branches/tree-conflicts/subversion/libsvn_client/info.c
> branches/tree-conflicts/subversion/libsvn_wc/tree_conflicts.c
> branches/tree-conflicts/subversion/svn/info-cmd.c
> branches/tree-conflicts/subversion/svn/schema/info.rnc
>
> Modified: branches/tree-conflicts/subversion/include/svn_client.h
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/include/svn_client.h?pathrev=28767&r1=28766&r2=28767
> ==============================================================================
> --- branches/tree-conflicts/subversion/include/svn_client.h (original)
> +++ branches/tree-conflicts/subversion/include/svn_client.h Sun Jan 6 12:41:32 2008
> @@ -3987,6 +3987,14 @@
> * @since New in 1.5.
> */
> apr_size_t working_size;
> +
> + /**
> + * For a directory only, all tree-conflicted children, stored
> + * in an array of @c svn_wc_conflict_description_t,
> + * @since New in 1.6.
> + */
> + apr_array_header_t *tree_conflicts;
> +
> /** @} */
>
> /**
>
> 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=28767&r1=28766&r2=28767
> ==============================================================================
> --- branches/tree-conflicts/subversion/include/svn_wc.h (original)
> +++ branches/tree-conflicts/subversion/include/svn_wc.h Sun Jan 6 12:41:32 2008
> @@ -4684,6 +4684,18 @@
> svn_stringbuf_t *descriptions,
> svn_wc_conflict_description_t *conflict,
> apr_pool_t *pool);
> +
> +/**
> + * Append to @a stringbuf an XML representation of the tree conflict data
> + * for @a conflict, in a format suitable for 'svn info --xml'.
> + *
> + * @since New in 1.6.
> + */
> +svn_error_t *
> +svn_wc_append_tree_conflict_info_xml(svn_stringbuf_t *str,
> + svn_wc_conflict_description_t *conflict,
> + apr_pool_t *pool);
> +
>
> #ifdef __cplusplus
> }
>
> Modified: branches/tree-conflicts/subversion/libsvn_client/info.c
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/libsvn_client/info.c?pathrev=28767&r1=28766&r2=28767
> ==============================================================================
> --- branches/tree-conflicts/subversion/libsvn_client/info.c (original)
> +++ branches/tree-conflicts/subversion/libsvn_client/info.c Sun Jan 6 12:41:32 2008
> @@ -57,6 +57,7 @@
> tmpinfo->depth = svn_depth_unknown;
> tmpinfo->working_size = SVN_WC_ENTRY_WORKING_SIZE_UNKNOWN;
> tmpinfo->size = dirent->size;
> + tmpinfo->tree_conflicts = NULL;
>
> *info = tmpinfo;
> return SVN_NO_ERROR;
> @@ -98,6 +99,14 @@
> tmpinfo->working_size = entry->working_size;
> tmpinfo->size = SVN_INFO_SIZE_UNKNOWN;
>
> + if ((entry->kind == svn_node_dir)
> + && entry->tree_conflict_data)
> + tmpinfo->tree_conflicts = apr_array_make(pool, 1,
> + sizeof(svn_wc_conflict_description_t *));
> + SVN_ERR(svn_wc_read_tree_conflicts_from_entry(tmpinfo->tree_conflicts,
> + entry,
> + pool));
> +
> /* lock stuff */
> if (entry->lock_token) /* the token is the critical bit. */
> {
>
> Modified: branches/tree-conflicts/subversion/libsvn_wc/tree_conflicts.c
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/libsvn_wc/tree_conflicts.c?pathrev=28767&r1=28766&r2=28767
> ==============================================================================
> --- branches/tree-conflicts/subversion/libsvn_wc/tree_conflicts.c (original)
> +++ branches/tree-conflicts/subversion/libsvn_wc/tree_conflicts.c Sun Jan 6 12:41:32 2008
> @@ -20,6 +20,7 @@
> #include "log.h"
> #include "entries.h"
> #include "svn_types.h"
> +#include "svn_xml.h"
> #include "svn_private_config.h"
>
> #include <assert.h>
> @@ -615,3 +616,81 @@
> return SVN_NO_ERROR;
> }
>
> +
> +svn_error_t *
> +svn_wc_append_tree_conflict_info_xml(svn_stringbuf_t *str,
> + svn_wc_conflict_description_t *conflict,
> + apr_pool_t *pool)
> +{
> + apr_hash_t *att_hash = apr_hash_make(pool);
> + const char *tmp;
> +
> + apr_hash_set(att_hash, "victim", APR_HASH_KEY_STRING,
> + conflict->victim_path);
> +
> + switch (conflict->node_kind)
> + {
> + case svn_node_dir:
> + tmp = SVN_WC__NODE_DIR;
> + break;
> + case svn_node_file:
> + tmp = SVN_WC__NODE_FILE;
> + break;
> + default:
> + return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
> + _("Bad node_kind in tree conflict description"));
> + }
> + apr_hash_set(att_hash, "kind", APR_HASH_KEY_STRING, tmp);
> +
> + switch (conflict->operation)
> + {
> + case svn_wc_operation_update:
> + tmp = SVN_WC__OPERATION_UPDATE;
> + break;
> + case svn_wc_operation_switch:
> + tmp = SVN_WC__OPERATION_SWITCH;
> + break;
> + case svn_wc_operation_merge:
> + tmp = SVN_WC__OPERATION_MERGE;
> + default:
> + return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
> + _("Bad operation in tree conflict description"));
> + }
> + apr_hash_set(att_hash, "operation", APR_HASH_KEY_STRING, tmp);
> +
> + switch (conflict->action)
> + {
> + case svn_wc_conflict_action_edit:
> + tmp = SVN_WC__CONFLICT_ACTION_EDITED;
> + break;
> + case svn_wc_conflict_action_delete:
> + tmp = SVN_WC__CONFLICT_ACTION_DELETED;
> + break;
> + default:
> + return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
> + _("Bad action in tree conflict description"));
> + }
> + apr_hash_set(att_hash, "action", APR_HASH_KEY_STRING, tmp);
> +
> + switch (conflict->reason)
> + {
> + case svn_wc_conflict_reason_edited:
> + tmp = SVN_WC__CONFLICT_REASON_EDITED;
> + break;
> + case svn_wc_conflict_reason_deleted:
> + tmp = SVN_WC__CONFLICT_REASON_DELETED;
> + break;
> + case svn_wc_conflict_reason_missing:
> + tmp = SVN_WC__CONFLICT_REASON_MISSING;
> + break;
> + default:
> + return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
> + _("Bad reason in tree conflict description"));
> + }
> + apr_hash_set(att_hash, "reason", APR_HASH_KEY_STRING, tmp);
> +
> + svn_xml_make_open_tag_hash(&str, pool, svn_xml_self_closing,
> + "tree-conflict", att_hash);
> +
> + return SVN_NO_ERROR;
> +}
>
> Modified: branches/tree-conflicts/subversion/svn/info-cmd.c
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/svn/info-cmd.c?pathrev=28767&r1=28766&r2=28767
> ==============================================================================
> --- branches/tree-conflicts/subversion/svn/info-cmd.c (original)
> +++ branches/tree-conflicts/subversion/svn/info-cmd.c Sun Jan 6 12:41:32 2008
> @@ -222,6 +222,25 @@
> svn_xml_make_close_tag(&sb, pool, "lock");
> }
>
> + if (info->tree_conflicts)
> + {
> + svn_wc_conflict_description_t *conflict;
> + int i;
> +
> + /* "<tree-conflicts>" */
> + svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "tree-conflicts", NULL);
> +
> + for (i = 0; i < info->tree_conflicts->nelts; i++)
> + {
> + conflict = APR_ARRAY_IDX(info->tree_conflicts, i,
> + svn_wc_conflict_description_t *);
> + SVN_ERR(svn_wc_append_tree_conflict_info_xml(sb, conflict, pool));
> + }
> +
> + /* "</tree-conflicts>" */
> + svn_xml_make_close_tag(&sb, pool, "tree-conflicts");
> + }
> +
> /* "</entry>" */
> svn_xml_make_close_tag(&sb, pool, "entry");
>
> @@ -428,6 +447,30 @@
> SVN_ERR(svn_cmdline_printf(pool, _("Changelist: %s\n"),
> info->changelist));
>
> + if (info->tree_conflicts)
> + {
> + svn_wc_conflict_description_t *tree_conflict;
> + svn_stringbuf_t *tree_conflict_descs = svn_stringbuf_create("", pool);
> + int i;
> +
> + for (i = 0; i < info->tree_conflicts->nelts; i++)
> + {
> + svn_stringbuf_appendcstr(tree_conflict_descs, "\n");
> + tree_conflict = APR_ARRAY_IDX(info->tree_conflicts, i,
> + svn_wc_conflict_description_t *);
> + SVN_ERR(svn_wc_append_human_readable_tree_conflict_description(
> + tree_conflict_descs,
> + tree_conflict,
> + pool));
> + }
> +
> + if (tree_conflict_descs->len > 0)
> + {
> + svn_cmdline_printf(pool, "Tree conflicts:%s",
> + tree_conflict_descs->data);
> + }
> + }
> +
> /* Print extra newline separator. */
> SVN_ERR(svn_cmdline_printf(pool, "\n"));
>
>
> Modified: branches/tree-conflicts/subversion/svn/schema/info.rnc
> URL: http://svn.collab.net/viewvc/svn/branches/tree-conflicts/subversion/svn/schema/info.rnc?pathrev=28767&r1=28766&r2=28767
> ==============================================================================
> --- branches/tree-conflicts/subversion/svn/schema/info.rnc (original)
> +++ branches/tree-conflicts/subversion/svn/schema/info.rnc Sun Jan 6 12:41:32 2008
> @@ -9,7 +9,8 @@
>
> entry =
> element entry {
> - attlist.entry, url?, repository?, wc-info?, commit?, lock?
> + attlist.entry, url?, repository?, wc-info?, commit?, conflict?, lock?,
> + tree-conflicts?
> }
> attlist.entry &=
> ## Local path.
> @@ -41,8 +42,7 @@
> depth?,
> text-updated?,
> prop-updated?,
> - checksum?,
> - conflict?
> + checksum?
> }
>
> schedule =
> @@ -85,3 +85,21 @@
>
> ## Depth of this directory, always "infinity" for non-directories
> depth = element depth { "infinity" | "immediates" | "files" | "empty" }
> +
> +tree-conflicts =
> + element tree-conflicts { tree-conflict+ }
> +
> +tree-conflict =
> + element tree-conflict { attlist.tree-conflict }
> +
> +attlist.tree-conflict &=
> + ## Local path to the original victim.
> + attribute victim { string },
> + ## Path type.
> + attribute kind { "file" | "dir" },
> + ## Operation causing the tree conflict.
> + attribute operation { "update" | "merge" | "switch" },
> + ## Operation's action on the victim.
> + attribute action { "edited" | "deleted" },
> + ## Local reason for the conflict.
> + attribute reason { "edited" | "deleted" | "missing" }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: svn-help_at_subversion.tigris.org
>
>

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-07 05:13:37 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.