xmloutput for xmllog does not include fixes or bugs information

Bug #677344 reported by Brook Stevens on 2010-11-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bzr-xmloutput
Medium
Unassigned

Bug Description

Not a bug but more of a wish item but bzr xmllog does not include the fixes information when commits using the fixes feature.
bzr commit --fixes=ABC123

Would be nice. Below is a patch for logxml.py that supports this, but this is my first python/bazaar experience so it is more a proof of concept than a real fix.

=== modified file logxml.py
--- logxml.py 2010-09-05 17:40:26 +0000
+++ logxml.py 2010-11-19 06:02:09 +0000
@@ -150,6 +150,14 @@
                 self.to_file.write('<parent>%s</parent>' % parent_id)
             if len(revision.rev.parent_ids) > 0:
                 self.to_file.write('</parents>')
+
+ #show bigs (fixes) only when exists
+ bug_property = revision.rev.properties.get('bugs', None)
+ if bug_property:
+ for line in bug_property.splitlines():
+ self.to_file.write("<bugs>")
+ self.to_file.write("<bug>%s</bug>" % line)
+ self.to_file.write("</bugs>")

         self.to_file.write('<committer>%s</committer>' % \
                         _escape_cdata(revision.rev.committer))
@@ -227,6 +235,15 @@
             out.append("<revno>%s</revno>" % revno)
         elif rev.revision_id:
             out.append("<revisionid>%s</revisionid>" % rev.revision_id)
+
+ #show bigs (fixes) only when exists
+ bug_property = rev.properties.get('bugs', None)
+ if bug_property:
+ for line in bug_property.splitlines():
+ out.append("<bugs>")
+ out.append("<bug>%s</bug>" % line)
+ out.append("</bugs>")
+
         out.append('<committer>%s</committer>' %
                    _escape_cdata(rev.committer))
         date_str = osutils.format_date(rev.timestamp,

Jelmer Vernooij (jelmer) wrote :

I wonder if it wouldn't make more sense to include the revision properties verbatim. That would also make the authors accessible.

Changed in bzr-xmloutput:
status: New → Confirmed
importance: Undecided → Medium
Brook Stevens (brook) wrote :

Yes I see what you mean. Here is an attempt at that. The branch_nick was removed as it will now render as part of the revision properties.

I couldn't test the XMLLineLogFormatter section but if you tell me I can make sure it is working; I tried setting up a pending merge scenario which is where I think it is called but perhaps I didn't get it right.

=== modified file 'logxml.py'
--- logxml.py 2010-12-15 18:27:12 +0000
+++ logxml.py 2010-12-31 04:05:49 +0000
@@ -150,15 +150,15 @@
                 self.to_file.write('<parent>%s</parent>' % parent_id)
             if len(revision.rev.parent_ids) > 0:
                 self.to_file.write('</parents>')
-
+
         self.to_file.write('<committer>%s</committer>' % \
                         _escape_cdata(revision.rev.committer))

- try:
- self.to_file.write('<branch-nick>%s</branch-nick>' % \
- _escape_cdata(revision.rev.properties['branch-nick']))
- except KeyError:
- pass
+ #Write out any arbitrary revision properties
+ for revPropName in revision.rev.properties:
+ revPropVal = _escape_cdata(revision.rev.properties.get(revPropName, None))
+ self.to_file.write("<%s>%s<%s>" % (revPropName, revPropVal, revPropName))
+
         date_str = osutils.format_date(revision.rev.timestamp,
                                revision.rev.timezone or 0,
                                self.show_timezone)
@@ -227,6 +227,12 @@
             out.append("<revno>%s</revno>" % revno)
         elif rev.revision_id:
             out.append("<revisionid>%s</revisionid>" % rev.revision_id)
+
+ #Write out any arbitrary revision properties
+ for revPropName in rev.properties:
+ revPropVal = _escape_cdata(rev.properties.get(revPropName, None))
+ out.append("<%s>%s<%s>" % (revPropName, revPropVal, revPropName))
+
         out.append('<committer>%s</committer>' %
                    _escape_cdata(rev.committer))
         date_str = osutils.format_date(rev.timestamp,

Brook Stevens (brook) wrote :

Forgot the / in the trailing tag. Here is the corrected diff; sorry this is my first time dealing with python guess I got ahead of myself.

=== modified file 'logxml.py'
--- logxml.py 2010-12-15 18:27:12 +0000
+++ logxml.py 2011-01-01 05:25:35 +0000
@@ -150,15 +150,15 @@
                 self.to_file.write('<parent>%s</parent>' % parent_id)
             if len(revision.rev.parent_ids) > 0:
                 self.to_file.write('</parents>')
-
+
         self.to_file.write('<committer>%s</committer>' % \
                         _escape_cdata(revision.rev.committer))

- try:
- self.to_file.write('<branch-nick>%s</branch-nick>' % \
- _escape_cdata(revision.rev.properties['branch-nick']))
- except KeyError:
- pass
+ #Write out any arbitrary revision properties
+ for revPropName in revision.rev.properties:
+ revPropVal = _escape_cdata(revision.rev.properties.get(revPropName, None))
+ self.to_file.write("<%s>%s</%s>" % (revPropName, revPropVal, revPropName))
+
         date_str = osutils.format_date(revision.rev.timestamp,
                                revision.rev.timezone or 0,
                                self.show_timezone)
@@ -227,6 +227,12 @@
             out.append("<revno>%s</revno>" % revno)
         elif rev.revision_id:
             out.append("<revisionid>%s</revisionid>" % rev.revision_id)
+
+ #Write out any arbitrary revision properties
+ for revPropName in rev.properties:
+ revPropVal = _escape_cdata(rev.properties.get(revPropName, None))
+ out.append("<%s>%s</%s>" % (revPropName, revPropVal, revPropName))
+
         out.append('<committer>%s</committer>' %
                    _escape_cdata(rev.committer))
         date_str = osutils.format_date(rev.timestamp,

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers