Fossil SCM
Fix the "revert" command so that it distinguishes between files that were added versus files imported by merge. Added files are not unlinked. Ticket [baf9b6b11e08c1].
Commit
157eed29f4a93afaab20fe37a69f1042a398b231
Parent
ae3409bf49b792d…
1 file changed
+8
-4
+8
-4
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -569,13 +569,17 @@ | ||
| 569 | 569 | char *zFull; |
| 570 | 570 | zFile = db_column_text(&q, 0); |
| 571 | 571 | zFull = mprintf("%/%/", g.zLocalRoot, zFile); |
| 572 | 572 | errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2); |
| 573 | 573 | if( errCode==2 ){ |
| 574 | - undo_save(zFile); | |
| 575 | - unlink(zFull); | |
| 576 | - printf("DELETE: %s\n", zFile); | |
| 574 | + if( db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFile)==0 ){ | |
| 575 | + printf("UNMANAGE: %s\n", zFile); | |
| 576 | + }else{ | |
| 577 | + undo_save(zFile); | |
| 578 | + unlink(zFull); | |
| 579 | + printf("DELETE: %s\n", zFile); | |
| 580 | + } | |
| 577 | 581 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 578 | 582 | }else{ |
| 579 | 583 | sqlite3_int64 mtime; |
| 580 | 584 | undo_save(zFile); |
| 581 | 585 | blob_write_to_file(&record, zFull); |
| @@ -582,11 +586,11 @@ | ||
| 582 | 586 | file_setexe(zFull, isExe); |
| 583 | 587 | printf("REVERTED: %s\n", zFile); |
| 584 | 588 | mtime = file_mtime(zFull); |
| 585 | 589 | db_multi_exec( |
| 586 | 590 | "UPDATE vfile" |
| 587 | - " SET mtime=%lld, chnged=0, deleted=0, isexe=%d," | |
| 591 | + " SET mtime=%lld, chnged=0, deleted=0, isexe=%d, mrid=rid," | |
| 588 | 592 | " pathname=coalesce(origname,pathname), origname=NULL" |
| 589 | 593 | " WHERE pathname=%Q", |
| 590 | 594 | mtime, isExe, zFile |
| 591 | 595 | ); |
| 592 | 596 | } |
| 593 | 597 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -569,13 +569,17 @@ | |
| 569 | char *zFull; |
| 570 | zFile = db_column_text(&q, 0); |
| 571 | zFull = mprintf("%/%/", g.zLocalRoot, zFile); |
| 572 | errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2); |
| 573 | if( errCode==2 ){ |
| 574 | undo_save(zFile); |
| 575 | unlink(zFull); |
| 576 | printf("DELETE: %s\n", zFile); |
| 577 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 578 | }else{ |
| 579 | sqlite3_int64 mtime; |
| 580 | undo_save(zFile); |
| 581 | blob_write_to_file(&record, zFull); |
| @@ -582,11 +586,11 @@ | |
| 582 | file_setexe(zFull, isExe); |
| 583 | printf("REVERTED: %s\n", zFile); |
| 584 | mtime = file_mtime(zFull); |
| 585 | db_multi_exec( |
| 586 | "UPDATE vfile" |
| 587 | " SET mtime=%lld, chnged=0, deleted=0, isexe=%d," |
| 588 | " pathname=coalesce(origname,pathname), origname=NULL" |
| 589 | " WHERE pathname=%Q", |
| 590 | mtime, isExe, zFile |
| 591 | ); |
| 592 | } |
| 593 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -569,13 +569,17 @@ | |
| 569 | char *zFull; |
| 570 | zFile = db_column_text(&q, 0); |
| 571 | zFull = mprintf("%/%/", g.zLocalRoot, zFile); |
| 572 | errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2); |
| 573 | if( errCode==2 ){ |
| 574 | if( db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFile)==0 ){ |
| 575 | printf("UNMANAGE: %s\n", zFile); |
| 576 | }else{ |
| 577 | undo_save(zFile); |
| 578 | unlink(zFull); |
| 579 | printf("DELETE: %s\n", zFile); |
| 580 | } |
| 581 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 582 | }else{ |
| 583 | sqlite3_int64 mtime; |
| 584 | undo_save(zFile); |
| 585 | blob_write_to_file(&record, zFull); |
| @@ -582,11 +586,11 @@ | |
| 586 | file_setexe(zFull, isExe); |
| 587 | printf("REVERTED: %s\n", zFile); |
| 588 | mtime = file_mtime(zFull); |
| 589 | db_multi_exec( |
| 590 | "UPDATE vfile" |
| 591 | " SET mtime=%lld, chnged=0, deleted=0, isexe=%d, mrid=rid," |
| 592 | " pathname=coalesce(origname,pathname), origname=NULL" |
| 593 | " WHERE pathname=%Q", |
| 594 | mtime, isExe, zFile |
| 595 | ); |
| 596 | } |
| 597 |