Fossil

Check-in [2487f505]
Login

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

Overview
Comment:Render any phantom or shunned artifacts as an empty file.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mirror-cmd
Files: files | file ages | folders
SHA3-256: 2487f505cd3bf30fc3dcf9ce63c4560b72428cd3b959a27fa94d6c2067822a01
User & Date: drh 2019-03-15 11:48:41
Context
2019-03-15
13:12
The branch names should start with "refs/heads" (with an "s" at the end), not just "refs/head". check-in: d7437168 user: drh tags: mirror-cmd
11:48
Render any phantom or shunned artifacts as an empty file. check-in: 2487f505 user: drh tags: mirror-cmd
2019-03-14
20:16
The mirror command is now able to export all of Fossil itself, though tags are still not exported. check-in: a3471a5e user: drh tags: mirror-cmd
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/export.c.

947
948
949
950
951
952
953




954
955
956
957
958
959
960
961
962
963


964
965





966
967
968
969
970
971
972
....
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
  );
  db_bind_text(&sIns, ":uuid", zUuid);
  db_step(&sIns);
  db_reset(&sIns);
  return db_last_insert_rowid();
}





/*
** Export a single file named by zUuid.
*/
static void mirror_send_file(FILE *xCmd, const char *zUuid){
  int iMark;
  int rid;
  int rc;
  Blob data;
  rid = fast_uuid_to_rid(zUuid);
  if( rid<0 ) fossil_fatal("no rid for %s", zUuid);


  rc = content_get(rid, &data);
  if( rc==0 ) fossil_fatal("%s is a phantom", zUuid);





  iMark = mirror_find_mark(zUuid, 1);
  fprintf(xCmd, "blob\nmark :%d\ndata %d\n", iMark, blob_size(&data));
  fwrite(blob_buffer(&data), 1, blob_size(&data), xCmd);
  fprintf(xCmd, "\n");
  blob_reset(&data);
}

................................................................................
    "INSERT INTO tomirror "
    "SELECT objid, type, mtime, blob.uuid FROM event, blob\n"
    " WHERE type IN ('ci','t')"
    "   AND mtime>coalesce((SELECT value FROM mconfig WHERE key='start'),0.0)"
    "   AND blob.rid=event.objid"
    "   AND blob.uuid NOT IN (SELECT uuid FROM mirror.mmark);"
  );
  nTotal = db_int(0, "SELECT count(*) FROM tomirror");
  if( nLimit<nTotal ){
    nTotal = nLimit;
  }else if( nLimit>nTotal ){
    nLimit = nTotal;
  }
  db_prepare(&q,
    "SELECT objid, type, mtime, uuid FROM tomirror ORDER BY mtime"







>
>
>
>









|
>
>
|
<
>
>
>
>
>







 







|







947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970

971
972
973
974
975
976
977
978
979
980
981
982
....
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
  );
  db_bind_text(&sIns, ":uuid", zUuid);
  db_step(&sIns);
  db_reset(&sIns);
  return db_last_insert_rowid();
}

/* This is the SHA3-256 hash of an empty file */
static const char zEmptySha3[] = 
  "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a";

/*
** Export a single file named by zUuid.
*/
static void mirror_send_file(FILE *xCmd, const char *zUuid){
  int iMark;
  int rid;
  int rc;
  Blob data;
  rid = fast_uuid_to_rid(zUuid);
  if( rid<0 ){
    zUuid = zEmptySha3;
  }else{
    rc = content_get(rid, &data);

    if( rc==0 ){
      blob_init(&data, 0, 0);
      zUuid = zEmptySha3;
    }
  }
  iMark = mirror_find_mark(zUuid, 1);
  fprintf(xCmd, "blob\nmark :%d\ndata %d\n", iMark, blob_size(&data));
  fwrite(blob_buffer(&data), 1, blob_size(&data), xCmd);
  fprintf(xCmd, "\n");
  blob_reset(&data);
}

................................................................................
    "INSERT INTO tomirror "
    "SELECT objid, type, mtime, blob.uuid FROM event, blob\n"
    " WHERE type IN ('ci','t')"
    "   AND mtime>coalesce((SELECT value FROM mconfig WHERE key='start'),0.0)"
    "   AND blob.rid=event.objid"
    "   AND blob.uuid NOT IN (SELECT uuid FROM mirror.mmark);"
  );
  nTotal = db_int(0, "SELECT count(*) FROM tomirror WHERE type='ci'");
  if( nLimit<nTotal ){
    nTotal = nLimit;
  }else if( nLimit>nTotal ){
    nLimit = nTotal;
  }
  db_prepare(&q,
    "SELECT objid, type, mtime, uuid FROM tomirror ORDER BY mtime"