Fossil SCM
Updates to the "help" text for the tarball command. Add hyperlinks for accessing content on the /cachestat webpage.
Commit
b6a5023faefffefacfbda986853aa5a845715137
Parent
b9b3ce3b3907823…
2 files changed
+29
-1
+15
-2
+29
-1
| --- src/cache.c | ||
| +++ src/cache.c | ||
| @@ -62,10 +62,11 @@ | ||
| 62 | 62 | if( rc ){ |
| 63 | 63 | sqlite3_close(db); |
| 64 | 64 | return 0; |
| 65 | 65 | } |
| 66 | 66 | rc = sqlite3_exec(db, |
| 67 | + "PRAGMA page_size=8192;" | |
| 67 | 68 | "CREATE TABLE IF NOT EXISTS blob(id INTEGER PRIMARY KEY, data BLOB);" |
| 68 | 69 | "CREATE TABLE IF NOT EXISTS cache(" |
| 69 | 70 | "key TEXT PRIMARY KEY," /* Key used to access the cache */ |
| 70 | 71 | "id INT REFERENCES blob," /* The cache content */ |
| 71 | 72 | "sz INT," /* Size of content in bytes */ |
| @@ -345,11 +346,12 @@ | ||
| 345 | 346 | " ORDER BY tm DESC" |
| 346 | 347 | ); |
| 347 | 348 | if( pStmt ){ |
| 348 | 349 | @ <ol> |
| 349 | 350 | 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> | |
| 351 | 353 | @ size: %s(sqlite3_column_text(pStmt,1)) |
| 352 | 354 | @ hit-count: %d(sqlite3_column_int(pStmt,2)) |
| 353 | 355 | @ last-access: %s(sqlite3_column_text(pStmt,3))</p></li> |
| 354 | 356 | } |
| 355 | 357 | sqlite3_finalize(pStmt); |
| @@ -362,5 +364,31 @@ | ||
| 362 | 364 | fossil_free(zDbName); |
| 363 | 365 | sqlite3_close(db); |
| 364 | 366 | } |
| 365 | 367 | style_footer(); |
| 366 | 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 | +} | |
| 367 | 395 |
| --- 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 @@ | ||
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | /* |
| 529 | 529 | ** COMMAND: tarball* |
| 530 | 530 | ** |
| 531 | -** Usage: %fossil tarball VERSION OUTPUTFILE [--name DIRECTORYNAME] [-R|--repository REPO] | |
| 531 | +** Usage: %fossil tarball VERSION OUTPUTFILE | |
| 532 | 532 | ** |
| 533 | 533 | ** Generate a compressed tarball for a specified version. If the --name |
| 534 | 534 | ** option is used, its argument becomes the name of the top-level directory |
| 535 | 535 | ** in the resulting tarball. If --name is omitted, the top-level directory |
| 536 | 536 | ** named is derived from the project name, the check-in date and time, and |
| 537 | 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 | |
| 538 | 542 | */ |
| 539 | 543 | void tarball_cmd(void){ |
| 540 | 544 | int rid; |
| 541 | 545 | Blob tarball; |
| 542 | 546 | const char *zName; |
| @@ -620,11 +624,20 @@ | ||
| 620 | 624 | if( rid==0 ){ |
| 621 | 625 | @ Not found |
| 622 | 626 | return; |
| 623 | 627 | } |
| 624 | 628 | 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 | + } | |
| 626 | 639 | blob_zero(&tarball); |
| 627 | 640 | if( cache_read(&tarball, zKey)==0 ){ |
| 628 | 641 | tarball_of_checkin(rid, &tarball, zName); |
| 629 | 642 | cache_write(&tarball, zKey); |
| 630 | 643 | } |
| 631 | 644 |
| --- 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 |