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

XML output of "svn log" should omit unknown values.

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-09-30 01:07:21 CEST

The following change is not open to discussion unless you have a very good objection. :-)

[[[
Make XML output from "svn log" omit unknown values, rather than contain
fixed strings like "(no author)", so that the meaning is programmatically
obvious, language-neutral, etc.

* subversion/clients/cmdline/log-cmd.c
  (log_message_receiver_xml) Omit <author> and/or <date> elements if the
    respective data are missing.
]]]

Index: subversion/clients/cmdline/log-cmd.c
===================================================================
--- subversion/clients/cmdline/log-cmd.c (revision 7248)
+++ subversion/clients/cmdline/log-cmd.c (working copy)
@@ -352,24 +352,24 @@ log_message_receiver_xml (void *baton,
   svn_xml_make_open_tag (&sb, pool, svn_xml_normal, "logentry",
                          "revision", revstr, NULL);

- if (author == NULL)
- author = "(no author)";
+ if (author)
+ {
+ /* <author>xxx</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");
+ }

- /* <author>xxx</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");
-
- if (date == NULL)
- date = "(no date)";
-
- /* Print the full, uncut, date. This is machine output. */
- /* <date>xxx</date> */
- svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata, "date",
- NULL);
- svn_xml_escape_cdata_cstring (&sb, date, pool);
- svn_xml_make_close_tag (&sb, pool, "date");
+ if (date)
+ {
+ /* Print the full, uncut, date. This is machine output. */
+ /* <date>xxx</date> */
+ svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata, "date",
+ NULL);
+ svn_xml_escape_cdata_cstring (&sb, date, pool);
+ svn_xml_make_close_tag (&sb, pool, "date");
+ }

   if (changed_paths)
     {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Sep 30 01:06:45 2003

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.