Fossil SCM
merge trunk
Commit
f05090e5e8369f6ae91940f4165388e59f68d119
Parent
1772f8b895ec340…
1 file changed
+45
-23
+45
-23
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -656,11 +656,11 @@ | ||
| 656 | 656 | " AND type='ci' AND objid=%d", |
| 657 | 657 | zDate, rid |
| 658 | 658 | ); |
| 659 | 659 | if( b ){ |
| 660 | 660 | fossil_fatal("ancestor check-in [%.10s] (%s) is not older (clock skew?)" |
| 661 | - " Use -f to override.", zUuid, zDate); | |
| 661 | + " Use --allow-older to override.", zUuid, zDate); | |
| 662 | 662 | } |
| 663 | 663 | #endif |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | /* |
| @@ -987,32 +987,45 @@ | ||
| 987 | 987 | ** |
| 988 | 988 | ** The --bgcolor option works like --branchcolor but only sets the |
| 989 | 989 | ** background color for a single check-in. Subsequent check-ins revert |
| 990 | 990 | ** to the default color. |
| 991 | 991 | ** |
| 992 | -** A check-in is not permitted to fork unless the --force or -f | |
| 993 | -** option appears. A check-in is not allowed against a closed leaf. | |
| 992 | +** A check-in is not permitted to fork unless the --allow-fork option | |
| 993 | +** appears. An empty check-in (i.e. with nothing changed) is not | |
| 994 | +** allowed unless the --allow-empty option appears. A check-in may not | |
| 995 | +** be older than its ancestor unless the --allow-older option appears. | |
| 996 | +** If any of files in the check-in appear to contain unresolved merge | |
| 997 | +** conflicts, the check-in will not be allowed unless the | |
| 998 | +** --allow-conflict option is present. In addition, the entire | |
| 999 | +** check-in process may be aborted if a file contains content that | |
| 1000 | +** appears to be binary, Unicode text, or text with CR/NL line endings | |
| 1001 | +** unless the interactive user chooses to proceed. If there is no | |
| 1002 | +** interactive user or these warnings should be skipped for some other | |
| 1003 | +** reason, the --no-warnings option may be used. A check-in is not | |
| 1004 | +** allowed against a closed leaf. | |
| 994 | 1005 | ** |
| 995 | 1006 | ** The --private option creates a private check-in that is never synced. |
| 996 | 1007 | ** Children of private check-ins are automatically private. |
| 997 | 1008 | ** |
| 998 | 1009 | ** the --tag option applies the symbolic tag name to the check-in. |
| 999 | 1010 | ** |
| 1000 | 1011 | ** Options: |
| 1012 | +** --allow-conflict allow unresolved merge conflicts | |
| 1013 | +** --allow-empty allow a commit with no changes | |
| 1014 | +** --allow-fork allow the commit to fork | |
| 1015 | +** --allow-older allow a commit older than its ancestor | |
| 1001 | 1016 | ** --baseline use a baseline manifest in the commit process |
| 1002 | 1017 | ** --bgcolor COLOR apply COLOR to this one check-in only |
| 1003 | 1018 | ** --branch NEW-BRANCH-NAME check in to this new branch |
| 1004 | 1019 | ** --branchcolor COLOR apply given COLOR to the branch |
| 1005 | 1020 | ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment |
| 1006 | 1021 | ** --delta use a delta manifest in the commit process |
| 1007 | -** --force|-f allow forking with this commit | |
| 1008 | 1022 | ** --message-file|-M FILE read the commit comment from given file |
| 1023 | +** --no-warnings omit all warnings about file contents | |
| 1009 | 1024 | ** --nosign do not attempt to sign this commit with gpg |
| 1010 | 1025 | ** --private do not sync changes and their descendants |
| 1011 | 1026 | ** --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 | 1027 | ** |
| 1015 | 1028 | ** See also: branch, changes, checkout, extra, sync |
| 1016 | 1029 | */ |
| 1017 | 1030 | void commit_cmd(void){ |
| 1018 | 1031 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1024,15 +1037,17 @@ | ||
| 1024 | 1037 | Stmt q; /* Query to find files that have been modified */ |
| 1025 | 1038 | char *zUuid; /* UUID of the new check-in */ |
| 1026 | 1039 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1027 | 1040 | int isAMerge = 0; /* True if checking in a merge */ |
| 1028 | 1041 | int noWarningFlag = 0; /* True if skipping all warnings */ |
| 1029 | - int forceFlag = 0; /* Force a fork */ | |
| 1042 | + int forceFlag = 0; /* Undocumented: Disables all checks */ | |
| 1030 | 1043 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1031 | 1044 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1032 | 1045 | int allowConflict = 0; /* Allow unresolve merge conflicts */ |
| 1033 | - int binaryOk = 0; /* The --binary-ok flag */ | |
| 1046 | + int allowEmpty = 0; /* Allow a commit with no changes */ | |
| 1047 | + int allowFork = 0; /* Allow the commit to fork */ | |
| 1048 | + int allowOlder = 0; /* Allow a commit older than its ancestor */ | |
| 1034 | 1049 | char *zManifestFile; /* Name of the manifest file */ |
| 1035 | 1050 | int useCksum; /* True if checksums should be computed and verified */ |
| 1036 | 1051 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1037 | 1052 | int testRun; /* True for a test run. Debugging only */ |
| 1038 | 1053 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1062,15 +1077,18 @@ | ||
| 1062 | 1077 | fossil_fatal("cannot use --delta and --baseline together"); |
| 1063 | 1078 | } |
| 1064 | 1079 | testRun = find_option("test",0,0)!=0; |
| 1065 | 1080 | zComment = find_option("comment","m",1); |
| 1066 | 1081 | forceFlag = find_option("force", "f", 0)!=0; |
| 1082 | + allowConflict = find_option("allow-conflict",0,0)!=0; | |
| 1083 | + allowEmpty = find_option("allow-empty",0,0)!=0; | |
| 1084 | + allowFork = find_option("allow-fork",0,0)!=0; | |
| 1085 | + allowOlder = find_option("allow-older",0,0)!=0; | |
| 1067 | 1086 | noWarningFlag = find_option("no-warnings", 0, 0)!=0; |
| 1068 | 1087 | zBranch = find_option("branch","b",1); |
| 1069 | 1088 | zColor = find_option("bgcolor",0,1); |
| 1070 | 1089 | zBrClr = find_option("branchcolor",0,1); |
| 1071 | - binaryOk = find_option("binary-ok",0,0)!=0; | |
| 1072 | 1090 | while( (zTag = find_option("tag",0,1))!=0 ){ |
| 1073 | 1091 | if( zTag[0]==0 ) continue; |
| 1074 | 1092 | azTag = fossil_realloc((void *)azTag, sizeof(char*)*(nTag+2)); |
| 1075 | 1093 | azTag[nTag++] = zTag; |
| 1076 | 1094 | azTag[nTag] = 0; |
| @@ -1081,11 +1099,10 @@ | ||
| 1081 | 1099 | if( zBranch==0 ) zBranch = "private"; |
| 1082 | 1100 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 1083 | 1101 | } |
| 1084 | 1102 | zDateOvrd = find_option("date-override",0,1); |
| 1085 | 1103 | zUserOvrd = find_option("user-override",0,1); |
| 1086 | - allowConflict = find_option("conflict",0,0)!=0; | |
| 1087 | 1104 | db_must_be_within_tree(); |
| 1088 | 1105 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1089 | 1106 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1090 | 1107 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1091 | 1108 | outputManifest = db_get_boolean("manifest", 0); |
| @@ -1188,34 +1205,38 @@ | ||
| 1188 | 1205 | } |
| 1189 | 1206 | |
| 1190 | 1207 | hasChanges = unsaved_changes(); |
| 1191 | 1208 | db_begin_transaction(); |
| 1192 | 1209 | db_record_repository_filename(0); |
| 1193 | - if( hasChanges==0 && !isAMerge && !forceFlag ){ | |
| 1194 | - fossil_fatal("nothing has changed"); | |
| 1210 | + if( hasChanges==0 && !isAMerge && !allowEmpty && !forceFlag ){ | |
| 1211 | + fossil_fatal("nothing has changed; use --allow-empty to override"); | |
| 1195 | 1212 | } |
| 1196 | 1213 | |
| 1197 | 1214 | /* 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. | |
| 1215 | + ** been modified, bail out now unless the --allow-empty or --force | |
| 1216 | + ** flags is used. | |
| 1199 | 1217 | */ |
| 1200 | 1218 | if( g.aCommitFile |
| 1219 | + && !allowEmpty | |
| 1201 | 1220 | && !forceFlag |
| 1202 | 1221 | && !db_exists( |
| 1203 | 1222 | "SELECT 1 FROM vfile " |
| 1204 | 1223 | " WHERE is_selected(id)" |
| 1205 | 1224 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname)") |
| 1206 | 1225 | ){ |
| 1207 | - fossil_fatal("none of the selected files have changed; use -f" | |
| 1208 | - " or --force."); | |
| 1226 | + fossil_fatal("none of the selected files have changed; use " | |
| 1227 | + "--allow-empty to override."); | |
| 1209 | 1228 | } |
| 1210 | 1229 | |
| 1211 | 1230 | /* |
| 1212 | - ** Do not allow a commit that will cause a fork unless the --force flag | |
| 1213 | - ** is used or unless this is a private check-in. | |
| 1231 | + ** Do not allow a commit that will cause a fork unless the --allow-fork | |
| 1232 | + ** or --force flags is used, or unless this is a private check-in. | |
| 1214 | 1233 | */ |
| 1215 | - if( zBranch==0 && forceFlag==0 && g.markPrivate==0 && !is_a_leaf(vid) ){ | |
| 1216 | - fossil_fatal("would fork. \"update\" first or use -f or --force."); | |
| 1234 | + if( zBranch==0 && allowFork==0 && forceFlag==0 | |
| 1235 | + && g.markPrivate==0 && !is_a_leaf(vid) | |
| 1236 | + ){ | |
| 1237 | + fossil_fatal("would fork. \"update\" first or use --allow-fork."); | |
| 1217 | 1238 | } |
| 1218 | 1239 | |
| 1219 | 1240 | /* |
| 1220 | 1241 | ** Do not allow a commit against a closed leaf |
| 1221 | 1242 | */ |
| @@ -1278,11 +1299,11 @@ | ||
| 1278 | 1299 | id = db_column_int(&q, 0); |
| 1279 | 1300 | zFullname = db_column_text(&q, 1); |
| 1280 | 1301 | rid = db_column_int(&q, 2); |
| 1281 | 1302 | crnlOk = db_column_int(&q, 3); |
| 1282 | 1303 | chnged = db_column_int(&q, 4); |
| 1283 | - binOk = binaryOk || db_column_int(&q, 5); | |
| 1304 | + binOk = db_column_int(&q, 5); | |
| 1284 | 1305 | unicodeOk = db_column_int(&q, 6); |
| 1285 | 1306 | |
| 1286 | 1307 | blob_zero(&content); |
| 1287 | 1308 | if( file_wd_islink(zFullname) ){ |
| 1288 | 1309 | /* Instead of file content, put link destination path */ |
| @@ -1311,11 +1332,12 @@ | ||
| 1311 | 1332 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); |
| 1312 | 1333 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 1313 | 1334 | } |
| 1314 | 1335 | db_finalize(&q); |
| 1315 | 1336 | if( nConflict && !allowConflict ){ |
| 1316 | - fossil_fatal("abort due to unresolve merge conflicts"); | |
| 1337 | + fossil_fatal("abort due to unresolved merge conflicts; " | |
| 1338 | + "use --allow-conflict to override"); | |
| 1317 | 1339 | } |
| 1318 | 1340 | |
| 1319 | 1341 | /* Create the new manifest */ |
| 1320 | 1342 | if( blob_size(&comment)==0 ){ |
| 1321 | 1343 | blob_append(&comment, "(no comment)", -1); |
| @@ -1322,11 +1344,11 @@ | ||
| 1322 | 1344 | } |
| 1323 | 1345 | if( forceDelta ){ |
| 1324 | 1346 | blob_zero(&manifest); |
| 1325 | 1347 | }else{ |
| 1326 | 1348 | create_manifest(&manifest, 0, 0, &comment, vid, |
| 1327 | - !forceFlag, useCksum ? &cksum1 : 0, | |
| 1349 | + !allowOlder && !forceFlag, useCksum ? &cksum1 : 0, | |
| 1328 | 1350 | zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, |
| 1329 | 1351 | azTag, &szB); |
| 1330 | 1352 | } |
| 1331 | 1353 | |
| 1332 | 1354 | /* See if a delta-manifest would be more appropriate */ |
| @@ -1343,11 +1365,11 @@ | ||
| 1343 | 1365 | pBaseline = pParent; |
| 1344 | 1366 | } |
| 1345 | 1367 | if( pBaseline ){ |
| 1346 | 1368 | Blob delta; |
| 1347 | 1369 | create_manifest(&delta, zBaselineUuid, pBaseline, &comment, vid, |
| 1348 | - !forceFlag, useCksum ? &cksum1 : 0, | |
| 1370 | + !allowOlder && !forceFlag, useCksum ? &cksum1 : 0, | |
| 1349 | 1371 | zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, |
| 1350 | 1372 | azTag, &szD); |
| 1351 | 1373 | /* |
| 1352 | 1374 | ** At this point, two manifests have been constructed, either of |
| 1353 | 1375 | ** which would work for this checkin. The first manifest (held |
| 1354 | 1376 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -656,11 +656,11 @@ | |
| 656 | " AND type='ci' AND objid=%d", |
| 657 | zDate, rid |
| 658 | ); |
| 659 | if( b ){ |
| 660 | fossil_fatal("ancestor check-in [%.10s] (%s) is not older (clock skew?)" |
| 661 | " Use -f to override.", zUuid, zDate); |
| 662 | } |
| 663 | #endif |
| 664 | } |
| 665 | |
| 666 | /* |
| @@ -987,32 +987,45 @@ | |
| 987 | ** |
| 988 | ** The --bgcolor option works like --branchcolor but only sets the |
| 989 | ** background color for a single check-in. Subsequent check-ins revert |
| 990 | ** to the default color. |
| 991 | ** |
| 992 | ** A check-in is not permitted to fork unless the --force or -f |
| 993 | ** option appears. A check-in is not allowed against a closed leaf. |
| 994 | ** |
| 995 | ** The --private option creates a private check-in that is never synced. |
| 996 | ** Children of private check-ins are automatically private. |
| 997 | ** |
| 998 | ** the --tag option applies the symbolic tag name to the check-in. |
| 999 | ** |
| 1000 | ** Options: |
| 1001 | ** --baseline use a baseline manifest in the commit process |
| 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){ |
| 1018 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1024,15 +1037,17 @@ | |
| 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 */ |
| 1038 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1062,15 +1077,18 @@ | |
| 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 ){ |
| 1073 | if( zTag[0]==0 ) continue; |
| 1074 | azTag = fossil_realloc((void *)azTag, sizeof(char*)*(nTag+2)); |
| 1075 | azTag[nTag++] = zTag; |
| 1076 | azTag[nTag] = 0; |
| @@ -1081,11 +1099,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); |
| @@ -1188,34 +1205,38 @@ | |
| 1188 | } |
| 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 | */ |
| 1200 | if( g.aCommitFile |
| 1201 | && !forceFlag |
| 1202 | && !db_exists( |
| 1203 | "SELECT 1 FROM vfile " |
| 1204 | " WHERE is_selected(id)" |
| 1205 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname)") |
| 1206 | ){ |
| 1207 | fossil_fatal("none of the selected files have changed; use -f" |
| 1208 | " or --force."); |
| 1209 | } |
| 1210 | |
| 1211 | /* |
| 1212 | ** Do not allow a commit that will cause a fork unless the --force flag |
| 1213 | ** is used or unless this is a private check-in. |
| 1214 | */ |
| 1215 | if( zBranch==0 && forceFlag==0 && g.markPrivate==0 && !is_a_leaf(vid) ){ |
| 1216 | fossil_fatal("would fork. \"update\" first or use -f or --force."); |
| 1217 | } |
| 1218 | |
| 1219 | /* |
| 1220 | ** Do not allow a commit against a closed leaf |
| 1221 | */ |
| @@ -1278,11 +1299,11 @@ | |
| 1278 | id = db_column_int(&q, 0); |
| 1279 | zFullname = db_column_text(&q, 1); |
| 1280 | rid = db_column_int(&q, 2); |
| 1281 | crnlOk = db_column_int(&q, 3); |
| 1282 | chnged = db_column_int(&q, 4); |
| 1283 | binOk = binaryOk || db_column_int(&q, 5); |
| 1284 | unicodeOk = db_column_int(&q, 6); |
| 1285 | |
| 1286 | blob_zero(&content); |
| 1287 | if( file_wd_islink(zFullname) ){ |
| 1288 | /* Instead of file content, put link destination path */ |
| @@ -1311,11 +1332,12 @@ | |
| 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,11 +1344,11 @@ | |
| 1322 | } |
| 1323 | if( forceDelta ){ |
| 1324 | blob_zero(&manifest); |
| 1325 | }else{ |
| 1326 | create_manifest(&manifest, 0, 0, &comment, vid, |
| 1327 | !forceFlag, useCksum ? &cksum1 : 0, |
| 1328 | zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, |
| 1329 | azTag, &szB); |
| 1330 | } |
| 1331 | |
| 1332 | /* See if a delta-manifest would be more appropriate */ |
| @@ -1343,11 +1365,11 @@ | |
| 1343 | pBaseline = pParent; |
| 1344 | } |
| 1345 | if( pBaseline ){ |
| 1346 | Blob delta; |
| 1347 | create_manifest(&delta, zBaselineUuid, pBaseline, &comment, vid, |
| 1348 | !forceFlag, useCksum ? &cksum1 : 0, |
| 1349 | zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, |
| 1350 | azTag, &szD); |
| 1351 | /* |
| 1352 | ** At this point, two manifests have been constructed, either of |
| 1353 | ** which would work for this checkin. The first manifest (held |
| 1354 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -656,11 +656,11 @@ | |
| 656 | " AND type='ci' AND objid=%d", |
| 657 | zDate, rid |
| 658 | ); |
| 659 | if( b ){ |
| 660 | fossil_fatal("ancestor check-in [%.10s] (%s) is not older (clock skew?)" |
| 661 | " Use --allow-older to override.", zUuid, zDate); |
| 662 | } |
| 663 | #endif |
| 664 | } |
| 665 | |
| 666 | /* |
| @@ -987,32 +987,45 @@ | |
| 987 | ** |
| 988 | ** The --bgcolor option works like --branchcolor but only sets the |
| 989 | ** background color for a single check-in. Subsequent check-ins revert |
| 990 | ** to the default color. |
| 991 | ** |
| 992 | ** A check-in is not permitted to fork unless the --allow-fork option |
| 993 | ** appears. An empty check-in (i.e. with nothing changed) is not |
| 994 | ** allowed unless the --allow-empty option appears. A check-in may not |
| 995 | ** be older than its ancestor unless the --allow-older option appears. |
| 996 | ** If any of files in the check-in appear to contain unresolved merge |
| 997 | ** conflicts, the check-in will not be allowed unless the |
| 998 | ** --allow-conflict option is present. In addition, the entire |
| 999 | ** check-in process may be aborted if a file contains content that |
| 1000 | ** appears to be binary, Unicode text, or text with CR/NL line endings |
| 1001 | ** unless the interactive user chooses to proceed. If there is no |
| 1002 | ** interactive user or these warnings should be skipped for some other |
| 1003 | ** reason, the --no-warnings option may be used. A check-in is not |
| 1004 | ** allowed against a closed leaf. |
| 1005 | ** |
| 1006 | ** The --private option creates a private check-in that is never synced. |
| 1007 | ** Children of private check-ins are automatically private. |
| 1008 | ** |
| 1009 | ** the --tag option applies the symbolic tag name to the check-in. |
| 1010 | ** |
| 1011 | ** Options: |
| 1012 | ** --allow-conflict allow unresolved merge conflicts |
| 1013 | ** --allow-empty allow a commit with no changes |
| 1014 | ** --allow-fork allow the commit to fork |
| 1015 | ** --allow-older allow a commit older than its ancestor |
| 1016 | ** --baseline use a baseline manifest in the commit process |
| 1017 | ** --bgcolor COLOR apply COLOR to this one check-in only |
| 1018 | ** --branch NEW-BRANCH-NAME check in to this new branch |
| 1019 | ** --branchcolor COLOR apply given COLOR to the branch |
| 1020 | ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment |
| 1021 | ** --delta use a delta manifest in the commit process |
| 1022 | ** --message-file|-M FILE read the commit comment from given file |
| 1023 | ** --no-warnings omit all warnings about file contents |
| 1024 | ** --nosign do not attempt to sign this commit with gpg |
| 1025 | ** --private do not sync changes and their descendants |
| 1026 | ** --tag TAG-NAME assign given tag TAG-NAME to the checkin |
| 1027 | ** |
| 1028 | ** See also: branch, changes, checkout, extra, sync |
| 1029 | */ |
| 1030 | void commit_cmd(void){ |
| 1031 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1024,15 +1037,17 @@ | |
| 1037 | Stmt q; /* Query to find files that have been modified */ |
| 1038 | char *zUuid; /* UUID of the new check-in */ |
| 1039 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1040 | int isAMerge = 0; /* True if checking in a merge */ |
| 1041 | int noWarningFlag = 0; /* True if skipping all warnings */ |
| 1042 | int forceFlag = 0; /* Undocumented: Disables all checks */ |
| 1043 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1044 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1045 | int allowConflict = 0; /* Allow unresolve merge conflicts */ |
| 1046 | int allowEmpty = 0; /* Allow a commit with no changes */ |
| 1047 | int allowFork = 0; /* Allow the commit to fork */ |
| 1048 | int allowOlder = 0; /* Allow a commit older than its ancestor */ |
| 1049 | char *zManifestFile; /* Name of the manifest file */ |
| 1050 | int useCksum; /* True if checksums should be computed and verified */ |
| 1051 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1052 | int testRun; /* True for a test run. Debugging only */ |
| 1053 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1062,15 +1077,18 @@ | |
| 1077 | fossil_fatal("cannot use --delta and --baseline together"); |
| 1078 | } |
| 1079 | testRun = find_option("test",0,0)!=0; |
| 1080 | zComment = find_option("comment","m",1); |
| 1081 | forceFlag = find_option("force", "f", 0)!=0; |
| 1082 | allowConflict = find_option("allow-conflict",0,0)!=0; |
| 1083 | allowEmpty = find_option("allow-empty",0,0)!=0; |
| 1084 | allowFork = find_option("allow-fork",0,0)!=0; |
| 1085 | allowOlder = find_option("allow-older",0,0)!=0; |
| 1086 | noWarningFlag = find_option("no-warnings", 0, 0)!=0; |
| 1087 | zBranch = find_option("branch","b",1); |
| 1088 | zColor = find_option("bgcolor",0,1); |
| 1089 | zBrClr = find_option("branchcolor",0,1); |
| 1090 | while( (zTag = find_option("tag",0,1))!=0 ){ |
| 1091 | if( zTag[0]==0 ) continue; |
| 1092 | azTag = fossil_realloc((void *)azTag, sizeof(char*)*(nTag+2)); |
| 1093 | azTag[nTag++] = zTag; |
| 1094 | azTag[nTag] = 0; |
| @@ -1081,11 +1099,10 @@ | |
| 1099 | if( zBranch==0 ) zBranch = "private"; |
| 1100 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 1101 | } |
| 1102 | zDateOvrd = find_option("date-override",0,1); |
| 1103 | zUserOvrd = find_option("user-override",0,1); |
| 1104 | db_must_be_within_tree(); |
| 1105 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1106 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1107 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1108 | outputManifest = db_get_boolean("manifest", 0); |
| @@ -1188,34 +1205,38 @@ | |
| 1205 | } |
| 1206 | |
| 1207 | hasChanges = unsaved_changes(); |
| 1208 | db_begin_transaction(); |
| 1209 | db_record_repository_filename(0); |
| 1210 | if( hasChanges==0 && !isAMerge && !allowEmpty && !forceFlag ){ |
| 1211 | fossil_fatal("nothing has changed; use --allow-empty to override"); |
| 1212 | } |
| 1213 | |
| 1214 | /* If none of the files that were named on the command line have |
| 1215 | ** been modified, bail out now unless the --allow-empty or --force |
| 1216 | ** flags is used. |
| 1217 | */ |
| 1218 | if( g.aCommitFile |
| 1219 | && !allowEmpty |
| 1220 | && !forceFlag |
| 1221 | && !db_exists( |
| 1222 | "SELECT 1 FROM vfile " |
| 1223 | " WHERE is_selected(id)" |
| 1224 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname)") |
| 1225 | ){ |
| 1226 | fossil_fatal("none of the selected files have changed; use " |
| 1227 | "--allow-empty to override."); |
| 1228 | } |
| 1229 | |
| 1230 | /* |
| 1231 | ** Do not allow a commit that will cause a fork unless the --allow-fork |
| 1232 | ** or --force flags is used, or unless this is a private check-in. |
| 1233 | */ |
| 1234 | if( zBranch==0 && allowFork==0 && forceFlag==0 |
| 1235 | && g.markPrivate==0 && !is_a_leaf(vid) |
| 1236 | ){ |
| 1237 | fossil_fatal("would fork. \"update\" first or use --allow-fork."); |
| 1238 | } |
| 1239 | |
| 1240 | /* |
| 1241 | ** Do not allow a commit against a closed leaf |
| 1242 | */ |
| @@ -1278,11 +1299,11 @@ | |
| 1299 | id = db_column_int(&q, 0); |
| 1300 | zFullname = db_column_text(&q, 1); |
| 1301 | rid = db_column_int(&q, 2); |
| 1302 | crnlOk = db_column_int(&q, 3); |
| 1303 | chnged = db_column_int(&q, 4); |
| 1304 | binOk = db_column_int(&q, 5); |
| 1305 | unicodeOk = db_column_int(&q, 6); |
| 1306 | |
| 1307 | blob_zero(&content); |
| 1308 | if( file_wd_islink(zFullname) ){ |
| 1309 | /* Instead of file content, put link destination path */ |
| @@ -1311,11 +1332,12 @@ | |
| 1332 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); |
| 1333 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 1334 | } |
| 1335 | db_finalize(&q); |
| 1336 | if( nConflict && !allowConflict ){ |
| 1337 | fossil_fatal("abort due to unresolved merge conflicts; " |
| 1338 | "use --allow-conflict to override"); |
| 1339 | } |
| 1340 | |
| 1341 | /* Create the new manifest */ |
| 1342 | if( blob_size(&comment)==0 ){ |
| 1343 | blob_append(&comment, "(no comment)", -1); |
| @@ -1322,11 +1344,11 @@ | |
| 1344 | } |
| 1345 | if( forceDelta ){ |
| 1346 | blob_zero(&manifest); |
| 1347 | }else{ |
| 1348 | create_manifest(&manifest, 0, 0, &comment, vid, |
| 1349 | !allowOlder && !forceFlag, useCksum ? &cksum1 : 0, |
| 1350 | zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, |
| 1351 | azTag, &szB); |
| 1352 | } |
| 1353 | |
| 1354 | /* See if a delta-manifest would be more appropriate */ |
| @@ -1343,11 +1365,11 @@ | |
| 1365 | pBaseline = pParent; |
| 1366 | } |
| 1367 | if( pBaseline ){ |
| 1368 | Blob delta; |
| 1369 | create_manifest(&delta, zBaselineUuid, pBaseline, &comment, vid, |
| 1370 | !allowOlder && !forceFlag, useCksum ? &cksum1 : 0, |
| 1371 | zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, |
| 1372 | azTag, &szD); |
| 1373 | /* |
| 1374 | ** At this point, two manifests have been constructed, either of |
| 1375 | ** which would work for this checkin. The first manifest (held |
| 1376 |