Fossil SCM

Merge fixes in this branch to trunk prior to release.

andybradford 2016-10-16 01:21 trunk merge
Commit b2d51b1b226d2a5010877586cb2cde62eedec918
2 files changed +21 -1 +2 -6
+21 -1
--- src/stash.c
+++ src/stash.c
@@ -39,11 +39,11 @@
3939
@ isExec BOOLEAN, -- True if file is executable
4040
@ isLink BOOLEAN, -- True if file is a symlink
4141
@ origname TEXT, -- Original filename
4242
@ newname TEXT, -- New name for file at next check-in
4343
@ delta BLOB, -- Delta from baseline. Content if rid=0
44
-@ PRIMARY KEY(origname, stashid)
44
+@ PRIMARY KEY(newname, stashid)
4545
@ );
4646
@ INSERT OR IGNORE INTO vvar(name, value) VALUES('stash-next', 1);
4747
;
4848
4949
/*
@@ -278,10 +278,15 @@
278278
}
279279
blob_reset(&delta);
280280
if( fossil_strcmp(zOrig,zNew)!=0 ){
281281
undo_save(zOrig);
282282
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
+ );
283288
}
284289
}
285290
stash_add_files_in_sfile(vid);
286291
db_finalize(&q);
287292
if( nConflict ){
@@ -473,15 +478,30 @@
473478
*/
474479
void stash_cmd(void){
475480
const char *zCmd;
476481
int nCmd;
477482
int stashid = 0;
483
+ int rc;
478484
undo_capture_command_line();
479485
db_must_be_within_tree();
480486
db_open_config(0, 0);
481487
db_begin_transaction();
482488
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
+ }
483503
if( g.argc<=2 ){
484504
zCmd = "save";
485505
}else{
486506
zCmd = g.argv[2];
487507
}
488508
--- 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 @@
185185
ADDED f0
186186
} -changes {
187187
ADDED f0
188188
MISSING f1
189189
EDITED f2
190
- MISSING f3
190
+ RENAMED f3n
191191
} -addremove {
192
- ADDED f3n
193192
DELETED f1
194
- DELETED f3
195193
} -exists {f0 f2 f3n} -notexists {f1 f3}
196194
197195
# Confirm there is no longer a stash saved
198196
fossil stash list
199197
test stash-2-list {[first_data_line] eq "empty stash"}
@@ -311,13 +309,11 @@
311309
UPDATE f1
312310
UPDATE f2n
313311
} -changes {
314312
RENAMED f2n
315313
} -addremove {
316
- ADDED f2n
317
- DELETED f2
318
-} -exists {f1 f2n} -notexists {f2} -knownbugs {-changes}
314
+} -exists {f1 f2n} -notexists {f2}
319315
320316
321317
322318
########
323319
# fossil stash snapshot ?-m|--comment COMMENT? ?FILES...?
324320
--- 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

Keyboard Shortcuts

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