Fossil

Check-in [95e17f4e3f]
Login

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

Overview
Comment:Generate the "manifest.uuid" file containing the SHA1 hash of the "manifest" file whenever the manifest is generated. Makefiles can used the "manifest.uuid" to insert the version number into the executable.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 95e17f4e3f12b5a674e86dd827fc564bef6dc9da
User & Date: drh 2007-08-25 19:31:31.000
Context
2007-08-25
19:39
Add the "baseline" command that shows the UUID of the fossil baseline from which the fossil executable was built. ... (check-in: def4449a87 user: drh tags: trunk)
19:31
Generate the "manifest.uuid" file containing the SHA1 hash of the "manifest" file whenever the manifest is generated. Makefiles can used the "manifest.uuid" to insert the version number into the executable. ... (check-in: 95e17f4e3f user: drh tags: trunk)
19:00
Merging aku's changes into the head. ... (check-in: b0ad3f90bc user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/checkin.c.
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
  db_must_be_within_tree();
  db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
  chdir(g.zLocalRoot);
  blob_zero(&path);
  vfile_scan(0, &path);
  db_prepare(&q, 
      "SELECT x FROM sfile"
      " WHERE x NOT IN ('manifest','_FOSSIL_')"
      " ORDER BY 1");
  while( db_step(&q)==SQLITE_ROW ){
    printf("%s\n", db_column_text(&q, 0));
  }
  db_finalize(&q);
}








|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
  db_must_be_within_tree();
  db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
  chdir(g.zLocalRoot);
  blob_zero(&path);
  vfile_scan(0, &path);
  db_prepare(&q, 
      "SELECT x FROM sfile"
      " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_')"
      " ORDER BY 1");
  while( db_step(&q)==SQLITE_ROW ){
    printf("%s\n", db_column_text(&q, 0));
  }
  db_finalize(&q);
}

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
  db_must_be_within_tree();
  db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
  chdir(g.zLocalRoot);
  blob_zero(&path);
  vfile_scan(0, &path);
  db_prepare(&q, 
      "SELECT %Q || x FROM sfile"
      " WHERE x NOT IN ('manifest','_FOSSIL_')"
      " ORDER BY 1", g.zLocalRoot);
  while( db_step(&q)==SQLITE_ROW ){
    unlink(db_column_text(&q, 0));
  }
  db_finalize(&q);
}








|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
  db_must_be_within_tree();
  db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
  chdir(g.zLocalRoot);
  blob_zero(&path);
  vfile_scan(0, &path);
  db_prepare(&q, 
      "SELECT %Q || x FROM sfile"
      " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_')"
      " ORDER BY 1", g.zLocalRoot);
  while( db_step(&q)==SQLITE_ROW ){
    unlink(db_column_text(&q, 0));
  }
  db_finalize(&q);
}

Changes to src/checkout.c.
95
96
97
98
99
100
101

102
103
104
105
106
107


108





109
110
111
112
113
114
115
/*
** Read the manifest file given by vid out of the repository
** and store it in the root of the local check-out.
*/
void manifest_to_disk(int vid){
  char *zManFile;
  Blob manifest;


  blob_zero(&manifest);
  zManFile = mprintf("%smanifest", g.zLocalRoot);
  content_get(vid, &manifest);
  blob_write_to_file(&manifest, zManFile);
  free(zManFile);


  blob_reset(&manifest);





}

/*
** COMMAND: checkout
**
** Usage: %fossil checkout VERSION ?-f|--force?
** Check out a version specified on the command-line.  This command







>






>
>

>
>
>
>
>







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
** Read the manifest file given by vid out of the repository
** and store it in the root of the local check-out.
*/
void manifest_to_disk(int vid){
  char *zManFile;
  Blob manifest;
  Blob hash;

  blob_zero(&manifest);
  zManFile = mprintf("%smanifest", g.zLocalRoot);
  content_get(vid, &manifest);
  blob_write_to_file(&manifest, zManFile);
  free(zManFile);
  blob_zero(&hash);
  sha1sum_blob(&manifest, &hash);
  blob_reset(&manifest);
  zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
  blob_append(&hash, "\n", 1);
  blob_write_to_file(&hash, zManFile);
  free(zManFile);
  blob_reset(&hash);
}

/*
** COMMAND: checkout
**
** Usage: %fossil checkout VERSION ?-f|--force?
** Check out a version specified on the command-line.  This command
Changes to src/zip.c.
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280

281
282
283
284
285

286



287
288
289
290
291
292
293
** object.
**
** If the RID object does not exist in the repository, then
** pZip is zeroed.
*/
void zip_of_baseline(int rid, Blob *pZip){
  int i;
  Blob mfile, file;
  Manifest m;

  content_get(rid, &mfile);
  if( blob_size(&mfile)==0 ){
    blob_zero(pZip);
    return;
  }
  blob_zero(&file);

  blob_copy(&file, &mfile);
  zip_open();
  if( manifest_parse(&m, &mfile) ){
    zip_set_timedate(m.rDate);
    zip_add_file("manifest", &file);

    blob_reset(&file);



    for(i=0; i<m.nFile; i++){
      int fid = uuid_to_rid(m.aFile[i].zUuid, 0);
      if( fid ){
        content_get(fid, &file);
        zip_add_file(m.aFile[i].zName, &file);
        blob_reset(&file);
      }







|








>





>

>
>
>







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
** object.
**
** If the RID object does not exist in the repository, then
** pZip is zeroed.
*/
void zip_of_baseline(int rid, Blob *pZip){
  int i;
  Blob mfile, file, hash;
  Manifest m;

  content_get(rid, &mfile);
  if( blob_size(&mfile)==0 ){
    blob_zero(pZip);
    return;
  }
  blob_zero(&file);
  blob_zero(&hash);
  blob_copy(&file, &mfile);
  zip_open();
  if( manifest_parse(&m, &mfile) ){
    zip_set_timedate(m.rDate);
    zip_add_file("manifest", &file);
    sha1sum_blob(&file, &hash);
    blob_reset(&file);
    blob_append(&hash, "\n", 1);
    zip_add_file("manifest.uuid", &hash);
    blob_reset(&hash);
    for(i=0; i<m.nFile; i++){
      int fid = uuid_to_rid(m.aFile[i].zUuid, 0);
      if( fid ){
        content_get(fid, &file);
        zip_add_file(m.aFile[i].zName, &file);
        blob_reset(&file);
      }