Add 'bugs' property to xmllog?

Frits Jalvingh jal at etc.to
Thu Dec 17 09:51:59 GMT 2009


Hi Jelmer,

Thanks for your response. I modified the code to report the structure as
follows:
<bugs><bug><url>http://bugzilla.etc.to/show_bug.cgi?id=12345</url><status>fixed</status></bug></bugs>
where the "bug" tag gets repeated for every line in the bugs property.
Sadly enough I cannot properly split this into a bug tracker ID and a
bug number proper because only the URL is stored, not the components it
was created from. And properly decoding the URL into an ID and a tracker
key is not supported by TrackerRegistry.

The new diff is as follows:
=== modified file 'logxml.py'
--- logxml.py	2009-07-02 16:12:44 +0000
+++ logxml.py	2009-12-17 09:46:25 +0000
@@ -139,6 +139,26 @@
             for tag in revision.tags:
                 self.to_file.write('<tag>%s</tag>' % tag)
             self.to_file.write('</tags>')
+        # jal at etc.to expose 'bugs' property
+        if revision.rev.properties and 'bugs' in
revision.rev.properties:
+            bugs = revision.rev.properties['bugs']
+            if len(bugs) > 0:
+                self.to_file.write('<bugs>')
+                bugar = bugs.split('\n')
+                for bug in bugar:
+                    if len(bug) > 0:
+                        self.to_file.write('<bug>')
+                        lsp = bug.rfind(' ')
+                        if lsp == -1:
+                            url = bug
+                            status = ''
+                        else:
+                            url = bug[0:lsp].rstrip()
+                            status = bug[lsp+1:].strip()
+                        self.to_file.write('<url>%s</url>' % url)
+                        self.to_file.write('<status>%s</status>' %
status)
+                        self.to_file.write('</bug>')
+                self.to_file.write('</bugs>')
         if self.show_ids:
             self.to_file.write('<revisionid>%s</revisionid>' %
                                 revision.rev.revision_id)


On Sun, 2009-12-06 at 13:41 +0100, Jelmer Vernooij wrote:
> Hi Frits,
> 
> On Sun, 2009-12-06 at 12:11 +0100, Frits Jalvingh wrote: 
> > I want to be able to access the 'bugs' property on all revisions that were 
> > committed with a --fixes option. (bla bla bla)

> This seems like a good idea. I think it would be nice if we could
> provide the contents of the bugs property in XML as well rather than
> just providing the plain contents, to prevent the user from having to
> implement a parser for the bugs property themselves.
> 
> Cheers,
> 
> Jelmer





More information about the bazaar mailing list