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.
Commit
4c82c7773f49c1330a7c90220857696df6dbfd0f
Parent
f030c0aea76a40c…
4 files changed
+4
-2
+3
-2
+2
-1
-1
+4
-2
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -305,10 +305,11 @@ | ||
| 305 | 305 | const char *zComment; |
| 306 | 306 | Stmt q; |
| 307 | 307 | Stmt q2; |
| 308 | 308 | char *zUuid, *zDate; |
| 309 | 309 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 310 | + int isAMerge = 0; /* True if checking in a merge */ | |
| 310 | 311 | char *zManifestFile; /* Name of the manifest file */ |
| 311 | 312 | Blob manifest; |
| 312 | 313 | Blob muuid; /* Manifest uuid */ |
| 313 | 314 | Blob mcksum; /* Self-checksum on the manifest */ |
| 314 | 315 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| @@ -329,18 +330,19 @@ | ||
| 329 | 330 | ** array is allocated to contain the "id" field from the vfile table |
| 330 | 331 | ** for each file to be committed. Or, if aCommitFile is NULL, all files |
| 331 | 332 | ** should be committed. |
| 332 | 333 | */ |
| 333 | 334 | 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 ){ | |
| 335 | 337 | fossil_fatal("cannot do a partial commit of a merge"); |
| 336 | 338 | } |
| 337 | 339 | |
| 338 | 340 | user_select(); |
| 339 | 341 | db_begin_transaction(); |
| 340 | 342 | rc = unsaved_changes(); |
| 341 | - if( rc==0 ){ | |
| 343 | + if( rc==0 && !isAMerge ){ | |
| 342 | 344 | fossil_panic("nothing has changed"); |
| 343 | 345 | } |
| 344 | 346 | |
| 345 | 347 | /* If one or more files that were named on the command line have not |
| 346 | 348 | ** been modified, bail out now. |
| 347 | 349 |
| --- 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 @@ | ||
| 235 | 235 | blob_write_to_file(&r, zFullPath); |
| 236 | 236 | blob_reset(&p); |
| 237 | 237 | blob_reset(&m); |
| 238 | 238 | blob_reset(&v); |
| 239 | 239 | 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); | |
| 241 | 242 | } |
| 242 | 243 | db_finalize(&q); |
| 243 | 244 | |
| 244 | 245 | /* |
| 245 | 246 | ** Drop files from vid that are in pid but not in mid |
| @@ -262,8 +263,8 @@ | ||
| 262 | 263 | |
| 263 | 264 | /* |
| 264 | 265 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 265 | 266 | */ |
| 266 | 267 | 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); | |
| 268 | 269 | db_end_transaction(0); |
| 269 | 270 | } |
| 270 | 271 |
| --- 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 @@ | ||
| 245 | 245 | @ -- merge is the RECORD table entry that the file merged against. |
| 246 | 246 | @ -- An id of 0 here means the version record itself. |
| 247 | 247 | @ |
| 248 | 248 | @ CREATE TABLE vmerge( |
| 249 | 249 | @ 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) | |
| 251 | 252 | @ ); |
| 252 | 253 | ; |
| 253 | 254 | |
| 254 | 255 | const char zServerTempSchema[] = |
| 255 | 256 | @ -- A copy of the vfile table schema used by the WWW server |
| 256 | 257 |
| --- 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 |
-1
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -912,11 +912,10 @@ | ||
| 912 | 912 | ** is converted into <...> |
| 913 | 913 | ** * Unauthorized attributes on markup are removed |
| 914 | 914 | */ |
| 915 | 915 | void wiki_convert(Blob *pIn, Blob *pOut, int ops){ |
| 916 | 916 | char *z; |
| 917 | - int n; | |
| 918 | 917 | Renderer renderer; |
| 919 | 918 | |
| 920 | 919 | memset(&renderer, 0, sizeof(renderer)); |
| 921 | 920 | renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH; |
| 922 | 921 | renderer.pOut = pOut; |
| 923 | 922 |
| --- 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 |