Fossil

Check-in [2582ecf2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a "zip" command for generating a ZIP archive of a check-in from the command-line.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2582ecf2edc2d0d9c5818dc481bc7b330381716d
User & Date: drh 2010-03-11 03:29:57
Context
2010-03-12
14:29
Fix the formatting on the non-propagating tag timeline. Ticket [274b530475ce]. check-in: 19d6b1cf user: drh tags: trunk
2010-03-11
03:29
Add a "zip" command for generating a ZIP archive of a check-in from the command-line. check-in: 2582ecf2 user: drh tags: trunk
2010-03-10
17:18
Make sure the return value of db_text() is always something obtained from malloc() or else NULL. Strdup() the default value if the default value is used. check-in: 0cbc5d29 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/zip.c.

376
377
378
379
380
381
382
383
384


385




386
387
388
389



390
391

392
393
394











395
396
397
398
399
400
401
402
    blob_reset(&file);
  }
  blob_reset(&filename);
  zip_close(pZip);
}

/*
** COMMAND: test-baseline-zip
**


** Generate a ZIP archive for a specified baseline.




*/
void baseline_zip_cmd(void){
  int rid;
  Blob zip;



  if( g.argc!=4 ){
    usage("UUID ZIPFILE");

  }
  db_must_be_within_tree();
  rid = name_to_rid(g.argv[2]);











  zip_of_baseline(rid, &zip, g.argv[2]);
  blob_write_to_file(&zip, g.argv[3]);
}

/*
** WEBPAGE: zip
** URL: /zip/RID.zip
**







|

>
>
|
>
>
>
>




>
>
>

<
>

<

>
>
>
>
>
>
>
>
>
>
>
|







376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399

400
401

402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
    blob_reset(&file);
  }
  blob_reset(&filename);
  zip_close(pZip);
}

/*
** COMMAND: zip
**
** Usage: %fossil zip VERSION OUTPUTFILE [--name DIRECTORYNAME]
**
** Generate a ZIP archive for a specified version.  If the --name option is
** used, it argument becomes the name of the top-level directory in the
** resulting ZIP archive.  If --name is omitted, the top-level directory
** named is derived from the project name, the check-in date and time, and
** the artifact ID of the check-in.
*/
void baseline_zip_cmd(void){
  int rid;
  Blob zip;
  const char *zName;
  zName = find_option("name", 0, 1);
  db_find_and_open_repository(1);
  if( g.argc!=4 ){

    usage("VERSION OUTPUTFILE");
  }

  rid = name_to_rid(g.argv[2]);
  if( zName==0 ){
    zName = db_text("default-name",
       "SELECT replace(%Q,' ','_') "
          " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
          " || substr(blob.uuid, 1, 10)"
       "  FROM event, blob"
       " WHERE event.objid=%d"
       "   AND blob.rid=%d",
       db_get("project-name", "unnamed"), rid, rid
    );
  }
  zip_of_baseline(rid, &zip, zName);
  blob_write_to_file(&zip, g.argv[3]);
}

/*
** WEBPAGE: zip
** URL: /zip/RID.zip
**