Fossil SCM

- Make --force imply --no-warnings - Add --no-warnings to "fossil scrub" and "fossil clean" - Remove "--conflict" option for "fossil merge", use --force for that.

jan.nijtmans 2012-11-26 12:23 UTC bellon-unicode-v2
Commit 06e1b67270b521f391b5e4377460822004e03fb4
2 files changed +12 -12 +6 -5
+12 -12
--- src/checkin.c
+++ src/checkin.c
@@ -393,28 +393,29 @@
393393
** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
394394
** is used if the --ignore option is omitted.
395395
**
396396
** Options:
397397
** --dotfiles include files beginning with a dot (".")
398
-** --force Remove files without prompting
398
+** --no-warnings Remove files without prompting
399399
** --ignore <CSG> ignore files matching patterns from the
400400
** comma separated list of glob patterns.
401401
** --temp Remove only Fossil-generated temporary files
402402
**
403403
** See also: addremove, extra, status
404404
*/
405405
void clean_cmd(void){
406
- int allFlag;
406
+ int allFlag, bForce;
407407
unsigned scanFlags = 0;
408408
const char *zIgnoreFlag;
409409
Blob path, repo;
410410
Stmt q;
411411
int n;
412412
Glob *pIgnore;
413413
int testFlag = 0;
414414
415
- allFlag = find_option("force","f",0)!=0;
415
+ bForce = find_option("force","f",0)!=0;
416
+ allFlag = find_option("no-warnings", 0, 0)!=0 || bForce;
416417
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
417418
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
418419
zIgnoreFlag = find_option("ignore",0,1);
419420
testFlag = find_option("test",0,0)!=0;
420421
db_must_be_within_tree();
@@ -1002,16 +1003,16 @@
10021003
** --bgcolor COLOR apply COLOR to this one check-in only
10031004
** --branch NEW-BRANCH-NAME check in to this new branch
10041005
** --branchcolor COLOR apply given COLOR to the branch
10051006
** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment
10061007
** --delta use a delta manifest in the commit process
1007
-** --force|-f allow forking with this commit
1008
+** --force|-f allow forking/unresolved merge conflicts with this commit
10081009
** --message-file|-M FILE read the commit comment from given file
10091010
** --nosign do not attempt to sign this commit with gpg
1011
+** --no-warnings do not warn about anything
10101012
** --private do not sync changes and their descendants
10111013
** --tag TAG-NAME assign given tag TAG-NAME to the checkin
1012
-** --conflict allow unresolved merge conflicts
10131014
** --binary-ok do not warn about committing binary files
10141015
**
10151016
** See also: branch, changes, checkout, extra, sync
10161017
*/
10171018
void commit_cmd(void){
@@ -1024,14 +1025,13 @@
10241025
Stmt q; /* Query to find files that have been modified */
10251026
char *zUuid; /* UUID of the new check-in */
10261027
int noSign = 0; /* True to omit signing the manifest using GPG */
10271028
int isAMerge = 0; /* True if checking in a merge */
10281029
int noWarningFlag = 0; /* True if skipping all warnings */
1029
- int forceFlag = 0; /* Force a fork */
1030
+ int forceFlag = 0; /* Force a fork/commit with unresolved merge conflicts */
10301031
int forceDelta = 0; /* Force a delta-manifest */
10311032
int forceBaseline = 0; /* Force a baseline-manifest */
1032
- int allowConflict = 0; /* Allow unresolve merge conflicts */
10331033
int binaryOk = 0; /* The --binary-ok flag */
10341034
char *zManifestFile; /* Name of the manifest file */
10351035
int useCksum; /* True if checksums should be computed and verified */
10361036
int outputManifest; /* True to output "manifest" and "manifest.uuid" */
10371037
int testRun; /* True for a test run. Debugging only */
@@ -1062,11 +1062,11 @@
10621062
fossil_fatal("cannot use --delta and --baseline together");
10631063
}
10641064
testRun = find_option("test",0,0)!=0;
10651065
zComment = find_option("comment","m",1);
10661066
forceFlag = find_option("force", "f", 0)!=0;
1067
- noWarningFlag = find_option("no-warnings", 0, 0)!=0;
1067
+ noWarningFlag = find_option("no-warnings", 0, 0)!=0 || forceFlag;
10681068
zBranch = find_option("branch","b",1);
10691069
zColor = find_option("bgcolor",0,1);
10701070
zBrClr = find_option("branchcolor",0,1);
10711071
binaryOk = find_option("binary-ok",0,0)!=0;
10721072
while( (zTag = find_option("tag",0,1))!=0 ){
@@ -1081,11 +1081,10 @@
10811081
if( zBranch==0 ) zBranch = "private";
10821082
if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */
10831083
}
10841084
zDateOvrd = find_option("date-override",0,1);
10851085
zUserOvrd = find_option("user-override",0,1);
1086
- allowConflict = find_option("conflict",0,0)!=0;
10871086
db_must_be_within_tree();
10881087
noSign = db_get_boolean("omitsign", 0)|noSign;
10891088
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
10901089
useCksum = db_get_boolean("repo-cksum", 1);
10911090
outputManifest = db_get_boolean("manifest", 0);
@@ -1189,11 +1188,11 @@
11891188
11901189
hasChanges = unsaved_changes();
11911190
db_begin_transaction();
11921191
db_record_repository_filename(0);
11931192
if( hasChanges==0 && !isAMerge && !forceFlag ){
1194
- fossil_fatal("nothing has changed");
1193
+ fossil_fatal("nothing has changed; use -f or --force.");
11951194
}
11961195
11971196
/* If none of the files that were named on the command line have
11981197
** been modified, bail out now unless the --force flag is used.
11991198
*/
@@ -1310,12 +1309,13 @@
13101309
}
13111310
db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
13121311
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
13131312
}
13141313
db_finalize(&q);
1315
- if( nConflict && !allowConflict ){
1316
- fossil_fatal("abort due to unresolve merge conflicts");
1314
+ if( nConflict && !forceFlag ){
1315
+ fossil_fatal("abort due to unresolved merge conflicts; use -f"
1316
+ " or --force.");
13171317
}
13181318
13191319
/* Create the new manifest */
13201320
if( blob_size(&comment)==0 ){
13211321
blob_append(&comment, "(no comment)", -1);
13221322
--- src/checkin.c
+++ src/checkin.c
@@ -393,28 +393,29 @@
393 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
394 ** is used if the --ignore option is omitted.
395 **
396 ** Options:
397 ** --dotfiles include files beginning with a dot (".")
398 ** --force Remove files without prompting
399 ** --ignore <CSG> ignore files matching patterns from the
400 ** comma separated list of glob patterns.
401 ** --temp Remove only Fossil-generated temporary files
402 **
403 ** See also: addremove, extra, status
404 */
405 void clean_cmd(void){
406 int allFlag;
407 unsigned scanFlags = 0;
408 const char *zIgnoreFlag;
409 Blob path, repo;
410 Stmt q;
411 int n;
412 Glob *pIgnore;
413 int testFlag = 0;
414
415 allFlag = find_option("force","f",0)!=0;
 
416 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
417 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
418 zIgnoreFlag = find_option("ignore",0,1);
419 testFlag = find_option("test",0,0)!=0;
420 db_must_be_within_tree();
@@ -1002,16 +1003,16 @@
1002 ** --bgcolor COLOR apply COLOR to this one check-in only
1003 ** --branch NEW-BRANCH-NAME check in to this new branch
1004 ** --branchcolor COLOR apply given COLOR to the branch
1005 ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment
1006 ** --delta use a delta manifest in the commit process
1007 ** --force|-f allow forking with this commit
1008 ** --message-file|-M FILE read the commit comment from given file
1009 ** --nosign do not attempt to sign this commit with gpg
 
1010 ** --private do not sync changes and their descendants
1011 ** --tag TAG-NAME assign given tag TAG-NAME to the checkin
1012 ** --conflict allow unresolved merge conflicts
1013 ** --binary-ok do not warn about committing binary files
1014 **
1015 ** See also: branch, changes, checkout, extra, sync
1016 */
1017 void commit_cmd(void){
@@ -1024,14 +1025,13 @@
1024 Stmt q; /* Query to find files that have been modified */
1025 char *zUuid; /* UUID of the new check-in */
1026 int noSign = 0; /* True to omit signing the manifest using GPG */
1027 int isAMerge = 0; /* True if checking in a merge */
1028 int noWarningFlag = 0; /* True if skipping all warnings */
1029 int forceFlag = 0; /* Force a fork */
1030 int forceDelta = 0; /* Force a delta-manifest */
1031 int forceBaseline = 0; /* Force a baseline-manifest */
1032 int allowConflict = 0; /* Allow unresolve merge conflicts */
1033 int binaryOk = 0; /* The --binary-ok flag */
1034 char *zManifestFile; /* Name of the manifest file */
1035 int useCksum; /* True if checksums should be computed and verified */
1036 int outputManifest; /* True to output "manifest" and "manifest.uuid" */
1037 int testRun; /* True for a test run. Debugging only */
@@ -1062,11 +1062,11 @@
1062 fossil_fatal("cannot use --delta and --baseline together");
1063 }
1064 testRun = find_option("test",0,0)!=0;
1065 zComment = find_option("comment","m",1);
1066 forceFlag = find_option("force", "f", 0)!=0;
1067 noWarningFlag = find_option("no-warnings", 0, 0)!=0;
1068 zBranch = find_option("branch","b",1);
1069 zColor = find_option("bgcolor",0,1);
1070 zBrClr = find_option("branchcolor",0,1);
1071 binaryOk = find_option("binary-ok",0,0)!=0;
1072 while( (zTag = find_option("tag",0,1))!=0 ){
@@ -1081,11 +1081,10 @@
1081 if( zBranch==0 ) zBranch = "private";
1082 if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */
1083 }
1084 zDateOvrd = find_option("date-override",0,1);
1085 zUserOvrd = find_option("user-override",0,1);
1086 allowConflict = find_option("conflict",0,0)!=0;
1087 db_must_be_within_tree();
1088 noSign = db_get_boolean("omitsign", 0)|noSign;
1089 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
1090 useCksum = db_get_boolean("repo-cksum", 1);
1091 outputManifest = db_get_boolean("manifest", 0);
@@ -1189,11 +1188,11 @@
1189
1190 hasChanges = unsaved_changes();
1191 db_begin_transaction();
1192 db_record_repository_filename(0);
1193 if( hasChanges==0 && !isAMerge && !forceFlag ){
1194 fossil_fatal("nothing has changed");
1195 }
1196
1197 /* If none of the files that were named on the command line have
1198 ** been modified, bail out now unless the --force flag is used.
1199 */
@@ -1310,12 +1309,13 @@
1310 }
1311 db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
1312 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
1313 }
1314 db_finalize(&q);
1315 if( nConflict && !allowConflict ){
1316 fossil_fatal("abort due to unresolve merge conflicts");
 
1317 }
1318
1319 /* Create the new manifest */
1320 if( blob_size(&comment)==0 ){
1321 blob_append(&comment, "(no comment)", -1);
1322
--- src/checkin.c
+++ src/checkin.c
@@ -393,28 +393,29 @@
393 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
394 ** is used if the --ignore option is omitted.
395 **
396 ** Options:
397 ** --dotfiles include files beginning with a dot (".")
398 ** --no-warnings Remove files without prompting
399 ** --ignore <CSG> ignore files matching patterns from the
400 ** comma separated list of glob patterns.
401 ** --temp Remove only Fossil-generated temporary files
402 **
403 ** See also: addremove, extra, status
404 */
405 void clean_cmd(void){
406 int allFlag, bForce;
407 unsigned scanFlags = 0;
408 const char *zIgnoreFlag;
409 Blob path, repo;
410 Stmt q;
411 int n;
412 Glob *pIgnore;
413 int testFlag = 0;
414
415 bForce = find_option("force","f",0)!=0;
416 allFlag = find_option("no-warnings", 0, 0)!=0 || bForce;
417 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
418 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
419 zIgnoreFlag = find_option("ignore",0,1);
420 testFlag = find_option("test",0,0)!=0;
421 db_must_be_within_tree();
@@ -1002,16 +1003,16 @@
1003 ** --bgcolor COLOR apply COLOR to this one check-in only
1004 ** --branch NEW-BRANCH-NAME check in to this new branch
1005 ** --branchcolor COLOR apply given COLOR to the branch
1006 ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment
1007 ** --delta use a delta manifest in the commit process
1008 ** --force|-f allow forking/unresolved merge conflicts with this commit
1009 ** --message-file|-M FILE read the commit comment from given file
1010 ** --nosign do not attempt to sign this commit with gpg
1011 ** --no-warnings do not warn about anything
1012 ** --private do not sync changes and their descendants
1013 ** --tag TAG-NAME assign given tag TAG-NAME to the checkin
 
1014 ** --binary-ok do not warn about committing binary files
1015 **
1016 ** See also: branch, changes, checkout, extra, sync
1017 */
1018 void commit_cmd(void){
@@ -1024,14 +1025,13 @@
1025 Stmt q; /* Query to find files that have been modified */
1026 char *zUuid; /* UUID of the new check-in */
1027 int noSign = 0; /* True to omit signing the manifest using GPG */
1028 int isAMerge = 0; /* True if checking in a merge */
1029 int noWarningFlag = 0; /* True if skipping all warnings */
1030 int forceFlag = 0; /* Force a fork/commit with unresolved merge conflicts */
1031 int forceDelta = 0; /* Force a delta-manifest */
1032 int forceBaseline = 0; /* Force a baseline-manifest */
 
1033 int binaryOk = 0; /* The --binary-ok flag */
1034 char *zManifestFile; /* Name of the manifest file */
1035 int useCksum; /* True if checksums should be computed and verified */
1036 int outputManifest; /* True to output "manifest" and "manifest.uuid" */
1037 int testRun; /* True for a test run. Debugging only */
@@ -1062,11 +1062,11 @@
1062 fossil_fatal("cannot use --delta and --baseline together");
1063 }
1064 testRun = find_option("test",0,0)!=0;
1065 zComment = find_option("comment","m",1);
1066 forceFlag = find_option("force", "f", 0)!=0;
1067 noWarningFlag = find_option("no-warnings", 0, 0)!=0 || forceFlag;
1068 zBranch = find_option("branch","b",1);
1069 zColor = find_option("bgcolor",0,1);
1070 zBrClr = find_option("branchcolor",0,1);
1071 binaryOk = find_option("binary-ok",0,0)!=0;
1072 while( (zTag = find_option("tag",0,1))!=0 ){
@@ -1081,11 +1081,10 @@
1081 if( zBranch==0 ) zBranch = "private";
1082 if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */
1083 }
1084 zDateOvrd = find_option("date-override",0,1);
1085 zUserOvrd = find_option("user-override",0,1);
 
1086 db_must_be_within_tree();
1087 noSign = db_get_boolean("omitsign", 0)|noSign;
1088 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
1089 useCksum = db_get_boolean("repo-cksum", 1);
1090 outputManifest = db_get_boolean("manifest", 0);
@@ -1189,11 +1188,11 @@
1188
1189 hasChanges = unsaved_changes();
1190 db_begin_transaction();
1191 db_record_repository_filename(0);
1192 if( hasChanges==0 && !isAMerge && !forceFlag ){
1193 fossil_fatal("nothing has changed; use -f or --force.");
1194 }
1195
1196 /* If none of the files that were named on the command line have
1197 ** been modified, bail out now unless the --force flag is used.
1198 */
@@ -1310,12 +1309,13 @@
1309 }
1310 db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
1311 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
1312 }
1313 db_finalize(&q);
1314 if( nConflict && !forceFlag ){
1315 fossil_fatal("abort due to unresolved merge conflicts; use -f"
1316 " or --force.");
1317 }
1318
1319 /* Create the new manifest */
1320 if( blob_size(&comment)==0 ){
1321 blob_append(&comment, "(no comment)", -1);
1322
+6 -5
--- src/rebuild.c
+++ src/rebuild.c
@@ -582,11 +582,11 @@
582582
"REPLACE INTO config(name,value,mtime) VALUES('aux-schema','%s',now());",
583583
CONTENT_SCHEMA, AUX_SCHEMA
584584
);
585585
if( errCnt && !forceFlag ){
586586
fossil_print(
587
- "%d errors. Rolling back changes. Use --force to force a commit.\n",
587
+ "%d errors. Rolling back changes. Use -f or --force to force a commit.\n",
588588
errCnt
589589
);
590590
db_end_transaction(1);
591591
}else{
592592
if( runCompress ){
@@ -767,21 +767,22 @@
767767
**
768768
** The user is prompted to confirm the scrub unless the --force option
769769
** is used.
770770
**
771771
** Options:
772
-** --force do not prompt for confirmation
773
-** --private only private branches are removed from the repository
774
-** --verily scrub real thoroughly (see above)
772
+** --no-warnings do not prompt for confirmation
773
+** --private only private branches are removed from the repository
774
+** --verily scrub real thoroughly (see above)
775775
*/
776776
void scrub_cmd(void){
777777
int bVerily = find_option("verily",0,0)!=0;
778778
int bForce = find_option("force", "f", 0)!=0;
779
+ int bNoWarning = find_option("no-warnings", 0, 0)!=0 || bForce;
779780
int privateOnly = find_option("private",0,0)!=0;
780781
int bNeedRebuild = 0;
781782
db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
782
- if( !bForce ){
783
+ if( !bNoWarning ){
783784
Blob ans;
784785
char cReply;
785786
blob_zero(&ans);
786787
prompt_user(
787788
"Scrubbing the repository will permanently delete information.\n"
788789
--- src/rebuild.c
+++ src/rebuild.c
@@ -582,11 +582,11 @@
582 "REPLACE INTO config(name,value,mtime) VALUES('aux-schema','%s',now());",
583 CONTENT_SCHEMA, AUX_SCHEMA
584 );
585 if( errCnt && !forceFlag ){
586 fossil_print(
587 "%d errors. Rolling back changes. Use --force to force a commit.\n",
588 errCnt
589 );
590 db_end_transaction(1);
591 }else{
592 if( runCompress ){
@@ -767,21 +767,22 @@
767 **
768 ** The user is prompted to confirm the scrub unless the --force option
769 ** is used.
770 **
771 ** Options:
772 ** --force do not prompt for confirmation
773 ** --private only private branches are removed from the repository
774 ** --verily scrub real thoroughly (see above)
775 */
776 void scrub_cmd(void){
777 int bVerily = find_option("verily",0,0)!=0;
778 int bForce = find_option("force", "f", 0)!=0;
 
779 int privateOnly = find_option("private",0,0)!=0;
780 int bNeedRebuild = 0;
781 db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
782 if( !bForce ){
783 Blob ans;
784 char cReply;
785 blob_zero(&ans);
786 prompt_user(
787 "Scrubbing the repository will permanently delete information.\n"
788
--- src/rebuild.c
+++ src/rebuild.c
@@ -582,11 +582,11 @@
582 "REPLACE INTO config(name,value,mtime) VALUES('aux-schema','%s',now());",
583 CONTENT_SCHEMA, AUX_SCHEMA
584 );
585 if( errCnt && !forceFlag ){
586 fossil_print(
587 "%d errors. Rolling back changes. Use -f or --force to force a commit.\n",
588 errCnt
589 );
590 db_end_transaction(1);
591 }else{
592 if( runCompress ){
@@ -767,21 +767,22 @@
767 **
768 ** The user is prompted to confirm the scrub unless the --force option
769 ** is used.
770 **
771 ** Options:
772 ** --no-warnings do not prompt for confirmation
773 ** --private only private branches are removed from the repository
774 ** --verily scrub real thoroughly (see above)
775 */
776 void scrub_cmd(void){
777 int bVerily = find_option("verily",0,0)!=0;
778 int bForce = find_option("force", "f", 0)!=0;
779 int bNoWarning = find_option("no-warnings", 0, 0)!=0 || bForce;
780 int privateOnly = find_option("private",0,0)!=0;
781 int bNeedRebuild = 0;
782 db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
783 if( !bNoWarning ){
784 Blob ans;
785 char cReply;
786 blob_zero(&ans);
787 prompt_user(
788 "Scrubbing the repository will permanently delete information.\n"
789

Keyboard Shortcuts

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