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

Re: [PATCH] 'svn blame --xml' and fix for mutliple targets for svn blame

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-04-29 13:24:24 CEST

Alexander Thomas wrote:
> [[[
> Patch to add XML output for 'svn blame' and to fix problem with multiple
> targets on svn blame

These are two separate new features or enhancements. Please provide two
separate patches.

I started to implement "svn blame --xml" a while back, and ran up against this
problem: XML output must be in UTF-8 encoding, while the file being blamed may
be in an incompatible encoding. Therefore it is not possible to simply insert
the lines of text from the file into the XML output. Either they need
re-coding, which is impractical, or they should be omitted and the XML just
contain the blame information but not the text itself. The latter solution
could be useful.

> * subversion/clients/cmdline/blame-cmd.c
> (print_blame_xml): New function for XML output
> (blame_receiver): Modified to check for XML option and process
> accordingly
> (print_header_xml): New function to print XML header
> (print_footer_xml): New function to print XML footer
> (svn_cl__blame): Modified for XML output
>
> * subversion/clients/cmdline/main.c
> (svn_cl__cmd_table[]): added --xml and --incremental options
> for blame
>
> * subversion/clients/cmdline/dtd/blame.dtd
> New dtd for blame --xml

There's no mention in your detailed change log of fixing a problem with
multiple targets.

>
> * subversion/tests/clients/cmdline/blame_tests.py
> (blame_in_xml): New test for blame --xml
> (blame_on_multiple_targets): New test to verify blame output
> for multiple targets
> (test_list): added blame_in_xml, blame_on_multiple_targets
> ]]]

> Index: subversion/clients/cmdline/blame-cmd.c
> ===================================================================
> --- subversion/clients/cmdline/blame-cmd.c (revision 14461)
> +++ subversion/clients/cmdline/blame-cmd.c (working copy)
> @@ -37,7 +38,67 @@
>
>
> /*** Code. ***/
> +
> static svn_error_t *
> +print_blame_xml (svn_stream_t *out,
> + apr_pool_t *pool,
> + const char *rev,
> + const char *author,
> + const char *time,
> + const char *line)
> +{
> + svn_stringbuf_t *sb = svn_stringbuf_create ("", pool);
> +
> + /* "<entry>" */
> + svn_xml_make_open_tag (&sb, pool, svn_xml_normal,
> + "entry", NULL);
> +
> + /* "<rev>xx</rev>" */
> + if (rev)
> + {
> + svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
> + "rev", NULL);
> + svn_xml_escape_cdata_cstring (&sb, rev, pool);
> + svn_xml_make_close_tag (&sb, pool, "rev");
> + }
> +
> + /* "<author>xx</author>" */
> + if (author)
> + {
> + svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
> + "author", NULL);
> + svn_xml_escape_cdata_cstring (&sb, author, pool);
> + svn_xml_make_close_tag (&sb, pool, "author");
> + }
> +
> + /* "<time>xx</time>" */
> + if (time)
> + {
> + svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
> + "time", NULL);
> + svn_xml_escape_cdata_cstring (&sb, time, pool);
> + svn_xml_make_close_tag (&sb, pool, "time");
> + }
> +
> + /* "<details>xx</details>" */

"details"? What does that mean?

> @@ -151,7 +269,20 @@
> /* Check for a peg revision. */
> SVN_ERR (svn_opt_parse_path (&peg_revision, &truepath, target,
> subpool));
> -
> + /* "<traget ...>" */

"traget"?

> Index: subversion/clients/cmdline/dtd/blame.dtd
> ===================================================================
> --- subversion/clients/cmdline/dtd/blame.dtd (revision 0)
> +++ subversion/clients/cmdline/dtd/blame.dtd (revision 0)
> @@ -0,0 +1,11 @@
> +<!-- XML DTD for Subversion command-line client output. -->
> +
> +<!-- For "svn blame" -->
> +<!ELEMENT blame (target*)>
> +<!ELEMENT target (entry*)>
> +<!ATTLIST target path CDATA #REQUIRED> <!-- file: character -->

"file: character"?

> +<!ELEMENT entry (rev, author, time?, details)>
> +<!ELEMENT rev (#PCDATA)> <!-- revision -->
> +<!ELEMENT author (#PCDATA)> <!-- author -->
> +<!ELEMENT time (#PCDATA)> <!-- date and time -->
> +<!ELEMENT details (#PCDATA)> <!-- deatils or content changed -->

"deatils"? "details or content changed"? What do you really intend this field
to contain?

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Apr 29 13:28:54 2005

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.