Fossil SCM
Added size to the "changed files" list for the /json routines which output that.
Commit
9575eb5d2add29f75a50d66ccfab82caa35bb3d3
Parent
8c6dc243c912e3e…
1 file changed
+7
-14
+7
-14
| --- src/json_timeline.c | ||
| +++ src/json_timeline.c | ||
| @@ -291,29 +291,20 @@ | ||
| 291 | 291 | cson_value * json_get_changed_files(int rid){ |
| 292 | 292 | cson_value * rowsV = NULL; |
| 293 | 293 | cson_array * rows = NULL; |
| 294 | 294 | Stmt q = empty_Stmt; |
| 295 | 295 | db_prepare(&q, |
| 296 | -#if 0 | |
| 297 | - "SELECT (mlink.pid==0) AS isNew," | |
| 298 | - " (mlink.fid==0) AS isDel," | |
| 299 | - " filename.name AS name" | |
| 300 | - " FROM mlink, filename" | |
| 301 | - " WHERE mid=%d" | |
| 302 | - " AND pid!=fid" | |
| 303 | - " AND filename.fnid=mlink.fnid" | |
| 304 | - " ORDER BY 3 /*sort*/", | |
| 305 | -#else | |
| 306 | 296 | "SELECT (pid==0) AS isnew," |
| 307 | 297 | " (fid==0) AS isdel," |
| 308 | 298 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 309 | - " (SELECT uuid FROM blob WHERE rid=fid) as uuid," | |
| 310 | - " (SELECT uuid FROM blob WHERE rid=pid) as parent" | |
| 311 | - " FROM mlink" | |
| 299 | + " blob.uuid as uuid," | |
| 300 | + " (SELECT uuid FROM blob WHERE rid=pid) as parent," | |
| 301 | + " blob.size as size" | |
| 302 | + " FROM mlink, blob" | |
| 312 | 303 | " WHERE mid=%d AND pid!=fid" |
| 304 | + " AND blob.rid=fid " | |
| 313 | 305 | " ORDER BY name /*sort*/", |
| 314 | -#endif | |
| 315 | 306 | rid |
| 316 | 307 | ); |
| 317 | 308 | while( (SQLITE_ROW == db_step(&q)) ){ |
| 318 | 309 | cson_value * rowV = cson_value_new_object(); |
| 319 | 310 | cson_object * row = cson_value_get_object(rowV); |
| @@ -328,10 +319,12 @@ | ||
| 328 | 319 | cson_object_set(row, "name", json_new_string(db_column_text(&q,2))); |
| 329 | 320 | cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3))); |
| 330 | 321 | if(!isNew){ |
| 331 | 322 | cson_object_set(row, "parent", json_new_string(db_column_text(&q,4))); |
| 332 | 323 | } |
| 324 | + cson_object_set(row, "size", json_new_int(db_column_int(&q,5))); | |
| 325 | + | |
| 333 | 326 | cson_object_set(row, "state", |
| 334 | 327 | json_new_string(json_artifact_status_to_string(isNew,isDel))); |
| 335 | 328 | zDownload = mprintf("/raw/%s?name=%s", |
| 336 | 329 | /* reminder: g.zBaseURL is of course not set for CLI mode. */ |
| 337 | 330 | db_column_text(&q,2), |
| 338 | 331 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -291,29 +291,20 @@ | |
| 291 | cson_value * json_get_changed_files(int rid){ |
| 292 | cson_value * rowsV = NULL; |
| 293 | cson_array * rows = NULL; |
| 294 | Stmt q = empty_Stmt; |
| 295 | db_prepare(&q, |
| 296 | #if 0 |
| 297 | "SELECT (mlink.pid==0) AS isNew," |
| 298 | " (mlink.fid==0) AS isDel," |
| 299 | " filename.name AS name" |
| 300 | " FROM mlink, filename" |
| 301 | " WHERE mid=%d" |
| 302 | " AND pid!=fid" |
| 303 | " AND filename.fnid=mlink.fnid" |
| 304 | " ORDER BY 3 /*sort*/", |
| 305 | #else |
| 306 | "SELECT (pid==0) AS isnew," |
| 307 | " (fid==0) AS isdel," |
| 308 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 309 | " (SELECT uuid FROM blob WHERE rid=fid) as uuid," |
| 310 | " (SELECT uuid FROM blob WHERE rid=pid) as parent" |
| 311 | " FROM mlink" |
| 312 | " WHERE mid=%d AND pid!=fid" |
| 313 | " ORDER BY name /*sort*/", |
| 314 | #endif |
| 315 | rid |
| 316 | ); |
| 317 | while( (SQLITE_ROW == db_step(&q)) ){ |
| 318 | cson_value * rowV = cson_value_new_object(); |
| 319 | cson_object * row = cson_value_get_object(rowV); |
| @@ -328,10 +319,12 @@ | |
| 328 | cson_object_set(row, "name", json_new_string(db_column_text(&q,2))); |
| 329 | cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3))); |
| 330 | if(!isNew){ |
| 331 | cson_object_set(row, "parent", json_new_string(db_column_text(&q,4))); |
| 332 | } |
| 333 | cson_object_set(row, "state", |
| 334 | json_new_string(json_artifact_status_to_string(isNew,isDel))); |
| 335 | zDownload = mprintf("/raw/%s?name=%s", |
| 336 | /* reminder: g.zBaseURL is of course not set for CLI mode. */ |
| 337 | db_column_text(&q,2), |
| 338 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -291,29 +291,20 @@ | |
| 291 | cson_value * json_get_changed_files(int rid){ |
| 292 | cson_value * rowsV = NULL; |
| 293 | cson_array * rows = NULL; |
| 294 | Stmt q = empty_Stmt; |
| 295 | db_prepare(&q, |
| 296 | "SELECT (pid==0) AS isnew," |
| 297 | " (fid==0) AS isdel," |
| 298 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 299 | " blob.uuid as uuid," |
| 300 | " (SELECT uuid FROM blob WHERE rid=pid) as parent," |
| 301 | " blob.size as size" |
| 302 | " FROM mlink, blob" |
| 303 | " WHERE mid=%d AND pid!=fid" |
| 304 | " AND blob.rid=fid " |
| 305 | " ORDER BY name /*sort*/", |
| 306 | rid |
| 307 | ); |
| 308 | while( (SQLITE_ROW == db_step(&q)) ){ |
| 309 | cson_value * rowV = cson_value_new_object(); |
| 310 | cson_object * row = cson_value_get_object(rowV); |
| @@ -328,10 +319,12 @@ | |
| 319 | cson_object_set(row, "name", json_new_string(db_column_text(&q,2))); |
| 320 | cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3))); |
| 321 | if(!isNew){ |
| 322 | cson_object_set(row, "parent", json_new_string(db_column_text(&q,4))); |
| 323 | } |
| 324 | cson_object_set(row, "size", json_new_int(db_column_int(&q,5))); |
| 325 | |
| 326 | cson_object_set(row, "state", |
| 327 | json_new_string(json_artifact_status_to_string(isNew,isDel))); |
| 328 | zDownload = mprintf("/raw/%s?name=%s", |
| 329 | /* reminder: g.zBaseURL is of course not set for CLI mode. */ |
| 330 | db_column_text(&q,2), |
| 331 |