Fossil SCM
Back out the undo/redo logic changes of [0c37874941c89] that caused the mtime to be restored on files. Playing games with mtimes is bad policy. Consider a scenario: "fossil merge; make; fossil undo; make". If the mtimes are reset by undo, then the second "make" above will not work correctly. This is not a complete backout of [0c37874941c89] as the underlying infrastructure used to compute the age of files is retained.
Commit
5c0843a8f1a7cc018f1249cf9b0ba44d648bfa8c
Parent
368347d660ffb3f…
1 file changed
+6
-14
+6
-14
| --- src/undo.c | ||
| +++ src/undo.c | ||
| @@ -30,11 +30,11 @@ | ||
| 30 | 30 | */ |
| 31 | 31 | static void undo_one(const char *zPathname, int redoFlag){ |
| 32 | 32 | Stmt q; |
| 33 | 33 | char *zFullname; |
| 34 | 34 | db_prepare(&q, |
| 35 | - "SELECT content, existsflag, isExe, isLink, mtime FROM undo" | |
| 35 | + "SELECT content, existsflag, isExe, isLink FROM undo" | |
| 36 | 36 | " WHERE pathname=%Q AND redoflag=%d", |
| 37 | 37 | zPathname, redoFlag |
| 38 | 38 | ); |
| 39 | 39 | if( db_step(&q)==SQLITE_ROW ){ |
| 40 | 40 | int old_exists; |
| @@ -41,11 +41,10 @@ | ||
| 41 | 41 | int new_exists; |
| 42 | 42 | int old_exe; |
| 43 | 43 | int new_exe; |
| 44 | 44 | int new_link; |
| 45 | 45 | int old_link; |
| 46 | - i64 old_mtime, new_mtime; | |
| 47 | 46 | Blob current; |
| 48 | 47 | Blob new; |
| 49 | 48 | zFullname = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 50 | 49 | old_link = db_column_int(&q, 3); |
| 51 | 50 | new_link = file_wd_islink(zFullname); |
| @@ -55,20 +54,17 @@ | ||
| 55 | 54 | blob_read_link(¤t, zFullname); |
| 56 | 55 | }else{ |
| 57 | 56 | blob_read_from_file(¤t, zFullname); |
| 58 | 57 | } |
| 59 | 58 | new_exe = file_wd_isexe(zFullname); |
| 60 | - new_mtime = file_wd_mtime(zFullname); | |
| 61 | 59 | }else{ |
| 62 | 60 | blob_zero(¤t); |
| 63 | 61 | new_exe = 0; |
| 64 | - new_mtime = 0; | |
| 65 | 62 | } |
| 66 | 63 | blob_zero(&new); |
| 67 | 64 | old_exists = db_column_int(&q, 1); |
| 68 | 65 | old_exe = db_column_int(&q, 2); |
| 69 | - old_mtime = db_column_int64(&q, 4); | |
| 70 | 66 | if( old_exists ){ |
| 71 | 67 | db_ephemeral_blob(&q, 0, &new); |
| 72 | 68 | } |
| 73 | 69 | if( old_exists ){ |
| 74 | 70 | if( new_exists ){ |
| @@ -83,23 +79,22 @@ | ||
| 83 | 79 | symlink_create(blob_str(&new), zFullname); |
| 84 | 80 | }else{ |
| 85 | 81 | blob_write_to_file(&new, zFullname); |
| 86 | 82 | } |
| 87 | 83 | file_wd_setexe(zFullname, old_exe); |
| 88 | - file_set_mtime(zFullname, old_mtime); | |
| 89 | 84 | }else{ |
| 90 | 85 | fossil_print("DELETE %s\n", zPathname); |
| 91 | 86 | file_delete(zFullname); |
| 92 | 87 | } |
| 93 | 88 | blob_reset(&new); |
| 94 | 89 | free(zFullname); |
| 95 | 90 | db_finalize(&q); |
| 96 | 91 | db_prepare(&q, |
| 97 | 92 | "UPDATE undo SET content=:c, existsflag=%d, isExe=%d, isLink=%d," |
| 98 | - " mtime=%lld, redoflag=NOT redoflag" | |
| 93 | + " redoflag=NOT redoflag" | |
| 99 | 94 | " WHERE pathname=%Q", |
| 100 | - new_exists, new_exe, new_link, new_mtime, zPathname | |
| 95 | + new_exists, new_exe, new_link, zPathname | |
| 101 | 96 | ); |
| 102 | 97 | if( new_exists ){ |
| 103 | 98 | db_bind_blob(&q, ":c", ¤t); |
| 104 | 99 | } |
| 105 | 100 | db_step(&q); |
| @@ -230,11 +225,10 @@ | ||
| 230 | 225 | @ pathname TEXT UNIQUE, -- Name of the file |
| 231 | 226 | @ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable |
| 232 | 227 | @ existsflag BOOLEAN, -- True if the file exists |
| 233 | 228 | @ isExe BOOLEAN, -- True if the file is executable |
| 234 | 229 | @ isLink BOOLEAN, -- True if the file is symlink |
| 235 | - @ mtime DATETIME, -- File modification time | |
| 236 | 230 | @ content BLOB -- Saved content |
| 237 | 231 | @ ); |
| 238 | 232 | @ CREATE TABLE %s.undo_vfile AS SELECT * FROM vfile; |
| 239 | 233 | @ CREATE TABLE %s.undo_vmerge AS SELECT * FROM vmerge; |
| 240 | 234 | ; |
| @@ -280,14 +274,13 @@ | ||
| 280 | 274 | zFullname = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 281 | 275 | existsFlag = file_wd_size(zFullname)>=0; |
| 282 | 276 | isLink = file_wd_islink(zFullname); |
| 283 | 277 | db_prepare(&q, |
| 284 | 278 | "INSERT OR IGNORE INTO" |
| 285 | - " undo(pathname,redoflag,existsflag,isExe,isLink,mtime,content)" | |
| 286 | - " VALUES(%Q,0,%d,%d,%d,%lld,:c)", | |
| 287 | - zPathname, existsFlag, file_wd_isexe(zFullname), isLink, | |
| 288 | - file_wd_mtime(zFullname) | |
| 279 | + " undo(pathname,redoflag,existsflag,isExe,isLink,content)" | |
| 280 | + " VALUES(%Q,0,%d,%d,%d,:c)", | |
| 281 | + zPathname, existsFlag, file_wd_isexe(zFullname), isLink | |
| 289 | 282 | ); |
| 290 | 283 | if( existsFlag ){ |
| 291 | 284 | if( isLink ){ |
| 292 | 285 | blob_read_link(&content, zFullname); |
| 293 | 286 | }else{ |
| @@ -390,11 +383,10 @@ | ||
| 390 | 383 | int isRedo = g.argv[1][0]=='r'; |
| 391 | 384 | int undo_available; |
| 392 | 385 | int explainFlag = find_option("explain", 0, 0)!=0; |
| 393 | 386 | const char *zCmd = isRedo ? "redo" : "undo"; |
| 394 | 387 | db_must_be_within_tree(); |
| 395 | - if( find_option("reset", 0, 0)!=0 ){ undo_reset(); return; } | |
| 396 | 388 | verify_all_options(); |
| 397 | 389 | db_begin_transaction(); |
| 398 | 390 | undo_available = db_lget_int("undo_available", 0); |
| 399 | 391 | if( explainFlag ){ |
| 400 | 392 | if( undo_available==0 ){ |
| 401 | 393 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -30,11 +30,11 @@ | |
| 30 | */ |
| 31 | static void undo_one(const char *zPathname, int redoFlag){ |
| 32 | Stmt q; |
| 33 | char *zFullname; |
| 34 | db_prepare(&q, |
| 35 | "SELECT content, existsflag, isExe, isLink, mtime FROM undo" |
| 36 | " WHERE pathname=%Q AND redoflag=%d", |
| 37 | zPathname, redoFlag |
| 38 | ); |
| 39 | if( db_step(&q)==SQLITE_ROW ){ |
| 40 | int old_exists; |
| @@ -41,11 +41,10 @@ | |
| 41 | int new_exists; |
| 42 | int old_exe; |
| 43 | int new_exe; |
| 44 | int new_link; |
| 45 | int old_link; |
| 46 | i64 old_mtime, new_mtime; |
| 47 | Blob current; |
| 48 | Blob new; |
| 49 | zFullname = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 50 | old_link = db_column_int(&q, 3); |
| 51 | new_link = file_wd_islink(zFullname); |
| @@ -55,20 +54,17 @@ | |
| 55 | blob_read_link(¤t, zFullname); |
| 56 | }else{ |
| 57 | blob_read_from_file(¤t, zFullname); |
| 58 | } |
| 59 | new_exe = file_wd_isexe(zFullname); |
| 60 | new_mtime = file_wd_mtime(zFullname); |
| 61 | }else{ |
| 62 | blob_zero(¤t); |
| 63 | new_exe = 0; |
| 64 | new_mtime = 0; |
| 65 | } |
| 66 | blob_zero(&new); |
| 67 | old_exists = db_column_int(&q, 1); |
| 68 | old_exe = db_column_int(&q, 2); |
| 69 | old_mtime = db_column_int64(&q, 4); |
| 70 | if( old_exists ){ |
| 71 | db_ephemeral_blob(&q, 0, &new); |
| 72 | } |
| 73 | if( old_exists ){ |
| 74 | if( new_exists ){ |
| @@ -83,23 +79,22 @@ | |
| 83 | symlink_create(blob_str(&new), zFullname); |
| 84 | }else{ |
| 85 | blob_write_to_file(&new, zFullname); |
| 86 | } |
| 87 | file_wd_setexe(zFullname, old_exe); |
| 88 | file_set_mtime(zFullname, old_mtime); |
| 89 | }else{ |
| 90 | fossil_print("DELETE %s\n", zPathname); |
| 91 | file_delete(zFullname); |
| 92 | } |
| 93 | blob_reset(&new); |
| 94 | free(zFullname); |
| 95 | db_finalize(&q); |
| 96 | db_prepare(&q, |
| 97 | "UPDATE undo SET content=:c, existsflag=%d, isExe=%d, isLink=%d," |
| 98 | " mtime=%lld, redoflag=NOT redoflag" |
| 99 | " WHERE pathname=%Q", |
| 100 | new_exists, new_exe, new_link, new_mtime, zPathname |
| 101 | ); |
| 102 | if( new_exists ){ |
| 103 | db_bind_blob(&q, ":c", ¤t); |
| 104 | } |
| 105 | db_step(&q); |
| @@ -230,11 +225,10 @@ | |
| 230 | @ pathname TEXT UNIQUE, -- Name of the file |
| 231 | @ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable |
| 232 | @ existsflag BOOLEAN, -- True if the file exists |
| 233 | @ isExe BOOLEAN, -- True if the file is executable |
| 234 | @ isLink BOOLEAN, -- True if the file is symlink |
| 235 | @ mtime DATETIME, -- File modification time |
| 236 | @ content BLOB -- Saved content |
| 237 | @ ); |
| 238 | @ CREATE TABLE %s.undo_vfile AS SELECT * FROM vfile; |
| 239 | @ CREATE TABLE %s.undo_vmerge AS SELECT * FROM vmerge; |
| 240 | ; |
| @@ -280,14 +274,13 @@ | |
| 280 | zFullname = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 281 | existsFlag = file_wd_size(zFullname)>=0; |
| 282 | isLink = file_wd_islink(zFullname); |
| 283 | db_prepare(&q, |
| 284 | "INSERT OR IGNORE INTO" |
| 285 | " undo(pathname,redoflag,existsflag,isExe,isLink,mtime,content)" |
| 286 | " VALUES(%Q,0,%d,%d,%d,%lld,:c)", |
| 287 | zPathname, existsFlag, file_wd_isexe(zFullname), isLink, |
| 288 | file_wd_mtime(zFullname) |
| 289 | ); |
| 290 | if( existsFlag ){ |
| 291 | if( isLink ){ |
| 292 | blob_read_link(&content, zFullname); |
| 293 | }else{ |
| @@ -390,11 +383,10 @@ | |
| 390 | int isRedo = g.argv[1][0]=='r'; |
| 391 | int undo_available; |
| 392 | int explainFlag = find_option("explain", 0, 0)!=0; |
| 393 | const char *zCmd = isRedo ? "redo" : "undo"; |
| 394 | db_must_be_within_tree(); |
| 395 | if( find_option("reset", 0, 0)!=0 ){ undo_reset(); return; } |
| 396 | verify_all_options(); |
| 397 | db_begin_transaction(); |
| 398 | undo_available = db_lget_int("undo_available", 0); |
| 399 | if( explainFlag ){ |
| 400 | if( undo_available==0 ){ |
| 401 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -30,11 +30,11 @@ | |
| 30 | */ |
| 31 | static void undo_one(const char *zPathname, int redoFlag){ |
| 32 | Stmt q; |
| 33 | char *zFullname; |
| 34 | db_prepare(&q, |
| 35 | "SELECT content, existsflag, isExe, isLink FROM undo" |
| 36 | " WHERE pathname=%Q AND redoflag=%d", |
| 37 | zPathname, redoFlag |
| 38 | ); |
| 39 | if( db_step(&q)==SQLITE_ROW ){ |
| 40 | int old_exists; |
| @@ -41,11 +41,10 @@ | |
| 41 | int new_exists; |
| 42 | int old_exe; |
| 43 | int new_exe; |
| 44 | int new_link; |
| 45 | int old_link; |
| 46 | Blob current; |
| 47 | Blob new; |
| 48 | zFullname = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 49 | old_link = db_column_int(&q, 3); |
| 50 | new_link = file_wd_islink(zFullname); |
| @@ -55,20 +54,17 @@ | |
| 54 | blob_read_link(¤t, zFullname); |
| 55 | }else{ |
| 56 | blob_read_from_file(¤t, zFullname); |
| 57 | } |
| 58 | new_exe = file_wd_isexe(zFullname); |
| 59 | }else{ |
| 60 | blob_zero(¤t); |
| 61 | new_exe = 0; |
| 62 | } |
| 63 | blob_zero(&new); |
| 64 | old_exists = db_column_int(&q, 1); |
| 65 | old_exe = db_column_int(&q, 2); |
| 66 | if( old_exists ){ |
| 67 | db_ephemeral_blob(&q, 0, &new); |
| 68 | } |
| 69 | if( old_exists ){ |
| 70 | if( new_exists ){ |
| @@ -83,23 +79,22 @@ | |
| 79 | symlink_create(blob_str(&new), zFullname); |
| 80 | }else{ |
| 81 | blob_write_to_file(&new, zFullname); |
| 82 | } |
| 83 | file_wd_setexe(zFullname, old_exe); |
| 84 | }else{ |
| 85 | fossil_print("DELETE %s\n", zPathname); |
| 86 | file_delete(zFullname); |
| 87 | } |
| 88 | blob_reset(&new); |
| 89 | free(zFullname); |
| 90 | db_finalize(&q); |
| 91 | db_prepare(&q, |
| 92 | "UPDATE undo SET content=:c, existsflag=%d, isExe=%d, isLink=%d," |
| 93 | " redoflag=NOT redoflag" |
| 94 | " WHERE pathname=%Q", |
| 95 | new_exists, new_exe, new_link, zPathname |
| 96 | ); |
| 97 | if( new_exists ){ |
| 98 | db_bind_blob(&q, ":c", ¤t); |
| 99 | } |
| 100 | db_step(&q); |
| @@ -230,11 +225,10 @@ | |
| 225 | @ pathname TEXT UNIQUE, -- Name of the file |
| 226 | @ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable |
| 227 | @ existsflag BOOLEAN, -- True if the file exists |
| 228 | @ isExe BOOLEAN, -- True if the file is executable |
| 229 | @ isLink BOOLEAN, -- True if the file is symlink |
| 230 | @ content BLOB -- Saved content |
| 231 | @ ); |
| 232 | @ CREATE TABLE %s.undo_vfile AS SELECT * FROM vfile; |
| 233 | @ CREATE TABLE %s.undo_vmerge AS SELECT * FROM vmerge; |
| 234 | ; |
| @@ -280,14 +274,13 @@ | |
| 274 | zFullname = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 275 | existsFlag = file_wd_size(zFullname)>=0; |
| 276 | isLink = file_wd_islink(zFullname); |
| 277 | db_prepare(&q, |
| 278 | "INSERT OR IGNORE INTO" |
| 279 | " undo(pathname,redoflag,existsflag,isExe,isLink,content)" |
| 280 | " VALUES(%Q,0,%d,%d,%d,:c)", |
| 281 | zPathname, existsFlag, file_wd_isexe(zFullname), isLink |
| 282 | ); |
| 283 | if( existsFlag ){ |
| 284 | if( isLink ){ |
| 285 | blob_read_link(&content, zFullname); |
| 286 | }else{ |
| @@ -390,11 +383,10 @@ | |
| 383 | int isRedo = g.argv[1][0]=='r'; |
| 384 | int undo_available; |
| 385 | int explainFlag = find_option("explain", 0, 0)!=0; |
| 386 | const char *zCmd = isRedo ? "redo" : "undo"; |
| 387 | db_must_be_within_tree(); |
| 388 | verify_all_options(); |
| 389 | db_begin_transaction(); |
| 390 | undo_available = db_lget_int("undo_available", 0); |
| 391 | if( explainFlag ){ |
| 392 | if( undo_available==0 ){ |
| 393 |