Fossil SCM
Merge fixes in this branch to trunk prior to release.
Commit
b2d51b1b226d2a5010877586cb2cde62eedec918
Parent
4946b5b186cdd2f…
2 files changed
+21
-1
+2
-6
+21
-1
| --- src/stash.c | ||
| +++ src/stash.c | ||
| @@ -39,11 +39,11 @@ | ||
| 39 | 39 | @ isExec BOOLEAN, -- True if file is executable |
| 40 | 40 | @ isLink BOOLEAN, -- True if file is a symlink |
| 41 | 41 | @ origname TEXT, -- Original filename |
| 42 | 42 | @ newname TEXT, -- New name for file at next check-in |
| 43 | 43 | @ delta BLOB, -- Delta from baseline. Content if rid=0 |
| 44 | -@ PRIMARY KEY(origname, stashid) | |
| 44 | +@ PRIMARY KEY(newname, stashid) | |
| 45 | 45 | @ ); |
| 46 | 46 | @ INSERT OR IGNORE INTO vvar(name, value) VALUES('stash-next', 1); |
| 47 | 47 | ; |
| 48 | 48 | |
| 49 | 49 | /* |
| @@ -278,10 +278,15 @@ | ||
| 278 | 278 | } |
| 279 | 279 | blob_reset(&delta); |
| 280 | 280 | if( fossil_strcmp(zOrig,zNew)!=0 ){ |
| 281 | 281 | undo_save(zOrig); |
| 282 | 282 | file_delete(zOPath); |
| 283 | + db_multi_exec( | |
| 284 | + "UPDATE vfile SET pathname='%q', origname='%q'" | |
| 285 | + " WHERE pathname='%q' %s AND vid=%d", | |
| 286 | + zNew, zOrig, zOrig, filename_collation(), vid | |
| 287 | + ); | |
| 283 | 288 | } |
| 284 | 289 | } |
| 285 | 290 | stash_add_files_in_sfile(vid); |
| 286 | 291 | db_finalize(&q); |
| 287 | 292 | if( nConflict ){ |
| @@ -473,15 +478,30 @@ | ||
| 473 | 478 | */ |
| 474 | 479 | void stash_cmd(void){ |
| 475 | 480 | const char *zCmd; |
| 476 | 481 | int nCmd; |
| 477 | 482 | int stashid = 0; |
| 483 | + int rc; | |
| 478 | 484 | undo_capture_command_line(); |
| 479 | 485 | db_must_be_within_tree(); |
| 480 | 486 | db_open_config(0, 0); |
| 481 | 487 | db_begin_transaction(); |
| 482 | 488 | db_multi_exec(zStashInit /*works-like:""*/); |
| 489 | + rc = db_exists("SELECT 1 FROM sqlite_master" | |
| 490 | + " WHERE name='stashfile'" | |
| 491 | + " AND sql GLOB '* PRIMARY KEY(origname, stashid)*'"); | |
| 492 | + if( rc!=0 ){ | |
| 493 | + db_multi_exec( | |
| 494 | + "CREATE TABLE localdb.stashfile_tmp AS SELECT * FROM stashfile;" | |
| 495 | + "DROP TABLE stashfile;" | |
| 496 | + ); | |
| 497 | + db_multi_exec(zStashInit /*works-like:""*/); | |
| 498 | + db_multi_exec( | |
| 499 | + "INSERT INTO stashfile SELECT * FROM stashfile_tmp;" | |
| 500 | + "DROP TABLE stashfile_tmp;" | |
| 501 | + ); | |
| 502 | + } | |
| 483 | 503 | if( g.argc<=2 ){ |
| 484 | 504 | zCmd = "save"; |
| 485 | 505 | }else{ |
| 486 | 506 | zCmd = g.argv[2]; |
| 487 | 507 | } |
| 488 | 508 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -39,11 +39,11 @@ | |
| 39 | @ isExec BOOLEAN, -- True if file is executable |
| 40 | @ isLink BOOLEAN, -- True if file is a symlink |
| 41 | @ origname TEXT, -- Original filename |
| 42 | @ newname TEXT, -- New name for file at next check-in |
| 43 | @ delta BLOB, -- Delta from baseline. Content if rid=0 |
| 44 | @ PRIMARY KEY(origname, stashid) |
| 45 | @ ); |
| 46 | @ INSERT OR IGNORE INTO vvar(name, value) VALUES('stash-next', 1); |
| 47 | ; |
| 48 | |
| 49 | /* |
| @@ -278,10 +278,15 @@ | |
| 278 | } |
| 279 | blob_reset(&delta); |
| 280 | if( fossil_strcmp(zOrig,zNew)!=0 ){ |
| 281 | undo_save(zOrig); |
| 282 | file_delete(zOPath); |
| 283 | } |
| 284 | } |
| 285 | stash_add_files_in_sfile(vid); |
| 286 | db_finalize(&q); |
| 287 | if( nConflict ){ |
| @@ -473,15 +478,30 @@ | |
| 473 | */ |
| 474 | void stash_cmd(void){ |
| 475 | const char *zCmd; |
| 476 | int nCmd; |
| 477 | int stashid = 0; |
| 478 | undo_capture_command_line(); |
| 479 | db_must_be_within_tree(); |
| 480 | db_open_config(0, 0); |
| 481 | db_begin_transaction(); |
| 482 | db_multi_exec(zStashInit /*works-like:""*/); |
| 483 | if( g.argc<=2 ){ |
| 484 | zCmd = "save"; |
| 485 | }else{ |
| 486 | zCmd = g.argv[2]; |
| 487 | } |
| 488 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -39,11 +39,11 @@ | |
| 39 | @ isExec BOOLEAN, -- True if file is executable |
| 40 | @ isLink BOOLEAN, -- True if file is a symlink |
| 41 | @ origname TEXT, -- Original filename |
| 42 | @ newname TEXT, -- New name for file at next check-in |
| 43 | @ delta BLOB, -- Delta from baseline. Content if rid=0 |
| 44 | @ PRIMARY KEY(newname, stashid) |
| 45 | @ ); |
| 46 | @ INSERT OR IGNORE INTO vvar(name, value) VALUES('stash-next', 1); |
| 47 | ; |
| 48 | |
| 49 | /* |
| @@ -278,10 +278,15 @@ | |
| 278 | } |
| 279 | blob_reset(&delta); |
| 280 | if( fossil_strcmp(zOrig,zNew)!=0 ){ |
| 281 | undo_save(zOrig); |
| 282 | file_delete(zOPath); |
| 283 | db_multi_exec( |
| 284 | "UPDATE vfile SET pathname='%q', origname='%q'" |
| 285 | " WHERE pathname='%q' %s AND vid=%d", |
| 286 | zNew, zOrig, zOrig, filename_collation(), vid |
| 287 | ); |
| 288 | } |
| 289 | } |
| 290 | stash_add_files_in_sfile(vid); |
| 291 | db_finalize(&q); |
| 292 | if( nConflict ){ |
| @@ -473,15 +478,30 @@ | |
| 478 | */ |
| 479 | void stash_cmd(void){ |
| 480 | const char *zCmd; |
| 481 | int nCmd; |
| 482 | int stashid = 0; |
| 483 | int rc; |
| 484 | undo_capture_command_line(); |
| 485 | db_must_be_within_tree(); |
| 486 | db_open_config(0, 0); |
| 487 | db_begin_transaction(); |
| 488 | db_multi_exec(zStashInit /*works-like:""*/); |
| 489 | rc = db_exists("SELECT 1 FROM sqlite_master" |
| 490 | " WHERE name='stashfile'" |
| 491 | " AND sql GLOB '* PRIMARY KEY(origname, stashid)*'"); |
| 492 | if( rc!=0 ){ |
| 493 | db_multi_exec( |
| 494 | "CREATE TABLE localdb.stashfile_tmp AS SELECT * FROM stashfile;" |
| 495 | "DROP TABLE stashfile;" |
| 496 | ); |
| 497 | db_multi_exec(zStashInit /*works-like:""*/); |
| 498 | db_multi_exec( |
| 499 | "INSERT INTO stashfile SELECT * FROM stashfile_tmp;" |
| 500 | "DROP TABLE stashfile_tmp;" |
| 501 | ); |
| 502 | } |
| 503 | if( g.argc<=2 ){ |
| 504 | zCmd = "save"; |
| 505 | }else{ |
| 506 | zCmd = g.argv[2]; |
| 507 | } |
| 508 |
+2
-6
| --- test/stash.test | ||
| +++ test/stash.test | ||
| @@ -185,15 +185,13 @@ | ||
| 185 | 185 | ADDED f0 |
| 186 | 186 | } -changes { |
| 187 | 187 | ADDED f0 |
| 188 | 188 | MISSING f1 |
| 189 | 189 | EDITED f2 |
| 190 | - MISSING f3 | |
| 190 | + RENAMED f3n | |
| 191 | 191 | } -addremove { |
| 192 | - ADDED f3n | |
| 193 | 192 | DELETED f1 |
| 194 | - DELETED f3 | |
| 195 | 193 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 196 | 194 | |
| 197 | 195 | # Confirm there is no longer a stash saved |
| 198 | 196 | fossil stash list |
| 199 | 197 | test stash-2-list {[first_data_line] eq "empty stash"} |
| @@ -311,13 +309,11 @@ | ||
| 311 | 309 | UPDATE f1 |
| 312 | 310 | UPDATE f2n |
| 313 | 311 | } -changes { |
| 314 | 312 | RENAMED f2n |
| 315 | 313 | } -addremove { |
| 316 | - ADDED f2n | |
| 317 | - DELETED f2 | |
| 318 | -} -exists {f1 f2n} -notexists {f2} -knownbugs {-changes} | |
| 314 | +} -exists {f1 f2n} -notexists {f2} | |
| 319 | 315 | |
| 320 | 316 | |
| 321 | 317 | |
| 322 | 318 | ######## |
| 323 | 319 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 324 | 320 |
| --- test/stash.test | |
| +++ test/stash.test | |
| @@ -185,15 +185,13 @@ | |
| 185 | ADDED f0 |
| 186 | } -changes { |
| 187 | ADDED f0 |
| 188 | MISSING f1 |
| 189 | EDITED f2 |
| 190 | MISSING f3 |
| 191 | } -addremove { |
| 192 | ADDED f3n |
| 193 | DELETED f1 |
| 194 | DELETED f3 |
| 195 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 196 | |
| 197 | # Confirm there is no longer a stash saved |
| 198 | fossil stash list |
| 199 | test stash-2-list {[first_data_line] eq "empty stash"} |
| @@ -311,13 +309,11 @@ | |
| 311 | UPDATE f1 |
| 312 | UPDATE f2n |
| 313 | } -changes { |
| 314 | RENAMED f2n |
| 315 | } -addremove { |
| 316 | ADDED f2n |
| 317 | DELETED f2 |
| 318 | } -exists {f1 f2n} -notexists {f2} -knownbugs {-changes} |
| 319 | |
| 320 | |
| 321 | |
| 322 | ######## |
| 323 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 324 |
| --- test/stash.test | |
| +++ test/stash.test | |
| @@ -185,15 +185,13 @@ | |
| 185 | ADDED f0 |
| 186 | } -changes { |
| 187 | ADDED f0 |
| 188 | MISSING f1 |
| 189 | EDITED f2 |
| 190 | RENAMED f3n |
| 191 | } -addremove { |
| 192 | DELETED f1 |
| 193 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 194 | |
| 195 | # Confirm there is no longer a stash saved |
| 196 | fossil stash list |
| 197 | test stash-2-list {[first_data_line] eq "empty stash"} |
| @@ -311,13 +309,11 @@ | |
| 309 | UPDATE f1 |
| 310 | UPDATE f2n |
| 311 | } -changes { |
| 312 | RENAMED f2n |
| 313 | } -addremove { |
| 314 | } -exists {f1 f2n} -notexists {f2} |
| 315 | |
| 316 | |
| 317 | |
| 318 | ######## |
| 319 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 320 |