Fossil SCM
Improvement on the checkout/co command. "co --keep" now imply "--force" since it's guaranteed that no file from the checkout will be affected. Add short flag version of --keep and --force. Document the existence of the "--prompt" flag.
Commit
5bc31db11a8e6112cd06fda0e153809fd42263e93b1bcc2e3c7af1ee80ff6ea5
Parent
54cfac8c8452a3a…
1 file changed
+10
-4
+10
-4
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -276,13 +276,14 @@ | ||
| 276 | 276 | ** |
| 277 | 277 | ** The --latest flag can be used in place of VERSION to check-out the |
| 278 | 278 | ** latest version in the repository. |
| 279 | 279 | ** |
| 280 | 280 | ** Options: |
| 281 | -** --force Ignore edited files in the current check-out | |
| 282 | -** --keep Only update the manifest file(s) | |
| 281 | +** -f|--force Ignore edited files in the current check-out | |
| 282 | +** -k|--keep Only update the manifest file(s) | |
| 283 | 283 | ** --force-missing Force check-out even if content is missing |
| 284 | +** --prompt Prompt before overwritting when --force is used | |
| 284 | 285 | ** --setmtime Set timestamps of all files to match their SCM-side |
| 285 | 286 | ** times (the timestamp of the last check-in which modified |
| 286 | 287 | ** them) |
| 287 | 288 | ** |
| 288 | 289 | ** See also: [[update]] |
| @@ -298,16 +299,21 @@ | ||
| 298 | 299 | int setmtimeFlag; /* --setmtime. Set mtimes on files */ |
| 299 | 300 | Blob cksum1, cksum1b, cksum2; |
| 300 | 301 | |
| 301 | 302 | db_must_be_within_tree(); |
| 302 | 303 | db_begin_transaction(); |
| 303 | - forceFlag = find_option("force","f",0)!=0; | |
| 304 | 304 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 305 | - keepFlag = find_option("keep",0,0)!=0; | |
| 305 | + keepFlag = find_option("keep","k",0)!=0; | |
| 306 | + forceFlag = find_option("force","f",0)!=0; | |
| 306 | 307 | latestFlag = find_option("latest",0,0)!=0; |
| 307 | 308 | promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; |
| 308 | 309 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 310 | + | |
| 311 | + if( keepFlag != 0 ){ | |
| 312 | + /* After flag collection to explicitly don't affect promptFlag */ | |
| 313 | + forceFlag=1; | |
| 314 | + } | |
| 309 | 315 | |
| 310 | 316 | /* We should be done with options.. */ |
| 311 | 317 | verify_all_options(); |
| 312 | 318 | |
| 313 | 319 | if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ |
| 314 | 320 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -276,13 +276,14 @@ | |
| 276 | ** |
| 277 | ** The --latest flag can be used in place of VERSION to check-out the |
| 278 | ** latest version in the repository. |
| 279 | ** |
| 280 | ** Options: |
| 281 | ** --force Ignore edited files in the current check-out |
| 282 | ** --keep Only update the manifest file(s) |
| 283 | ** --force-missing Force check-out even if content is missing |
| 284 | ** --setmtime Set timestamps of all files to match their SCM-side |
| 285 | ** times (the timestamp of the last check-in which modified |
| 286 | ** them) |
| 287 | ** |
| 288 | ** See also: [[update]] |
| @@ -298,16 +299,21 @@ | |
| 298 | int setmtimeFlag; /* --setmtime. Set mtimes on files */ |
| 299 | Blob cksum1, cksum1b, cksum2; |
| 300 | |
| 301 | db_must_be_within_tree(); |
| 302 | db_begin_transaction(); |
| 303 | forceFlag = find_option("force","f",0)!=0; |
| 304 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 305 | keepFlag = find_option("keep",0,0)!=0; |
| 306 | latestFlag = find_option("latest",0,0)!=0; |
| 307 | promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; |
| 308 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 309 | |
| 310 | /* We should be done with options.. */ |
| 311 | verify_all_options(); |
| 312 | |
| 313 | if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ |
| 314 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -276,13 +276,14 @@ | |
| 276 | ** |
| 277 | ** The --latest flag can be used in place of VERSION to check-out the |
| 278 | ** latest version in the repository. |
| 279 | ** |
| 280 | ** Options: |
| 281 | ** -f|--force Ignore edited files in the current check-out |
| 282 | ** -k|--keep Only update the manifest file(s) |
| 283 | ** --force-missing Force check-out even if content is missing |
| 284 | ** --prompt Prompt before overwritting when --force is used |
| 285 | ** --setmtime Set timestamps of all files to match their SCM-side |
| 286 | ** times (the timestamp of the last check-in which modified |
| 287 | ** them) |
| 288 | ** |
| 289 | ** See also: [[update]] |
| @@ -298,16 +299,21 @@ | |
| 299 | int setmtimeFlag; /* --setmtime. Set mtimes on files */ |
| 300 | Blob cksum1, cksum1b, cksum2; |
| 301 | |
| 302 | db_must_be_within_tree(); |
| 303 | db_begin_transaction(); |
| 304 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 305 | keepFlag = find_option("keep","k",0)!=0; |
| 306 | forceFlag = find_option("force","f",0)!=0; |
| 307 | latestFlag = find_option("latest",0,0)!=0; |
| 308 | promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; |
| 309 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 310 | |
| 311 | if( keepFlag != 0 ){ |
| 312 | /* After flag collection to explicitly don't affect promptFlag */ |
| 313 | forceFlag=1; |
| 314 | } |
| 315 | |
| 316 | /* We should be done with options.. */ |
| 317 | verify_all_options(); |
| 318 | |
| 319 | if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ |
| 320 |