Fossil SCM
Even more consistency.
Commit
e5cbf41c04f1cb0d839b7526fb62ba0cc1a90369
Parent
b94587625384355…
2 files changed
+7
-8
+17
-12
+7
-8
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -544,11 +544,11 @@ | ||
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /* |
| 547 | 547 | ** COMMAND: tarball* |
| 548 | 548 | ** |
| 549 | -** Usage: %fossil tarball VERSION OUTPUTFILE | |
| 549 | +** Usage: %fossil tarball VERSION OUTPUTFILE [OPTIONS] | |
| 550 | 550 | ** |
| 551 | 551 | ** Generate a compressed tarball for a specified version. If the --name |
| 552 | 552 | ** option is used, its argument becomes the name of the top-level directory |
| 553 | 553 | ** in the resulting tarball. If --name is omitted, the top-level directory |
| 554 | 554 | ** name is derived from the project name, the check-in date and time, and |
| @@ -612,21 +612,21 @@ | ||
| 612 | 612 | |
| 613 | 613 | /* |
| 614 | 614 | ** WEBPAGE: tarball |
| 615 | 615 | ** URL: /tarball |
| 616 | 616 | ** |
| 617 | -** Generate a compressed tarball for a check-in and return that | |
| 618 | -** tarball as the HTTP reply content. | |
| 617 | +** Generate a compressed tarball for the check-in specified by the "uuid" | |
| 618 | +** query parameter. Return that ZIP archive as the HTTP reply content. | |
| 619 | 619 | ** |
| 620 | 620 | ** Query parameters: |
| 621 | 621 | ** |
| 622 | 622 | ** name=NAME[.tar.gz] The base name of the output file. The default |
| 623 | 623 | ** value is a configuration parameter in the project |
| 624 | -** settings. A prefix of the name, omitting the extension, | |
| 625 | -** is used as the top-most directory name. | |
| 624 | +** settings. A prefix of the name, omitting the | |
| 625 | +** extension, is used as the top-most directory name. | |
| 626 | 626 | ** |
| 627 | -** uuid=TAG The check-in that is turned into a tarball. | |
| 627 | +** uuid=TAG The check-in that is turned into a compressed tarball. | |
| 628 | 628 | ** Defaults to "trunk". |
| 629 | 629 | ** |
| 630 | 630 | ** in=PATTERN Only include files that match the comma-separate |
| 631 | 631 | ** list of GLOB patterns in PATTERN, as with ex= |
| 632 | 632 | ** |
| @@ -655,11 +655,10 @@ | ||
| 655 | 655 | nRid = strlen(zRid); |
| 656 | 656 | zInclude = P("in"); |
| 657 | 657 | if( zInclude ) pInclude = glob_create(zInclude); |
| 658 | 658 | zExclude = P("ex"); |
| 659 | 659 | if( zExclude ) pExclude = glob_create(zExclude); |
| 660 | - | |
| 661 | 660 | if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){ |
| 662 | 661 | /* Special case: Remove the ".tar.gz" suffix. */ |
| 663 | 662 | nName -= 7; |
| 664 | 663 | zName[nName] = 0; |
| 665 | 664 | }else{ |
| @@ -701,11 +700,11 @@ | ||
| 701 | 700 | style_footer(); |
| 702 | 701 | return; |
| 703 | 702 | } |
| 704 | 703 | if( referred_from_login() ){ |
| 705 | 704 | style_header("Tarball Download"); |
| 706 | - @ <form action='%R/tarball'> | |
| 705 | + @ <form action='%R/tarball/%h(zName).tar.gz'> | |
| 707 | 706 | cgi_query_parameters_to_hidden(); |
| 708 | 707 | @ <p>Tarball named <b>%h(zName).tar.gz</b> holding the content |
| 709 | 708 | @ of check-in <b>%h(zRid)</b>: |
| 710 | 709 | @ <input type="submit" value="Download" /> |
| 711 | 710 | @ </form> |
| 712 | 711 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -544,11 +544,11 @@ | |
| 544 | } |
| 545 | |
| 546 | /* |
| 547 | ** COMMAND: tarball* |
| 548 | ** |
| 549 | ** Usage: %fossil tarball VERSION OUTPUTFILE |
| 550 | ** |
| 551 | ** Generate a compressed tarball for a specified version. If the --name |
| 552 | ** option is used, its argument becomes the name of the top-level directory |
| 553 | ** in the resulting tarball. If --name is omitted, the top-level directory |
| 554 | ** name is derived from the project name, the check-in date and time, and |
| @@ -612,21 +612,21 @@ | |
| 612 | |
| 613 | /* |
| 614 | ** WEBPAGE: tarball |
| 615 | ** URL: /tarball |
| 616 | ** |
| 617 | ** Generate a compressed tarball for a check-in and return that |
| 618 | ** tarball as the HTTP reply content. |
| 619 | ** |
| 620 | ** Query parameters: |
| 621 | ** |
| 622 | ** name=NAME[.tar.gz] The base name of the output file. The default |
| 623 | ** value is a configuration parameter in the project |
| 624 | ** settings. A prefix of the name, omitting the extension, |
| 625 | ** is used as the top-most directory name. |
| 626 | ** |
| 627 | ** uuid=TAG The check-in that is turned into a tarball. |
| 628 | ** Defaults to "trunk". |
| 629 | ** |
| 630 | ** in=PATTERN Only include files that match the comma-separate |
| 631 | ** list of GLOB patterns in PATTERN, as with ex= |
| 632 | ** |
| @@ -655,11 +655,10 @@ | |
| 655 | nRid = strlen(zRid); |
| 656 | zInclude = P("in"); |
| 657 | if( zInclude ) pInclude = glob_create(zInclude); |
| 658 | zExclude = P("ex"); |
| 659 | if( zExclude ) pExclude = glob_create(zExclude); |
| 660 | |
| 661 | if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){ |
| 662 | /* Special case: Remove the ".tar.gz" suffix. */ |
| 663 | nName -= 7; |
| 664 | zName[nName] = 0; |
| 665 | }else{ |
| @@ -701,11 +700,11 @@ | |
| 701 | style_footer(); |
| 702 | return; |
| 703 | } |
| 704 | if( referred_from_login() ){ |
| 705 | style_header("Tarball Download"); |
| 706 | @ <form action='%R/tarball'> |
| 707 | cgi_query_parameters_to_hidden(); |
| 708 | @ <p>Tarball named <b>%h(zName).tar.gz</b> holding the content |
| 709 | @ of check-in <b>%h(zRid)</b>: |
| 710 | @ <input type="submit" value="Download" /> |
| 711 | @ </form> |
| 712 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -544,11 +544,11 @@ | |
| 544 | } |
| 545 | |
| 546 | /* |
| 547 | ** COMMAND: tarball* |
| 548 | ** |
| 549 | ** Usage: %fossil tarball VERSION OUTPUTFILE [OPTIONS] |
| 550 | ** |
| 551 | ** Generate a compressed tarball for a specified version. If the --name |
| 552 | ** option is used, its argument becomes the name of the top-level directory |
| 553 | ** in the resulting tarball. If --name is omitted, the top-level directory |
| 554 | ** name is derived from the project name, the check-in date and time, and |
| @@ -612,21 +612,21 @@ | |
| 612 | |
| 613 | /* |
| 614 | ** WEBPAGE: tarball |
| 615 | ** URL: /tarball |
| 616 | ** |
| 617 | ** Generate a compressed tarball for the check-in specified by the "uuid" |
| 618 | ** query parameter. Return that ZIP archive as the HTTP reply content. |
| 619 | ** |
| 620 | ** Query parameters: |
| 621 | ** |
| 622 | ** name=NAME[.tar.gz] The base name of the output file. The default |
| 623 | ** value is a configuration parameter in the project |
| 624 | ** settings. A prefix of the name, omitting the |
| 625 | ** extension, is used as the top-most directory name. |
| 626 | ** |
| 627 | ** uuid=TAG The check-in that is turned into a compressed tarball. |
| 628 | ** Defaults to "trunk". |
| 629 | ** |
| 630 | ** in=PATTERN Only include files that match the comma-separate |
| 631 | ** list of GLOB patterns in PATTERN, as with ex= |
| 632 | ** |
| @@ -655,11 +655,10 @@ | |
| 655 | nRid = strlen(zRid); |
| 656 | zInclude = P("in"); |
| 657 | if( zInclude ) pInclude = glob_create(zInclude); |
| 658 | zExclude = P("ex"); |
| 659 | if( zExclude ) pExclude = glob_create(zExclude); |
| 660 | if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){ |
| 661 | /* Special case: Remove the ".tar.gz" suffix. */ |
| 662 | nName -= 7; |
| 663 | zName[nName] = 0; |
| 664 | }else{ |
| @@ -701,11 +700,11 @@ | |
| 700 | style_footer(); |
| 701 | return; |
| 702 | } |
| 703 | if( referred_from_login() ){ |
| 704 | style_header("Tarball Download"); |
| 705 | @ <form action='%R/tarball/%h(zName).tar.gz'> |
| 706 | cgi_query_parameters_to_hidden(); |
| 707 | @ <p>Tarball named <b>%h(zName).tar.gz</b> holding the content |
| 708 | @ of check-in <b>%h(zRid)</b>: |
| 709 | @ <input type="submit" value="Download" /> |
| 710 | @ </form> |
| 711 |
+17
-12
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -402,11 +402,11 @@ | ||
| 402 | 402 | ** Usage: %fossil zip VERSION OUTPUTFILE [OPTIONS] |
| 403 | 403 | ** |
| 404 | 404 | ** Generate a ZIP archive for a check-in. If the --name option is |
| 405 | 405 | ** used, its argument becomes the name of the top-level directory in the |
| 406 | 406 | ** resulting ZIP archive. If --name is omitted, the top-level directory |
| 407 | -** named is derived from the project name, the check-in date and time, and | |
| 407 | +** name is derived from the project name, the check-in date and time, and | |
| 408 | 408 | ** the artifact ID of the check-in. |
| 409 | 409 | ** |
| 410 | 410 | ** The GLOBLIST argument to --exclude and --include can be a comma-separated |
| 411 | 411 | ** list of glob patterns, where each glob pattern may optionally be enclosed |
| 412 | 412 | ** in "..." or '...' so that it may contain commas. If a file matches both |
| @@ -437,11 +437,16 @@ | ||
| 437 | 437 | verify_all_options(); |
| 438 | 438 | |
| 439 | 439 | if( g.argc!=4 ){ |
| 440 | 440 | usage("VERSION OUTPUTFILE"); |
| 441 | 441 | } |
| 442 | - rid = name_to_typed_rid(g.argv[2],"ci"); | |
| 442 | + rid = name_to_typed_rid(g.argv[2], "ci"); | |
| 443 | + if( rid==0 ){ | |
| 444 | + fossil_fatal("Check-in not found: %s", g.argv[2]); | |
| 445 | + return; | |
| 446 | + } | |
| 447 | + | |
| 443 | 448 | if( zName==0 ){ |
| 444 | 449 | zName = db_text("default-name", |
| 445 | 450 | "SELECT replace(%Q,' ','_') " |
| 446 | 451 | " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) " |
| 447 | 452 | " || substr(blob.uuid, 1, 10)" |
| @@ -450,30 +455,31 @@ | ||
| 450 | 455 | " AND blob.rid=%d", |
| 451 | 456 | db_get("project-name", "unnamed"), rid, rid |
| 452 | 457 | ); |
| 453 | 458 | } |
| 454 | 459 | zip_of_checkin(rid, &zip, zName, pInclude, pExclude); |
| 455 | - blob_write_to_file(&zip, g.argv[3]); | |
| 456 | 460 | glob_free(pInclude); |
| 457 | 461 | glob_free(pExclude); |
| 462 | + blob_write_to_file(&zip, g.argv[3]); | |
| 463 | + blob_reset(&zip); | |
| 458 | 464 | } |
| 459 | 465 | |
| 460 | 466 | /* |
| 461 | 467 | ** WEBPAGE: zip |
| 462 | 468 | ** URL: /zip |
| 463 | 469 | ** |
| 464 | -** Generate a ZIP archive for a checkin specified by the uuid= query parameter. | |
| 465 | -** Return that ZIP archive as the HTTP reply content. | |
| 470 | +** Generate a ZIP archive for the check-in specified by the "uuid" | |
| 471 | +** query parameter. Return that ZIP archive as the HTTP reply content. | |
| 466 | 472 | ** |
| 467 | 473 | ** Query parameters: |
| 468 | 474 | ** |
| 469 | 475 | ** name=NAME[.zip] The base name of the output file. The default |
| 470 | 476 | ** value is a configuration parameter in the project |
| 471 | -** settings. A prefix of the name, omitting the extension, | |
| 472 | -** is used as the top-most directory name. | |
| 477 | +** settings. A prefix of the name, omitting the | |
| 478 | +** extension, is used as the top-most directory name. | |
| 473 | 479 | ** |
| 474 | -** uuid=TAG The check-in that is turned into a ZIP file. | |
| 480 | +** uuid=TAG The check-in that is turned into a ZIP archive. | |
| 475 | 481 | ** Defaults to "trunk". |
| 476 | 482 | ** |
| 477 | 483 | ** in=PATTERN Only include files that match the comma-separate |
| 478 | 484 | ** list of GLOB patterns in PATTERN, as with ex= |
| 479 | 485 | ** |
| @@ -482,19 +488,18 @@ | ||
| 482 | 488 | ** pattern can optionally be quoted using ".." or '..'. |
| 483 | 489 | ** Any file matching both ex= and in= is excluded. |
| 484 | 490 | */ |
| 485 | 491 | void baseline_zip_page(void){ |
| 486 | 492 | int rid; |
| 487 | - char *zName, *zRid; | |
| 493 | + char *zName, *zRid, *zKey; | |
| 488 | 494 | int nName, nRid; |
| 489 | - Blob zip; | |
| 490 | - char *zKey; | |
| 491 | 495 | const char *zInclude; /* The in= query parameter */ |
| 492 | 496 | const char *zExclude; /* The ex= query parameter */ |
| 493 | 497 | Blob cacheKey; /* The key to cache */ |
| 494 | 498 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 495 | 499 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 500 | + Blob zip; /* ZIP archive accumulated here */ | |
| 496 | 501 | |
| 497 | 502 | login_check_credentials(); |
| 498 | 503 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 499 | 504 | load_control(); |
| 500 | 505 | zName = mprintf("%s", PD("name","")); |
| @@ -517,11 +522,11 @@ | ||
| 517 | 522 | zName[nName] = 0; |
| 518 | 523 | break; |
| 519 | 524 | } |
| 520 | 525 | } |
| 521 | 526 | } |
| 522 | - rid = name_to_typed_rid(nRid?zRid:zName,"ci"); | |
| 527 | + rid = name_to_typed_rid(nRid?zRid:zName, "ci"); | |
| 523 | 528 | if( rid==0 ){ |
| 524 | 529 | @ Not found |
| 525 | 530 | return; |
| 526 | 531 | } |
| 527 | 532 | if( nRid==0 && nName>10 ) zName[10] = 0; |
| 528 | 533 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -402,11 +402,11 @@ | |
| 402 | ** Usage: %fossil zip VERSION OUTPUTFILE [OPTIONS] |
| 403 | ** |
| 404 | ** Generate a ZIP archive for a check-in. If the --name option is |
| 405 | ** used, its argument becomes the name of the top-level directory in the |
| 406 | ** resulting ZIP archive. If --name is omitted, the top-level directory |
| 407 | ** named is derived from the project name, the check-in date and time, and |
| 408 | ** the artifact ID of the check-in. |
| 409 | ** |
| 410 | ** The GLOBLIST argument to --exclude and --include can be a comma-separated |
| 411 | ** list of glob patterns, where each glob pattern may optionally be enclosed |
| 412 | ** in "..." or '...' so that it may contain commas. If a file matches both |
| @@ -437,11 +437,16 @@ | |
| 437 | verify_all_options(); |
| 438 | |
| 439 | if( g.argc!=4 ){ |
| 440 | usage("VERSION OUTPUTFILE"); |
| 441 | } |
| 442 | rid = name_to_typed_rid(g.argv[2],"ci"); |
| 443 | if( zName==0 ){ |
| 444 | zName = db_text("default-name", |
| 445 | "SELECT replace(%Q,' ','_') " |
| 446 | " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) " |
| 447 | " || substr(blob.uuid, 1, 10)" |
| @@ -450,30 +455,31 @@ | |
| 450 | " AND blob.rid=%d", |
| 451 | db_get("project-name", "unnamed"), rid, rid |
| 452 | ); |
| 453 | } |
| 454 | zip_of_checkin(rid, &zip, zName, pInclude, pExclude); |
| 455 | blob_write_to_file(&zip, g.argv[3]); |
| 456 | glob_free(pInclude); |
| 457 | glob_free(pExclude); |
| 458 | } |
| 459 | |
| 460 | /* |
| 461 | ** WEBPAGE: zip |
| 462 | ** URL: /zip |
| 463 | ** |
| 464 | ** Generate a ZIP archive for a checkin specified by the uuid= query parameter. |
| 465 | ** Return that ZIP archive as the HTTP reply content. |
| 466 | ** |
| 467 | ** Query parameters: |
| 468 | ** |
| 469 | ** name=NAME[.zip] The base name of the output file. The default |
| 470 | ** value is a configuration parameter in the project |
| 471 | ** settings. A prefix of the name, omitting the extension, |
| 472 | ** is used as the top-most directory name. |
| 473 | ** |
| 474 | ** uuid=TAG The check-in that is turned into a ZIP file. |
| 475 | ** Defaults to "trunk". |
| 476 | ** |
| 477 | ** in=PATTERN Only include files that match the comma-separate |
| 478 | ** list of GLOB patterns in PATTERN, as with ex= |
| 479 | ** |
| @@ -482,19 +488,18 @@ | |
| 482 | ** pattern can optionally be quoted using ".." or '..'. |
| 483 | ** Any file matching both ex= and in= is excluded. |
| 484 | */ |
| 485 | void baseline_zip_page(void){ |
| 486 | int rid; |
| 487 | char *zName, *zRid; |
| 488 | int nName, nRid; |
| 489 | Blob zip; |
| 490 | char *zKey; |
| 491 | const char *zInclude; /* The in= query parameter */ |
| 492 | const char *zExclude; /* The ex= query parameter */ |
| 493 | Blob cacheKey; /* The key to cache */ |
| 494 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 495 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 496 | |
| 497 | login_check_credentials(); |
| 498 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 499 | load_control(); |
| 500 | zName = mprintf("%s", PD("name","")); |
| @@ -517,11 +522,11 @@ | |
| 517 | zName[nName] = 0; |
| 518 | break; |
| 519 | } |
| 520 | } |
| 521 | } |
| 522 | rid = name_to_typed_rid(nRid?zRid:zName,"ci"); |
| 523 | if( rid==0 ){ |
| 524 | @ Not found |
| 525 | return; |
| 526 | } |
| 527 | if( nRid==0 && nName>10 ) zName[10] = 0; |
| 528 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -402,11 +402,11 @@ | |
| 402 | ** Usage: %fossil zip VERSION OUTPUTFILE [OPTIONS] |
| 403 | ** |
| 404 | ** Generate a ZIP archive for a check-in. If the --name option is |
| 405 | ** used, its argument becomes the name of the top-level directory in the |
| 406 | ** resulting ZIP archive. If --name is omitted, the top-level directory |
| 407 | ** name is derived from the project name, the check-in date and time, and |
| 408 | ** the artifact ID of the check-in. |
| 409 | ** |
| 410 | ** The GLOBLIST argument to --exclude and --include can be a comma-separated |
| 411 | ** list of glob patterns, where each glob pattern may optionally be enclosed |
| 412 | ** in "..." or '...' so that it may contain commas. If a file matches both |
| @@ -437,11 +437,16 @@ | |
| 437 | verify_all_options(); |
| 438 | |
| 439 | if( g.argc!=4 ){ |
| 440 | usage("VERSION OUTPUTFILE"); |
| 441 | } |
| 442 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| 443 | if( rid==0 ){ |
| 444 | fossil_fatal("Check-in not found: %s", g.argv[2]); |
| 445 | return; |
| 446 | } |
| 447 | |
| 448 | if( zName==0 ){ |
| 449 | zName = db_text("default-name", |
| 450 | "SELECT replace(%Q,' ','_') " |
| 451 | " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) " |
| 452 | " || substr(blob.uuid, 1, 10)" |
| @@ -450,30 +455,31 @@ | |
| 455 | " AND blob.rid=%d", |
| 456 | db_get("project-name", "unnamed"), rid, rid |
| 457 | ); |
| 458 | } |
| 459 | zip_of_checkin(rid, &zip, zName, pInclude, pExclude); |
| 460 | glob_free(pInclude); |
| 461 | glob_free(pExclude); |
| 462 | blob_write_to_file(&zip, g.argv[3]); |
| 463 | blob_reset(&zip); |
| 464 | } |
| 465 | |
| 466 | /* |
| 467 | ** WEBPAGE: zip |
| 468 | ** URL: /zip |
| 469 | ** |
| 470 | ** Generate a ZIP archive for the check-in specified by the "uuid" |
| 471 | ** query parameter. Return that ZIP archive as the HTTP reply content. |
| 472 | ** |
| 473 | ** Query parameters: |
| 474 | ** |
| 475 | ** name=NAME[.zip] The base name of the output file. The default |
| 476 | ** value is a configuration parameter in the project |
| 477 | ** settings. A prefix of the name, omitting the |
| 478 | ** extension, is used as the top-most directory name. |
| 479 | ** |
| 480 | ** uuid=TAG The check-in that is turned into a ZIP archive. |
| 481 | ** Defaults to "trunk". |
| 482 | ** |
| 483 | ** in=PATTERN Only include files that match the comma-separate |
| 484 | ** list of GLOB patterns in PATTERN, as with ex= |
| 485 | ** |
| @@ -482,19 +488,18 @@ | |
| 488 | ** pattern can optionally be quoted using ".." or '..'. |
| 489 | ** Any file matching both ex= and in= is excluded. |
| 490 | */ |
| 491 | void baseline_zip_page(void){ |
| 492 | int rid; |
| 493 | char *zName, *zRid, *zKey; |
| 494 | int nName, nRid; |
| 495 | const char *zInclude; /* The in= query parameter */ |
| 496 | const char *zExclude; /* The ex= query parameter */ |
| 497 | Blob cacheKey; /* The key to cache */ |
| 498 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 499 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 500 | Blob zip; /* ZIP archive accumulated here */ |
| 501 | |
| 502 | login_check_credentials(); |
| 503 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 504 | load_control(); |
| 505 | zName = mprintf("%s", PD("name","")); |
| @@ -517,11 +522,11 @@ | |
| 522 | zName[nName] = 0; |
| 523 | break; |
| 524 | } |
| 525 | } |
| 526 | } |
| 527 | rid = name_to_typed_rid(nRid?zRid:zName, "ci"); |
| 528 | if( rid==0 ){ |
| 529 | @ Not found |
| 530 | return; |
| 531 | } |
| 532 | if( nRid==0 && nName>10 ) zName[10] = 0; |
| 533 |