Fossil SCM

Store a short description of artifacts in bundles and in purgeitem entries. Use that short description on listings.

drh 2014-12-01 20:26 UTC DBP-workflow
Commit 87a04576f2de9c109d2f3b2a7689bd0b5d7f2cfc
3 files changed +46 -26 +27 -30 +13 -9
+46 -26
--- src/bundle.c
+++ src/bundle.c
@@ -38,10 +38,11 @@
3838
@ CREATE TABLE IF NOT EXISTS "%w".bblob(
3939
@ blobid INTEGER PRIMARY KEY, -- Blob ID
4040
@ uuid TEXT NOT NULL, -- SHA1 hash of expanded blob
4141
@ sz INT NOT NULL, -- Size of blob after expansion
4242
@ delta ANY, -- Delta compression basis, or NULL
43
+@ notes TEXT, -- Description of content
4344
@ data BLOB -- compressed content
4445
@ );
4546
;
4647
4748
/*
@@ -64,10 +65,11 @@
6465
*/
6566
static void bundle_ls_cmd(void){
6667
Stmt q;
6768
sqlite3_int64 sumSz = 0;
6869
sqlite3_int64 sumLen = 0;
70
+ int bDetails = find_option("details","l",0)!=0;
6971
bundle_attach_file(g.argv[3], "b1", 0);
7072
db_prepare(&q,
7173
"SELECT bcname, bcvalue FROM bconfig"
7274
" WHERE typeof(bcvalue)='text'"
7375
" AND bcvalue NOT GLOB char(0x2a,0x0a,0x2a);"
@@ -74,27 +76,41 @@
7476
);
7577
while( db_step(&q)==SQLITE_ROW ){
7678
fossil_print("%s: %s\n", db_column_text(&q,0), db_column_text(&q,1));
7779
}
7880
db_finalize(&q);
79
- db_prepare(&q,
80
- "SELECT blobid, substr(uuid,1,16), coalesce(substr(delta,1,16),''),"
81
- " sz, length(data)"
82
- " FROM bblob"
83
- );
84
- while( db_step(&q)==SQLITE_ROW ){
85
- fossil_print("%4d %16s %16s %10d %10d\n",
86
- db_column_int(&q,0),
87
- db_column_text(&q,1),
88
- db_column_text(&q,2),
89
- db_column_int(&q,3),
90
- db_column_int(&q,4));
91
- sumSz += db_column_int(&q,3);
92
- sumLen += db_column_int(&q,4);
93
- }
94
- db_finalize(&q);
95
- fossil_print("%39s %10lld %10lld\n", "Total:", sumSz, sumLen);
81
+ fossil_print("%.78c\n",'-');
82
+ if( bDetails ){
83
+ db_prepare(&q,
84
+ "SELECT blobid, substr(uuid,1,10), coalesce(substr(delta,1,10),''),"
85
+ " sz, length(data), notes"
86
+ " FROM bblob"
87
+ );
88
+ while( db_step(&q)==SQLITE_ROW ){
89
+ fossil_print("%4d %10s %10s %8d %8d %s\n",
90
+ db_column_int(&q,0),
91
+ db_column_text(&q,1),
92
+ db_column_text(&q,2),
93
+ db_column_int(&q,3),
94
+ db_column_int(&q,4),
95
+ db_column_text(&q,5));
96
+ sumSz += db_column_int(&q,3);
97
+ sumLen += db_column_int(&q,4);
98
+ }
99
+ db_finalize(&q);
100
+ fossil_print("%27s %8lld %8lld\n", "Total:", sumSz, sumLen);
101
+ }else{
102
+ db_prepare(&q,
103
+ "SELECT substr(uuid,1,16), notes FROM bblob"
104
+ );
105
+ while( db_step(&q)==SQLITE_ROW ){
106
+ fossil_print("%16s %s\n",
107
+ db_column_text(&q,0),
108
+ db_column_text(&q,1));
109
+ }
110
+ db_finalize(&q);
111
+ }
96112
}
97113
98114
/*
99115
** Implement the "fossil bundle append BUNDLE FILE..." command. Add
100116
** the named files into the BUNDLE. Create the BUNDLE if it does not
@@ -107,12 +123,12 @@
107123
Stmt q;
108124
109125
verify_all_options();
110126
bundle_attach_file(g.argv[3], "b1", 1);
111127
db_prepare(&q,
112
- "INSERT INTO bblob(blobid, uuid, sz, delta, data) "
113
- "VALUES(NULL, $uuid, $sz, NULL, $data)");
128
+ "INSERT INTO bblob(blobid, uuid, sz, delta, data, notes) "
129
+ "VALUES(NULL, $uuid, $sz, NULL, $data, $filename)");
114130
db_begin_transaction();
115131
for(i=4; i<g.argc; i++){
116132
int sz;
117133
blob_read_from_file(&content, g.argv[i]);
118134
sz = blob_size(&content);
@@ -119,10 +135,11 @@
119135
sha1sum_blob(&content, &hash);
120136
blob_compress(&content, &content);
121137
db_bind_text(&q, "$uuid", blob_str(&hash));
122138
db_bind_int(&q, "$sz", sz);
123139
db_bind_blob(&q, "$data", &content);
140
+ db_bind_text(&q, "$filename", g.argv[i]);
124141
db_step(&q);
125142
db_reset(&q);
126143
blob_reset(&content);
127144
blob_reset(&hash);
128145
}
@@ -248,10 +265,11 @@
248265
** should be in the bundle */
249266
db_multi_exec("CREATE TEMP TABLE tobundle(rid INTEGER PRIMARY KEY);");
250267
subtree_from_arguments("tobundle");
251268
find_checkin_associates("tobundle", 0);
252269
verify_all_options();
270
+ describe_artifacts("IN tobundle");
253271
254272
/* Create the new bundle */
255273
bundle_attach_file(g.argv[3], "b1", 1);
256274
db_begin_transaction();
257275
@@ -269,17 +287,18 @@
269287
/* Directly copy content from the repository into the bundle as long
270288
** as the repository content is a delta from some other artifact that
271289
** is also in the bundle.
272290
*/
273291
db_multi_exec(
274
- "REPLACE INTO bblob(blobid,uuid,sz,delta,data) "
292
+ "REPLACE INTO bblob(blobid,uuid,sz,delta,data,notes) "
275293
" SELECT"
276294
" tobundle.rid,"
277295
" blob.uuid,"
278296
" blob.size,"
279297
" delta.srcid,"
280
- " blob.content"
298
+ " blob.content,"
299
+ " (SELECT summary FROM description WHERE rid=blob.rid)"
281300
" FROM tobundle, blob, delta"
282301
" WHERE blob.rid=tobundle.rid"
283302
" AND delta.rid=tobundle.rid"
284303
" AND delta.srcid IN tobundle;"
285304
);
@@ -329,13 +348,14 @@
329348
deltaFrom = 0;
330349
}else{
331350
Stmt ins;
332351
blob_compress(&delta, &delta);
333352
db_prepare(&ins,
334
- "REPLACE INTO bblob(blobid,uuid,sz,delta,data)"
353
+ "REPLACE INTO bblob(blobid,uuid,sz,delta,data,notes)"
335354
" SELECT %d, uuid, size, (SELECT uuid FROM blob WHERE rid=%d),"
336
- " :delta FROM blob WHERE rid=%d", rid, deltaFrom, rid);
355
+ " :delta, (SELECT summary FROM description WHERE rid=blob.rid)"
356
+ " FROM blob WHERE rid=%d", rid, deltaFrom, rid);
337357
db_bind_blob(&ins, ":delta", &delta);
338358
db_step(&ins);
339359
db_finalize(&ins);
340360
}
341361
blob_reset(&basis);
@@ -345,21 +365,21 @@
345365
/* If unable to insert the artifact as a delta, insert full-text */
346366
if( deltaFrom==0 ){
347367
Stmt ins;
348368
blob_compress(&content, &content);
349369
db_prepare(&ins,
350
- "REPLACE INTO bblob(blobid,uuid,sz,delta,data)"
351
- " SELECT rid, uuid, size, NULL, :content"
370
+ "REPLACE INTO bblob(blobid,uuid,sz,delta,data,notes)"
371
+ " SELECT rid, uuid, size, NULL, :content,"
372
+ " (SELECT summary FROM description WHERE rid=blob.rid)"
352373
" FROM blob WHERE rid=%d", rid);
353374
db_bind_blob(&ins, ":content", &content);
354375
db_step(&ins);
355376
db_finalize(&ins);
356377
}
357378
blob_reset(&content);
358379
}
359380
db_finalize(&q);
360
-
361381
362382
db_end_transaction(0);
363383
}
364384
365385
366386
--- src/bundle.c
+++ src/bundle.c
@@ -38,10 +38,11 @@
38 @ CREATE TABLE IF NOT EXISTS "%w".bblob(
39 @ blobid INTEGER PRIMARY KEY, -- Blob ID
40 @ uuid TEXT NOT NULL, -- SHA1 hash of expanded blob
41 @ sz INT NOT NULL, -- Size of blob after expansion
42 @ delta ANY, -- Delta compression basis, or NULL
 
43 @ data BLOB -- compressed content
44 @ );
45 ;
46
47 /*
@@ -64,10 +65,11 @@
64 */
65 static void bundle_ls_cmd(void){
66 Stmt q;
67 sqlite3_int64 sumSz = 0;
68 sqlite3_int64 sumLen = 0;
 
69 bundle_attach_file(g.argv[3], "b1", 0);
70 db_prepare(&q,
71 "SELECT bcname, bcvalue FROM bconfig"
72 " WHERE typeof(bcvalue)='text'"
73 " AND bcvalue NOT GLOB char(0x2a,0x0a,0x2a);"
@@ -74,27 +76,41 @@
74 );
75 while( db_step(&q)==SQLITE_ROW ){
76 fossil_print("%s: %s\n", db_column_text(&q,0), db_column_text(&q,1));
77 }
78 db_finalize(&q);
79 db_prepare(&q,
80 "SELECT blobid, substr(uuid,1,16), coalesce(substr(delta,1,16),''),"
81 " sz, length(data)"
82 " FROM bblob"
83 );
84 while( db_step(&q)==SQLITE_ROW ){
85 fossil_print("%4d %16s %16s %10d %10d\n",
86 db_column_int(&q,0),
87 db_column_text(&q,1),
88 db_column_text(&q,2),
89 db_column_int(&q,3),
90 db_column_int(&q,4));
91 sumSz += db_column_int(&q,3);
92 sumLen += db_column_int(&q,4);
93 }
94 db_finalize(&q);
95 fossil_print("%39s %10lld %10lld\n", "Total:", sumSz, sumLen);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96 }
97
98 /*
99 ** Implement the "fossil bundle append BUNDLE FILE..." command. Add
100 ** the named files into the BUNDLE. Create the BUNDLE if it does not
@@ -107,12 +123,12 @@
107 Stmt q;
108
109 verify_all_options();
110 bundle_attach_file(g.argv[3], "b1", 1);
111 db_prepare(&q,
112 "INSERT INTO bblob(blobid, uuid, sz, delta, data) "
113 "VALUES(NULL, $uuid, $sz, NULL, $data)");
114 db_begin_transaction();
115 for(i=4; i<g.argc; i++){
116 int sz;
117 blob_read_from_file(&content, g.argv[i]);
118 sz = blob_size(&content);
@@ -119,10 +135,11 @@
119 sha1sum_blob(&content, &hash);
120 blob_compress(&content, &content);
121 db_bind_text(&q, "$uuid", blob_str(&hash));
122 db_bind_int(&q, "$sz", sz);
123 db_bind_blob(&q, "$data", &content);
 
124 db_step(&q);
125 db_reset(&q);
126 blob_reset(&content);
127 blob_reset(&hash);
128 }
@@ -248,10 +265,11 @@
248 ** should be in the bundle */
249 db_multi_exec("CREATE TEMP TABLE tobundle(rid INTEGER PRIMARY KEY);");
250 subtree_from_arguments("tobundle");
251 find_checkin_associates("tobundle", 0);
252 verify_all_options();
 
253
254 /* Create the new bundle */
255 bundle_attach_file(g.argv[3], "b1", 1);
256 db_begin_transaction();
257
@@ -269,17 +287,18 @@
269 /* Directly copy content from the repository into the bundle as long
270 ** as the repository content is a delta from some other artifact that
271 ** is also in the bundle.
272 */
273 db_multi_exec(
274 "REPLACE INTO bblob(blobid,uuid,sz,delta,data) "
275 " SELECT"
276 " tobundle.rid,"
277 " blob.uuid,"
278 " blob.size,"
279 " delta.srcid,"
280 " blob.content"
 
281 " FROM tobundle, blob, delta"
282 " WHERE blob.rid=tobundle.rid"
283 " AND delta.rid=tobundle.rid"
284 " AND delta.srcid IN tobundle;"
285 );
@@ -329,13 +348,14 @@
329 deltaFrom = 0;
330 }else{
331 Stmt ins;
332 blob_compress(&delta, &delta);
333 db_prepare(&ins,
334 "REPLACE INTO bblob(blobid,uuid,sz,delta,data)"
335 " SELECT %d, uuid, size, (SELECT uuid FROM blob WHERE rid=%d),"
336 " :delta FROM blob WHERE rid=%d", rid, deltaFrom, rid);
 
337 db_bind_blob(&ins, ":delta", &delta);
338 db_step(&ins);
339 db_finalize(&ins);
340 }
341 blob_reset(&basis);
@@ -345,21 +365,21 @@
345 /* If unable to insert the artifact as a delta, insert full-text */
346 if( deltaFrom==0 ){
347 Stmt ins;
348 blob_compress(&content, &content);
349 db_prepare(&ins,
350 "REPLACE INTO bblob(blobid,uuid,sz,delta,data)"
351 " SELECT rid, uuid, size, NULL, :content"
 
352 " FROM blob WHERE rid=%d", rid);
353 db_bind_blob(&ins, ":content", &content);
354 db_step(&ins);
355 db_finalize(&ins);
356 }
357 blob_reset(&content);
358 }
359 db_finalize(&q);
360
361
362 db_end_transaction(0);
363 }
364
365
366
--- src/bundle.c
+++ src/bundle.c
@@ -38,10 +38,11 @@
38 @ CREATE TABLE IF NOT EXISTS "%w".bblob(
39 @ blobid INTEGER PRIMARY KEY, -- Blob ID
40 @ uuid TEXT NOT NULL, -- SHA1 hash of expanded blob
41 @ sz INT NOT NULL, -- Size of blob after expansion
42 @ delta ANY, -- Delta compression basis, or NULL
43 @ notes TEXT, -- Description of content
44 @ data BLOB -- compressed content
45 @ );
46 ;
47
48 /*
@@ -64,10 +65,11 @@
65 */
66 static void bundle_ls_cmd(void){
67 Stmt q;
68 sqlite3_int64 sumSz = 0;
69 sqlite3_int64 sumLen = 0;
70 int bDetails = find_option("details","l",0)!=0;
71 bundle_attach_file(g.argv[3], "b1", 0);
72 db_prepare(&q,
73 "SELECT bcname, bcvalue FROM bconfig"
74 " WHERE typeof(bcvalue)='text'"
75 " AND bcvalue NOT GLOB char(0x2a,0x0a,0x2a);"
@@ -74,27 +76,41 @@
76 );
77 while( db_step(&q)==SQLITE_ROW ){
78 fossil_print("%s: %s\n", db_column_text(&q,0), db_column_text(&q,1));
79 }
80 db_finalize(&q);
81 fossil_print("%.78c\n",'-');
82 if( bDetails ){
83 db_prepare(&q,
84 "SELECT blobid, substr(uuid,1,10), coalesce(substr(delta,1,10),''),"
85 " sz, length(data), notes"
86 " FROM bblob"
87 );
88 while( db_step(&q)==SQLITE_ROW ){
89 fossil_print("%4d %10s %10s %8d %8d %s\n",
90 db_column_int(&q,0),
91 db_column_text(&q,1),
92 db_column_text(&q,2),
93 db_column_int(&q,3),
94 db_column_int(&q,4),
95 db_column_text(&q,5));
96 sumSz += db_column_int(&q,3);
97 sumLen += db_column_int(&q,4);
98 }
99 db_finalize(&q);
100 fossil_print("%27s %8lld %8lld\n", "Total:", sumSz, sumLen);
101 }else{
102 db_prepare(&q,
103 "SELECT substr(uuid,1,16), notes FROM bblob"
104 );
105 while( db_step(&q)==SQLITE_ROW ){
106 fossil_print("%16s %s\n",
107 db_column_text(&q,0),
108 db_column_text(&q,1));
109 }
110 db_finalize(&q);
111 }
112 }
113
114 /*
115 ** Implement the "fossil bundle append BUNDLE FILE..." command. Add
116 ** the named files into the BUNDLE. Create the BUNDLE if it does not
@@ -107,12 +123,12 @@
123 Stmt q;
124
125 verify_all_options();
126 bundle_attach_file(g.argv[3], "b1", 1);
127 db_prepare(&q,
128 "INSERT INTO bblob(blobid, uuid, sz, delta, data, notes) "
129 "VALUES(NULL, $uuid, $sz, NULL, $data, $filename)");
130 db_begin_transaction();
131 for(i=4; i<g.argc; i++){
132 int sz;
133 blob_read_from_file(&content, g.argv[i]);
134 sz = blob_size(&content);
@@ -119,10 +135,11 @@
135 sha1sum_blob(&content, &hash);
136 blob_compress(&content, &content);
137 db_bind_text(&q, "$uuid", blob_str(&hash));
138 db_bind_int(&q, "$sz", sz);
139 db_bind_blob(&q, "$data", &content);
140 db_bind_text(&q, "$filename", g.argv[i]);
141 db_step(&q);
142 db_reset(&q);
143 blob_reset(&content);
144 blob_reset(&hash);
145 }
@@ -248,10 +265,11 @@
265 ** should be in the bundle */
266 db_multi_exec("CREATE TEMP TABLE tobundle(rid INTEGER PRIMARY KEY);");
267 subtree_from_arguments("tobundle");
268 find_checkin_associates("tobundle", 0);
269 verify_all_options();
270 describe_artifacts("IN tobundle");
271
272 /* Create the new bundle */
273 bundle_attach_file(g.argv[3], "b1", 1);
274 db_begin_transaction();
275
@@ -269,17 +287,18 @@
287 /* Directly copy content from the repository into the bundle as long
288 ** as the repository content is a delta from some other artifact that
289 ** is also in the bundle.
290 */
291 db_multi_exec(
292 "REPLACE INTO bblob(blobid,uuid,sz,delta,data,notes) "
293 " SELECT"
294 " tobundle.rid,"
295 " blob.uuid,"
296 " blob.size,"
297 " delta.srcid,"
298 " blob.content,"
299 " (SELECT summary FROM description WHERE rid=blob.rid)"
300 " FROM tobundle, blob, delta"
301 " WHERE blob.rid=tobundle.rid"
302 " AND delta.rid=tobundle.rid"
303 " AND delta.srcid IN tobundle;"
304 );
@@ -329,13 +348,14 @@
348 deltaFrom = 0;
349 }else{
350 Stmt ins;
351 blob_compress(&delta, &delta);
352 db_prepare(&ins,
353 "REPLACE INTO bblob(blobid,uuid,sz,delta,data,notes)"
354 " SELECT %d, uuid, size, (SELECT uuid FROM blob WHERE rid=%d),"
355 " :delta, (SELECT summary FROM description WHERE rid=blob.rid)"
356 " FROM blob WHERE rid=%d", rid, deltaFrom, rid);
357 db_bind_blob(&ins, ":delta", &delta);
358 db_step(&ins);
359 db_finalize(&ins);
360 }
361 blob_reset(&basis);
@@ -345,21 +365,21 @@
365 /* If unable to insert the artifact as a delta, insert full-text */
366 if( deltaFrom==0 ){
367 Stmt ins;
368 blob_compress(&content, &content);
369 db_prepare(&ins,
370 "REPLACE INTO bblob(blobid,uuid,sz,delta,data,notes)"
371 " SELECT rid, uuid, size, NULL, :content,"
372 " (SELECT summary FROM description WHERE rid=blob.rid)"
373 " FROM blob WHERE rid=%d", rid);
374 db_bind_blob(&ins, ":content", &content);
375 db_step(&ins);
376 db_finalize(&ins);
377 }
378 blob_reset(&content);
379 }
380 db_finalize(&q);
 
381
382 db_end_transaction(0);
383 }
384
385
386
+27 -30
--- src/name.c
+++ src/name.c
@@ -790,10 +790,11 @@
790790
@ rid INTEGER PRIMARY KEY, -- RID of the object
791791
@ uuid TEXT, -- SHA1 hash of the object
792792
@ ctime DATETIME, -- Time of creation
793793
@ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts
794794
@ type TEXT, -- file, checkin, wiki, ticket, etc.
795
+@ summary TEXT, -- Summary comment for the object
795796
@ detail TEXT -- filename, checkin comment, etc
796797
@ );
797798
;
798799
799800
/*
@@ -807,22 +808,23 @@
807808
808809
db_multi_exec("%s", zDescTab/*safe-for-%s*/);
809810
810811
/* Describe checkins */
811812
db_multi_exec(
812
- "INSERT OR IGNORE INTO description(rid,uuid,ctime,type)\n"
813
- "SELECT blob.rid, blob.uuid, event.mtime, 'checkin'\n"
813
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
814
+ "SELECT blob.rid, blob.uuid, event.mtime, 'checkin',\n"
815
+ " 'checkin on ' || strftime('%%Y-%%m-%%d %%H:%%M',event.mtime)\n"
814816
" FROM event, blob\n"
815817
" WHERE event.objid %s AND event.type='ci'\n"
816818
" AND event.objid=blob.rid;",
817819
zWhere /*safe-for-%s*/
818820
);
819821
820822
/* Describe files */
821823
db_multi_exec(
822
- "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
823
- "SELECT blob.rid, blob.uuid, event.mtime, 'file', filename.name\n"
824
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
825
+ "SELECT blob.rid, blob.uuid, event.mtime, 'file', 'file '||filename.name\n"
824826
" FROM mlink, blob, event, filename\n"
825827
" WHERE mlink.fid %s\n"
826828
" AND mlink.mid=event.objid\n"
827829
" AND filename.fnid=mlink.fnid\n"
828830
" AND mlink.fid=blob.rid;",
@@ -829,35 +831,35 @@
829831
zWhere /*safe-for-%s*/
830832
);
831833
832834
/* Describe tags */
833835
db_multi_exec(
834
- "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
836
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
835837
"SELECT blob.rid, blob.uuid, tagxref.mtime, 'tag',\n"
836
- " substr((SELECT uuid FROM blob WHERE rid=tagxref.rid),1,16)\n"
838
+ " 'tag '||substr((SELECT uuid FROM blob WHERE rid=tagxref.rid),1,16)\n"
837839
" FROM tagxref, blob\n"
838840
" WHERE tagxref.srcid %s AND tagxref.srcid!=tagxref.rid\n"
839841
" AND tagxref.srcid=blob.rid;",
840842
zWhere /*safe-for-%s*/
841843
);
842844
843845
/* Cluster artifacts */
844846
db_multi_exec(
845
- "INSERT OR IGNORE INTO description(rid,uuid,ctime,type)\n"
846
- "SELECT blob.rid, blob.uuid, tagxref.mtime, 'cluster'\n"
847
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
848
+ "SELECT blob.rid, blob.uuid, tagxref.mtime, 'cluster', 'cluster'\n"
847849
" FROM tagxref, blob\n"
848850
" WHERE tagxref.rid %s\n"
849851
" AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='cluster')\n"
850852
" AND blob.rid=tagxref.rid;",
851853
zWhere /*safe-for-%s*/
852854
);
853855
854856
/* Ticket change artifacts */
855857
db_multi_exec(
856
- "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
858
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
857859
"SELECT blob.rid, blob.uuid, tagxref.mtime, 'ticket',\n"
858
- " substr(tag.tagname,5)\n"
860
+ " 'ticket '||substr(tag.tagname,5,21)\n"
859861
" FROM tagxref, tag, blob\n"
860862
" WHERE tagxref.rid %s\n"
861863
" AND tag.tagid=tagxref.tagid\n"
862864
" AND tag.tagname GLOB 'tkt-*'"
863865
" AND blob.rid=tagxref.rid;",
@@ -864,13 +866,13 @@
864866
zWhere /*safe-for-%s*/
865867
);
866868
867869
/* Wiki edit artifacts */
868870
db_multi_exec(
869
- "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
871
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
870872
"SELECT blob.rid, blob.uuid, tagxref.mtime, 'wiki',\n"
871
- " printf('\"%%s\"',substr(tag.tagname,6))\n"
873
+ " printf('wiki \"%%s\"',substr(tag.tagname,6))\n"
872874
" FROM tagxref, tag, blob\n"
873875
" WHERE tagxref.rid %s\n"
874876
" AND tag.tagid=tagxref.tagid\n"
875877
" AND tag.tagname GLOB 'wiki-*'"
876878
" AND blob.rid=tagxref.rid;",
@@ -877,13 +879,13 @@
877879
zWhere /*safe-for-%s*/
878880
);
879881
880882
/* Event edit artifacts */
881883
db_multi_exec(
882
- "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
884
+ "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
883885
"SELECT blob.rid, blob.uuid, tagxref.mtime, 'event',\n"
884
- " substr(tag.tagname,7)\n"
886
+ " 'event '||substr(tag.tagname,7)\n"
885887
" FROM tagxref, tag, blob\n"
886888
" WHERE tagxref.rid %s\n"
887889
" AND tag.tagid=tagxref.tagid\n"
888890
" AND tag.tagname GLOB 'event-*'"
889891
" AND blob.rid=tagxref.rid;",
@@ -892,22 +894,23 @@
892894
893895
/* Attachments */
894896
db_multi_exec(
895897
"INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
896898
"SELECT blob.rid, blob.uuid, attachment.mtime, 'attachment',\n"
897
- " attachment.filename\n"
899
+ " 'attachment '||attachment.filename\n"
898900
" FROM attachment, blob\n"
899901
" WHERE attachment.src %s\n"
900902
" AND blob.rid=attachment.src;",
901903
zWhere /*safe-for-%s*/
902904
);
903905
904906
/* Everything else */
905907
db_multi_exec(
906
- "INSERT OR IGNORE INTO description(rid,uuid,type)\n"
908
+ "INSERT OR IGNORE INTO description(rid,uuid,type,summary)\n"
907909
"SELECT blob.rid, blob.uuid,"
908
- " CASE WHEN blob.size<0 THEN 'phantom' ELSE '' END\n"
910
+ " CASE WHEN blob.size<0 THEN 'phantom' ELSE '' END,\n"
911
+ " 'unknown'\n"
909912
" FROM blob WHERE blob.rid %s;",
910913
zWhere /*safe-for-%s*/
911914
);
912915
913916
/* Mark private elements */
@@ -922,27 +925,21 @@
922925
int describe_artifacts_to_stdout(const char *zWhere, const char *zLabel){
923926
Stmt q;
924927
int cnt = 0;
925928
describe_artifacts(zWhere);
926929
db_prepare(&q,
927
- "SELECT uuid, datetime(ctime,'localtime'), type, detail, isPrivate\n"
930
+ "SELECT uuid, summary, isPrivate\n"
928931
" FROM description\n"
929932
" ORDER BY ctime, type;"
930933
);
931934
while( db_step(&q)==SQLITE_ROW ){
932
- const char *zType = db_column_text(&q,2);
933
- if( zLabel ){ fossil_print("%s\n", zLabel); zLabel = 0; }
934
- fossil_print(" %.16s %s", db_column_text(&q,0), db_column_text(&q,2));
935
- if( db_column_bytes(&q,3)>0 ){
936
- fossil_print(" %s", db_column_text(&q,3));
937
- }
938
- if( db_column_bytes(&q,1)>0
939
- && fossil_strcmp(zType,"checkin")==0
940
- ){
941
- fossil_print(" %s", db_column_text(&q,1));
942
- }
943
- if( db_column_int(&q,4) ) fossil_print(" (unpublished)");
935
+ if( zLabel ){
936
+ fossil_print("%s\n", zLabel);
937
+ zLabel = 0;
938
+ }
939
+ fossil_print(" %.16s %s", db_column_text(&q,0), db_column_text(&q,1));
940
+ if( db_column_int(&q,2) ) fossil_print(" (unpublished)");
944941
fossil_print("\n");
945942
cnt++;
946943
}
947944
db_finalize(&q);
948945
db_multi_exec("DELETE FROM description;");
949946
--- src/name.c
+++ src/name.c
@@ -790,10 +790,11 @@
790 @ rid INTEGER PRIMARY KEY, -- RID of the object
791 @ uuid TEXT, -- SHA1 hash of the object
792 @ ctime DATETIME, -- Time of creation
793 @ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts
794 @ type TEXT, -- file, checkin, wiki, ticket, etc.
 
795 @ detail TEXT -- filename, checkin comment, etc
796 @ );
797 ;
798
799 /*
@@ -807,22 +808,23 @@
807
808 db_multi_exec("%s", zDescTab/*safe-for-%s*/);
809
810 /* Describe checkins */
811 db_multi_exec(
812 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type)\n"
813 "SELECT blob.rid, blob.uuid, event.mtime, 'checkin'\n"
 
814 " FROM event, blob\n"
815 " WHERE event.objid %s AND event.type='ci'\n"
816 " AND event.objid=blob.rid;",
817 zWhere /*safe-for-%s*/
818 );
819
820 /* Describe files */
821 db_multi_exec(
822 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
823 "SELECT blob.rid, blob.uuid, event.mtime, 'file', filename.name\n"
824 " FROM mlink, blob, event, filename\n"
825 " WHERE mlink.fid %s\n"
826 " AND mlink.mid=event.objid\n"
827 " AND filename.fnid=mlink.fnid\n"
828 " AND mlink.fid=blob.rid;",
@@ -829,35 +831,35 @@
829 zWhere /*safe-for-%s*/
830 );
831
832 /* Describe tags */
833 db_multi_exec(
834 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
835 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'tag',\n"
836 " substr((SELECT uuid FROM blob WHERE rid=tagxref.rid),1,16)\n"
837 " FROM tagxref, blob\n"
838 " WHERE tagxref.srcid %s AND tagxref.srcid!=tagxref.rid\n"
839 " AND tagxref.srcid=blob.rid;",
840 zWhere /*safe-for-%s*/
841 );
842
843 /* Cluster artifacts */
844 db_multi_exec(
845 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type)\n"
846 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'cluster'\n"
847 " FROM tagxref, blob\n"
848 " WHERE tagxref.rid %s\n"
849 " AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='cluster')\n"
850 " AND blob.rid=tagxref.rid;",
851 zWhere /*safe-for-%s*/
852 );
853
854 /* Ticket change artifacts */
855 db_multi_exec(
856 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
857 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'ticket',\n"
858 " substr(tag.tagname,5)\n"
859 " FROM tagxref, tag, blob\n"
860 " WHERE tagxref.rid %s\n"
861 " AND tag.tagid=tagxref.tagid\n"
862 " AND tag.tagname GLOB 'tkt-*'"
863 " AND blob.rid=tagxref.rid;",
@@ -864,13 +866,13 @@
864 zWhere /*safe-for-%s*/
865 );
866
867 /* Wiki edit artifacts */
868 db_multi_exec(
869 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
870 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'wiki',\n"
871 " printf('\"%%s\"',substr(tag.tagname,6))\n"
872 " FROM tagxref, tag, blob\n"
873 " WHERE tagxref.rid %s\n"
874 " AND tag.tagid=tagxref.tagid\n"
875 " AND tag.tagname GLOB 'wiki-*'"
876 " AND blob.rid=tagxref.rid;",
@@ -877,13 +879,13 @@
877 zWhere /*safe-for-%s*/
878 );
879
880 /* Event edit artifacts */
881 db_multi_exec(
882 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
883 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'event',\n"
884 " substr(tag.tagname,7)\n"
885 " FROM tagxref, tag, blob\n"
886 " WHERE tagxref.rid %s\n"
887 " AND tag.tagid=tagxref.tagid\n"
888 " AND tag.tagname GLOB 'event-*'"
889 " AND blob.rid=tagxref.rid;",
@@ -892,22 +894,23 @@
892
893 /* Attachments */
894 db_multi_exec(
895 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
896 "SELECT blob.rid, blob.uuid, attachment.mtime, 'attachment',\n"
897 " attachment.filename\n"
898 " FROM attachment, blob\n"
899 " WHERE attachment.src %s\n"
900 " AND blob.rid=attachment.src;",
901 zWhere /*safe-for-%s*/
902 );
903
904 /* Everything else */
905 db_multi_exec(
906 "INSERT OR IGNORE INTO description(rid,uuid,type)\n"
907 "SELECT blob.rid, blob.uuid,"
908 " CASE WHEN blob.size<0 THEN 'phantom' ELSE '' END\n"
 
909 " FROM blob WHERE blob.rid %s;",
910 zWhere /*safe-for-%s*/
911 );
912
913 /* Mark private elements */
@@ -922,27 +925,21 @@
922 int describe_artifacts_to_stdout(const char *zWhere, const char *zLabel){
923 Stmt q;
924 int cnt = 0;
925 describe_artifacts(zWhere);
926 db_prepare(&q,
927 "SELECT uuid, datetime(ctime,'localtime'), type, detail, isPrivate\n"
928 " FROM description\n"
929 " ORDER BY ctime, type;"
930 );
931 while( db_step(&q)==SQLITE_ROW ){
932 const char *zType = db_column_text(&q,2);
933 if( zLabel ){ fossil_print("%s\n", zLabel); zLabel = 0; }
934 fossil_print(" %.16s %s", db_column_text(&q,0), db_column_text(&q,2));
935 if( db_column_bytes(&q,3)>0 ){
936 fossil_print(" %s", db_column_text(&q,3));
937 }
938 if( db_column_bytes(&q,1)>0
939 && fossil_strcmp(zType,"checkin")==0
940 ){
941 fossil_print(" %s", db_column_text(&q,1));
942 }
943 if( db_column_int(&q,4) ) fossil_print(" (unpublished)");
944 fossil_print("\n");
945 cnt++;
946 }
947 db_finalize(&q);
948 db_multi_exec("DELETE FROM description;");
949
--- src/name.c
+++ src/name.c
@@ -790,10 +790,11 @@
790 @ rid INTEGER PRIMARY KEY, -- RID of the object
791 @ uuid TEXT, -- SHA1 hash of the object
792 @ ctime DATETIME, -- Time of creation
793 @ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts
794 @ type TEXT, -- file, checkin, wiki, ticket, etc.
795 @ summary TEXT, -- Summary comment for the object
796 @ detail TEXT -- filename, checkin comment, etc
797 @ );
798 ;
799
800 /*
@@ -807,22 +808,23 @@
808
809 db_multi_exec("%s", zDescTab/*safe-for-%s*/);
810
811 /* Describe checkins */
812 db_multi_exec(
813 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
814 "SELECT blob.rid, blob.uuid, event.mtime, 'checkin',\n"
815 " 'checkin on ' || strftime('%%Y-%%m-%%d %%H:%%M',event.mtime)\n"
816 " FROM event, blob\n"
817 " WHERE event.objid %s AND event.type='ci'\n"
818 " AND event.objid=blob.rid;",
819 zWhere /*safe-for-%s*/
820 );
821
822 /* Describe files */
823 db_multi_exec(
824 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
825 "SELECT blob.rid, blob.uuid, event.mtime, 'file', 'file '||filename.name\n"
826 " FROM mlink, blob, event, filename\n"
827 " WHERE mlink.fid %s\n"
828 " AND mlink.mid=event.objid\n"
829 " AND filename.fnid=mlink.fnid\n"
830 " AND mlink.fid=blob.rid;",
@@ -829,35 +831,35 @@
831 zWhere /*safe-for-%s*/
832 );
833
834 /* Describe tags */
835 db_multi_exec(
836 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
837 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'tag',\n"
838 " 'tag '||substr((SELECT uuid FROM blob WHERE rid=tagxref.rid),1,16)\n"
839 " FROM tagxref, blob\n"
840 " WHERE tagxref.srcid %s AND tagxref.srcid!=tagxref.rid\n"
841 " AND tagxref.srcid=blob.rid;",
842 zWhere /*safe-for-%s*/
843 );
844
845 /* Cluster artifacts */
846 db_multi_exec(
847 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
848 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'cluster', 'cluster'\n"
849 " FROM tagxref, blob\n"
850 " WHERE tagxref.rid %s\n"
851 " AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='cluster')\n"
852 " AND blob.rid=tagxref.rid;",
853 zWhere /*safe-for-%s*/
854 );
855
856 /* Ticket change artifacts */
857 db_multi_exec(
858 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
859 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'ticket',\n"
860 " 'ticket '||substr(tag.tagname,5,21)\n"
861 " FROM tagxref, tag, blob\n"
862 " WHERE tagxref.rid %s\n"
863 " AND tag.tagid=tagxref.tagid\n"
864 " AND tag.tagname GLOB 'tkt-*'"
865 " AND blob.rid=tagxref.rid;",
@@ -864,13 +866,13 @@
866 zWhere /*safe-for-%s*/
867 );
868
869 /* Wiki edit artifacts */
870 db_multi_exec(
871 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
872 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'wiki',\n"
873 " printf('wiki \"%%s\"',substr(tag.tagname,6))\n"
874 " FROM tagxref, tag, blob\n"
875 " WHERE tagxref.rid %s\n"
876 " AND tag.tagid=tagxref.tagid\n"
877 " AND tag.tagname GLOB 'wiki-*'"
878 " AND blob.rid=tagxref.rid;",
@@ -877,13 +879,13 @@
879 zWhere /*safe-for-%s*/
880 );
881
882 /* Event edit artifacts */
883 db_multi_exec(
884 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,summary)\n"
885 "SELECT blob.rid, blob.uuid, tagxref.mtime, 'event',\n"
886 " 'event '||substr(tag.tagname,7)\n"
887 " FROM tagxref, tag, blob\n"
888 " WHERE tagxref.rid %s\n"
889 " AND tag.tagid=tagxref.tagid\n"
890 " AND tag.tagname GLOB 'event-*'"
891 " AND blob.rid=tagxref.rid;",
@@ -892,22 +894,23 @@
894
895 /* Attachments */
896 db_multi_exec(
897 "INSERT OR IGNORE INTO description(rid,uuid,ctime,type,detail)\n"
898 "SELECT blob.rid, blob.uuid, attachment.mtime, 'attachment',\n"
899 " 'attachment '||attachment.filename\n"
900 " FROM attachment, blob\n"
901 " WHERE attachment.src %s\n"
902 " AND blob.rid=attachment.src;",
903 zWhere /*safe-for-%s*/
904 );
905
906 /* Everything else */
907 db_multi_exec(
908 "INSERT OR IGNORE INTO description(rid,uuid,type,summary)\n"
909 "SELECT blob.rid, blob.uuid,"
910 " CASE WHEN blob.size<0 THEN 'phantom' ELSE '' END,\n"
911 " 'unknown'\n"
912 " FROM blob WHERE blob.rid %s;",
913 zWhere /*safe-for-%s*/
914 );
915
916 /* Mark private elements */
@@ -922,27 +925,21 @@
925 int describe_artifacts_to_stdout(const char *zWhere, const char *zLabel){
926 Stmt q;
927 int cnt = 0;
928 describe_artifacts(zWhere);
929 db_prepare(&q,
930 "SELECT uuid, summary, isPrivate\n"
931 " FROM description\n"
932 " ORDER BY ctime, type;"
933 );
934 while( db_step(&q)==SQLITE_ROW ){
935 if( zLabel ){
936 fossil_print("%s\n", zLabel);
937 zLabel = 0;
938 }
939 fossil_print(" %.16s %s", db_column_text(&q,0), db_column_text(&q,1));
940 if( db_column_int(&q,2) ) fossil_print(" (unpublished)");
 
 
 
 
 
 
941 fossil_print("\n");
942 cnt++;
943 }
944 db_finalize(&q);
945 db_multi_exec("DELETE FROM description;");
946
+13 -9
--- src/purge.c
+++ src/purge.c
@@ -47,10 +47,11 @@
4747
@ orid INTEGER, -- Original RID before purged
4848
@ uuid TEXT NOT NULL, -- SHA1 hash of the purged artifact
4949
@ srcid INTEGER, -- Basis purgeitem for delta compression
5050
@ isPrivate BOOLEAN, -- True if artifact was originally private
5151
@ sz INT NOT NULL, -- Uncompressed size of the purged artifact
52
+@ desc TEXT, -- Brief description of this artifact
5253
@ data BLOB -- Compressed artifact content
5354
@ );
5455
;
5556
5657
/*
@@ -90,13 +91,17 @@
9091
const char *zNote, /* Text of the purgeevent.pnotes field */
9192
int moveToGraveyard /* Move purged artifacts into the graveyard */
9293
){
9394
int peid = 0; /* New purgeevent ID */
9495
Stmt q; /* General-use prepared statement */
96
+ char *z;
9597
9698
assert( g.repositoryOpen ); /* Main database must already be open */
9799
db_begin_transaction();
100
+ z = sqlite3_mprintf("IN \"%w\"", zTab);
101
+ describe_artifacts(z);
102
+ sqlite3_free(z);
98103
99104
/* Make sure we are not removing a manifest that is the baseline of some
100105
** manifest that is being left behind. This step is not strictly necessary.
101106
** is is just a safety check. */
102107
if( purge_baseline_out_from_under_delta(zTab) ){
@@ -131,13 +136,14 @@
131136
int rid = db_column_int(&q, 0);
132137
content_undelta(rid);
133138
}
134139
db_finalize(&q);
135140
db_multi_exec(
136
- "INSERT INTO purgeitem(peid,orid,uuid,sz,isPrivate,data)"
141
+ "INSERT INTO purgeitem(peid,orid,uuid,sz,isPrivate,desc,data)"
137142
" SELECT %d, rid, uuid, size,"
138143
" EXISTS(SELECT 1 FROM private WHERE private.rid=blob.rid),"
144
+ " (SELECT summary FROM description WHERE rid=blob.rid),"
139145
" content"
140146
" FROM blob WHERE rid IN \"%w\"",
141147
peid, zTab
142148
);
143149
db_multi_exec(
@@ -288,28 +294,26 @@
288294
/*
289295
** Display the content of a single purge event.
290296
*/
291297
static void purge_list_event_content(int peid){
292298
Stmt q;
293
- sqlite3_int64 sz1 = 0;
294
- sqlite3_int64 sz2 = 0;
299
+ sqlite3_int64 sz = 0;
295300
db_prepare(&q, "SELECT piid, substr(uuid,1,16), srcid, isPrivate,"
296
- " sz, length(data)"
301
+ " length(data), desc"
297302
" FROM purgeitem WHERE peid=%d", peid);
298303
while( db_step(&q)==SQLITE_ROW ){
299
- fossil_print(" %5d %s %4s %c %10d %10d\n",
304
+ fossil_print(" %5d %s %4s %c %10d %s\n",
300305
db_column_int(&q,0),
301306
db_column_text(&q,1),
302307
db_column_text(&q,2),
303308
db_column_int(&q,3) ? 'P' : ' ',
304309
db_column_int(&q,4),
305
- db_column_int(&q,5));
306
- sz1 += db_column_int(&q,4);
307
- sz2 += db_column_int(&q,5);
310
+ db_column_text(&q,5));
311
+ sz += db_column_int(&q,4);
308312
}
309313
db_finalize(&q);
310
- fossil_print("%.11c%16s%.8c%10lld %10lld\n", ' ', "Total:", ' ', sz1, sz2);
314
+ fossil_print("%.11c%16s%.8c%10lld\n", ' ', "Total:", ' ', sz);
311315
}
312316
313317
/*
314318
** Extract the content for purgeitem number piid into a Blob. Return
315319
** the number of errors.
316320
--- src/purge.c
+++ src/purge.c
@@ -47,10 +47,11 @@
47 @ orid INTEGER, -- Original RID before purged
48 @ uuid TEXT NOT NULL, -- SHA1 hash of the purged artifact
49 @ srcid INTEGER, -- Basis purgeitem for delta compression
50 @ isPrivate BOOLEAN, -- True if artifact was originally private
51 @ sz INT NOT NULL, -- Uncompressed size of the purged artifact
 
52 @ data BLOB -- Compressed artifact content
53 @ );
54 ;
55
56 /*
@@ -90,13 +91,17 @@
90 const char *zNote, /* Text of the purgeevent.pnotes field */
91 int moveToGraveyard /* Move purged artifacts into the graveyard */
92 ){
93 int peid = 0; /* New purgeevent ID */
94 Stmt q; /* General-use prepared statement */
 
95
96 assert( g.repositoryOpen ); /* Main database must already be open */
97 db_begin_transaction();
 
 
 
98
99 /* Make sure we are not removing a manifest that is the baseline of some
100 ** manifest that is being left behind. This step is not strictly necessary.
101 ** is is just a safety check. */
102 if( purge_baseline_out_from_under_delta(zTab) ){
@@ -131,13 +136,14 @@
131 int rid = db_column_int(&q, 0);
132 content_undelta(rid);
133 }
134 db_finalize(&q);
135 db_multi_exec(
136 "INSERT INTO purgeitem(peid,orid,uuid,sz,isPrivate,data)"
137 " SELECT %d, rid, uuid, size,"
138 " EXISTS(SELECT 1 FROM private WHERE private.rid=blob.rid),"
 
139 " content"
140 " FROM blob WHERE rid IN \"%w\"",
141 peid, zTab
142 );
143 db_multi_exec(
@@ -288,28 +294,26 @@
288 /*
289 ** Display the content of a single purge event.
290 */
291 static void purge_list_event_content(int peid){
292 Stmt q;
293 sqlite3_int64 sz1 = 0;
294 sqlite3_int64 sz2 = 0;
295 db_prepare(&q, "SELECT piid, substr(uuid,1,16), srcid, isPrivate,"
296 " sz, length(data)"
297 " FROM purgeitem WHERE peid=%d", peid);
298 while( db_step(&q)==SQLITE_ROW ){
299 fossil_print(" %5d %s %4s %c %10d %10d\n",
300 db_column_int(&q,0),
301 db_column_text(&q,1),
302 db_column_text(&q,2),
303 db_column_int(&q,3) ? 'P' : ' ',
304 db_column_int(&q,4),
305 db_column_int(&q,5));
306 sz1 += db_column_int(&q,4);
307 sz2 += db_column_int(&q,5);
308 }
309 db_finalize(&q);
310 fossil_print("%.11c%16s%.8c%10lld %10lld\n", ' ', "Total:", ' ', sz1, sz2);
311 }
312
313 /*
314 ** Extract the content for purgeitem number piid into a Blob. Return
315 ** the number of errors.
316
--- src/purge.c
+++ src/purge.c
@@ -47,10 +47,11 @@
47 @ orid INTEGER, -- Original RID before purged
48 @ uuid TEXT NOT NULL, -- SHA1 hash of the purged artifact
49 @ srcid INTEGER, -- Basis purgeitem for delta compression
50 @ isPrivate BOOLEAN, -- True if artifact was originally private
51 @ sz INT NOT NULL, -- Uncompressed size of the purged artifact
52 @ desc TEXT, -- Brief description of this artifact
53 @ data BLOB -- Compressed artifact content
54 @ );
55 ;
56
57 /*
@@ -90,13 +91,17 @@
91 const char *zNote, /* Text of the purgeevent.pnotes field */
92 int moveToGraveyard /* Move purged artifacts into the graveyard */
93 ){
94 int peid = 0; /* New purgeevent ID */
95 Stmt q; /* General-use prepared statement */
96 char *z;
97
98 assert( g.repositoryOpen ); /* Main database must already be open */
99 db_begin_transaction();
100 z = sqlite3_mprintf("IN \"%w\"", zTab);
101 describe_artifacts(z);
102 sqlite3_free(z);
103
104 /* Make sure we are not removing a manifest that is the baseline of some
105 ** manifest that is being left behind. This step is not strictly necessary.
106 ** is is just a safety check. */
107 if( purge_baseline_out_from_under_delta(zTab) ){
@@ -131,13 +136,14 @@
136 int rid = db_column_int(&q, 0);
137 content_undelta(rid);
138 }
139 db_finalize(&q);
140 db_multi_exec(
141 "INSERT INTO purgeitem(peid,orid,uuid,sz,isPrivate,desc,data)"
142 " SELECT %d, rid, uuid, size,"
143 " EXISTS(SELECT 1 FROM private WHERE private.rid=blob.rid),"
144 " (SELECT summary FROM description WHERE rid=blob.rid),"
145 " content"
146 " FROM blob WHERE rid IN \"%w\"",
147 peid, zTab
148 );
149 db_multi_exec(
@@ -288,28 +294,26 @@
294 /*
295 ** Display the content of a single purge event.
296 */
297 static void purge_list_event_content(int peid){
298 Stmt q;
299 sqlite3_int64 sz = 0;
 
300 db_prepare(&q, "SELECT piid, substr(uuid,1,16), srcid, isPrivate,"
301 " length(data), desc"
302 " FROM purgeitem WHERE peid=%d", peid);
303 while( db_step(&q)==SQLITE_ROW ){
304 fossil_print(" %5d %s %4s %c %10d %s\n",
305 db_column_int(&q,0),
306 db_column_text(&q,1),
307 db_column_text(&q,2),
308 db_column_int(&q,3) ? 'P' : ' ',
309 db_column_int(&q,4),
310 db_column_text(&q,5));
311 sz += db_column_int(&q,4);
 
312 }
313 db_finalize(&q);
314 fossil_print("%.11c%16s%.8c%10lld\n", ' ', "Total:", ' ', sz);
315 }
316
317 /*
318 ** Extract the content for purgeitem number piid into a Blob. Return
319 ** the number of errors.
320

Keyboard Shortcuts

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