Fossil SCM

Updates to the "help" text for the tarball command. Add hyperlinks for accessing content on the /cachestat webpage.

drh 2014-08-05 17:27 UTC trunk
Commit b6a5023faefffefacfbda986853aa5a845715137
2 files changed +29 -1 +15 -2
+29 -1
--- src/cache.c
+++ src/cache.c
@@ -62,10 +62,11 @@
6262
if( rc ){
6363
sqlite3_close(db);
6464
return 0;
6565
}
6666
rc = sqlite3_exec(db,
67
+ "PRAGMA page_size=8192;"
6768
"CREATE TABLE IF NOT EXISTS blob(id INTEGER PRIMARY KEY, data BLOB);"
6869
"CREATE TABLE IF NOT EXISTS cache("
6970
"key TEXT PRIMARY KEY," /* Key used to access the cache */
7071
"id INT REFERENCES blob," /* The cache content */
7172
"sz INT," /* Size of content in bytes */
@@ -345,11 +346,12 @@
345346
" ORDER BY tm DESC"
346347
);
347348
if( pStmt ){
348349
@ <ol>
349350
while( sqlite3_step(pStmt)==SQLITE_ROW ){
350
- @ <li><p>%h(sqlite3_column_text(pStmt,0))<br>
351
+ const char *zName = sqlite3_column_text(pStmt,0);
352
+ @ <li><p>%z(href("%R/cacheget?key=%T",zName))%h(zName)</a><br>
351353
@ size: %s(sqlite3_column_text(pStmt,1))
352354
@ hit-count: %d(sqlite3_column_int(pStmt,2))
353355
@ last-access: %s(sqlite3_column_text(pStmt,3))</p></li>
354356
}
355357
sqlite3_finalize(pStmt);
@@ -362,5 +364,31 @@
362364
fossil_free(zDbName);
363365
sqlite3_close(db);
364366
}
365367
style_footer();
366368
}
369
+
370
+/*
371
+** WEBPAGE: cacheget
372
+**
373
+** Usage: /cacheget?key=KEY
374
+**
375
+** Download a single entry for the cache, identified by KEY.
376
+** This page is normally a hyperlink from the /cachestat page.
377
+*/
378
+void cache_getpage(void){
379
+ const char *zKey;
380
+ Blob content;
381
+
382
+ login_check_credentials();
383
+ if( !g.perm.Setup ){ login_needed(); return; }
384
+ zKey = PD("key","");
385
+ blob_zero(&content);
386
+ if( cache_read(&content, zKey)==0 ){
387
+ style_header("Cache Download Error");
388
+ @ The cache does not contain any entry with this key: "%h(zKey)"
389
+ style_footer();
390
+ return;
391
+ }
392
+ cgi_set_content(&content);
393
+ cgi_set_content_type("application/x-compressed");
394
+}
367395
--- src/cache.c
+++ src/cache.c
@@ -62,10 +62,11 @@
62 if( rc ){
63 sqlite3_close(db);
64 return 0;
65 }
66 rc = sqlite3_exec(db,
 
67 "CREATE TABLE IF NOT EXISTS blob(id INTEGER PRIMARY KEY, data BLOB);"
68 "CREATE TABLE IF NOT EXISTS cache("
69 "key TEXT PRIMARY KEY," /* Key used to access the cache */
70 "id INT REFERENCES blob," /* The cache content */
71 "sz INT," /* Size of content in bytes */
@@ -345,11 +346,12 @@
345 " ORDER BY tm DESC"
346 );
347 if( pStmt ){
348 @ <ol>
349 while( sqlite3_step(pStmt)==SQLITE_ROW ){
350 @ <li><p>%h(sqlite3_column_text(pStmt,0))<br>
 
351 @ size: %s(sqlite3_column_text(pStmt,1))
352 @ hit-count: %d(sqlite3_column_int(pStmt,2))
353 @ last-access: %s(sqlite3_column_text(pStmt,3))</p></li>
354 }
355 sqlite3_finalize(pStmt);
@@ -362,5 +364,31 @@
362 fossil_free(zDbName);
363 sqlite3_close(db);
364 }
365 style_footer();
366 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
--- src/cache.c
+++ src/cache.c
@@ -62,10 +62,11 @@
62 if( rc ){
63 sqlite3_close(db);
64 return 0;
65 }
66 rc = sqlite3_exec(db,
67 "PRAGMA page_size=8192;"
68 "CREATE TABLE IF NOT EXISTS blob(id INTEGER PRIMARY KEY, data BLOB);"
69 "CREATE TABLE IF NOT EXISTS cache("
70 "key TEXT PRIMARY KEY," /* Key used to access the cache */
71 "id INT REFERENCES blob," /* The cache content */
72 "sz INT," /* Size of content in bytes */
@@ -345,11 +346,12 @@
346 " ORDER BY tm DESC"
347 );
348 if( pStmt ){
349 @ <ol>
350 while( sqlite3_step(pStmt)==SQLITE_ROW ){
351 const char *zName = sqlite3_column_text(pStmt,0);
352 @ <li><p>%z(href("%R/cacheget?key=%T",zName))%h(zName)</a><br>
353 @ size: %s(sqlite3_column_text(pStmt,1))
354 @ hit-count: %d(sqlite3_column_int(pStmt,2))
355 @ last-access: %s(sqlite3_column_text(pStmt,3))</p></li>
356 }
357 sqlite3_finalize(pStmt);
@@ -362,5 +364,31 @@
364 fossil_free(zDbName);
365 sqlite3_close(db);
366 }
367 style_footer();
368 }
369
370 /*
371 ** WEBPAGE: cacheget
372 **
373 ** Usage: /cacheget?key=KEY
374 **
375 ** Download a single entry for the cache, identified by KEY.
376 ** This page is normally a hyperlink from the /cachestat page.
377 */
378 void cache_getpage(void){
379 const char *zKey;
380 Blob content;
381
382 login_check_credentials();
383 if( !g.perm.Setup ){ login_needed(); return; }
384 zKey = PD("key","");
385 blob_zero(&content);
386 if( cache_read(&content, zKey)==0 ){
387 style_header("Cache Download Error");
388 @ The cache does not contain any entry with this key: "%h(zKey)"
389 style_footer();
390 return;
391 }
392 cgi_set_content(&content);
393 cgi_set_content_type("application/x-compressed");
394 }
395
+15 -2
--- src/tar.c
+++ src/tar.c
@@ -526,17 +526,21 @@
526526
}
527527
528528
/*
529529
** COMMAND: tarball*
530530
**
531
-** Usage: %fossil tarball VERSION OUTPUTFILE [--name DIRECTORYNAME] [-R|--repository REPO]
531
+** Usage: %fossil tarball VERSION OUTPUTFILE
532532
**
533533
** Generate a compressed tarball for a specified version. If the --name
534534
** option is used, its argument becomes the name of the top-level directory
535535
** in the resulting tarball. If --name is omitted, the top-level directory
536536
** named is derived from the project name, the check-in date and time, and
537537
** the artifact ID of the check-in.
538
+**
539
+** Options:
540
+** --name DIRECTORYNAME The name of the top-level directory in the archive
541
+** -R REPOSITORY Specify a Fossil repository
538542
*/
539543
void tarball_cmd(void){
540544
int rid;
541545
Blob tarball;
542546
const char *zName;
@@ -620,11 +624,20 @@
620624
if( rid==0 ){
621625
@ Not found
622626
return;
623627
}
624628
if( nRid==0 && nName>10 ) zName[10] = 0;
625
- zKey = db_text(0, "SELECT '/tarball/'||uuid||'/%q' FROM blob WHERE rid=%d",zName,rid);
629
+ zKey = db_text(0, "SELECT '/tarball/'||uuid||'/%q'"
630
+ " FROM blob WHERE rid=%d",zName,rid);
631
+ if( P("debug")!=0 ){
632
+ style_header("Tarball Generator Debug Screen");
633
+ @ zName = "%h(zName)"<br>
634
+ @ rid = %d(rid)<br>
635
+ @ zKey = "%h(zKey)"
636
+ style_footer();
637
+ return;
638
+ }
626639
blob_zero(&tarball);
627640
if( cache_read(&tarball, zKey)==0 ){
628641
tarball_of_checkin(rid, &tarball, zName);
629642
cache_write(&tarball, zKey);
630643
}
631644
--- src/tar.c
+++ src/tar.c
@@ -526,17 +526,21 @@
526 }
527
528 /*
529 ** COMMAND: tarball*
530 **
531 ** Usage: %fossil tarball VERSION OUTPUTFILE [--name DIRECTORYNAME] [-R|--repository REPO]
532 **
533 ** Generate a compressed tarball for a specified version. If the --name
534 ** option is used, its argument becomes the name of the top-level directory
535 ** in the resulting tarball. If --name is omitted, the top-level directory
536 ** named is derived from the project name, the check-in date and time, and
537 ** the artifact ID of the check-in.
 
 
 
 
538 */
539 void tarball_cmd(void){
540 int rid;
541 Blob tarball;
542 const char *zName;
@@ -620,11 +624,20 @@
620 if( rid==0 ){
621 @ Not found
622 return;
623 }
624 if( nRid==0 && nName>10 ) zName[10] = 0;
625 zKey = db_text(0, "SELECT '/tarball/'||uuid||'/%q' FROM blob WHERE rid=%d",zName,rid);
 
 
 
 
 
 
 
 
 
626 blob_zero(&tarball);
627 if( cache_read(&tarball, zKey)==0 ){
628 tarball_of_checkin(rid, &tarball, zName);
629 cache_write(&tarball, zKey);
630 }
631
--- src/tar.c
+++ src/tar.c
@@ -526,17 +526,21 @@
526 }
527
528 /*
529 ** COMMAND: tarball*
530 **
531 ** Usage: %fossil tarball VERSION OUTPUTFILE
532 **
533 ** Generate a compressed tarball for a specified version. If the --name
534 ** option is used, its argument becomes the name of the top-level directory
535 ** in the resulting tarball. If --name is omitted, the top-level directory
536 ** named is derived from the project name, the check-in date and time, and
537 ** the artifact ID of the check-in.
538 **
539 ** Options:
540 ** --name DIRECTORYNAME The name of the top-level directory in the archive
541 ** -R REPOSITORY Specify a Fossil repository
542 */
543 void tarball_cmd(void){
544 int rid;
545 Blob tarball;
546 const char *zName;
@@ -620,11 +624,20 @@
624 if( rid==0 ){
625 @ Not found
626 return;
627 }
628 if( nRid==0 && nName>10 ) zName[10] = 0;
629 zKey = db_text(0, "SELECT '/tarball/'||uuid||'/%q'"
630 " FROM blob WHERE rid=%d",zName,rid);
631 if( P("debug")!=0 ){
632 style_header("Tarball Generator Debug Screen");
633 @ zName = "%h(zName)"<br>
634 @ rid = %d(rid)<br>
635 @ zKey = "%h(zKey)"
636 style_footer();
637 return;
638 }
639 blob_zero(&tarball);
640 if( cache_read(&tarball, zKey)==0 ){
641 tarball_of_checkin(rid, &tarball, zName);
642 cache_write(&tarball, zKey);
643 }
644

Keyboard Shortcuts

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