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

Re: [PATCH] Do 'svn log --xml --incremental'

From: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2002-10-29 21:57:51 CET

Nuutti Kotivuori <naked@iki.fi> writes:
> Log message:
> Taught the xml log output to take advantage of the new --incremental
> option that was added.
>
> * subversion/clients/cmdline/log-cmd.c (svn_cl__log): Use
> opt_state->incremental.

The patch looks good (haven't tested it, but it makes sense).

Hmmmm...

If you run plain 'svn log' without --incremental' its output is still
suitable to for concatenation with incremental output later on. For
example:

   $ svn log -r X:Y > foo
   $ svn log --incremental -r (Y+1):Z > bar; cat foo >> bar

where usually X < Y < Z.

But with the xml output, if you didn't use --incremental the first
time, then using it the second time will result in an strange xml
document, because it will have some log data inside the overall log
element, and some outside it.

This isn't a fatal flaw, just something that maybe should be
documented somewhere, I guess (?). People doing xml logs will need to
always pass the --incremental flag, or do some manual cutting, I
think.

Anyway, +1 on the patch, with or without more documentation.

-K

> Index: subversion/clients/cmdline/log-cmd.c
> ===================================================================
> --- subversion/clients/cmdline/log-cmd.c (revision 3549)
> +++ subversion/clients/cmdline/log-cmd.c (working copy)
> @@ -420,20 +420,21 @@
>
> if (opt_state->xml)
> {
> - svn_stringbuf_t *sb;
> -
> - /* The header generation is commented out because it might not
> - be certain that the log messages are indeed the advertised
> - encoding, UTF-8. The absence of the header should not matter
> - to people processing the output, and they should add it
> - themselves if storing the output as a fully-formed XML
> - document. */
> - /* <?xml version="1.0" encoding="utf-8"?> */
> - /* svn_xml_make_header (&sb, pool); */
> -
> - sb = NULL;
> - svn_xml_make_open_tag (&sb, pool, svn_xml_normal, "log", NULL);
> - printf ("%s", sb->data); /* "<log>" */
> + /* If output is not incremental, output the XML header and wrap
> + everything in a top-level element. This makes the output in
> + it's entirety a well-formed XML document. */
> + if (! opt_state->incremental)
> + {
> + svn_stringbuf_t *sb = svn_stringbuf_create ("", pool);
> +
> + /* <?xml version="1.0" encoding="utf-8"?> */
> + svn_xml_make_header (&sb, pool);
> +
> + /* "<log>" */
> + svn_xml_make_open_tag (&sb, pool, svn_xml_normal, "log", NULL);
> +
> + printf ("%s", sb->data);
> + }
>
> SVN_ERR (svn_client_log (auth_baton,
> targets,
> @@ -445,9 +446,15 @@
> NULL, /* no baton necessary */
> pool));
>
> - sb = NULL;
> - svn_xml_make_close_tag (&sb, pool, "log");
> - printf ("%s", sb->data); /* "</log>" */
> + if (! opt_state->incremental)
> + {
> + svn_stringbuf_t *sb = svn_stringbuf_create ("", pool);
> +
> + /* "</log>" */
> + svn_xml_make_close_tag (&sb, pool, "log");
> +
> + printf ("%s", sb->data);
> + }
> }
> else /* default output format */
> {
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 29 22:29:19 2002

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.