Fossil SCM

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.

drh 2007-08-30 20:27 trunk
Commit 4c82c7773f49c1330a7c90220857696df6dbfd0f
+4 -2
--- src/checkin.c
+++ src/checkin.c
@@ -305,10 +305,11 @@
305305
const char *zComment;
306306
Stmt q;
307307
Stmt q2;
308308
char *zUuid, *zDate;
309309
int noSign = 0; /* True to omit signing the manifest using GPG */
310
+ int isAMerge = 0; /* True if checking in a merge */
310311
char *zManifestFile; /* Name of the manifest file */
311312
Blob manifest;
312313
Blob muuid; /* Manifest uuid */
313314
Blob mcksum; /* Self-checksum on the manifest */
314315
Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -329,18 +330,19 @@
329330
** array is allocated to contain the "id" field from the vfile table
330331
** for each file to be committed. Or, if aCommitFile is NULL, all files
331332
** should be committed.
332333
*/
333334
select_commit_files();
334
- if( g.aCommitFile && db_exists("SELECT 1 FROM vmerge") ){
335
+ isAMerge = db_exists("SELECT 1 FROM vmerge");
336
+ if( g.aCommitFile && isAMerge ){
335337
fossil_fatal("cannot do a partial commit of a merge");
336338
}
337339
338340
user_select();
339341
db_begin_transaction();
340342
rc = unsaved_changes();
341
- if( rc==0 ){
343
+ if( rc==0 && !isAMerge ){
342344
fossil_panic("nothing has changed");
343345
}
344346
345347
/* If one or more files that were named on the command line have not
346348
** been modified, bail out now.
347349
--- src/checkin.c
+++ src/checkin.c
@@ -305,10 +305,11 @@
305 const char *zComment;
306 Stmt q;
307 Stmt q2;
308 char *zUuid, *zDate;
309 int noSign = 0; /* True to omit signing the manifest using GPG */
 
310 char *zManifestFile; /* Name of the manifest file */
311 Blob manifest;
312 Blob muuid; /* Manifest uuid */
313 Blob mcksum; /* Self-checksum on the manifest */
314 Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -329,18 +330,19 @@
329 ** array is allocated to contain the "id" field from the vfile table
330 ** for each file to be committed. Or, if aCommitFile is NULL, all files
331 ** should be committed.
332 */
333 select_commit_files();
334 if( g.aCommitFile && db_exists("SELECT 1 FROM vmerge") ){
 
335 fossil_fatal("cannot do a partial commit of a merge");
336 }
337
338 user_select();
339 db_begin_transaction();
340 rc = unsaved_changes();
341 if( rc==0 ){
342 fossil_panic("nothing has changed");
343 }
344
345 /* If one or more files that were named on the command line have not
346 ** been modified, bail out now.
347
--- src/checkin.c
+++ src/checkin.c
@@ -305,10 +305,11 @@
305 const char *zComment;
306 Stmt q;
307 Stmt q2;
308 char *zUuid, *zDate;
309 int noSign = 0; /* True to omit signing the manifest using GPG */
310 int isAMerge = 0; /* True if checking in a merge */
311 char *zManifestFile; /* Name of the manifest file */
312 Blob manifest;
313 Blob muuid; /* Manifest uuid */
314 Blob mcksum; /* Self-checksum on the manifest */
315 Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -329,18 +330,19 @@
330 ** array is allocated to contain the "id" field from the vfile table
331 ** for each file to be committed. Or, if aCommitFile is NULL, all files
332 ** should be committed.
333 */
334 select_commit_files();
335 isAMerge = db_exists("SELECT 1 FROM vmerge");
336 if( g.aCommitFile && isAMerge ){
337 fossil_fatal("cannot do a partial commit of a merge");
338 }
339
340 user_select();
341 db_begin_transaction();
342 rc = unsaved_changes();
343 if( rc==0 && !isAMerge ){
344 fossil_panic("nothing has changed");
345 }
346
347 /* If one or more files that were named on the command line have not
348 ** been modified, bail out now.
349
+3 -2
--- src/merge.c
+++ src/merge.c
@@ -235,11 +235,12 @@
235235
blob_write_to_file(&r, zFullPath);
236236
blob_reset(&p);
237237
blob_reset(&m);
238238
blob_reset(&v);
239239
blob_reset(&r);
240
- db_multi_exec("INSERT INTO vmerge(id,merge) VALUES(%d,%d)",idv,ridm);
240
+ db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(%d,%d)",
241
+ idv,ridm);
241242
}
242243
db_finalize(&q);
243244
244245
/*
245246
** Drop files from vid that are in pid but not in mid
@@ -262,8 +263,8 @@
262263
263264
/*
264265
** Clean up the mid and pid VFILE entries. Then commit the changes.
265266
*/
266267
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
267
- db_multi_exec("INSERT INTO vmerge(id,merge) VALUES(0,%d)", mid);
268
+ db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid);
268269
db_end_transaction(0);
269270
}
270271
--- src/merge.c
+++ src/merge.c
@@ -235,11 +235,12 @@
235 blob_write_to_file(&r, zFullPath);
236 blob_reset(&p);
237 blob_reset(&m);
238 blob_reset(&v);
239 blob_reset(&r);
240 db_multi_exec("INSERT INTO vmerge(id,merge) VALUES(%d,%d)",idv,ridm);
 
241 }
242 db_finalize(&q);
243
244 /*
245 ** Drop files from vid that are in pid but not in mid
@@ -262,8 +263,8 @@
262
263 /*
264 ** Clean up the mid and pid VFILE entries. Then commit the changes.
265 */
266 db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
267 db_multi_exec("INSERT INTO vmerge(id,merge) VALUES(0,%d)", mid);
268 db_end_transaction(0);
269 }
270
--- src/merge.c
+++ src/merge.c
@@ -235,11 +235,12 @@
235 blob_write_to_file(&r, zFullPath);
236 blob_reset(&p);
237 blob_reset(&m);
238 blob_reset(&v);
239 blob_reset(&r);
240 db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(%d,%d)",
241 idv,ridm);
242 }
243 db_finalize(&q);
244
245 /*
246 ** Drop files from vid that are in pid but not in mid
@@ -262,8 +263,8 @@
263
264 /*
265 ** Clean up the mid and pid VFILE entries. Then commit the changes.
266 */
267 db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
268 db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid);
269 db_end_transaction(0);
270 }
271
+2 -1
--- src/schema.c
+++ src/schema.c
@@ -245,11 +245,12 @@
245245
@ -- merge is the RECORD table entry that the file merged against.
246246
@ -- An id of 0 here means the version record itself.
247247
@
248248
@ CREATE TABLE vmerge(
249249
@ id INTEGER REFERENCES vfile, -- VFILE entry that has been merged
250
-@ merge INTEGER -- Merged with this record
250
+@ merge INTEGER, -- Merged with this record
251
+@ UNIQUE(id, merge)
251252
@ );
252253
;
253254
254255
const char zServerTempSchema[] =
255256
@ -- A copy of the vfile table schema used by the WWW server
256257
--- src/schema.c
+++ src/schema.c
@@ -245,11 +245,12 @@
245 @ -- merge is the RECORD table entry that the file merged against.
246 @ -- An id of 0 here means the version record itself.
247 @
248 @ CREATE TABLE vmerge(
249 @ id INTEGER REFERENCES vfile, -- VFILE entry that has been merged
250 @ merge INTEGER -- Merged with this record
 
251 @ );
252 ;
253
254 const char zServerTempSchema[] =
255 @ -- A copy of the vfile table schema used by the WWW server
256
--- src/schema.c
+++ src/schema.c
@@ -245,11 +245,12 @@
245 @ -- merge is the RECORD table entry that the file merged against.
246 @ -- An id of 0 here means the version record itself.
247 @
248 @ CREATE TABLE vmerge(
249 @ id INTEGER REFERENCES vfile, -- VFILE entry that has been merged
250 @ merge INTEGER, -- Merged with this record
251 @ UNIQUE(id, merge)
252 @ );
253 ;
254
255 const char zServerTempSchema[] =
256 @ -- A copy of the vfile table schema used by the WWW server
257
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -912,11 +912,10 @@
912912
** is converted into <...>
913913
** * Unauthorized attributes on markup are removed
914914
*/
915915
void wiki_convert(Blob *pIn, Blob *pOut, int ops){
916916
char *z;
917
- int n;
918917
Renderer renderer;
919918
920919
memset(&renderer, 0, sizeof(renderer));
921920
renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
922921
renderer.pOut = pOut;
923922
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -912,11 +912,10 @@
912 ** is converted into <...>
913 ** * Unauthorized attributes on markup are removed
914 */
915 void wiki_convert(Blob *pIn, Blob *pOut, int ops){
916 char *z;
917 int n;
918 Renderer renderer;
919
920 memset(&renderer, 0, sizeof(renderer));
921 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
922 renderer.pOut = pOut;
923
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -912,11 +912,10 @@
912 ** is converted into <...>
913 ** * Unauthorized attributes on markup are removed
914 */
915 void wiki_convert(Blob *pIn, Blob *pOut, int ops){
916 char *z;
 
917 Renderer renderer;
918
919 memset(&renderer, 0, sizeof(renderer));
920 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
921 renderer.pOut = pOut;
922

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button