Fossil SCM

Added size to the "changed files" list for the /json routines which output that.

stephan 2012-03-22 23:26 trunk
Commit 9575eb5d2add29f75a50d66ccfab82caa35bb3d3
1 file changed +7 -14
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -291,29 +291,20 @@
291291
cson_value * json_get_changed_files(int rid){
292292
cson_value * rowsV = NULL;
293293
cson_array * rows = NULL;
294294
Stmt q = empty_Stmt;
295295
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
306296
"SELECT (pid==0) AS isnew,"
307297
" (fid==0) AS isdel,"
308298
" (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"
312303
" WHERE mid=%d AND pid!=fid"
304
+ " AND blob.rid=fid "
313305
" ORDER BY name /*sort*/",
314
-#endif
315306
rid
316307
);
317308
while( (SQLITE_ROW == db_step(&q)) ){
318309
cson_value * rowV = cson_value_new_object();
319310
cson_object * row = cson_value_get_object(rowV);
@@ -328,10 +319,12 @@
328319
cson_object_set(row, "name", json_new_string(db_column_text(&q,2)));
329320
cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3)));
330321
if(!isNew){
331322
cson_object_set(row, "parent", json_new_string(db_column_text(&q,4)));
332323
}
324
+ cson_object_set(row, "size", json_new_int(db_column_int(&q,5)));
325
+
333326
cson_object_set(row, "state",
334327
json_new_string(json_artifact_status_to_string(isNew,isDel)));
335328
zDownload = mprintf("/raw/%s?name=%s",
336329
/* reminder: g.zBaseURL is of course not set for CLI mode. */
337330
db_column_text(&q,2),
338331
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button