Fossil SCM

Even more consistency.

mistachkin 2016-09-15 04:12 UTC tarAndZip
Commit e5cbf41c04f1cb0d839b7526fb62ba0cc1a90369
2 files changed +7 -8 +17 -12
+7 -8
--- src/tar.c
+++ src/tar.c
@@ -544,11 +544,11 @@
544544
}
545545
546546
/*
547547
** COMMAND: tarball*
548548
**
549
-** Usage: %fossil tarball VERSION OUTPUTFILE
549
+** Usage: %fossil tarball VERSION OUTPUTFILE [OPTIONS]
550550
**
551551
** Generate a compressed tarball for a specified version. If the --name
552552
** option is used, its argument becomes the name of the top-level directory
553553
** in the resulting tarball. If --name is omitted, the top-level directory
554554
** name is derived from the project name, the check-in date and time, and
@@ -612,21 +612,21 @@
612612
613613
/*
614614
** WEBPAGE: tarball
615615
** URL: /tarball
616616
**
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.
619619
**
620620
** Query parameters:
621621
**
622622
** name=NAME[.tar.gz] The base name of the output file. The default
623623
** 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.
626626
**
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.
628628
** Defaults to "trunk".
629629
**
630630
** in=PATTERN Only include files that match the comma-separate
631631
** list of GLOB patterns in PATTERN, as with ex=
632632
**
@@ -655,11 +655,10 @@
655655
nRid = strlen(zRid);
656656
zInclude = P("in");
657657
if( zInclude ) pInclude = glob_create(zInclude);
658658
zExclude = P("ex");
659659
if( zExclude ) pExclude = glob_create(zExclude);
660
-
661660
if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
662661
/* Special case: Remove the ".tar.gz" suffix. */
663662
nName -= 7;
664663
zName[nName] = 0;
665664
}else{
@@ -701,11 +700,11 @@
701700
style_footer();
702701
return;
703702
}
704703
if( referred_from_login() ){
705704
style_header("Tarball Download");
706
- @ <form action='%R/tarball'>
705
+ @ <form action='%R/tarball/%h(zName).tar.gz'>
707706
cgi_query_parameters_to_hidden();
708707
@ <p>Tarball named <b>%h(zName).tar.gz</b> holding the content
709708
@ of check-in <b>%h(zRid)</b>:
710709
@ <input type="submit" value="Download" />
711710
@ </form>
712711
--- 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 @@
402402
** Usage: %fossil zip VERSION OUTPUTFILE [OPTIONS]
403403
**
404404
** Generate a ZIP archive for a check-in. If the --name option is
405405
** used, its argument becomes the name of the top-level directory in the
406406
** 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
408408
** the artifact ID of the check-in.
409409
**
410410
** The GLOBLIST argument to --exclude and --include can be a comma-separated
411411
** list of glob patterns, where each glob pattern may optionally be enclosed
412412
** in "..." or '...' so that it may contain commas. If a file matches both
@@ -437,11 +437,16 @@
437437
verify_all_options();
438438
439439
if( g.argc!=4 ){
440440
usage("VERSION OUTPUTFILE");
441441
}
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
+
443448
if( zName==0 ){
444449
zName = db_text("default-name",
445450
"SELECT replace(%Q,' ','_') "
446451
" || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
447452
" || substr(blob.uuid, 1, 10)"
@@ -450,30 +455,31 @@
450455
" AND blob.rid=%d",
451456
db_get("project-name", "unnamed"), rid, rid
452457
);
453458
}
454459
zip_of_checkin(rid, &zip, zName, pInclude, pExclude);
455
- blob_write_to_file(&zip, g.argv[3]);
456460
glob_free(pInclude);
457461
glob_free(pExclude);
462
+ blob_write_to_file(&zip, g.argv[3]);
463
+ blob_reset(&zip);
458464
}
459465
460466
/*
461467
** WEBPAGE: zip
462468
** URL: /zip
463469
**
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.
466472
**
467473
** Query parameters:
468474
**
469475
** name=NAME[.zip] The base name of the output file. The default
470476
** 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.
473479
**
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.
475481
** Defaults to "trunk".
476482
**
477483
** in=PATTERN Only include files that match the comma-separate
478484
** list of GLOB patterns in PATTERN, as with ex=
479485
**
@@ -482,19 +488,18 @@
482488
** pattern can optionally be quoted using ".." or '..'.
483489
** Any file matching both ex= and in= is excluded.
484490
*/
485491
void baseline_zip_page(void){
486492
int rid;
487
- char *zName, *zRid;
493
+ char *zName, *zRid, *zKey;
488494
int nName, nRid;
489
- Blob zip;
490
- char *zKey;
491495
const char *zInclude; /* The in= query parameter */
492496
const char *zExclude; /* The ex= query parameter */
493497
Blob cacheKey; /* The key to cache */
494498
Glob *pInclude = 0; /* The compiled in= glob pattern */
495499
Glob *pExclude = 0; /* The compiled ex= glob pattern */
500
+ Blob zip; /* ZIP archive accumulated here */
496501
497502
login_check_credentials();
498503
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
499504
load_control();
500505
zName = mprintf("%s", PD("name",""));
@@ -517,11 +522,11 @@
517522
zName[nName] = 0;
518523
break;
519524
}
520525
}
521526
}
522
- rid = name_to_typed_rid(nRid?zRid:zName,"ci");
527
+ rid = name_to_typed_rid(nRid?zRid:zName, "ci");
523528
if( rid==0 ){
524529
@ Not found
525530
return;
526531
}
527532
if( nRid==0 && nName>10 ) zName[10] = 0;
528533
--- 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

Keyboard Shortcuts

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