Fossil SCM
Add the --setmtime command-line option to "fossil update". When this option is used, the mtime of all unmodified managed files is set to the time when that file was originally checked in.
Commit
ae092ec605eed11fc5790718aff2b110b156c97d
Parent
5c0843a8f1a7cc0…
8 files changed
+2
-2
+1
-1
+1
-1
+1
-1
+1
-1
+1
-1
+5
-2
+29
-8
+2
-2
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -160,11 +160,11 @@ | ||
| 160 | 160 | int cwdRelative = 0; |
| 161 | 161 | db_must_be_within_tree(); |
| 162 | 162 | cwdRelative = determine_cwd_relative_option(); |
| 163 | 163 | blob_zero(&report); |
| 164 | 164 | vid = db_lget_int("checkout", 0); |
| 165 | - vfile_check_signature(vid, 0, useSha1sum); | |
| 165 | + vfile_check_signature(vid, useSha1sum ? CKSIG_SHA1 : 0); | |
| 166 | 166 | status_report(&report, "", 0, cwdRelative); |
| 167 | 167 | if( verbose && blob_size(&report)==0 ){ |
| 168 | 168 | blob_append(&report, " (none)\n", -1); |
| 169 | 169 | } |
| 170 | 170 | if( showHdr && blob_size(&report)>0 ){ |
| @@ -244,11 +244,11 @@ | ||
| 244 | 244 | }else{ |
| 245 | 245 | zOrderBy = "mtime DESC"; |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | verify_all_options(); |
| 249 | - vfile_check_signature(vid, 0, 0); | |
| 249 | + vfile_check_signature(vid, 0); | |
| 250 | 250 | if( showAge ){ |
| 251 | 251 | db_prepare(&q, |
| 252 | 252 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)," |
| 253 | 253 | " datetime(checkin_mtime(%d,rid),'unixepoch','localtime')" |
| 254 | 254 | " FROM vfile" |
| 255 | 255 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -160,11 +160,11 @@ | |
| 160 | int cwdRelative = 0; |
| 161 | db_must_be_within_tree(); |
| 162 | cwdRelative = determine_cwd_relative_option(); |
| 163 | blob_zero(&report); |
| 164 | vid = db_lget_int("checkout", 0); |
| 165 | vfile_check_signature(vid, 0, useSha1sum); |
| 166 | status_report(&report, "", 0, cwdRelative); |
| 167 | if( verbose && blob_size(&report)==0 ){ |
| 168 | blob_append(&report, " (none)\n", -1); |
| 169 | } |
| 170 | if( showHdr && blob_size(&report)>0 ){ |
| @@ -244,11 +244,11 @@ | |
| 244 | }else{ |
| 245 | zOrderBy = "mtime DESC"; |
| 246 | } |
| 247 | } |
| 248 | verify_all_options(); |
| 249 | vfile_check_signature(vid, 0, 0); |
| 250 | if( showAge ){ |
| 251 | db_prepare(&q, |
| 252 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)," |
| 253 | " datetime(checkin_mtime(%d,rid),'unixepoch','localtime')" |
| 254 | " FROM vfile" |
| 255 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -160,11 +160,11 @@ | |
| 160 | int cwdRelative = 0; |
| 161 | db_must_be_within_tree(); |
| 162 | cwdRelative = determine_cwd_relative_option(); |
| 163 | blob_zero(&report); |
| 164 | vid = db_lget_int("checkout", 0); |
| 165 | vfile_check_signature(vid, useSha1sum ? CKSIG_SHA1 : 0); |
| 166 | status_report(&report, "", 0, cwdRelative); |
| 167 | if( verbose && blob_size(&report)==0 ){ |
| 168 | blob_append(&report, " (none)\n", -1); |
| 169 | } |
| 170 | if( showHdr && blob_size(&report)>0 ){ |
| @@ -244,11 +244,11 @@ | |
| 244 | }else{ |
| 245 | zOrderBy = "mtime DESC"; |
| 246 | } |
| 247 | } |
| 248 | verify_all_options(); |
| 249 | vfile_check_signature(vid, 0); |
| 250 | if( showAge ){ |
| 251 | db_prepare(&q, |
| 252 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)," |
| 253 | " datetime(checkin_mtime(%d,rid),'unixepoch','localtime')" |
| 254 | " FROM vfile" |
| 255 |
+1
-1
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -33,11 +33,11 @@ | ||
| 33 | 33 | int unsaved_changes(void){ |
| 34 | 34 | int vid; |
| 35 | 35 | db_must_be_within_tree(); |
| 36 | 36 | vid = db_lget_int("checkout",0); |
| 37 | 37 | if( vid==0 ) return 2; |
| 38 | - vfile_check_signature(vid, 1, 0); | |
| 38 | + vfile_check_signature(vid, CKSIG_ENOTFILE); | |
| 39 | 39 | return db_exists("SELECT 1 FROM vfile WHERE chnged" |
| 40 | 40 | " OR coalesce(origname!=pathname,0)"); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /* |
| 44 | 44 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -33,11 +33,11 @@ | |
| 33 | int unsaved_changes(void){ |
| 34 | int vid; |
| 35 | db_must_be_within_tree(); |
| 36 | vid = db_lget_int("checkout",0); |
| 37 | if( vid==0 ) return 2; |
| 38 | vfile_check_signature(vid, 1, 0); |
| 39 | return db_exists("SELECT 1 FROM vfile WHERE chnged" |
| 40 | " OR coalesce(origname!=pathname,0)"); |
| 41 | } |
| 42 | |
| 43 | /* |
| 44 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -33,11 +33,11 @@ | |
| 33 | int unsaved_changes(void){ |
| 34 | int vid; |
| 35 | db_must_be_within_tree(); |
| 36 | vid = db_lget_int("checkout",0); |
| 37 | if( vid==0 ) return 2; |
| 38 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 39 | return db_exists("SELECT 1 FROM vfile WHERE chnged" |
| 40 | " OR coalesce(origname!=pathname,0)"); |
| 41 | } |
| 42 | |
| 43 | /* |
| 44 |
+1
-1
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -322,11 +322,11 @@ | ||
| 322 | 322 | Stmt q; |
| 323 | 323 | int asNewFile; /* Treat non-existant files as empty files */ |
| 324 | 324 | |
| 325 | 325 | asNewFile = (diffFlags & DIFF_NEWFILE)!=0; |
| 326 | 326 | vid = db_lget_int("checkout", 0); |
| 327 | - vfile_check_signature(vid, 1, 0); | |
| 327 | + vfile_check_signature(vid, CKSIG_ENOTFILE); | |
| 328 | 328 | blob_zero(&sql); |
| 329 | 329 | db_begin_transaction(); |
| 330 | 330 | if( zFrom ){ |
| 331 | 331 | int rid = name_to_typed_rid(zFrom, "ci"); |
| 332 | 332 | if( !is_a_version(rid) ){ |
| 333 | 333 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -322,11 +322,11 @@ | |
| 322 | Stmt q; |
| 323 | int asNewFile; /* Treat non-existant files as empty files */ |
| 324 | |
| 325 | asNewFile = (diffFlags & DIFF_NEWFILE)!=0; |
| 326 | vid = db_lget_int("checkout", 0); |
| 327 | vfile_check_signature(vid, 1, 0); |
| 328 | blob_zero(&sql); |
| 329 | db_begin_transaction(); |
| 330 | if( zFrom ){ |
| 331 | int rid = name_to_typed_rid(zFrom, "ci"); |
| 332 | if( !is_a_version(rid) ){ |
| 333 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -322,11 +322,11 @@ | |
| 322 | Stmt q; |
| 323 | int asNewFile; /* Treat non-existant files as empty files */ |
| 324 | |
| 325 | asNewFile = (diffFlags & DIFF_NEWFILE)!=0; |
| 326 | vid = db_lget_int("checkout", 0); |
| 327 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 328 | blob_zero(&sql); |
| 329 | db_begin_transaction(); |
| 330 | if( zFrom ){ |
| 331 | int rid = name_to_typed_rid(zFrom, "ci"); |
| 332 | if( !is_a_version(rid) ){ |
| 333 |
+1
-1
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -66,11 +66,11 @@ | ||
| 66 | 66 | if( g.argc!=3 ) usage("-s|--status FILENAME"); |
| 67 | 67 | vid = db_lget_int("checkout", 0); |
| 68 | 68 | if( vid==0 ){ |
| 69 | 69 | fossil_panic("no checkout to finfo files in"); |
| 70 | 70 | } |
| 71 | - vfile_check_signature(vid, 1, 0); | |
| 71 | + vfile_check_signature(vid, CKSIG_ENOTFILE); | |
| 72 | 72 | file_tree_name(g.argv[2], &fname, 1); |
| 73 | 73 | db_prepare(&q, |
| 74 | 74 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| 75 | 75 | " FROM vfile WHERE vfile.pathname=%B %s", |
| 76 | 76 | &fname, filename_collation()); |
| 77 | 77 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -66,11 +66,11 @@ | |
| 66 | if( g.argc!=3 ) usage("-s|--status FILENAME"); |
| 67 | vid = db_lget_int("checkout", 0); |
| 68 | if( vid==0 ){ |
| 69 | fossil_panic("no checkout to finfo files in"); |
| 70 | } |
| 71 | vfile_check_signature(vid, 1, 0); |
| 72 | file_tree_name(g.argv[2], &fname, 1); |
| 73 | db_prepare(&q, |
| 74 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| 75 | " FROM vfile WHERE vfile.pathname=%B %s", |
| 76 | &fname, filename_collation()); |
| 77 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -66,11 +66,11 @@ | |
| 66 | if( g.argc!=3 ) usage("-s|--status FILENAME"); |
| 67 | vid = db_lget_int("checkout", 0); |
| 68 | if( vid==0 ){ |
| 69 | fossil_panic("no checkout to finfo files in"); |
| 70 | } |
| 71 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 72 | file_tree_name(g.argv[2], &fname, 1); |
| 73 | db_prepare(&q, |
| 74 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| 75 | " FROM vfile WHERE vfile.pathname=%B %s", |
| 76 | &fname, filename_collation()); |
| 77 |
+1
-1
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -189,11 +189,11 @@ | ||
| 189 | 189 | } |
| 190 | 190 | if( detailFlag ){ |
| 191 | 191 | print_checkin_description(mid, 12, "merge-from:"); |
| 192 | 192 | print_checkin_description(pid, 12, "baseline:"); |
| 193 | 193 | } |
| 194 | - vfile_check_signature(vid, 1, 0); | |
| 194 | + vfile_check_signature(vid, CKSIG_ENOTFILE); | |
| 195 | 195 | db_begin_transaction(); |
| 196 | 196 | if( !nochangeFlag ) undo_begin(); |
| 197 | 197 | load_vfile_from_rid(mid); |
| 198 | 198 | load_vfile_from_rid(pid); |
| 199 | 199 | if( debugFlag ){ |
| 200 | 200 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -189,11 +189,11 @@ | |
| 189 | } |
| 190 | if( detailFlag ){ |
| 191 | print_checkin_description(mid, 12, "merge-from:"); |
| 192 | print_checkin_description(pid, 12, "baseline:"); |
| 193 | } |
| 194 | vfile_check_signature(vid, 1, 0); |
| 195 | db_begin_transaction(); |
| 196 | if( !nochangeFlag ) undo_begin(); |
| 197 | load_vfile_from_rid(mid); |
| 198 | load_vfile_from_rid(pid); |
| 199 | if( debugFlag ){ |
| 200 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -189,11 +189,11 @@ | |
| 189 | } |
| 190 | if( detailFlag ){ |
| 191 | print_checkin_description(mid, 12, "merge-from:"); |
| 192 | print_checkin_description(pid, 12, "baseline:"); |
| 193 | } |
| 194 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 195 | db_begin_transaction(); |
| 196 | if( !nochangeFlag ) undo_begin(); |
| 197 | load_vfile_from_rid(mid); |
| 198 | load_vfile_from_rid(pid); |
| 199 | if( debugFlag ){ |
| 200 |
+1
-1
| --- src/stash.c | ||
| +++ src/stash.c | ||
| @@ -172,11 +172,11 @@ | ||
| 172 | 172 | zComment = blob_str(&comment); |
| 173 | 173 | } |
| 174 | 174 | stashid = db_lget_int("stash-next", 1); |
| 175 | 175 | db_lset_int("stash-next", stashid+1); |
| 176 | 176 | vid = db_lget_int("checkout", 0); |
| 177 | - vfile_check_signature(vid, 0, 0); | |
| 177 | + vfile_check_signature(vid, 0); | |
| 178 | 178 | db_multi_exec( |
| 179 | 179 | "INSERT INTO stash(stashid,vid,comment,ctime)" |
| 180 | 180 | "VALUES(%d,%d,%Q,julianday('now'))", |
| 181 | 181 | stashid, vid, zComment |
| 182 | 182 | ); |
| 183 | 183 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -172,11 +172,11 @@ | |
| 172 | zComment = blob_str(&comment); |
| 173 | } |
| 174 | stashid = db_lget_int("stash-next", 1); |
| 175 | db_lset_int("stash-next", stashid+1); |
| 176 | vid = db_lget_int("checkout", 0); |
| 177 | vfile_check_signature(vid, 0, 0); |
| 178 | db_multi_exec( |
| 179 | "INSERT INTO stash(stashid,vid,comment,ctime)" |
| 180 | "VALUES(%d,%d,%Q,julianday('now'))", |
| 181 | stashid, vid, zComment |
| 182 | ); |
| 183 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -172,11 +172,11 @@ | |
| 172 | zComment = blob_str(&comment); |
| 173 | } |
| 174 | stashid = db_lget_int("stash-next", 1); |
| 175 | db_lset_int("stash-next", stashid+1); |
| 176 | vid = db_lget_int("checkout", 0); |
| 177 | vfile_check_signature(vid, 0); |
| 178 | db_multi_exec( |
| 179 | "INSERT INTO stash(stashid,vid,comment,ctime)" |
| 180 | "VALUES(%d,%d,%Q,julianday('now'))", |
| 181 | stashid, vid, zComment |
| 182 | ); |
| 183 |
+5
-2
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -100,10 +100,11 @@ | ||
| 100 | 100 | Stmt q; |
| 101 | 101 | int latestFlag; /* --latest. Pick the latest version if true */ |
| 102 | 102 | int nochangeFlag; /* -n or --nochange. Do a dry run */ |
| 103 | 103 | int verboseFlag; /* -v or --verbose. Output extra information */ |
| 104 | 104 | int debugFlag; /* --debug option */ |
| 105 | + int setmtimeFlag; /* --setmtime. Set mtimes on files */ | |
| 105 | 106 | int nChng; /* Number of file renames */ |
| 106 | 107 | int *aChng; /* Array of file renames */ |
| 107 | 108 | int i; /* Loop counter */ |
| 108 | 109 | int nConflict = 0; /* Number of merge conflicts */ |
| 109 | 110 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| @@ -116,10 +117,11 @@ | ||
| 116 | 117 | } |
| 117 | 118 | latestFlag = find_option("latest",0, 0)!=0; |
| 118 | 119 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 119 | 120 | verboseFlag = find_option("verbose","v",0)!=0; |
| 120 | 121 | debugFlag = find_option("debug",0,0)!=0; |
| 122 | + setmtimeFlag = find_option("setmtime",0,0)!=0; | |
| 121 | 123 | db_must_be_within_tree(); |
| 122 | 124 | vid = db_lget_int("checkout", 0); |
| 123 | 125 | if( vid==0 ){ |
| 124 | 126 | fossil_fatal("cannot find current version"); |
| 125 | 127 | } |
| @@ -194,11 +196,11 @@ | ||
| 194 | 196 | if( tid==0 ){ |
| 195 | 197 | fossil_panic("Internal Error: unable to find a version to update to."); |
| 196 | 198 | } |
| 197 | 199 | |
| 198 | 200 | db_begin_transaction(); |
| 199 | - vfile_check_signature(vid, 1, 0); | |
| 201 | + vfile_check_signature(vid, CKSIG_ENOTFILE); | |
| 200 | 202 | if( !nochangeFlag && !internalUpdate ) undo_begin(); |
| 201 | 203 | load_vfile_from_rid(tid); |
| 202 | 204 | |
| 203 | 205 | /* |
| 204 | 206 | ** The record.fn field is used to match files against each other. The |
| @@ -529,10 +531,11 @@ | ||
| 529 | 531 | /* A subset of files have been checked out. Keep the current |
| 530 | 532 | ** checkout unchanged. */ |
| 531 | 533 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); |
| 532 | 534 | } |
| 533 | 535 | if( !internalUpdate ) undo_finish(); |
| 536 | + if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); | |
| 534 | 537 | db_end_transaction(0); |
| 535 | 538 | } |
| 536 | 539 | } |
| 537 | 540 | |
| 538 | 541 | /* |
| @@ -696,11 +699,11 @@ | ||
| 696 | 699 | blob_reset(&fname); |
| 697 | 700 | } |
| 698 | 701 | }else{ |
| 699 | 702 | int vid; |
| 700 | 703 | vid = db_lget_int("checkout", 0); |
| 701 | - vfile_check_signature(vid, 0, 0); | |
| 704 | + vfile_check_signature(vid, 0); | |
| 702 | 705 | db_multi_exec( |
| 703 | 706 | "DELETE FROM vmerge;" |
| 704 | 707 | "INSERT INTO torevert " |
| 705 | 708 | "SELECT pathname" |
| 706 | 709 | " FROM vfile " |
| 707 | 710 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -100,10 +100,11 @@ | |
| 100 | Stmt q; |
| 101 | int latestFlag; /* --latest. Pick the latest version if true */ |
| 102 | int nochangeFlag; /* -n or --nochange. Do a dry run */ |
| 103 | int verboseFlag; /* -v or --verbose. Output extra information */ |
| 104 | int debugFlag; /* --debug option */ |
| 105 | int nChng; /* Number of file renames */ |
| 106 | int *aChng; /* Array of file renames */ |
| 107 | int i; /* Loop counter */ |
| 108 | int nConflict = 0; /* Number of merge conflicts */ |
| 109 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| @@ -116,10 +117,11 @@ | |
| 116 | } |
| 117 | latestFlag = find_option("latest",0, 0)!=0; |
| 118 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 119 | verboseFlag = find_option("verbose","v",0)!=0; |
| 120 | debugFlag = find_option("debug",0,0)!=0; |
| 121 | db_must_be_within_tree(); |
| 122 | vid = db_lget_int("checkout", 0); |
| 123 | if( vid==0 ){ |
| 124 | fossil_fatal("cannot find current version"); |
| 125 | } |
| @@ -194,11 +196,11 @@ | |
| 194 | if( tid==0 ){ |
| 195 | fossil_panic("Internal Error: unable to find a version to update to."); |
| 196 | } |
| 197 | |
| 198 | db_begin_transaction(); |
| 199 | vfile_check_signature(vid, 1, 0); |
| 200 | if( !nochangeFlag && !internalUpdate ) undo_begin(); |
| 201 | load_vfile_from_rid(tid); |
| 202 | |
| 203 | /* |
| 204 | ** The record.fn field is used to match files against each other. The |
| @@ -529,10 +531,11 @@ | |
| 529 | /* A subset of files have been checked out. Keep the current |
| 530 | ** checkout unchanged. */ |
| 531 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); |
| 532 | } |
| 533 | if( !internalUpdate ) undo_finish(); |
| 534 | db_end_transaction(0); |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | /* |
| @@ -696,11 +699,11 @@ | |
| 696 | blob_reset(&fname); |
| 697 | } |
| 698 | }else{ |
| 699 | int vid; |
| 700 | vid = db_lget_int("checkout", 0); |
| 701 | vfile_check_signature(vid, 0, 0); |
| 702 | db_multi_exec( |
| 703 | "DELETE FROM vmerge;" |
| 704 | "INSERT INTO torevert " |
| 705 | "SELECT pathname" |
| 706 | " FROM vfile " |
| 707 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -100,10 +100,11 @@ | |
| 100 | Stmt q; |
| 101 | int latestFlag; /* --latest. Pick the latest version if true */ |
| 102 | int nochangeFlag; /* -n or --nochange. Do a dry run */ |
| 103 | int verboseFlag; /* -v or --verbose. Output extra information */ |
| 104 | int debugFlag; /* --debug option */ |
| 105 | int setmtimeFlag; /* --setmtime. Set mtimes on files */ |
| 106 | int nChng; /* Number of file renames */ |
| 107 | int *aChng; /* Array of file renames */ |
| 108 | int i; /* Loop counter */ |
| 109 | int nConflict = 0; /* Number of merge conflicts */ |
| 110 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| @@ -116,10 +117,11 @@ | |
| 117 | } |
| 118 | latestFlag = find_option("latest",0, 0)!=0; |
| 119 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 120 | verboseFlag = find_option("verbose","v",0)!=0; |
| 121 | debugFlag = find_option("debug",0,0)!=0; |
| 122 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 123 | db_must_be_within_tree(); |
| 124 | vid = db_lget_int("checkout", 0); |
| 125 | if( vid==0 ){ |
| 126 | fossil_fatal("cannot find current version"); |
| 127 | } |
| @@ -194,11 +196,11 @@ | |
| 196 | if( tid==0 ){ |
| 197 | fossil_panic("Internal Error: unable to find a version to update to."); |
| 198 | } |
| 199 | |
| 200 | db_begin_transaction(); |
| 201 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 202 | if( !nochangeFlag && !internalUpdate ) undo_begin(); |
| 203 | load_vfile_from_rid(tid); |
| 204 | |
| 205 | /* |
| 206 | ** The record.fn field is used to match files against each other. The |
| @@ -529,10 +531,11 @@ | |
| 531 | /* A subset of files have been checked out. Keep the current |
| 532 | ** checkout unchanged. */ |
| 533 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); |
| 534 | } |
| 535 | if( !internalUpdate ) undo_finish(); |
| 536 | if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); |
| 537 | db_end_transaction(0); |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | /* |
| @@ -696,11 +699,11 @@ | |
| 699 | blob_reset(&fname); |
| 700 | } |
| 701 | }else{ |
| 702 | int vid; |
| 703 | vid = db_lget_int("checkout", 0); |
| 704 | vfile_check_signature(vid, 0); |
| 705 | db_multi_exec( |
| 706 | "DELETE FROM vmerge;" |
| 707 | "INSERT INTO torevert " |
| 708 | "SELECT pathname" |
| 709 | " FROM vfile " |
| 710 |
+29
-8
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -118,19 +118,30 @@ | ||
| 118 | 118 | db_finalize(&ins); |
| 119 | 119 | manifest_destroy(p); |
| 120 | 120 | db_end_transaction(0); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | +#if INTERFACE | |
| 124 | +/* | |
| 125 | +** The cksigFlags parameter to vfile_check_signature() is an OR-ed | |
| 126 | +** combination of the following bits: | |
| 127 | +*/ | |
| 128 | +#define CKSIG_ENOTFILE 0x001 /* non-file FS objects throw an error */ | |
| 129 | +#define CKSIG_SHA1 0x002 /* Verify file content using sha1sum */ | |
| 130 | +#define CKSIG_SETMTIME 0x004 /* Set mtime to last check-out time */ | |
| 131 | + | |
| 132 | +#endif /* INTERFACE */ | |
| 133 | + | |
| 123 | 134 | /* |
| 124 | -** Look at every VFILE entry with the given vid and set update | |
| 125 | -** VFILE.CHNGED field on every file according to whether or not | |
| 126 | -** the file has changes. 0 means no change. 1 means edited. 2 means | |
| 135 | +** Look at every VFILE entry with the given vid and update | |
| 136 | +** VFILE.CHNGED field according to whether or not | |
| 137 | +** the file has changed. 0 means no change. 1 means edited. 2 means | |
| 127 | 138 | ** the file has changed due to a merge. 3 means the file was added |
| 128 | 139 | ** by a merge. |
| 129 | 140 | ** |
| 130 | -** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was | |
| 131 | -** either removed from managemented via "fossil rm" or added via | |
| 141 | +** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either | |
| 142 | +** removed from configuration management via "fossil rm" or added via | |
| 132 | 143 | ** "fossil add", respectively, and in both cases we always know that |
| 133 | 144 | ** the file has changed without having the check the size, mtime, |
| 134 | 145 | ** or on-disk content. |
| 135 | 146 | ** |
| 136 | 147 | ** If the size of the file has changed, then we always know that the file |
| @@ -144,15 +155,16 @@ | ||
| 144 | 155 | ** |
| 145 | 156 | ** If the mtime is used, it is used only to determine if files are the same. |
| 146 | 157 | ** If the mtime of a file has changed, we still examine the on-disk content |
| 147 | 158 | ** to see whether or not the edit was a null-edit. |
| 148 | 159 | */ |
| 149 | -void vfile_check_signature(int vid, int notFileIsFatal, int useSha1sum){ | |
| 160 | +void vfile_check_signature(int vid, unsigned int cksigFlags){ | |
| 150 | 161 | int nErr = 0; |
| 151 | 162 | Stmt q; |
| 152 | 163 | Blob fileCksum, origCksum; |
| 153 | - int useMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1); | |
| 164 | + int useMtime = (cksigFlags & CKSIG_SHA1)==0 | |
| 165 | + && db_get_boolean("mtime-changes", 1); | |
| 154 | 166 | |
| 155 | 167 | db_begin_transaction(); |
| 156 | 168 | db_prepare(&q, "SELECT id, %Q || pathname," |
| 157 | 169 | " vfile.mrid, deleted, chnged, uuid, size, mtime" |
| 158 | 170 | " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid" |
| @@ -178,11 +190,11 @@ | ||
| 178 | 190 | currentMtime = file_wd_mtime(0); |
| 179 | 191 | if( chnged==0 && (isDeleted || rid==0) ){ |
| 180 | 192 | /* "fossil rm" or "fossil add" always change the file */ |
| 181 | 193 | chnged = 1; |
| 182 | 194 | }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){ |
| 183 | - if( notFileIsFatal ){ | |
| 195 | + if( cksigFlags & CKSIG_ENOTFILE ){ | |
| 184 | 196 | fossil_warning("not an ordinary file: %s", zName); |
| 185 | 197 | nErr++; |
| 186 | 198 | } |
| 187 | 199 | chnged = 1; |
| 188 | 200 | } |
| @@ -217,10 +229,19 @@ | ||
| 217 | 229 | if( blob_compare(&fileCksum, &origCksum) ){ |
| 218 | 230 | chnged = 1; |
| 219 | 231 | } |
| 220 | 232 | blob_reset(&origCksum); |
| 221 | 233 | blob_reset(&fileCksum); |
| 234 | + } | |
| 235 | + if( (cksigFlags & CKSIG_SETMTIME) && (chnged==0 || chnged==2) ){ | |
| 236 | + i64 desiredMtime; | |
| 237 | + if( mtime_of_manifest_file(vid,rid,&desiredMtime)==0 ){ | |
| 238 | + if( currentMtime!=desiredMtime ){ | |
| 239 | + file_set_mtime(zName, desiredMtime); | |
| 240 | + currentMtime = file_wd_mtime(zName); | |
| 241 | + } | |
| 242 | + } | |
| 222 | 243 | } |
| 223 | 244 | if( currentMtime!=oldMtime || chnged!=oldChnged ){ |
| 224 | 245 | db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d", |
| 225 | 246 | currentMtime, chnged, id); |
| 226 | 247 | } |
| 227 | 248 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -118,19 +118,30 @@ | |
| 118 | db_finalize(&ins); |
| 119 | manifest_destroy(p); |
| 120 | db_end_transaction(0); |
| 121 | } |
| 122 | |
| 123 | /* |
| 124 | ** Look at every VFILE entry with the given vid and set update |
| 125 | ** VFILE.CHNGED field on every file according to whether or not |
| 126 | ** the file has changes. 0 means no change. 1 means edited. 2 means |
| 127 | ** the file has changed due to a merge. 3 means the file was added |
| 128 | ** by a merge. |
| 129 | ** |
| 130 | ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was |
| 131 | ** either removed from managemented via "fossil rm" or added via |
| 132 | ** "fossil add", respectively, and in both cases we always know that |
| 133 | ** the file has changed without having the check the size, mtime, |
| 134 | ** or on-disk content. |
| 135 | ** |
| 136 | ** If the size of the file has changed, then we always know that the file |
| @@ -144,15 +155,16 @@ | |
| 144 | ** |
| 145 | ** If the mtime is used, it is used only to determine if files are the same. |
| 146 | ** If the mtime of a file has changed, we still examine the on-disk content |
| 147 | ** to see whether or not the edit was a null-edit. |
| 148 | */ |
| 149 | void vfile_check_signature(int vid, int notFileIsFatal, int useSha1sum){ |
| 150 | int nErr = 0; |
| 151 | Stmt q; |
| 152 | Blob fileCksum, origCksum; |
| 153 | int useMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1); |
| 154 | |
| 155 | db_begin_transaction(); |
| 156 | db_prepare(&q, "SELECT id, %Q || pathname," |
| 157 | " vfile.mrid, deleted, chnged, uuid, size, mtime" |
| 158 | " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid" |
| @@ -178,11 +190,11 @@ | |
| 178 | currentMtime = file_wd_mtime(0); |
| 179 | if( chnged==0 && (isDeleted || rid==0) ){ |
| 180 | /* "fossil rm" or "fossil add" always change the file */ |
| 181 | chnged = 1; |
| 182 | }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){ |
| 183 | if( notFileIsFatal ){ |
| 184 | fossil_warning("not an ordinary file: %s", zName); |
| 185 | nErr++; |
| 186 | } |
| 187 | chnged = 1; |
| 188 | } |
| @@ -217,10 +229,19 @@ | |
| 217 | if( blob_compare(&fileCksum, &origCksum) ){ |
| 218 | chnged = 1; |
| 219 | } |
| 220 | blob_reset(&origCksum); |
| 221 | blob_reset(&fileCksum); |
| 222 | } |
| 223 | if( currentMtime!=oldMtime || chnged!=oldChnged ){ |
| 224 | db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d", |
| 225 | currentMtime, chnged, id); |
| 226 | } |
| 227 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -118,19 +118,30 @@ | |
| 118 | db_finalize(&ins); |
| 119 | manifest_destroy(p); |
| 120 | db_end_transaction(0); |
| 121 | } |
| 122 | |
| 123 | #if INTERFACE |
| 124 | /* |
| 125 | ** The cksigFlags parameter to vfile_check_signature() is an OR-ed |
| 126 | ** combination of the following bits: |
| 127 | */ |
| 128 | #define CKSIG_ENOTFILE 0x001 /* non-file FS objects throw an error */ |
| 129 | #define CKSIG_SHA1 0x002 /* Verify file content using sha1sum */ |
| 130 | #define CKSIG_SETMTIME 0x004 /* Set mtime to last check-out time */ |
| 131 | |
| 132 | #endif /* INTERFACE */ |
| 133 | |
| 134 | /* |
| 135 | ** Look at every VFILE entry with the given vid and update |
| 136 | ** VFILE.CHNGED field according to whether or not |
| 137 | ** the file has changed. 0 means no change. 1 means edited. 2 means |
| 138 | ** the file has changed due to a merge. 3 means the file was added |
| 139 | ** by a merge. |
| 140 | ** |
| 141 | ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either |
| 142 | ** removed from configuration management via "fossil rm" or added via |
| 143 | ** "fossil add", respectively, and in both cases we always know that |
| 144 | ** the file has changed without having the check the size, mtime, |
| 145 | ** or on-disk content. |
| 146 | ** |
| 147 | ** If the size of the file has changed, then we always know that the file |
| @@ -144,15 +155,16 @@ | |
| 155 | ** |
| 156 | ** If the mtime is used, it is used only to determine if files are the same. |
| 157 | ** If the mtime of a file has changed, we still examine the on-disk content |
| 158 | ** to see whether or not the edit was a null-edit. |
| 159 | */ |
| 160 | void vfile_check_signature(int vid, unsigned int cksigFlags){ |
| 161 | int nErr = 0; |
| 162 | Stmt q; |
| 163 | Blob fileCksum, origCksum; |
| 164 | int useMtime = (cksigFlags & CKSIG_SHA1)==0 |
| 165 | && db_get_boolean("mtime-changes", 1); |
| 166 | |
| 167 | db_begin_transaction(); |
| 168 | db_prepare(&q, "SELECT id, %Q || pathname," |
| 169 | " vfile.mrid, deleted, chnged, uuid, size, mtime" |
| 170 | " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid" |
| @@ -178,11 +190,11 @@ | |
| 190 | currentMtime = file_wd_mtime(0); |
| 191 | if( chnged==0 && (isDeleted || rid==0) ){ |
| 192 | /* "fossil rm" or "fossil add" always change the file */ |
| 193 | chnged = 1; |
| 194 | }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){ |
| 195 | if( cksigFlags & CKSIG_ENOTFILE ){ |
| 196 | fossil_warning("not an ordinary file: %s", zName); |
| 197 | nErr++; |
| 198 | } |
| 199 | chnged = 1; |
| 200 | } |
| @@ -217,10 +229,19 @@ | |
| 229 | if( blob_compare(&fileCksum, &origCksum) ){ |
| 230 | chnged = 1; |
| 231 | } |
| 232 | blob_reset(&origCksum); |
| 233 | blob_reset(&fileCksum); |
| 234 | } |
| 235 | if( (cksigFlags & CKSIG_SETMTIME) && (chnged==0 || chnged==2) ){ |
| 236 | i64 desiredMtime; |
| 237 | if( mtime_of_manifest_file(vid,rid,&desiredMtime)==0 ){ |
| 238 | if( currentMtime!=desiredMtime ){ |
| 239 | file_set_mtime(zName, desiredMtime); |
| 240 | currentMtime = file_wd_mtime(zName); |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | if( currentMtime!=oldMtime || chnged!=oldChnged ){ |
| 245 | db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d", |
| 246 | currentMtime, chnged, id); |
| 247 | } |
| 248 |