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.

stephan 2019-06-13 06:18 trunk
Commit e59d8d99b88d677c489ebeae4056540139054b9d449fa246529b1b631125e6df
2 files changed +7 +11
--- src/checkout.c
+++ src/checkout.c
@@ -275,10 +275,13 @@
275275
**
276276
** Options:
277277
** --force Ignore edited files in the current checkout
278278
** --keep Only update the manifest and manifest.uuid files
279279
** --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).
280283
**
281284
** See also: update
282285
*/
283286
void checkout_cmd(void){
284287
int forceFlag; /* Force checkout even if edits exist */
@@ -286,19 +289,21 @@
286289
int keepFlag; /* Do not change any files on disk */
287290
int latestFlag; /* Checkout the latest version */
288291
char *zVers; /* Version to checkout */
289292
int promptFlag; /* True to prompt before overwriting */
290293
int vid, prior;
294
+ int setmtimeFlag; /* --setmtime. Set mtimes on files */
291295
Blob cksum1, cksum1b, cksum2;
292296
293297
db_must_be_within_tree();
294298
db_begin_transaction();
295299
forceFlag = find_option("force","f",0)!=0;
296300
forceMissingFlag = find_option("force-missing",0,0)!=0;
297301
keepFlag = find_option("keep",0,0)!=0;
298302
latestFlag = find_option("latest",0,0)!=0;
299303
promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0;
304
+ setmtimeFlag = find_option("setmtime",0,0)!=0;
300305
301306
/* We should be done with options.. */
302307
verify_all_options();
303308
304309
if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){
@@ -329,10 +334,11 @@
329334
}else{
330335
zVers = g.argv[2];
331336
}
332337
vid = load_vfile(zVers, forceMissingFlag);
333338
if( prior==vid ){
339
+ if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME);
334340
db_end_transaction(0);
335341
return;
336342
}
337343
if( !keepFlag ){
338344
uncheckout(prior);
@@ -355,10 +361,11 @@
355361
}
356362
if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){
357363
fossil_print("WARNING: manifest checksum does not agree with manifest\n");
358364
}
359365
}
366
+ if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME);
360367
db_end_transaction(0);
361368
}
362369
363370
/*
364371
** Unlink the local database file
365372
--- 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
+11
--- src/db.c
+++ src/db.c
@@ -2880,26 +2880,31 @@
28802880
** with the local repository. If you commit this checkout,
28812881
** it will become a new "initial" commit in the repository.
28822882
** --keep Only modify the manifest and manifest.uuid files
28832883
** --nested Allow opening a repository inside an opened checkout
28842884
** --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).
28852888
**
28862889
** See also: close
28872890
*/
28882891
void cmd_open(void){
28892892
int emptyFlag;
28902893
int keepFlag;
28912894
int forceMissingFlag;
28922895
int allowNested;
28932896
int allowSymlinks;
2897
+ int setmtimeFlag; /* --setmtime. Set mtimes on files */
28942898
static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 };
28952899
28962900
url_proxy_options();
28972901
emptyFlag = find_option("empty",0,0)!=0;
28982902
keepFlag = find_option("keep",0,0)!=0;
28992903
forceMissingFlag = find_option("force-missing",0,0)!=0;
29002904
allowNested = find_option("nested",0,0)!=0;
2905
+ setmtimeFlag = find_option("setmtime",0,0)!=0;
29012906
29022907
/* We should be done with options.. */
29032908
verify_all_options();
29042909
29052910
if( g.argc!=3 && g.argc!=4 ){
@@ -2978,10 +2983,16 @@
29782983
}
29792984
if( forceMissingFlag ){
29802985
azNewArgv[g.argc++] = "--force-missing";
29812986
}
29822987
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
+ }
29832994
}
29842995
g.argc = 2;
29852996
info_cmd();
29862997
}
29872998
29882999
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button