Hi, all!

i finally found a good use-case for my sql-to-json tool: the past days
someone has taken the time to file a few tickets in two separate repos of
mine. It was only by accident that i saw them (b/c i like to read my own
timeline page from time to time), and i want to get the info fed to me. i
couldn't find an rss feed for the tickets, but i was able to use this tool
to implement it easily:

http://fossil.wanderinghorse.net/repos/cson/index.cgi/wiki?name=select-to-json

Example:

Copy your favourite ticket report query/queries to a file:

stephan@tiny:~/cvs/fossil/cson$ cat > fossil-tickets.sql
SELECT
  CASE WHEN status IN ('Open','Verified') THEN '#f2dcdc'
       WHEN status='Review' THEN '#e8e8e8'
       WHEN status='Fixed' THEN '#cfe8bd'
       WHEN status='Tested' THEN '#bde5d6'
       WHEN status='Deferred' THEN '#cacae5'
       ELSE '#c8c8c8' END AS 'bgcolor',
  substr(tkt_uuid,1,10) AS '#',
  datetime(tkt_mtime) AS 'mtime',
  type,
  status,
  subsystem,
  title
FROM ticket
WHERE status NOT IN ('Closed')
^D

(or ^Z on Windows, IIRC)

then:

stephan@tiny:~/cvs/fossil$ ./select-to-json -d 'sqlite3:whio.fsl' -S
fossil-tickets.sql
{
"columns":[
"bgcolor",
"#",
"mtime",
"type",
"status",
"subsystem",
"title"
],
"rows":[
{
"bgcolor":"#f2dcdc",
"#":"cb6afe9640",
"mtime":"2010-02-16 01:02:45",
"type":"Reminder",
"status":"Open",
"subsystem":"whio_dev",
"title":"reminder: test subdevice fcntl forwarding"
},
...snip...
}

on top of that it is trivial to write a JavaScript app which sorts and shows
me my list of new tickets, and it can be scripted to walk all my repos,
collating the data for me.

If i ever get around to writing such a JS script, i'll post it here.

Happy Hacking!

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to