Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | 2582ecf2edc2d0d9c5818dc481bc7b330381716d |
|---|---|
| Date: | 2010-03-11 03:29:57 |
| User: | drh |
| Comment: | Add a "zip" command for generating a ZIP archive of a check-in from the command-line. |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
Changes to src/zip.c
376 blob_reset(&file); 376 blob_reset(&file);
377 } 377 }
378 blob_reset(&filename); 378 blob_reset(&filename);
379 zip_close(pZip); 379 zip_close(pZip);
380 } 380 }
381 381
382 /* 382 /*
383 ** COMMAND: test-baseline-zip | 383 ** COMMAND: zip
> 384 **
> 385 ** Usage: %fossil zip VERSION OUTPUTFILE [--name DIRECTORYNAME]
384 ** 386 **
385 ** Generate a ZIP archive for a specified baseline. | 387 ** Generate a ZIP archive for a specified version. If the --name option is
> 388 ** used, it argument becomes the name of the top-level directory in the
> 389 ** resulting ZIP archive. If --name is omitted, the top-level directory
> 390 ** named is derived from the project name, the check-in date and time, and
> 391 ** the artifact ID of the check-in.
386 */ 392 */
387 void baseline_zip_cmd(void){ 393 void baseline_zip_cmd(void){
388 int rid; 394 int rid;
389 Blob zip; 395 Blob zip;
> 396 const char *zName;
> 397 zName = find_option("name", 0, 1);
> 398 db_find_and_open_repository(1);
390 if( g.argc!=4 ){ 399 if( g.argc!=4 ){
391 usage("UUID ZIPFILE"); | 400 usage("VERSION OUTPUTFILE");
392 } 401 }
393 db_must_be_within_tree(); <
394 rid = name_to_rid(g.argv[2]); 402 rid = name_to_rid(g.argv[2]);
395 zip_of_baseline(rid, &zip, g.argv[2]); | 403 if( zName==0 ){
> 404 zName = db_text("default-name",
> 405 "SELECT replace(%Q,' ','_') "
> 406 " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
> 407 " || substr(blob.uuid, 1, 10)"
> 408 " FROM event, blob"
> 409 " WHERE event.objid=%d"
> 410 " AND blob.rid=%d",
> 411 db_get("project-name", "unnamed"), rid, rid
> 412 );
> 413 }
> 414 zip_of_baseline(rid, &zip, zName);
396 blob_write_to_file(&zip, g.argv[3]); 415 blob_write_to_file(&zip, g.argv[3]);
397 } 416 }
398 417
399 /* 418 /*
400 ** WEBPAGE: zip 419 ** WEBPAGE: zip
401 ** URL: /zip/RID.zip 420 ** URL: /zip/RID.zip
402 ** 421 **