diff options
Diffstat (limited to 'subversion/svn/info-cmd.c')
-rw-r--r-- | subversion/svn/info-cmd.c | 198 |
1 files changed, 123 insertions, 75 deletions
diff --git a/subversion/svn/info-cmd.c b/subversion/svn/info-cmd.c index 14d0db6..56833f6 100644 --- a/subversion/svn/info-cmd.c +++ b/subversion/svn/info-cmd.c @@ -40,7 +40,7 @@ #include "cl.h" #include "svn_private_config.h" -#include "tree-conflicts.h" +#include "cl-conflicts.h" /*** Code. ***/ @@ -85,7 +85,7 @@ print_info_xml(void *baton, const svn_client_info2_t *info, apr_pool_t *pool) { - svn_stringbuf_t *sb = svn_stringbuf_create("", pool); + svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool); const char *rev_str; const char *path_prefix = baton; @@ -102,8 +102,22 @@ print_info_xml(void *baton, "revision", rev_str, NULL); + /* "<url> xx </url>" */ svn_cl__xml_tagged_cdata(&sb, pool, "url", info->URL); + if (info->repos_root_URL && info->URL) + { + /* "<relative-url> xx </relative-url>" */ + svn_cl__xml_tagged_cdata(&sb, pool, "relative-url", + apr_pstrcat(pool, "^/", + svn_path_uri_encode( + svn_uri_skip_ancestor( + info->repos_root_URL, + info->URL, pool), + pool), + NULL)); + } + if (info->repos_root_URL || info->repos_UUID) { /* "<repository>" */ @@ -172,6 +186,35 @@ print_info_xml(void *baton, svn_cl__xml_tagged_cdata(&sb, pool, "changelist", info->wc_info->changelist); + if (info->wc_info->moved_from_abspath) + { + const char *relpath; + + relpath = svn_dirent_skip_ancestor(info->wc_info->wcroot_abspath, + info->wc_info->moved_from_abspath); + + /* <moved-from> xx </moved-from> */ + if (relpath && relpath[0] != '\0') + svn_cl__xml_tagged_cdata(&sb, pool, "moved-from", relpath); + else + svn_cl__xml_tagged_cdata(&sb, pool, "moved-from", + info->wc_info->moved_from_abspath); + } + + if (info->wc_info->moved_to_abspath) + { + const char *relpath; + + relpath = svn_dirent_skip_ancestor(info->wc_info->wcroot_abspath, + info->wc_info->moved_to_abspath); + /* <moved-to> xx </moved-to> */ + if (relpath && relpath[0] != '\0') + svn_cl__xml_tagged_cdata(&sb, pool, "moved-to", relpath); + else + svn_cl__xml_tagged_cdata(&sb, pool, "moved-to", + info->wc_info->moved_to_abspath); + } + /* "</wc-info>" */ svn_xml_make_close_tag(&sb, pool, "wc-info"); } @@ -197,47 +240,7 @@ print_info_xml(void *baton, APR_ARRAY_IDX(info->wc_info->conflicts, i, const svn_wc_conflict_description2_t *); - switch (conflict->kind) - { - case svn_wc_conflict_kind_text: - /* "<conflict>" */ - svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "conflict", - NULL); - - /* "<prev-base-file> xx </prev-base-file>" */ - svn_cl__xml_tagged_cdata(&sb, pool, "prev-base-file", - conflict->base_abspath); - - /* "<prev-wc-file> xx </prev-wc-file>" */ - svn_cl__xml_tagged_cdata(&sb, pool, "prev-wc-file", - conflict->my_abspath); - - /* "<cur-base-file> xx </cur-base-file>" */ - svn_cl__xml_tagged_cdata(&sb, pool, "cur-base-file", - conflict->their_abspath); - - /* "</conflict>" */ - svn_xml_make_close_tag(&sb, pool, "conflict"); - break; - - case svn_wc_conflict_kind_property: - /* "<conflict>" */ - svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "conflict", - NULL); - - /* "<prop-file> xx </prop-file>" */ - svn_cl__xml_tagged_cdata(&sb, pool, "prop-file", - conflict->their_abspath); - - /* "</conflict>" */ - svn_xml_make_close_tag(&sb, pool, "conflict"); - break; - - case svn_wc_conflict_kind_tree: - SVN_ERR(svn_cl__append_tree_conflict_info_xml(sb, conflict, - pool)); - break; - } + SVN_ERR(svn_cl__append_conflict_info_xml(sb, conflict, pool)); } } @@ -279,6 +282,13 @@ print_info(void *baton, if (info->URL) SVN_ERR(svn_cmdline_printf(pool, _("URL: %s\n"), info->URL)); + if (info->URL && info->repos_root_URL) + SVN_ERR(svn_cmdline_printf(pool, _("Relative URL: ^/%s\n"), + svn_path_uri_encode( + svn_uri_skip_ancestor(info->repos_root_URL, + info->URL, pool), + pool))); + if (info->repos_root_URL) SVN_ERR(svn_cmdline_printf(pool, _("Repository Root: %s\n"), info->repos_root_URL)); @@ -376,6 +386,31 @@ print_info(void *baton, if (SVN_IS_VALID_REVNUM(info->wc_info->copyfrom_rev)) SVN_ERR(svn_cmdline_printf(pool, _("Copied From Rev: %ld\n"), info->wc_info->copyfrom_rev)); + if (info->wc_info->moved_from_abspath) + { + const char *relpath; + + relpath = svn_dirent_skip_ancestor(info->wc_info->wcroot_abspath, + info->wc_info->moved_from_abspath); + if (relpath && relpath[0] != '\0') + SVN_ERR(svn_cmdline_printf(pool, _("Moved From: %s\n"), relpath)); + else + SVN_ERR(svn_cmdline_printf(pool, _("Moved From: %s\n"), + info->wc_info->moved_from_abspath)); + } + + if (info->wc_info->moved_to_abspath) + { + const char *relpath; + + relpath = svn_dirent_skip_ancestor(info->wc_info->wcroot_abspath, + info->wc_info->moved_to_abspath); + if (relpath && relpath[0] != '\0') + SVN_ERR(svn_cmdline_printf(pool, _("Moved To: %s\n"), relpath)); + else + SVN_ERR(svn_cmdline_printf(pool, _("Moved To: %s\n"), + info->wc_info->moved_to_abspath)); + } } if (info->last_changed_author) @@ -403,16 +438,15 @@ print_info(void *baton, if (info->wc_info->conflicts) { + svn_boolean_t printed_prop_conflict_file = FALSE; int i; for (i = 0; i < info->wc_info->conflicts->nelts; i++) { - const svn_wc_conflict_description2_t *conflict = - APR_ARRAY_IDX(info->wc_info->conflicts, i, - const svn_wc_conflict_description2_t *); - const char *desc; - const char *src_left_version; - const char *src_right_version; + const svn_wc_conflict_description2_t *conflict = + APR_ARRAY_IDX(info->wc_info->conflicts, i, + const svn_wc_conflict_description2_t *); + const char *desc; switch (conflict->kind) { @@ -440,10 +474,12 @@ print_info(void *baton, break; case svn_wc_conflict_kind_property: - SVN_ERR(svn_cmdline_printf(pool, - _("Conflict Properties File: %s\n"), - svn_dirent_local_style(conflict->their_abspath, - pool))); + if (! printed_prop_conflict_file) + SVN_ERR(svn_cmdline_printf(pool, + _("Conflict Properties File: %s\n"), + svn_dirent_local_style(conflict->their_abspath, + pool))); + printed_prop_conflict_file = TRUE; break; case svn_wc_conflict_kind_tree: @@ -451,33 +487,45 @@ print_info(void *baton, svn_cl__get_human_readable_tree_conflict_description( &desc, conflict, pool)); - src_left_version = - svn_cl__node_description(conflict->src_left_version, - info->repos_root_URL, pool); - - src_right_version = - svn_cl__node_description(conflict->src_right_version, - info->repos_root_URL, pool); - SVN_ERR(svn_cmdline_printf(pool, "%s: %s\n", _("Tree conflict"), desc)); - - if (src_left_version) - SVN_ERR(svn_cmdline_printf(pool, " %s: %s\n", - _("Source left"), /* (1) */ - src_left_version)); - /* (1): Sneaking in a space in "Source left" so that - * it is the same length as "Source right" while it still - * starts in the same column. That's just a tiny tweak in - * the English `svn'. */ - - if (src_right_version) - SVN_ERR(svn_cmdline_printf(pool, " %s: %s\n", - _("Source right"), - src_right_version)); break; } } + + /* We only store one left and right version for all conflicts, which is + referenced from all conflicts. + Print it after the conflicts to match the 1.6/1.7 output where it is + only available for tree conflicts */ + { + const char *src_left_version; + const char *src_right_version; + const svn_wc_conflict_description2_t *conflict = + APR_ARRAY_IDX(info->wc_info->conflicts, 0, + const svn_wc_conflict_description2_t *); + + src_left_version = + svn_cl__node_description(conflict->src_left_version, + info->repos_root_URL, pool); + + src_right_version = + svn_cl__node_description(conflict->src_right_version, + info->repos_root_URL, pool); + + if (src_left_version) + SVN_ERR(svn_cmdline_printf(pool, " %s: %s\n", + _("Source left"), /* (1) */ + src_left_version)); + /* (1): Sneaking in a space in "Source left" so that + * it is the same length as "Source right" while it still + * starts in the same column. That's just a tiny tweak in + * the English `svn'. */ + + if (src_right_version) + SVN_ERR(svn_cmdline_printf(pool, " %s: %s\n", + _("Source right"), + src_right_version)); + } } } |