Fossil SCM
Added a -setmtime flag to the checkout and open commands which works identically to that flag for the update command. The open command should arguably do this by default.
Commit
e59d8d99b88d677c489ebeae4056540139054b9d449fa246529b1b631125e6df
Parent
34fcaf829a908db…
2 files changed
+7
+11
+7
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -275,10 +275,13 @@ | ||
| 275 | 275 | ** |
| 276 | 276 | ** Options: |
| 277 | 277 | ** --force Ignore edited files in the current checkout |
| 278 | 278 | ** --keep Only update the manifest and manifest.uuid files |
| 279 | 279 | ** --force-missing Force checkout even if content is missing |
| 280 | +** --setmtime Set timestamps of all files to match their SCM-side | |
| 281 | +** times (the timestamp of the last checkin which modified | |
| 282 | +** them). | |
| 280 | 283 | ** |
| 281 | 284 | ** See also: update |
| 282 | 285 | */ |
| 283 | 286 | void checkout_cmd(void){ |
| 284 | 287 | int forceFlag; /* Force checkout even if edits exist */ |
| @@ -286,19 +289,21 @@ | ||
| 286 | 289 | int keepFlag; /* Do not change any files on disk */ |
| 287 | 290 | int latestFlag; /* Checkout the latest version */ |
| 288 | 291 | char *zVers; /* Version to checkout */ |
| 289 | 292 | int promptFlag; /* True to prompt before overwriting */ |
| 290 | 293 | int vid, prior; |
| 294 | + int setmtimeFlag; /* --setmtime. Set mtimes on files */ | |
| 291 | 295 | Blob cksum1, cksum1b, cksum2; |
| 292 | 296 | |
| 293 | 297 | db_must_be_within_tree(); |
| 294 | 298 | db_begin_transaction(); |
| 295 | 299 | forceFlag = find_option("force","f",0)!=0; |
| 296 | 300 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 297 | 301 | keepFlag = find_option("keep",0,0)!=0; |
| 298 | 302 | latestFlag = find_option("latest",0,0)!=0; |
| 299 | 303 | promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; |
| 304 | + setmtimeFlag = find_option("setmtime",0,0)!=0; | |
| 300 | 305 | |
| 301 | 306 | /* We should be done with options.. */ |
| 302 | 307 | verify_all_options(); |
| 303 | 308 | |
| 304 | 309 | if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ |
| @@ -329,10 +334,11 @@ | ||
| 329 | 334 | }else{ |
| 330 | 335 | zVers = g.argv[2]; |
| 331 | 336 | } |
| 332 | 337 | vid = load_vfile(zVers, forceMissingFlag); |
| 333 | 338 | if( prior==vid ){ |
| 339 | + if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); | |
| 334 | 340 | db_end_transaction(0); |
| 335 | 341 | return; |
| 336 | 342 | } |
| 337 | 343 | if( !keepFlag ){ |
| 338 | 344 | uncheckout(prior); |
| @@ -355,10 +361,11 @@ | ||
| 355 | 361 | } |
| 356 | 362 | if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){ |
| 357 | 363 | fossil_print("WARNING: manifest checksum does not agree with manifest\n"); |
| 358 | 364 | } |
| 359 | 365 | } |
| 366 | + if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); | |
| 360 | 367 | db_end_transaction(0); |
| 361 | 368 | } |
| 362 | 369 | |
| 363 | 370 | /* |
| 364 | 371 | ** Unlink the local database file |
| 365 | 372 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -275,10 +275,13 @@ | |
| 275 | ** |
| 276 | ** Options: |
| 277 | ** --force Ignore edited files in the current checkout |
| 278 | ** --keep Only update the manifest and manifest.uuid files |
| 279 | ** --force-missing Force checkout even if content is missing |
| 280 | ** |
| 281 | ** See also: update |
| 282 | */ |
| 283 | void checkout_cmd(void){ |
| 284 | int forceFlag; /* Force checkout even if edits exist */ |
| @@ -286,19 +289,21 @@ | |
| 286 | int keepFlag; /* Do not change any files on disk */ |
| 287 | int latestFlag; /* Checkout the latest version */ |
| 288 | char *zVers; /* Version to checkout */ |
| 289 | int promptFlag; /* True to prompt before overwriting */ |
| 290 | int vid, prior; |
| 291 | Blob cksum1, cksum1b, cksum2; |
| 292 | |
| 293 | db_must_be_within_tree(); |
| 294 | db_begin_transaction(); |
| 295 | forceFlag = find_option("force","f",0)!=0; |
| 296 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 297 | keepFlag = find_option("keep",0,0)!=0; |
| 298 | latestFlag = find_option("latest",0,0)!=0; |
| 299 | promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; |
| 300 | |
| 301 | /* We should be done with options.. */ |
| 302 | verify_all_options(); |
| 303 | |
| 304 | if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ |
| @@ -329,10 +334,11 @@ | |
| 329 | }else{ |
| 330 | zVers = g.argv[2]; |
| 331 | } |
| 332 | vid = load_vfile(zVers, forceMissingFlag); |
| 333 | if( prior==vid ){ |
| 334 | db_end_transaction(0); |
| 335 | return; |
| 336 | } |
| 337 | if( !keepFlag ){ |
| 338 | uncheckout(prior); |
| @@ -355,10 +361,11 @@ | |
| 355 | } |
| 356 | if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){ |
| 357 | fossil_print("WARNING: manifest checksum does not agree with manifest\n"); |
| 358 | } |
| 359 | } |
| 360 | db_end_transaction(0); |
| 361 | } |
| 362 | |
| 363 | /* |
| 364 | ** Unlink the local database file |
| 365 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -275,10 +275,13 @@ | |
| 275 | ** |
| 276 | ** Options: |
| 277 | ** --force Ignore edited files in the current checkout |
| 278 | ** --keep Only update the manifest and manifest.uuid files |
| 279 | ** --force-missing Force checkout even if content is missing |
| 280 | ** --setmtime Set timestamps of all files to match their SCM-side |
| 281 | ** times (the timestamp of the last checkin which modified |
| 282 | ** them). |
| 283 | ** |
| 284 | ** See also: update |
| 285 | */ |
| 286 | void checkout_cmd(void){ |
| 287 | int forceFlag; /* Force checkout even if edits exist */ |
| @@ -286,19 +289,21 @@ | |
| 289 | int keepFlag; /* Do not change any files on disk */ |
| 290 | int latestFlag; /* Checkout the latest version */ |
| 291 | char *zVers; /* Version to checkout */ |
| 292 | int promptFlag; /* True to prompt before overwriting */ |
| 293 | int vid, prior; |
| 294 | int setmtimeFlag; /* --setmtime. Set mtimes on files */ |
| 295 | Blob cksum1, cksum1b, cksum2; |
| 296 | |
| 297 | db_must_be_within_tree(); |
| 298 | db_begin_transaction(); |
| 299 | forceFlag = find_option("force","f",0)!=0; |
| 300 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 301 | keepFlag = find_option("keep",0,0)!=0; |
| 302 | latestFlag = find_option("latest",0,0)!=0; |
| 303 | promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; |
| 304 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 305 | |
| 306 | /* We should be done with options.. */ |
| 307 | verify_all_options(); |
| 308 | |
| 309 | if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ |
| @@ -329,10 +334,11 @@ | |
| 334 | }else{ |
| 335 | zVers = g.argv[2]; |
| 336 | } |
| 337 | vid = load_vfile(zVers, forceMissingFlag); |
| 338 | if( prior==vid ){ |
| 339 | if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); |
| 340 | db_end_transaction(0); |
| 341 | return; |
| 342 | } |
| 343 | if( !keepFlag ){ |
| 344 | uncheckout(prior); |
| @@ -355,10 +361,11 @@ | |
| 361 | } |
| 362 | if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){ |
| 363 | fossil_print("WARNING: manifest checksum does not agree with manifest\n"); |
| 364 | } |
| 365 | } |
| 366 | if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); |
| 367 | db_end_transaction(0); |
| 368 | } |
| 369 | |
| 370 | /* |
| 371 | ** Unlink the local database file |
| 372 |
M
src/db.c
+11
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2880,26 +2880,31 @@ | ||
| 2880 | 2880 | ** with the local repository. If you commit this checkout, |
| 2881 | 2881 | ** it will become a new "initial" commit in the repository. |
| 2882 | 2882 | ** --keep Only modify the manifest and manifest.uuid files |
| 2883 | 2883 | ** --nested Allow opening a repository inside an opened checkout |
| 2884 | 2884 | ** --force-missing Force opening a repository with missing content |
| 2885 | +** --setmtime Set timestamps of all files to match their SCM-side | |
| 2886 | +** times (the timestamp of the last checkin which modified | |
| 2887 | +** them). | |
| 2885 | 2888 | ** |
| 2886 | 2889 | ** See also: close |
| 2887 | 2890 | */ |
| 2888 | 2891 | void cmd_open(void){ |
| 2889 | 2892 | int emptyFlag; |
| 2890 | 2893 | int keepFlag; |
| 2891 | 2894 | int forceMissingFlag; |
| 2892 | 2895 | int allowNested; |
| 2893 | 2896 | int allowSymlinks; |
| 2897 | + int setmtimeFlag; /* --setmtime. Set mtimes on files */ | |
| 2894 | 2898 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; |
| 2895 | 2899 | |
| 2896 | 2900 | url_proxy_options(); |
| 2897 | 2901 | emptyFlag = find_option("empty",0,0)!=0; |
| 2898 | 2902 | keepFlag = find_option("keep",0,0)!=0; |
| 2899 | 2903 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 2900 | 2904 | allowNested = find_option("nested",0,0)!=0; |
| 2905 | + setmtimeFlag = find_option("setmtime",0,0)!=0; | |
| 2901 | 2906 | |
| 2902 | 2907 | /* We should be done with options.. */ |
| 2903 | 2908 | verify_all_options(); |
| 2904 | 2909 | |
| 2905 | 2910 | if( g.argc!=3 && g.argc!=4 ){ |
| @@ -2978,10 +2983,16 @@ | ||
| 2978 | 2983 | } |
| 2979 | 2984 | if( forceMissingFlag ){ |
| 2980 | 2985 | azNewArgv[g.argc++] = "--force-missing"; |
| 2981 | 2986 | } |
| 2982 | 2987 | checkout_cmd(); |
| 2988 | + } | |
| 2989 | + if( setmtimeFlag ){ | |
| 2990 | + int const vid = db_lget_int("checkout", 0); | |
| 2991 | + if(vid!=0){ | |
| 2992 | + vfile_check_signature(vid, CKSIG_SETMTIME); | |
| 2993 | + } | |
| 2983 | 2994 | } |
| 2984 | 2995 | g.argc = 2; |
| 2985 | 2996 | info_cmd(); |
| 2986 | 2997 | } |
| 2987 | 2998 | |
| 2988 | 2999 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2880,26 +2880,31 @@ | |
| 2880 | ** with the local repository. If you commit this checkout, |
| 2881 | ** it will become a new "initial" commit in the repository. |
| 2882 | ** --keep Only modify the manifest and manifest.uuid files |
| 2883 | ** --nested Allow opening a repository inside an opened checkout |
| 2884 | ** --force-missing Force opening a repository with missing content |
| 2885 | ** |
| 2886 | ** See also: close |
| 2887 | */ |
| 2888 | void cmd_open(void){ |
| 2889 | int emptyFlag; |
| 2890 | int keepFlag; |
| 2891 | int forceMissingFlag; |
| 2892 | int allowNested; |
| 2893 | int allowSymlinks; |
| 2894 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; |
| 2895 | |
| 2896 | url_proxy_options(); |
| 2897 | emptyFlag = find_option("empty",0,0)!=0; |
| 2898 | keepFlag = find_option("keep",0,0)!=0; |
| 2899 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 2900 | allowNested = find_option("nested",0,0)!=0; |
| 2901 | |
| 2902 | /* We should be done with options.. */ |
| 2903 | verify_all_options(); |
| 2904 | |
| 2905 | if( g.argc!=3 && g.argc!=4 ){ |
| @@ -2978,10 +2983,16 @@ | |
| 2978 | } |
| 2979 | if( forceMissingFlag ){ |
| 2980 | azNewArgv[g.argc++] = "--force-missing"; |
| 2981 | } |
| 2982 | checkout_cmd(); |
| 2983 | } |
| 2984 | g.argc = 2; |
| 2985 | info_cmd(); |
| 2986 | } |
| 2987 | |
| 2988 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2880,26 +2880,31 @@ | |
| 2880 | ** with the local repository. If you commit this checkout, |
| 2881 | ** it will become a new "initial" commit in the repository. |
| 2882 | ** --keep Only modify the manifest and manifest.uuid files |
| 2883 | ** --nested Allow opening a repository inside an opened checkout |
| 2884 | ** --force-missing Force opening a repository with missing content |
| 2885 | ** --setmtime Set timestamps of all files to match their SCM-side |
| 2886 | ** times (the timestamp of the last checkin which modified |
| 2887 | ** them). |
| 2888 | ** |
| 2889 | ** See also: close |
| 2890 | */ |
| 2891 | void cmd_open(void){ |
| 2892 | int emptyFlag; |
| 2893 | int keepFlag; |
| 2894 | int forceMissingFlag; |
| 2895 | int allowNested; |
| 2896 | int allowSymlinks; |
| 2897 | int setmtimeFlag; /* --setmtime. Set mtimes on files */ |
| 2898 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; |
| 2899 | |
| 2900 | url_proxy_options(); |
| 2901 | emptyFlag = find_option("empty",0,0)!=0; |
| 2902 | keepFlag = find_option("keep",0,0)!=0; |
| 2903 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 2904 | allowNested = find_option("nested",0,0)!=0; |
| 2905 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 2906 | |
| 2907 | /* We should be done with options.. */ |
| 2908 | verify_all_options(); |
| 2909 | |
| 2910 | if( g.argc!=3 && g.argc!=4 ){ |
| @@ -2978,10 +2983,16 @@ | |
| 2983 | } |
| 2984 | if( forceMissingFlag ){ |
| 2985 | azNewArgv[g.argc++] = "--force-missing"; |
| 2986 | } |
| 2987 | checkout_cmd(); |
| 2988 | } |
| 2989 | if( setmtimeFlag ){ |
| 2990 | int const vid = db_lget_int("checkout", 0); |
| 2991 | if(vid!=0){ |
| 2992 | vfile_check_signature(vid, CKSIG_SETMTIME); |
| 2993 | } |
| 2994 | } |
| 2995 | g.argc = 2; |
| 2996 | info_cmd(); |
| 2997 | } |
| 2998 | |
| 2999 |