parsing trac

1 view
Skip to first unread message

Martin Albrecht

unread,
Oct 29, 2010, 9:33:07 AM10/29/10
to Sage Development
Hi there,

in light of the recent discussion on that our Trac based system shows its age
compared to more awesome technologies I figured I might try to automate a few
more steps of my own Trac interaction.

For me almost the most annoying thing is to
1) export the patch
2) upload the patch (make sure to click the overwrite button)
3) add myself as an author (or reviewer if it's a reviewer patch)
4) toggle the needs_review state

Those steps could easily be automated by adding a function to hg_sage called
for instance push_patch().

For now I'm relying on parsing the HTML output to get stuff like the current
list of authors etc. which seems to be what everybody does (sage-apply-ticket
does the same). Is there a better way of doing this (getting information about
a patch), e.g. is there a way to make Trac spit out some machine readable
format which is more easily parsed? We could use that to implement a class
TracTicket which automatically fetches all the information and makes it
accessible in a convenient fashion.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinr...@jabber.ccc.de

John Cremona

unread,
Oct 29, 2010, 11:15:12 AM10/29/10
to sage-...@googlegroups.com
Are you in danger on reinventing the wheel?

John

> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

Jeroen Demeyer

unread,
Oct 29, 2010, 11:25:50 AM10/29/10
to sage-...@googlegroups.com
On 2010-10-29 15:33, Martin Albrecht wrote:
> Is there a better way of doing this (getting information about
> a patch), e.g. is there a way to make Trac spit out some machine readable
> format which is more easily parsed?

I did this, see
http://sage.math.washington.edu/home/jdemeyer/merger/parseticket.c

Robert Bradshaw

unread,
Oct 29, 2010, 12:11:08 PM10/29/10
to sage-...@googlegroups.com

I've got http://code.google.com/p/sage-buildbot/source/browse/ . It
doesn't push yet, but it pulls and parses stuff from Sage and creates
a clone (trying to be minimally disruptive if you have a clone of that
name, for easy ticket editing). It also stores test results in a db,
but doesn't serve them yet (I'm imaging an iframe on the trac site
with a green/yellow/red bubble and some status info with a link for
more.

- Robert

Jason Grout

unread,
Oct 29, 2010, 7:03:22 PM10/29/10
to sage-...@googlegroups.com
On 10/29/10 8:33 AM, Martin Albrecht wrote:
> Hi there,
>
> in light of the recent discussion on that our Trac based system shows its age
> compared to more awesome technologies I figured I might try to automate a few
> more steps of my own Trac interaction.
>
> For me almost the most annoying thing is to
> 1) export the patch
> 2) upload the patch (make sure to click the overwrite button)
> 3) add myself as an author (or reviewer if it's a reviewer patch)
> 4) toggle the needs_review state
>
> Those steps could easily be automated by adding a function to hg_sage called
> for instance push_patch().
>
> For now I'm relying on parsing the HTML output to get stuff like the current
> list of authors etc. which seems to be what everybody does (sage-apply-ticket
> does the same). Is there a better way of doing this (getting information about
> a patch), e.g. is there a way to make Trac spit out some machine readable
> format which is more easily parsed? We could use that to implement a class
> TracTicket which automatically fetches all the information and makes it
> accessible in a convenient fashion.
>

Surely the xmlrpc interface, or something like that, would be more
natural than parsing the html:

http://trac-hacks.org/wiki/XmlRpcPlugin

It seems that Mike Hansen had some pretty cool ideas about how to use
that plugin.

Or maybe there's another plugin that makes things more natural:
http://trac-hacks.org/

Maybe just accessing the trac database directly might be less work and
more consistent than parsing the html.

Jason

--
Jason Grout

Mike Hansen

unread,
Oct 30, 2010, 1:51:32 AM10/30/10
to sage-...@googlegroups.com
On Fri, Oct 29, 2010 at 4:03 PM, Jason Grout
<jason...@creativetrax.com> wrote:
> It seems that Mike Hansen had some pretty cool ideas about how to use that
> plugin.

There's some code at [1] which handles the digest authentication that
xmlrpclib doesn't handle by default. With the result of
"SageTracServerProxy", you can do the examples at [2].

--Mike

[1] http://sage.math.washington.edu/home/mhansen/sagetrac_xmlrpc.py

[2] http://trac-hacks.org/wiki/XmlRpcPlugin

Reply all
Reply to author
Forward
0 new messages