Check-in [4c82c7773f]
Not logged in

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

Overview
Comment:Fix some annoyances with "merge". This involves a schema change to the _FOSSIL_ file. Older versions will continue to work, but it would make since to "close" and "open" local source tree after updating to this version of fossil, in order to update the schema.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4c82c7773f49c1330a7c90220857696df6dbfd0f
User & Date: drh 2007-08-30 20:27:14.000
Context
2007-08-30
21:37
Put a colored asterisk beside entries of interest in the timeline, rather than doing lots of annoying text color and background changes. check-in: 4d03017923 user: drh tags: trunk
20:27
Fix some annoyances with "merge". This involves a schema change to the _FOSSIL_ file. Older versions will continue to work, but it would make since to "close" and "open" local source tree after updating to this version of fossil, in order to update the schema. check-in: 4c82c7773f user: drh tags: trunk
19:46
Fix multiple bugs in the comment parser of the commit command. Allow blank lines in comments. check-in: f030c0aea7 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/checkin.c.
303
304
305
306
307
308
309

310
311
312
313
314
315
316
  int vid, nrid, nvid;
  Blob comment;
  const char *zComment;
  Stmt q;
  Stmt q2;
  char *zUuid, *zDate;
  int noSign = 0;        /* True to omit signing the manifest using GPG */

  char *zManifestFile;   /* Name of the manifest file */
  Blob manifest;
  Blob muuid;            /* Manifest uuid */
  Blob mcksum;           /* Self-checksum on the manifest */
  Blob cksum1, cksum2;   /* Before and after commit checksums */
  Blob cksum1b;          /* Checksum recorded in the manifest */
 







>







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
  int vid, nrid, nvid;
  Blob comment;
  const char *zComment;
  Stmt q;
  Stmt q2;
  char *zUuid, *zDate;
  int noSign = 0;        /* True to omit signing the manifest using GPG */
  int isAMerge = 0;      /* True if checking in a merge */
  char *zManifestFile;   /* Name of the manifest file */
  Blob manifest;
  Blob muuid;            /* Manifest uuid */
  Blob mcksum;           /* Self-checksum on the manifest */
  Blob cksum1, cksum2;   /* Before and after commit checksums */
  Blob cksum1b;          /* Checksum recorded in the manifest */
 
327
328
329
330
331
332
333

334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
  **
  ** After the following function call has returned, the Global.aCommitFile[]
  ** array is allocated to contain the "id" field from the vfile table
  ** for each file to be committed. Or, if aCommitFile is NULL, all files
  ** should be committed.
  */
  select_commit_files();

  if( g.aCommitFile && db_exists("SELECT 1 FROM vmerge") ){
    fossil_fatal("cannot do a partial commit of a merge");
  }

  user_select();
  db_begin_transaction();
  rc = unsaved_changes();
  if( rc==0 ){
    fossil_panic("nothing has changed");
  }

  /* If one or more files that were named on the command line have not
  ** been modified, bail out now.
  */
  if( g.aCommitFile ){







>
|






|







328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
  **
  ** After the following function call has returned, the Global.aCommitFile[]
  ** array is allocated to contain the "id" field from the vfile table
  ** for each file to be committed. Or, if aCommitFile is NULL, all files
  ** should be committed.
  */
  select_commit_files();
  isAMerge = db_exists("SELECT 1 FROM vmerge");
  if( g.aCommitFile && isAMerge ){
    fossil_fatal("cannot do a partial commit of a merge");
  }

  user_select();
  db_begin_transaction();
  rc = unsaved_changes();
  if( rc==0 && !isAMerge ){
    fossil_panic("nothing has changed");
  }

  /* If one or more files that were named on the command line have not
  ** been modified, bail out now.
  */
  if( g.aCommitFile ){
Changes to src/merge.c.
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
    blob_read_from_file(&v, zFullPath);
    blob_merge(&p, &m, &v, &r);
    blob_write_to_file(&r, zFullPath);
    blob_reset(&p);
    blob_reset(&m);
    blob_reset(&v);
    blob_reset(&r);
    db_multi_exec("INSERT INTO vmerge(id,merge) VALUES(%d,%d)",idv,ridm);

  }
  db_finalize(&q);

  /*
  ** Drop files from vid that are in pid but not in mid
  */
  db_prepare(&q,







|
>







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
    blob_read_from_file(&v, zFullPath);
    blob_merge(&p, &m, &v, &r);
    blob_write_to_file(&r, zFullPath);
    blob_reset(&p);
    blob_reset(&m);
    blob_reset(&v);
    blob_reset(&r);
    db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(%d,%d)",
                  idv,ridm);
  }
  db_finalize(&q);

  /*
  ** Drop files from vid that are in pid but not in mid
  */
  db_prepare(&q,
260
261
262
263
264
265
266
267
268
269
  }
  db_finalize(&q);
  
  /*
  ** Clean up the mid and pid VFILE entries.  Then commit the changes.
  */
  db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
  db_multi_exec("INSERT INTO vmerge(id,merge) VALUES(0,%d)", mid);
  db_end_transaction(0);
}







|


261
262
263
264
265
266
267
268
269
270
  }
  db_finalize(&q);
  
  /*
  ** Clean up the mid and pid VFILE entries.  Then commit the changes.
  */
  db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
  db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid);
  db_end_transaction(0);
}
Changes to src/schema.c.
243
244
245
246
247
248
249
250

251
252
253
254
255
256
257
@ -- file tree.  If a VFILE entry with id has merged with another
@ -- record, there is an entry in this table with (id,merge) where
@ -- merge is the RECORD table entry that the file merged against.
@ -- An id of 0 here means the version record itself.
@
@ CREATE TABLE vmerge(
@   id INTEGER REFERENCES vfile,      -- VFILE entry that has been merged
@   merge INTEGER                     -- Merged with this record

@ );
;

const char zServerTempSchema[] =
@ -- A copy of the vfile table schema used by the WWW server
@ --
@ CREATE TEMP TABLE vfile(







|
>







243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
@ -- file tree.  If a VFILE entry with id has merged with another
@ -- record, there is an entry in this table with (id,merge) where
@ -- merge is the RECORD table entry that the file merged against.
@ -- An id of 0 here means the version record itself.
@
@ CREATE TABLE vmerge(
@   id INTEGER REFERENCES vfile,      -- VFILE entry that has been merged
@   merge INTEGER,                    -- Merged with this record
@   UNIQUE(id, merge)
@ );
;

const char zServerTempSchema[] =
@ -- A copy of the vfile table schema used by the WWW server
@ --
@ CREATE TEMP TABLE vfile(
Changes to src/wikiformat.c.
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
**     * Convert & into &
**     * Unrecognized markup and markup within <verbatim>
**       is converted into &lt;...&gt;
**     * Unauthorized attributes on markup are removed
*/
void wiki_convert(Blob *pIn, Blob *pOut, int ops){
  char *z;
  int n;
  Renderer renderer;
  
  memset(&renderer, 0, sizeof(renderer));
  renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
  renderer.pOut = pOut;

  z = blob_str(pIn);







<







910
911
912
913
914
915
916

917
918
919
920
921
922
923
**     * Convert & into &amp;
**     * Unrecognized markup and markup within <verbatim>
**       is converted into &lt;...&gt;
**     * Unauthorized attributes on markup are removed
*/
void wiki_convert(Blob *pIn, Blob *pOut, int ops){
  char *z;

  Renderer renderer;
  
  memset(&renderer, 0, sizeof(renderer));
  renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
  renderer.pOut = pOut;

  z = blob_str(pIn);