Index: src/checkout.c ================================================================== --- src/checkout.c +++ src/checkout.c @@ -275,10 +275,13 @@ ** ** Options: ** --force Ignore edited files in the current checkout ** --keep Only update the manifest and manifest.uuid files ** --force-missing Force checkout even if content is missing +** --setmtime Set timestamps of all files to match their SCM-side +** times (the timestamp of the last checkin which modified +** them). ** ** See also: update */ void checkout_cmd(void){ int forceFlag; /* Force checkout even if edits exist */ @@ -286,19 +289,21 @@ int keepFlag; /* Do not change any files on disk */ int latestFlag; /* Checkout the latest version */ char *zVers; /* Version to checkout */ int promptFlag; /* True to prompt before overwriting */ int vid, prior; + int setmtimeFlag; /* --setmtime. Set mtimes on files */ Blob cksum1, cksum1b, cksum2; db_must_be_within_tree(); db_begin_transaction(); forceFlag = find_option("force","f",0)!=0; forceMissingFlag = find_option("force-missing",0,0)!=0; keepFlag = find_option("keep",0,0)!=0; latestFlag = find_option("latest",0,0)!=0; promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; + setmtimeFlag = find_option("setmtime",0,0)!=0; /* We should be done with options.. */ verify_all_options(); if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ @@ -329,10 +334,11 @@ }else{ zVers = g.argv[2]; } vid = load_vfile(zVers, forceMissingFlag); if( prior==vid ){ + if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); db_end_transaction(0); return; } if( !keepFlag ){ uncheckout(prior); @@ -355,10 +361,11 @@ } if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){ fossil_print("WARNING: manifest checksum does not agree with manifest\n"); } } + if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); db_end_transaction(0); } /* ** Unlink the local database file Index: src/db.c ================================================================== --- src/db.c +++ src/db.c @@ -2880,26 +2880,31 @@ ** with the local repository. If you commit this checkout, ** it will become a new "initial" commit in the repository. ** --keep Only modify the manifest and manifest.uuid files ** --nested Allow opening a repository inside an opened checkout ** --force-missing Force opening a repository with missing content +** --setmtime Set timestamps of all files to match their SCM-side +** times (the timestamp of the last checkin which modified +** them). ** ** See also: close */ void cmd_open(void){ int emptyFlag; int keepFlag; int forceMissingFlag; int allowNested; int allowSymlinks; + int setmtimeFlag; /* --setmtime. Set mtimes on files */ static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; url_proxy_options(); emptyFlag = find_option("empty",0,0)!=0; keepFlag = find_option("keep",0,0)!=0; forceMissingFlag = find_option("force-missing",0,0)!=0; allowNested = find_option("nested",0,0)!=0; + setmtimeFlag = find_option("setmtime",0,0)!=0; /* We should be done with options.. */ verify_all_options(); if( g.argc!=3 && g.argc!=4 ){ @@ -2978,10 +2983,16 @@ } if( forceMissingFlag ){ azNewArgv[g.argc++] = "--force-missing"; } checkout_cmd(); + } + if( setmtimeFlag ){ + int const vid = db_lget_int("checkout", 0); + if(vid!=0){ + vfile_check_signature(vid, CKSIG_SETMTIME); + } } g.argc = 2; info_cmd(); }