Fossil SCM
Changes /json/timeline/branch's payload structure to match that used by the other /json/timeline/xyz APIs. Removed rid property from timeline output.
Commit
bdc29eb897210da6ccb535046e525e44c8a3b10c
Parent
9b42f2e9765a9e0…
1 file changed
+15
-1
+15
-1
| --- src/json_timeline.c | ||
| +++ src/json_timeline.c | ||
| @@ -389,23 +389,37 @@ | ||
| 389 | 389 | if(pay){ |
| 390 | 390 | /* get the array-form tags of each record. */ |
| 391 | 391 | cson_string * tags = cson_new_string("tags",4); |
| 392 | 392 | cson_string * isLeaf = cson_new_string("isLeaf",6); |
| 393 | 393 | cson_array * ar = cson_value_get_array(pay); |
| 394 | + cson_object * outer = NULL; | |
| 394 | 395 | unsigned int i = 0; |
| 395 | 396 | unsigned int len = cson_array_length_get(ar); |
| 396 | 397 | cson_value_add_reference( cson_string_value(tags) ); |
| 397 | 398 | cson_value_add_reference( cson_string_value(isLeaf) ); |
| 398 | 399 | for( ; i < len; ++i ){ |
| 399 | 400 | cson_object * row = cson_value_get_object(cson_array_get(ar,i)); |
| 400 | 401 | int rid = cson_value_get_integer(cson_object_get(row,"rid")); |
| 401 | 402 | assert( rid > 0 ); |
| 402 | 403 | cson_object_set_s(row, tags, json_tags_for_checkin_rid(rid,0)); |
| 403 | - cson_object_set_s(row, isLeaf, json_value_to_bool(cson_object_get(row,"isLeaf"))); | |
| 404 | + cson_object_set_s(row, isLeaf, | |
| 405 | + json_value_to_bool(cson_object_get(row,"isLeaf"))); | |
| 406 | + cson_object_set(row, "rid", NULL) | |
| 407 | + /* remove rid - we don't really want it to be public */; | |
| 404 | 408 | } |
| 405 | 409 | cson_value_free( cson_string_value(tags) ); |
| 406 | 410 | cson_value_free( cson_string_value(isLeaf) ); |
| 411 | + | |
| 412 | + /* now we wrap the payload in an outer shell, for consistency with | |
| 413 | + other /json/timeline/xyz APIs... | |
| 414 | + */ | |
| 415 | + outer = cson_new_object(); | |
| 416 | + if(limit>0){ | |
| 417 | + cson_object_set( outer, "limit", json_new_int(limit) ); | |
| 418 | + } | |
| 419 | + cson_object_set( outer, "timeline", pay ); | |
| 420 | + pay = cson_object_value(outer); | |
| 407 | 421 | } |
| 408 | 422 | return pay; |
| 409 | 423 | } |
| 410 | 424 | |
| 411 | 425 | /* |
| 412 | 426 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -389,23 +389,37 @@ | |
| 389 | if(pay){ |
| 390 | /* get the array-form tags of each record. */ |
| 391 | cson_string * tags = cson_new_string("tags",4); |
| 392 | cson_string * isLeaf = cson_new_string("isLeaf",6); |
| 393 | cson_array * ar = cson_value_get_array(pay); |
| 394 | unsigned int i = 0; |
| 395 | unsigned int len = cson_array_length_get(ar); |
| 396 | cson_value_add_reference( cson_string_value(tags) ); |
| 397 | cson_value_add_reference( cson_string_value(isLeaf) ); |
| 398 | for( ; i < len; ++i ){ |
| 399 | cson_object * row = cson_value_get_object(cson_array_get(ar,i)); |
| 400 | int rid = cson_value_get_integer(cson_object_get(row,"rid")); |
| 401 | assert( rid > 0 ); |
| 402 | cson_object_set_s(row, tags, json_tags_for_checkin_rid(rid,0)); |
| 403 | cson_object_set_s(row, isLeaf, json_value_to_bool(cson_object_get(row,"isLeaf"))); |
| 404 | } |
| 405 | cson_value_free( cson_string_value(tags) ); |
| 406 | cson_value_free( cson_string_value(isLeaf) ); |
| 407 | } |
| 408 | return pay; |
| 409 | } |
| 410 | |
| 411 | /* |
| 412 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -389,23 +389,37 @@ | |
| 389 | if(pay){ |
| 390 | /* get the array-form tags of each record. */ |
| 391 | cson_string * tags = cson_new_string("tags",4); |
| 392 | cson_string * isLeaf = cson_new_string("isLeaf",6); |
| 393 | cson_array * ar = cson_value_get_array(pay); |
| 394 | cson_object * outer = NULL; |
| 395 | unsigned int i = 0; |
| 396 | unsigned int len = cson_array_length_get(ar); |
| 397 | cson_value_add_reference( cson_string_value(tags) ); |
| 398 | cson_value_add_reference( cson_string_value(isLeaf) ); |
| 399 | for( ; i < len; ++i ){ |
| 400 | cson_object * row = cson_value_get_object(cson_array_get(ar,i)); |
| 401 | int rid = cson_value_get_integer(cson_object_get(row,"rid")); |
| 402 | assert( rid > 0 ); |
| 403 | cson_object_set_s(row, tags, json_tags_for_checkin_rid(rid,0)); |
| 404 | cson_object_set_s(row, isLeaf, |
| 405 | json_value_to_bool(cson_object_get(row,"isLeaf"))); |
| 406 | cson_object_set(row, "rid", NULL) |
| 407 | /* remove rid - we don't really want it to be public */; |
| 408 | } |
| 409 | cson_value_free( cson_string_value(tags) ); |
| 410 | cson_value_free( cson_string_value(isLeaf) ); |
| 411 | |
| 412 | /* now we wrap the payload in an outer shell, for consistency with |
| 413 | other /json/timeline/xyz APIs... |
| 414 | */ |
| 415 | outer = cson_new_object(); |
| 416 | if(limit>0){ |
| 417 | cson_object_set( outer, "limit", json_new_int(limit) ); |
| 418 | } |
| 419 | cson_object_set( outer, "timeline", pay ); |
| 420 | pay = cson_object_value(outer); |
| 421 | } |
| 422 | return pay; |
| 423 | } |
| 424 | |
| 425 | /* |
| 426 |