Hi, all,
while hacking on a new /json/doc command for fossil i found that we don't
need one...
f json dir www -ci tip
resp.
/json/dir/www?checkin=tip
will get the current list of docs:
[stephan@host:~/cvs/fossil/fossil]$ f json dir www -ci tip -I 2 | sed -n
6,30p
"payload":{
"name":"www",
"checkin":"89fb414274ddcdac22563bf97079a539b3e2b9d0",
"entries":[
{
"isDir":true,
"name":"build-icons"
},
{
"name":"CollRev1.gif",
"uuid":"3ca46d72571bc56d114d467ec8d291541c9ae932",
"size":6493,
"timestamp":1195259382,
"downloadPath":"/raw/www/CollRev1.gif?name=3ca46d72571bc56d114d467ec8d291541c9ae932"
},
{
"name":"CollRev2.gif",
"uuid":"581afba0a01d5fd62e06ebbed88e76e51a5d1d6c",
"size":4785,
"timestamp":1195259382,
"downloadPath":"/raw/www/CollRev2.gif?name=581afba0a01d5fd62e06ebbed88e76e51a5d1d6c"
},
...
and we can then fetch any given one of them with:
f json artifact THE_UUID -c
# -c == include the file's content in the output. Only works for text files.
/json/artifact/THE_UUID
e.g.
[stephan@host:~/cvs/fossil/fossil]$ f json artifact
e0131236d0af2bd20c6fa96e1a7b84f1f555ea8b -c -I 2
{
"fossil":"3e1dd97f77481a92408e5ef0f27337ea5167793e",
"timestamp":1342190669,
"command":"artifact",
"procTimeMs":4,
"payload":{
"type":"file",
"name":"e0131236d0af2bd20c6fa96e1a7b84f1f555ea8b",
"artifact":{
"contentType":"text/plain",
"size":6852,
"content":"...snip..."
...
Still missing is an option to wiki-process the file's content, but we have
that code already so it will be easy to add.
Happy hacking!
PS: i've decided against sub-second timestamp precision for the time being,
primarily due to concerns about integer precision in JSON (specifically:
precision is unspecified, so an 8-bit-precision implementation is
technically compliant). i could revert to using doubles for timestamps, but
i find that somehow dissatisfying. Not sure exactly why, though. i want to
stick with Unix Epoch times, in any case, as opposed to Julian, simply for
portability - every platform has routines for dealing with epoch seconds
and many use them as their basis.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users