Fossil SCM
merge trunk
Commit
c7703868b39b825e08944bb77fadee014941755e
Parent
7f939bd8d714805…
12 files changed
+1
-1
+20
-3
+20
-3
+2
-2
+2
-2
+29
-10
+49
-12
+8
-8
+1
+78
-17
+70
+1
-1
M
VERSION
+1
-1
| --- VERSION | ||
| +++ VERSION | ||
| @@ -1,1 +1,1 @@ | ||
| 1 | -1.23 | |
| 1 | +1.24 | |
| 2 | 2 |
| --- VERSION | |
| +++ VERSION | |
| @@ -1,1 +1,1 @@ | |
| 1 | 1.23 |
| 2 |
| --- VERSION | |
| +++ VERSION | |
| @@ -1,1 +1,1 @@ | |
| 1 | 1.24 |
| 2 |
+20
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -87,11 +87,15 @@ | ||
| 87 | 87 | }else if( isChnged==2 ){ |
| 88 | 88 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 89 | 89 | }else if( isChnged==3 ){ |
| 90 | 90 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 91 | 91 | }else if( isChnged==1 ){ |
| 92 | - blob_appendf(report, "EDITED %s\n", zDisplayName); | |
| 92 | + if( file_contains_merge_marker(zFullName) ){ | |
| 93 | + blob_appendf(report, "CONFLICT %s\n", zDisplayName); | |
| 94 | + }else{ | |
| 95 | + blob_appendf(report, "EDITED %s\n", zDisplayName); | |
| 96 | + } | |
| 93 | 97 | }else if( isRenamed ){ |
| 94 | 98 | blob_appendf(report, "RENAMED %s\n", zDisplayName); |
| 95 | 99 | } |
| 96 | 100 | free(zFullName); |
| 97 | 101 | } |
| @@ -986,10 +990,11 @@ | ||
| 986 | 990 | ** --force|-f allow forking with this commit |
| 987 | 991 | ** --message-file|-M FILE read the commit comment from given file |
| 988 | 992 | ** --nosign do not attempt to sign this commit with gpg |
| 989 | 993 | ** --private do not sync changes and their descendants |
| 990 | 994 | ** --tag TAG-NAME assign given tag TAG-NAME to the checkin |
| 995 | +** --conflict allow unresolved merge conflicts | |
| 991 | 996 | ** |
| 992 | 997 | ** See also: branch, changes, checkout, extra, sync |
| 993 | 998 | */ |
| 994 | 999 | void commit_cmd(void){ |
| 995 | 1000 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1003,10 +1008,11 @@ | ||
| 1003 | 1008 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1004 | 1009 | int isAMerge = 0; /* True if checking in a merge */ |
| 1005 | 1010 | int forceFlag = 0; /* Force a fork */ |
| 1006 | 1011 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1007 | 1012 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1013 | + int allowConflict = 0; /* Allow unresolve merge conflicts */ | |
| 1008 | 1014 | char *zManifestFile; /* Name of the manifest file */ |
| 1009 | 1015 | int useCksum; /* True if checksums should be computed and verified */ |
| 1010 | 1016 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1011 | 1017 | int testRun; /* True for a test run. Debugging only */ |
| 1012 | 1018 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1022,10 +1028,11 @@ | ||
| 1022 | 1028 | Blob muuid; /* Manifest uuid */ |
| 1023 | 1029 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 1024 | 1030 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 1025 | 1031 | int szD; /* Size of the delta manifest */ |
| 1026 | 1032 | int szB; /* Size of the baseline manifest */ |
| 1033 | + int nConflict = 0; /* Number of unresolved merge conflicts */ | |
| 1027 | 1034 | |
| 1028 | 1035 | url_proxy_options(); |
| 1029 | 1036 | noSign = find_option("nosign",0,0)!=0; |
| 1030 | 1037 | forceDelta = find_option("delta",0,0)!=0; |
| 1031 | 1038 | forceBaseline = find_option("baseline",0,0)!=0; |
| @@ -1050,10 +1057,11 @@ | ||
| 1050 | 1057 | if( zBranch==0 ) zBranch = "private"; |
| 1051 | 1058 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 1052 | 1059 | } |
| 1053 | 1060 | zDateOvrd = find_option("date-override",0,1); |
| 1054 | 1061 | zUserOvrd = find_option("user-override",0,1); |
| 1062 | + allowConflict = find_option("conflict",0,0)!=0; | |
| 1055 | 1063 | db_must_be_within_tree(); |
| 1056 | 1064 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1057 | 1065 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1058 | 1066 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1059 | 1067 | outputManifest = db_get_boolean("manifest", 0); |
| @@ -1255,42 +1263,51 @@ | ||
| 1255 | 1263 | /* Step 1: Insert records for all modified files into the blob |
| 1256 | 1264 | ** table. If there were arguments passed to this command, only |
| 1257 | 1265 | ** the identified fils are inserted (if they have been modified). |
| 1258 | 1266 | */ |
| 1259 | 1267 | db_prepare(&q, |
| 1260 | - "SELECT id, %Q || pathname, mrid, %s FROM vfile " | |
| 1268 | + "SELECT id, %Q || pathname, mrid, %s, chnged FROM vfile " | |
| 1261 | 1269 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1262 | 1270 | g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")) |
| 1263 | 1271 | ); |
| 1264 | 1272 | while( db_step(&q)==SQLITE_ROW ){ |
| 1265 | 1273 | int id, rid; |
| 1266 | 1274 | const char *zFullname; |
| 1267 | 1275 | Blob content; |
| 1268 | - int crnlOk; | |
| 1276 | + int crnlOk, chnged; | |
| 1269 | 1277 | |
| 1270 | 1278 | id = db_column_int(&q, 0); |
| 1271 | 1279 | zFullname = db_column_text(&q, 1); |
| 1272 | 1280 | rid = db_column_int(&q, 2); |
| 1273 | 1281 | crnlOk = db_column_int(&q, 3); |
| 1282 | + chnged = db_column_int(&q, 4); | |
| 1274 | 1283 | |
| 1275 | 1284 | blob_zero(&content); |
| 1276 | 1285 | if( file_wd_islink(zFullname) ){ |
| 1277 | 1286 | /* Instead of file content, put link destination path */ |
| 1278 | 1287 | blob_read_link(&content, zFullname); |
| 1279 | 1288 | }else{ |
| 1280 | 1289 | blob_read_from_file(&content, zFullname); |
| 1281 | 1290 | } |
| 1282 | 1291 | if( !crnlOk ) cr_warning(&content, zFullname); |
| 1292 | + if( chnged==1 && contains_merge_marker(&content) ){ | |
| 1293 | + nConflict++; | |
| 1294 | + fossil_print("possible unresolved merge conflict in %s\n", | |
| 1295 | + zFullname+strlen(g.zLocalRoot)); | |
| 1296 | + } | |
| 1283 | 1297 | nrid = content_put(&content); |
| 1284 | 1298 | blob_reset(&content); |
| 1285 | 1299 | if( rid>0 ){ |
| 1286 | 1300 | content_deltify(rid, nrid, 0); |
| 1287 | 1301 | } |
| 1288 | 1302 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); |
| 1289 | 1303 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 1290 | 1304 | } |
| 1291 | 1305 | db_finalize(&q); |
| 1306 | + if( nConflict && !allowConflict ){ | |
| 1307 | + fossil_fatal("abort due to unresolve merge conflicts"); | |
| 1308 | + } | |
| 1292 | 1309 | |
| 1293 | 1310 | /* Create the new manifest */ |
| 1294 | 1311 | if( blob_size(&comment)==0 ){ |
| 1295 | 1312 | blob_append(&comment, "(no comment)", -1); |
| 1296 | 1313 | } |
| 1297 | 1314 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -87,11 +87,15 @@ | |
| 87 | }else if( isChnged==2 ){ |
| 88 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 89 | }else if( isChnged==3 ){ |
| 90 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 91 | }else if( isChnged==1 ){ |
| 92 | blob_appendf(report, "EDITED %s\n", zDisplayName); |
| 93 | }else if( isRenamed ){ |
| 94 | blob_appendf(report, "RENAMED %s\n", zDisplayName); |
| 95 | } |
| 96 | free(zFullName); |
| 97 | } |
| @@ -986,10 +990,11 @@ | |
| 986 | ** --force|-f allow forking with this commit |
| 987 | ** --message-file|-M FILE read the commit comment from given file |
| 988 | ** --nosign do not attempt to sign this commit with gpg |
| 989 | ** --private do not sync changes and their descendants |
| 990 | ** --tag TAG-NAME assign given tag TAG-NAME to the checkin |
| 991 | ** |
| 992 | ** See also: branch, changes, checkout, extra, sync |
| 993 | */ |
| 994 | void commit_cmd(void){ |
| 995 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1003,10 +1008,11 @@ | |
| 1003 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1004 | int isAMerge = 0; /* True if checking in a merge */ |
| 1005 | int forceFlag = 0; /* Force a fork */ |
| 1006 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1007 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1008 | char *zManifestFile; /* Name of the manifest file */ |
| 1009 | int useCksum; /* True if checksums should be computed and verified */ |
| 1010 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1011 | int testRun; /* True for a test run. Debugging only */ |
| 1012 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1022,10 +1028,11 @@ | |
| 1022 | Blob muuid; /* Manifest uuid */ |
| 1023 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 1024 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 1025 | int szD; /* Size of the delta manifest */ |
| 1026 | int szB; /* Size of the baseline manifest */ |
| 1027 | |
| 1028 | url_proxy_options(); |
| 1029 | noSign = find_option("nosign",0,0)!=0; |
| 1030 | forceDelta = find_option("delta",0,0)!=0; |
| 1031 | forceBaseline = find_option("baseline",0,0)!=0; |
| @@ -1050,10 +1057,11 @@ | |
| 1050 | if( zBranch==0 ) zBranch = "private"; |
| 1051 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 1052 | } |
| 1053 | zDateOvrd = find_option("date-override",0,1); |
| 1054 | zUserOvrd = find_option("user-override",0,1); |
| 1055 | db_must_be_within_tree(); |
| 1056 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1057 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1058 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1059 | outputManifest = db_get_boolean("manifest", 0); |
| @@ -1255,42 +1263,51 @@ | |
| 1255 | /* Step 1: Insert records for all modified files into the blob |
| 1256 | ** table. If there were arguments passed to this command, only |
| 1257 | ** the identified fils are inserted (if they have been modified). |
| 1258 | */ |
| 1259 | db_prepare(&q, |
| 1260 | "SELECT id, %Q || pathname, mrid, %s FROM vfile " |
| 1261 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1262 | g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")) |
| 1263 | ); |
| 1264 | while( db_step(&q)==SQLITE_ROW ){ |
| 1265 | int id, rid; |
| 1266 | const char *zFullname; |
| 1267 | Blob content; |
| 1268 | int crnlOk; |
| 1269 | |
| 1270 | id = db_column_int(&q, 0); |
| 1271 | zFullname = db_column_text(&q, 1); |
| 1272 | rid = db_column_int(&q, 2); |
| 1273 | crnlOk = db_column_int(&q, 3); |
| 1274 | |
| 1275 | blob_zero(&content); |
| 1276 | if( file_wd_islink(zFullname) ){ |
| 1277 | /* Instead of file content, put link destination path */ |
| 1278 | blob_read_link(&content, zFullname); |
| 1279 | }else{ |
| 1280 | blob_read_from_file(&content, zFullname); |
| 1281 | } |
| 1282 | if( !crnlOk ) cr_warning(&content, zFullname); |
| 1283 | nrid = content_put(&content); |
| 1284 | blob_reset(&content); |
| 1285 | if( rid>0 ){ |
| 1286 | content_deltify(rid, nrid, 0); |
| 1287 | } |
| 1288 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); |
| 1289 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 1290 | } |
| 1291 | db_finalize(&q); |
| 1292 | |
| 1293 | /* Create the new manifest */ |
| 1294 | if( blob_size(&comment)==0 ){ |
| 1295 | blob_append(&comment, "(no comment)", -1); |
| 1296 | } |
| 1297 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -87,11 +87,15 @@ | |
| 87 | }else if( isChnged==2 ){ |
| 88 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 89 | }else if( isChnged==3 ){ |
| 90 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 91 | }else if( isChnged==1 ){ |
| 92 | if( file_contains_merge_marker(zFullName) ){ |
| 93 | blob_appendf(report, "CONFLICT %s\n", zDisplayName); |
| 94 | }else{ |
| 95 | blob_appendf(report, "EDITED %s\n", zDisplayName); |
| 96 | } |
| 97 | }else if( isRenamed ){ |
| 98 | blob_appendf(report, "RENAMED %s\n", zDisplayName); |
| 99 | } |
| 100 | free(zFullName); |
| 101 | } |
| @@ -986,10 +990,11 @@ | |
| 990 | ** --force|-f allow forking with this commit |
| 991 | ** --message-file|-M FILE read the commit comment from given file |
| 992 | ** --nosign do not attempt to sign this commit with gpg |
| 993 | ** --private do not sync changes and their descendants |
| 994 | ** --tag TAG-NAME assign given tag TAG-NAME to the checkin |
| 995 | ** --conflict allow unresolved merge conflicts |
| 996 | ** |
| 997 | ** See also: branch, changes, checkout, extra, sync |
| 998 | */ |
| 999 | void commit_cmd(void){ |
| 1000 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1003,10 +1008,11 @@ | |
| 1008 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1009 | int isAMerge = 0; /* True if checking in a merge */ |
| 1010 | int forceFlag = 0; /* Force a fork */ |
| 1011 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1012 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1013 | int allowConflict = 0; /* Allow unresolve merge conflicts */ |
| 1014 | char *zManifestFile; /* Name of the manifest file */ |
| 1015 | int useCksum; /* True if checksums should be computed and verified */ |
| 1016 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1017 | int testRun; /* True for a test run. Debugging only */ |
| 1018 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1022,10 +1028,11 @@ | |
| 1028 | Blob muuid; /* Manifest uuid */ |
| 1029 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 1030 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 1031 | int szD; /* Size of the delta manifest */ |
| 1032 | int szB; /* Size of the baseline manifest */ |
| 1033 | int nConflict = 0; /* Number of unresolved merge conflicts */ |
| 1034 | |
| 1035 | url_proxy_options(); |
| 1036 | noSign = find_option("nosign",0,0)!=0; |
| 1037 | forceDelta = find_option("delta",0,0)!=0; |
| 1038 | forceBaseline = find_option("baseline",0,0)!=0; |
| @@ -1050,10 +1057,11 @@ | |
| 1057 | if( zBranch==0 ) zBranch = "private"; |
| 1058 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 1059 | } |
| 1060 | zDateOvrd = find_option("date-override",0,1); |
| 1061 | zUserOvrd = find_option("user-override",0,1); |
| 1062 | allowConflict = find_option("conflict",0,0)!=0; |
| 1063 | db_must_be_within_tree(); |
| 1064 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1065 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1066 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1067 | outputManifest = db_get_boolean("manifest", 0); |
| @@ -1255,42 +1263,51 @@ | |
| 1263 | /* Step 1: Insert records for all modified files into the blob |
| 1264 | ** table. If there were arguments passed to this command, only |
| 1265 | ** the identified fils are inserted (if they have been modified). |
| 1266 | */ |
| 1267 | db_prepare(&q, |
| 1268 | "SELECT id, %Q || pathname, mrid, %s, chnged FROM vfile " |
| 1269 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1270 | g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")) |
| 1271 | ); |
| 1272 | while( db_step(&q)==SQLITE_ROW ){ |
| 1273 | int id, rid; |
| 1274 | const char *zFullname; |
| 1275 | Blob content; |
| 1276 | int crnlOk, chnged; |
| 1277 | |
| 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 | |
| 1284 | blob_zero(&content); |
| 1285 | if( file_wd_islink(zFullname) ){ |
| 1286 | /* Instead of file content, put link destination path */ |
| 1287 | blob_read_link(&content, zFullname); |
| 1288 | }else{ |
| 1289 | blob_read_from_file(&content, zFullname); |
| 1290 | } |
| 1291 | if( !crnlOk ) cr_warning(&content, zFullname); |
| 1292 | if( chnged==1 && contains_merge_marker(&content) ){ |
| 1293 | nConflict++; |
| 1294 | fossil_print("possible unresolved merge conflict in %s\n", |
| 1295 | zFullname+strlen(g.zLocalRoot)); |
| 1296 | } |
| 1297 | nrid = content_put(&content); |
| 1298 | blob_reset(&content); |
| 1299 | if( rid>0 ){ |
| 1300 | content_deltify(rid, nrid, 0); |
| 1301 | } |
| 1302 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); |
| 1303 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 1304 | } |
| 1305 | db_finalize(&q); |
| 1306 | if( nConflict && !allowConflict ){ |
| 1307 | fossil_fatal("abort due to unresolve merge conflicts"); |
| 1308 | } |
| 1309 | |
| 1310 | /* Create the new manifest */ |
| 1311 | if( blob_size(&comment)==0 ){ |
| 1312 | blob_append(&comment, "(no comment)", -1); |
| 1313 | } |
| 1314 |
+20
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -87,11 +87,15 @@ | ||
| 87 | 87 | }else if( isChnged==2 ){ |
| 88 | 88 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 89 | 89 | }else if( isChnged==3 ){ |
| 90 | 90 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 91 | 91 | }else if( isChnged==1 ){ |
| 92 | - blob_appendf(report, "EDITED %s\n", zDisplayName); | |
| 92 | + if( file_contains_merge_marker(zFullName) ){ | |
| 93 | + blob_appendf(report, "CONFLICT %s\n", zDisplayName); | |
| 94 | + }else{ | |
| 95 | + blob_appendf(report, "EDITED %s\n", zDisplayName); | |
| 96 | + } | |
| 93 | 97 | }else if( isRenamed ){ |
| 94 | 98 | blob_appendf(report, "RENAMED %s\n", zDisplayName); |
| 95 | 99 | } |
| 96 | 100 | free(zFullName); |
| 97 | 101 | } |
| @@ -986,10 +990,11 @@ | ||
| 986 | 990 | ** --force|-f allow forking with this commit |
| 987 | 991 | ** --message-file|-M FILE read the commit comment from given file |
| 988 | 992 | ** --nosign do not attempt to sign this commit with gpg |
| 989 | 993 | ** --private do not sync changes and their descendants |
| 990 | 994 | ** --tag TAG-NAME assign given tag TAG-NAME to the checkin |
| 995 | +** --conflict allow unresolved merge conflicts | |
| 991 | 996 | ** |
| 992 | 997 | ** See also: branch, changes, checkout, extra, sync |
| 993 | 998 | */ |
| 994 | 999 | void commit_cmd(void){ |
| 995 | 1000 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1003,10 +1008,11 @@ | ||
| 1003 | 1008 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1004 | 1009 | int isAMerge = 0; /* True if checking in a merge */ |
| 1005 | 1010 | int forceFlag = 0; /* Force a fork */ |
| 1006 | 1011 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1007 | 1012 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1013 | + int allowConflict = 0; /* Allow unresolve merge conflicts */ | |
| 1008 | 1014 | char *zManifestFile; /* Name of the manifest file */ |
| 1009 | 1015 | int useCksum; /* True if checksums should be computed and verified */ |
| 1010 | 1016 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1011 | 1017 | int testRun; /* True for a test run. Debugging only */ |
| 1012 | 1018 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1022,10 +1028,11 @@ | ||
| 1022 | 1028 | Blob muuid; /* Manifest uuid */ |
| 1023 | 1029 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 1024 | 1030 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 1025 | 1031 | int szD; /* Size of the delta manifest */ |
| 1026 | 1032 | int szB; /* Size of the baseline manifest */ |
| 1033 | + int nConflict = 0; /* Number of unresolved merge conflicts */ | |
| 1027 | 1034 | |
| 1028 | 1035 | url_proxy_options(); |
| 1029 | 1036 | noSign = find_option("nosign",0,0)!=0; |
| 1030 | 1037 | forceDelta = find_option("delta",0,0)!=0; |
| 1031 | 1038 | forceBaseline = find_option("baseline",0,0)!=0; |
| @@ -1050,10 +1057,11 @@ | ||
| 1050 | 1057 | if( zBranch==0 ) zBranch = "private"; |
| 1051 | 1058 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 1052 | 1059 | } |
| 1053 | 1060 | zDateOvrd = find_option("date-override",0,1); |
| 1054 | 1061 | zUserOvrd = find_option("user-override",0,1); |
| 1062 | + allowConflict = find_option("conflict",0,0)!=0; | |
| 1055 | 1063 | db_must_be_within_tree(); |
| 1056 | 1064 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1057 | 1065 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1058 | 1066 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1059 | 1067 | outputManifest = db_get_boolean("manifest", 0); |
| @@ -1255,42 +1263,51 @@ | ||
| 1255 | 1263 | /* Step 1: Insert records for all modified files into the blob |
| 1256 | 1264 | ** table. If there were arguments passed to this command, only |
| 1257 | 1265 | ** the identified fils are inserted (if they have been modified). |
| 1258 | 1266 | */ |
| 1259 | 1267 | db_prepare(&q, |
| 1260 | - "SELECT id, %Q || pathname, mrid, %s FROM vfile " | |
| 1268 | + "SELECT id, %Q || pathname, mrid, %s, chnged FROM vfile " | |
| 1261 | 1269 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1262 | 1270 | g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")) |
| 1263 | 1271 | ); |
| 1264 | 1272 | while( db_step(&q)==SQLITE_ROW ){ |
| 1265 | 1273 | int id, rid; |
| 1266 | 1274 | const char *zFullname; |
| 1267 | 1275 | Blob content; |
| 1268 | - int crnlOk; | |
| 1276 | + int crnlOk, chnged; | |
| 1269 | 1277 | |
| 1270 | 1278 | id = db_column_int(&q, 0); |
| 1271 | 1279 | zFullname = db_column_text(&q, 1); |
| 1272 | 1280 | rid = db_column_int(&q, 2); |
| 1273 | 1281 | crnlOk = db_column_int(&q, 3); |
| 1282 | + chnged = db_column_int(&q, 4); | |
| 1274 | 1283 | |
| 1275 | 1284 | blob_zero(&content); |
| 1276 | 1285 | if( file_wd_islink(zFullname) ){ |
| 1277 | 1286 | /* Instead of file content, put link destination path */ |
| 1278 | 1287 | blob_read_link(&content, zFullname); |
| 1279 | 1288 | }else{ |
| 1280 | 1289 | blob_read_from_file(&content, zFullname); |
| 1281 | 1290 | } |
| 1282 | 1291 | if( !crnlOk ) cr_warning(&content, zFullname); |
| 1292 | + if( chnged==1 && contains_merge_marker(&content) ){ | |
| 1293 | + nConflict++; | |
| 1294 | + fossil_print("possible unresolved merge conflict in %s\n", | |
| 1295 | + zFullname+strlen(g.zLocalRoot)); | |
| 1296 | + } | |
| 1283 | 1297 | nrid = content_put(&content); |
| 1284 | 1298 | blob_reset(&content); |
| 1285 | 1299 | if( rid>0 ){ |
| 1286 | 1300 | content_deltify(rid, nrid, 0); |
| 1287 | 1301 | } |
| 1288 | 1302 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); |
| 1289 | 1303 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 1290 | 1304 | } |
| 1291 | 1305 | db_finalize(&q); |
| 1306 | + if( nConflict && !allowConflict ){ | |
| 1307 | + fossil_fatal("abort due to unresolve merge conflicts"); | |
| 1308 | + } | |
| 1292 | 1309 | |
| 1293 | 1310 | /* Create the new manifest */ |
| 1294 | 1311 | if( blob_size(&comment)==0 ){ |
| 1295 | 1312 | blob_append(&comment, "(no comment)", -1); |
| 1296 | 1313 | } |
| 1297 | 1314 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -87,11 +87,15 @@ | |
| 87 | }else if( isChnged==2 ){ |
| 88 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 89 | }else if( isChnged==3 ){ |
| 90 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 91 | }else if( isChnged==1 ){ |
| 92 | blob_appendf(report, "EDITED %s\n", zDisplayName); |
| 93 | }else if( isRenamed ){ |
| 94 | blob_appendf(report, "RENAMED %s\n", zDisplayName); |
| 95 | } |
| 96 | free(zFullName); |
| 97 | } |
| @@ -986,10 +990,11 @@ | |
| 986 | ** --force|-f allow forking with this commit |
| 987 | ** --message-file|-M FILE read the commit comment from given file |
| 988 | ** --nosign do not attempt to sign this commit with gpg |
| 989 | ** --private do not sync changes and their descendants |
| 990 | ** --tag TAG-NAME assign given tag TAG-NAME to the checkin |
| 991 | ** |
| 992 | ** See also: branch, changes, checkout, extra, sync |
| 993 | */ |
| 994 | void commit_cmd(void){ |
| 995 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1003,10 +1008,11 @@ | |
| 1003 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1004 | int isAMerge = 0; /* True if checking in a merge */ |
| 1005 | int forceFlag = 0; /* Force a fork */ |
| 1006 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1007 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1008 | char *zManifestFile; /* Name of the manifest file */ |
| 1009 | int useCksum; /* True if checksums should be computed and verified */ |
| 1010 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1011 | int testRun; /* True for a test run. Debugging only */ |
| 1012 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1022,10 +1028,11 @@ | |
| 1022 | Blob muuid; /* Manifest uuid */ |
| 1023 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 1024 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 1025 | int szD; /* Size of the delta manifest */ |
| 1026 | int szB; /* Size of the baseline manifest */ |
| 1027 | |
| 1028 | url_proxy_options(); |
| 1029 | noSign = find_option("nosign",0,0)!=0; |
| 1030 | forceDelta = find_option("delta",0,0)!=0; |
| 1031 | forceBaseline = find_option("baseline",0,0)!=0; |
| @@ -1050,10 +1057,11 @@ | |
| 1050 | if( zBranch==0 ) zBranch = "private"; |
| 1051 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 1052 | } |
| 1053 | zDateOvrd = find_option("date-override",0,1); |
| 1054 | zUserOvrd = find_option("user-override",0,1); |
| 1055 | db_must_be_within_tree(); |
| 1056 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1057 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1058 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1059 | outputManifest = db_get_boolean("manifest", 0); |
| @@ -1255,42 +1263,51 @@ | |
| 1255 | /* Step 1: Insert records for all modified files into the blob |
| 1256 | ** table. If there were arguments passed to this command, only |
| 1257 | ** the identified fils are inserted (if they have been modified). |
| 1258 | */ |
| 1259 | db_prepare(&q, |
| 1260 | "SELECT id, %Q || pathname, mrid, %s FROM vfile " |
| 1261 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1262 | g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")) |
| 1263 | ); |
| 1264 | while( db_step(&q)==SQLITE_ROW ){ |
| 1265 | int id, rid; |
| 1266 | const char *zFullname; |
| 1267 | Blob content; |
| 1268 | int crnlOk; |
| 1269 | |
| 1270 | id = db_column_int(&q, 0); |
| 1271 | zFullname = db_column_text(&q, 1); |
| 1272 | rid = db_column_int(&q, 2); |
| 1273 | crnlOk = db_column_int(&q, 3); |
| 1274 | |
| 1275 | blob_zero(&content); |
| 1276 | if( file_wd_islink(zFullname) ){ |
| 1277 | /* Instead of file content, put link destination path */ |
| 1278 | blob_read_link(&content, zFullname); |
| 1279 | }else{ |
| 1280 | blob_read_from_file(&content, zFullname); |
| 1281 | } |
| 1282 | if( !crnlOk ) cr_warning(&content, zFullname); |
| 1283 | nrid = content_put(&content); |
| 1284 | blob_reset(&content); |
| 1285 | if( rid>0 ){ |
| 1286 | content_deltify(rid, nrid, 0); |
| 1287 | } |
| 1288 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); |
| 1289 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 1290 | } |
| 1291 | db_finalize(&q); |
| 1292 | |
| 1293 | /* Create the new manifest */ |
| 1294 | if( blob_size(&comment)==0 ){ |
| 1295 | blob_append(&comment, "(no comment)", -1); |
| 1296 | } |
| 1297 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -87,11 +87,15 @@ | |
| 87 | }else if( isChnged==2 ){ |
| 88 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 89 | }else if( isChnged==3 ){ |
| 90 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 91 | }else if( isChnged==1 ){ |
| 92 | if( file_contains_merge_marker(zFullName) ){ |
| 93 | blob_appendf(report, "CONFLICT %s\n", zDisplayName); |
| 94 | }else{ |
| 95 | blob_appendf(report, "EDITED %s\n", zDisplayName); |
| 96 | } |
| 97 | }else if( isRenamed ){ |
| 98 | blob_appendf(report, "RENAMED %s\n", zDisplayName); |
| 99 | } |
| 100 | free(zFullName); |
| 101 | } |
| @@ -986,10 +990,11 @@ | |
| 990 | ** --force|-f allow forking with this commit |
| 991 | ** --message-file|-M FILE read the commit comment from given file |
| 992 | ** --nosign do not attempt to sign this commit with gpg |
| 993 | ** --private do not sync changes and their descendants |
| 994 | ** --tag TAG-NAME assign given tag TAG-NAME to the checkin |
| 995 | ** --conflict allow unresolved merge conflicts |
| 996 | ** |
| 997 | ** See also: branch, changes, checkout, extra, sync |
| 998 | */ |
| 999 | void commit_cmd(void){ |
| 1000 | int hasChanges; /* True if unsaved changes exist */ |
| @@ -1003,10 +1008,11 @@ | |
| 1008 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1009 | int isAMerge = 0; /* True if checking in a merge */ |
| 1010 | int forceFlag = 0; /* Force a fork */ |
| 1011 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1012 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1013 | int allowConflict = 0; /* Allow unresolve merge conflicts */ |
| 1014 | char *zManifestFile; /* Name of the manifest file */ |
| 1015 | int useCksum; /* True if checksums should be computed and verified */ |
| 1016 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1017 | int testRun; /* True for a test run. Debugging only */ |
| 1018 | const char *zBranch; /* Create a new branch with this name */ |
| @@ -1022,10 +1028,11 @@ | |
| 1028 | Blob muuid; /* Manifest uuid */ |
| 1029 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 1030 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 1031 | int szD; /* Size of the delta manifest */ |
| 1032 | int szB; /* Size of the baseline manifest */ |
| 1033 | int nConflict = 0; /* Number of unresolved merge conflicts */ |
| 1034 | |
| 1035 | url_proxy_options(); |
| 1036 | noSign = find_option("nosign",0,0)!=0; |
| 1037 | forceDelta = find_option("delta",0,0)!=0; |
| 1038 | forceBaseline = find_option("baseline",0,0)!=0; |
| @@ -1050,10 +1057,11 @@ | |
| 1057 | if( zBranch==0 ) zBranch = "private"; |
| 1058 | if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ |
| 1059 | } |
| 1060 | zDateOvrd = find_option("date-override",0,1); |
| 1061 | zUserOvrd = find_option("user-override",0,1); |
| 1062 | allowConflict = find_option("conflict",0,0)!=0; |
| 1063 | db_must_be_within_tree(); |
| 1064 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1065 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1066 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1067 | outputManifest = db_get_boolean("manifest", 0); |
| @@ -1255,42 +1263,51 @@ | |
| 1263 | /* Step 1: Insert records for all modified files into the blob |
| 1264 | ** table. If there were arguments passed to this command, only |
| 1265 | ** the identified fils are inserted (if they have been modified). |
| 1266 | */ |
| 1267 | db_prepare(&q, |
| 1268 | "SELECT id, %Q || pathname, mrid, %s, chnged FROM vfile " |
| 1269 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1270 | g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")) |
| 1271 | ); |
| 1272 | while( db_step(&q)==SQLITE_ROW ){ |
| 1273 | int id, rid; |
| 1274 | const char *zFullname; |
| 1275 | Blob content; |
| 1276 | int crnlOk, chnged; |
| 1277 | |
| 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 | |
| 1284 | blob_zero(&content); |
| 1285 | if( file_wd_islink(zFullname) ){ |
| 1286 | /* Instead of file content, put link destination path */ |
| 1287 | blob_read_link(&content, zFullname); |
| 1288 | }else{ |
| 1289 | blob_read_from_file(&content, zFullname); |
| 1290 | } |
| 1291 | if( !crnlOk ) cr_warning(&content, zFullname); |
| 1292 | if( chnged==1 && contains_merge_marker(&content) ){ |
| 1293 | nConflict++; |
| 1294 | fossil_print("possible unresolved merge conflict in %s\n", |
| 1295 | zFullname+strlen(g.zLocalRoot)); |
| 1296 | } |
| 1297 | nrid = content_put(&content); |
| 1298 | blob_reset(&content); |
| 1299 | if( rid>0 ){ |
| 1300 | content_deltify(rid, nrid, 0); |
| 1301 | } |
| 1302 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); |
| 1303 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 1304 | } |
| 1305 | db_finalize(&q); |
| 1306 | if( nConflict && !allowConflict ){ |
| 1307 | fossil_fatal("abort due to unresolve merge conflicts"); |
| 1308 | } |
| 1309 | |
| 1310 | /* Create the new manifest */ |
| 1311 | if( blob_size(&comment)==0 ){ |
| 1312 | blob_append(&comment, "(no comment)", -1); |
| 1313 | } |
| 1314 |
+2
-2
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -489,14 +489,14 @@ | ||
| 489 | 489 | " WHERE objid=%d AND type='ci'", vid)); |
| 490 | 490 | if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 491 | 491 | Blob title, tail; |
| 492 | 492 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 493 | 493 | style_header(blob_str(&title)); |
| 494 | - wiki_convert(&tail, 0, 0); | |
| 494 | + wiki_convert(&tail, 0, WIKI_BUTTONS); | |
| 495 | 495 | }else{ |
| 496 | 496 | style_header("Documentation"); |
| 497 | - wiki_convert(&filebody, 0, 0); | |
| 497 | + wiki_convert(&filebody, 0, WIKI_BUTTONS); | |
| 498 | 498 | } |
| 499 | 499 | style_footer(); |
| 500 | 500 | }else if( fossil_strcmp(zMime, "text/plain")==0 ){ |
| 501 | 501 | style_header("Documentation"); |
| 502 | 502 | @ <blockquote><pre> |
| 503 | 503 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -489,14 +489,14 @@ | |
| 489 | " WHERE objid=%d AND type='ci'", vid)); |
| 490 | if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 491 | Blob title, tail; |
| 492 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 493 | style_header(blob_str(&title)); |
| 494 | wiki_convert(&tail, 0, 0); |
| 495 | }else{ |
| 496 | style_header("Documentation"); |
| 497 | wiki_convert(&filebody, 0, 0); |
| 498 | } |
| 499 | style_footer(); |
| 500 | }else if( fossil_strcmp(zMime, "text/plain")==0 ){ |
| 501 | style_header("Documentation"); |
| 502 | @ <blockquote><pre> |
| 503 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -489,14 +489,14 @@ | |
| 489 | " WHERE objid=%d AND type='ci'", vid)); |
| 490 | if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 491 | Blob title, tail; |
| 492 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 493 | style_header(blob_str(&title)); |
| 494 | wiki_convert(&tail, 0, WIKI_BUTTONS); |
| 495 | }else{ |
| 496 | style_header("Documentation"); |
| 497 | wiki_convert(&filebody, 0, WIKI_BUTTONS); |
| 498 | } |
| 499 | style_footer(); |
| 500 | }else if( fossil_strcmp(zMime, "text/plain")==0 ){ |
| 501 | style_header("Documentation"); |
| 502 | @ <blockquote><pre> |
| 503 |
+2
-2
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -289,14 +289,14 @@ | ||
| 289 | 289 | if( (n = atoi(PD("n","0")))>0 ){ |
| 290 | 290 | blob_appendf(&sql, " LIMIT %d", n); |
| 291 | 291 | url_add_parameter(&url, "n", P("n")); |
| 292 | 292 | } |
| 293 | 293 | if( firstChngOnly ){ |
| 294 | - style_submenu_element("Full", "Show all changes", | |
| 294 | + style_submenu_element("Full", "Show all changes","%s", | |
| 295 | 295 | url_render(&url, "fco", "0", 0, 0)); |
| 296 | 296 | }else{ |
| 297 | - style_submenu_element("Simplified", "Show only first use of a change", | |
| 297 | + style_submenu_element("Simplified", "Show only first use of a change","%s", | |
| 298 | 298 | url_render(&url, "fco", "1", 0, 0)); |
| 299 | 299 | } |
| 300 | 300 | db_prepare(&q, blob_str(&sql)); |
| 301 | 301 | blob_reset(&sql); |
| 302 | 302 | blob_zero(&title); |
| 303 | 303 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -289,14 +289,14 @@ | |
| 289 | if( (n = atoi(PD("n","0")))>0 ){ |
| 290 | blob_appendf(&sql, " LIMIT %d", n); |
| 291 | url_add_parameter(&url, "n", P("n")); |
| 292 | } |
| 293 | if( firstChngOnly ){ |
| 294 | style_submenu_element("Full", "Show all changes", |
| 295 | url_render(&url, "fco", "0", 0, 0)); |
| 296 | }else{ |
| 297 | style_submenu_element("Simplified", "Show only first use of a change", |
| 298 | url_render(&url, "fco", "1", 0, 0)); |
| 299 | } |
| 300 | db_prepare(&q, blob_str(&sql)); |
| 301 | blob_reset(&sql); |
| 302 | blob_zero(&title); |
| 303 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -289,14 +289,14 @@ | |
| 289 | if( (n = atoi(PD("n","0")))>0 ){ |
| 290 | blob_appendf(&sql, " LIMIT %d", n); |
| 291 | url_add_parameter(&url, "n", P("n")); |
| 292 | } |
| 293 | if( firstChngOnly ){ |
| 294 | style_submenu_element("Full", "Show all changes","%s", |
| 295 | url_render(&url, "fco", "0", 0, 0)); |
| 296 | }else{ |
| 297 | style_submenu_element("Simplified", "Show only first use of a change","%s", |
| 298 | url_render(&url, "fco", "1", 0, 0)); |
| 299 | } |
| 300 | db_prepare(&q, blob_str(&sql)); |
| 301 | blob_reset(&sql); |
| 302 | blob_zero(&title); |
| 303 |
+29
-10
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -12,11 +12,11 @@ | ||
| 12 | 12 | ** Author contact information: |
| 13 | 13 | ** [email protected] |
| 14 | 14 | ** |
| 15 | 15 | ******************************************************************************* |
| 16 | 16 | ** |
| 17 | -** This file contains code used to import the content of a Git | |
| 17 | +** This file contains code used to import the content of a Git | |
| 18 | 18 | ** repository in the git-fast-import format as a new Fossil |
| 19 | 19 | ** repository. |
| 20 | 20 | */ |
| 21 | 21 | #include "config.h" |
| 22 | 22 | #include "import.h" |
| @@ -24,11 +24,11 @@ | ||
| 24 | 24 | |
| 25 | 25 | #if INTERFACE |
| 26 | 26 | /* |
| 27 | 27 | ** A single file change record. |
| 28 | 28 | */ |
| 29 | -struct ImportFile { | |
| 29 | +struct ImportFile { | |
| 30 | 30 | char *zName; /* Name of a file */ |
| 31 | 31 | char *zUuid; /* UUID of the file */ |
| 32 | 32 | char *zPrior; /* Prior name if the name was changed */ |
| 33 | 33 | char isFrom; /* True if obtained from the parent */ |
| 34 | 34 | char isExe; /* True if executable */ |
| @@ -80,11 +80,11 @@ | ||
| 80 | 80 | |
| 81 | 81 | /* |
| 82 | 82 | ** A no-op "xFinish" method |
| 83 | 83 | */ |
| 84 | 84 | static void finish_noop(void){} |
| 85 | - | |
| 85 | + | |
| 86 | 86 | /* |
| 87 | 87 | ** Deallocate the state information. |
| 88 | 88 | ** |
| 89 | 89 | ** The azMerge[] and aFile[] arrays are zeroed by allocated space is |
| 90 | 90 | ** retained unless the freeAll flag is set. |
| @@ -152,16 +152,16 @@ | ||
| 152 | 152 | rid = db_last_insert_rowid(); |
| 153 | 153 | } |
| 154 | 154 | if( zMark ){ |
| 155 | 155 | db_multi_exec( |
| 156 | 156 | "INSERT OR IGNORE INTO xmark(tname, trid, tuuid)" |
| 157 | - "VALUES(%Q,%d,%B)", | |
| 157 | + "VALUES(%Q,%d,%B)", | |
| 158 | 158 | zMark, rid, &hash |
| 159 | 159 | ); |
| 160 | 160 | db_multi_exec( |
| 161 | 161 | "INSERT OR IGNORE INTO xmark(tname, trid, tuuid)" |
| 162 | - "VALUES(%B,%d,%B)", | |
| 162 | + "VALUES(%B,%d,%B)", | |
| 163 | 163 | &hash, rid, &hash |
| 164 | 164 | ); |
| 165 | 165 | } |
| 166 | 166 | if( saveUuid ){ |
| 167 | 167 | fossil_free(gg.zPrevCheckin); |
| @@ -182,11 +182,11 @@ | ||
| 182 | 182 | blob_reset(&content); |
| 183 | 183 | import_reset(0); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /* |
| 187 | -** Use data accumulated in gg from a "tag" record to add a new | |
| 187 | +** Use data accumulated in gg from a "tag" record to add a new | |
| 188 | 188 | ** control artifact to the BLOB table. |
| 189 | 189 | */ |
| 190 | 190 | static void finish_tag(void){ |
| 191 | 191 | Blob record, cksum; |
| 192 | 192 | if( gg.zDate && gg.zTag && gg.zFrom && gg.zUser ){ |
| @@ -223,11 +223,11 @@ | ||
| 223 | 223 | |
| 224 | 224 | /* Forward reference */ |
| 225 | 225 | static void import_prior_files(void); |
| 226 | 226 | |
| 227 | 227 | /* |
| 228 | -** Use data accumulated in gg from a "commit" record to add a new | |
| 228 | +** Use data accumulated in gg from a "commit" record to add a new | |
| 229 | 229 | ** manifest artifact to the BLOB table. |
| 230 | 230 | */ |
| 231 | 231 | static void finish_commit(void){ |
| 232 | 232 | int i; |
| 233 | 233 | char *zFromBranch; |
| @@ -410,11 +410,11 @@ | ||
| 410 | 410 | int rid; |
| 411 | 411 | ManifestFile *pOld; |
| 412 | 412 | ImportFile *pNew; |
| 413 | 413 | if( gg.fromLoaded ) return; |
| 414 | 414 | gg.fromLoaded = 1; |
| 415 | - if( gg.zFrom==0 && gg.zPrevCheckin!=0 | |
| 415 | + if( gg.zFrom==0 && gg.zPrevCheckin!=0 | |
| 416 | 416 | && fossil_strcmp(gg.zBranch, gg.zPrevBranch)==0 |
| 417 | 417 | ){ |
| 418 | 418 | gg.zFrom = gg.zPrevCheckin; |
| 419 | 419 | gg.zPrevCheckin = 0; |
| 420 | 420 | } |
| @@ -451,10 +451,27 @@ | ||
| 451 | 451 | } |
| 452 | 452 | i++; |
| 453 | 453 | } |
| 454 | 454 | return 0; |
| 455 | 455 | } |
| 456 | + | |
| 457 | +/* | |
| 458 | +** Dequote a fast-export filename. Filenames are normally unquoted. But | |
| 459 | +** if the contain some obscure special characters, quotes might be added. | |
| 460 | +*/ | |
| 461 | +static void dequote_git_filename(char *zName){ | |
| 462 | + int n, i, j; | |
| 463 | + if( zName==0 || zName[0]!='"' ) return; | |
| 464 | + n = (int)strlen(zName); | |
| 465 | + if( zName[n-1]!='"' ) return; | |
| 466 | + for(i=0, j=1; j<n-1; j++){ | |
| 467 | + char c = zName[j]; | |
| 468 | + if( c=='\\' ) c = zName[++j]; | |
| 469 | + zName[i++] = c; | |
| 470 | + } | |
| 471 | + zName[i] = 0; | |
| 472 | +} | |
| 456 | 473 | |
| 457 | 474 | |
| 458 | 475 | /* |
| 459 | 476 | ** Read the git-fast-import format from pIn and insert the corresponding |
| 460 | 477 | ** content into the database. |
| @@ -596,26 +613,28 @@ | ||
| 596 | 613 | import_prior_files(); |
| 597 | 614 | z = &zLine[2]; |
| 598 | 615 | zPerm = next_token(&z); |
| 599 | 616 | zUuid = next_token(&z); |
| 600 | 617 | zName = rest_of_line(&z); |
| 618 | + dequote_git_filename(zName); | |
| 601 | 619 | i = 0; |
| 602 | 620 | pFile = import_find_file(zName, &i, gg.nFile); |
| 603 | 621 | if( pFile==0 ){ |
| 604 | 622 | pFile = import_add_file(); |
| 605 | 623 | pFile->zName = fossil_strdup(zName); |
| 606 | 624 | } |
| 607 | 625 | pFile->isExe = (fossil_strcmp(zPerm, "100755")==0); |
| 608 | - pFile->isLink = (fossil_strcmp(zPerm, "120000")==0); | |
| 626 | + pFile->isLink = (fossil_strcmp(zPerm, "120000")==0); | |
| 609 | 627 | fossil_free(pFile->zUuid); |
| 610 | 628 | pFile->zUuid = resolve_committish(zUuid); |
| 611 | 629 | pFile->isFrom = 0; |
| 612 | 630 | }else |
| 613 | 631 | if( memcmp(zLine, "D ", 2)==0 ){ |
| 614 | 632 | import_prior_files(); |
| 615 | 633 | z = &zLine[2]; |
| 616 | 634 | zName = rest_of_line(&z); |
| 635 | + dequote_git_filename(zName); | |
| 617 | 636 | i = 0; |
| 618 | 637 | while( (pFile = import_find_file(zName, &i, gg.nFile))!=0 ){ |
| 619 | 638 | if( pFile->isFrom==0 ) continue; |
| 620 | 639 | fossil_free(pFile->zName); |
| 621 | 640 | fossil_free(pFile->zPrior); |
| @@ -748,11 +767,11 @@ | ||
| 748 | 767 | |
| 749 | 768 | /* The following temp-tables are used to hold information needed for |
| 750 | 769 | ** the import. |
| 751 | 770 | ** |
| 752 | 771 | ** The XMARK table provides a mapping from fast-import "marks" and symbols |
| 753 | - ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts). | |
| 772 | + ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts). | |
| 754 | 773 | ** Given any valid fast-import symbol, the corresponding fossil rid and |
| 755 | 774 | ** uuid can found by searching against the xmark.tname field. |
| 756 | 775 | ** |
| 757 | 776 | ** The XBRANCH table maps commit marks and symbols into the branch those |
| 758 | 777 | ** commits belong to. If xbranch.tname is a fast-import symbol for a |
| 759 | 778 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -12,11 +12,11 @@ | |
| 12 | ** Author contact information: |
| 13 | ** [email protected] |
| 14 | ** |
| 15 | ******************************************************************************* |
| 16 | ** |
| 17 | ** This file contains code used to import the content of a Git |
| 18 | ** repository in the git-fast-import format as a new Fossil |
| 19 | ** repository. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "import.h" |
| @@ -24,11 +24,11 @@ | |
| 24 | |
| 25 | #if INTERFACE |
| 26 | /* |
| 27 | ** A single file change record. |
| 28 | */ |
| 29 | struct ImportFile { |
| 30 | char *zName; /* Name of a file */ |
| 31 | char *zUuid; /* UUID of the file */ |
| 32 | char *zPrior; /* Prior name if the name was changed */ |
| 33 | char isFrom; /* True if obtained from the parent */ |
| 34 | char isExe; /* True if executable */ |
| @@ -80,11 +80,11 @@ | |
| 80 | |
| 81 | /* |
| 82 | ** A no-op "xFinish" method |
| 83 | */ |
| 84 | static void finish_noop(void){} |
| 85 | |
| 86 | /* |
| 87 | ** Deallocate the state information. |
| 88 | ** |
| 89 | ** The azMerge[] and aFile[] arrays are zeroed by allocated space is |
| 90 | ** retained unless the freeAll flag is set. |
| @@ -152,16 +152,16 @@ | |
| 152 | rid = db_last_insert_rowid(); |
| 153 | } |
| 154 | if( zMark ){ |
| 155 | db_multi_exec( |
| 156 | "INSERT OR IGNORE INTO xmark(tname, trid, tuuid)" |
| 157 | "VALUES(%Q,%d,%B)", |
| 158 | zMark, rid, &hash |
| 159 | ); |
| 160 | db_multi_exec( |
| 161 | "INSERT OR IGNORE INTO xmark(tname, trid, tuuid)" |
| 162 | "VALUES(%B,%d,%B)", |
| 163 | &hash, rid, &hash |
| 164 | ); |
| 165 | } |
| 166 | if( saveUuid ){ |
| 167 | fossil_free(gg.zPrevCheckin); |
| @@ -182,11 +182,11 @@ | |
| 182 | blob_reset(&content); |
| 183 | import_reset(0); |
| 184 | } |
| 185 | |
| 186 | /* |
| 187 | ** Use data accumulated in gg from a "tag" record to add a new |
| 188 | ** control artifact to the BLOB table. |
| 189 | */ |
| 190 | static void finish_tag(void){ |
| 191 | Blob record, cksum; |
| 192 | if( gg.zDate && gg.zTag && gg.zFrom && gg.zUser ){ |
| @@ -223,11 +223,11 @@ | |
| 223 | |
| 224 | /* Forward reference */ |
| 225 | static void import_prior_files(void); |
| 226 | |
| 227 | /* |
| 228 | ** Use data accumulated in gg from a "commit" record to add a new |
| 229 | ** manifest artifact to the BLOB table. |
| 230 | */ |
| 231 | static void finish_commit(void){ |
| 232 | int i; |
| 233 | char *zFromBranch; |
| @@ -410,11 +410,11 @@ | |
| 410 | int rid; |
| 411 | ManifestFile *pOld; |
| 412 | ImportFile *pNew; |
| 413 | if( gg.fromLoaded ) return; |
| 414 | gg.fromLoaded = 1; |
| 415 | if( gg.zFrom==0 && gg.zPrevCheckin!=0 |
| 416 | && fossil_strcmp(gg.zBranch, gg.zPrevBranch)==0 |
| 417 | ){ |
| 418 | gg.zFrom = gg.zPrevCheckin; |
| 419 | gg.zPrevCheckin = 0; |
| 420 | } |
| @@ -451,10 +451,27 @@ | |
| 451 | } |
| 452 | i++; |
| 453 | } |
| 454 | return 0; |
| 455 | } |
| 456 | |
| 457 | |
| 458 | /* |
| 459 | ** Read the git-fast-import format from pIn and insert the corresponding |
| 460 | ** content into the database. |
| @@ -596,26 +613,28 @@ | |
| 596 | import_prior_files(); |
| 597 | z = &zLine[2]; |
| 598 | zPerm = next_token(&z); |
| 599 | zUuid = next_token(&z); |
| 600 | zName = rest_of_line(&z); |
| 601 | i = 0; |
| 602 | pFile = import_find_file(zName, &i, gg.nFile); |
| 603 | if( pFile==0 ){ |
| 604 | pFile = import_add_file(); |
| 605 | pFile->zName = fossil_strdup(zName); |
| 606 | } |
| 607 | pFile->isExe = (fossil_strcmp(zPerm, "100755")==0); |
| 608 | pFile->isLink = (fossil_strcmp(zPerm, "120000")==0); |
| 609 | fossil_free(pFile->zUuid); |
| 610 | pFile->zUuid = resolve_committish(zUuid); |
| 611 | pFile->isFrom = 0; |
| 612 | }else |
| 613 | if( memcmp(zLine, "D ", 2)==0 ){ |
| 614 | import_prior_files(); |
| 615 | z = &zLine[2]; |
| 616 | zName = rest_of_line(&z); |
| 617 | i = 0; |
| 618 | while( (pFile = import_find_file(zName, &i, gg.nFile))!=0 ){ |
| 619 | if( pFile->isFrom==0 ) continue; |
| 620 | fossil_free(pFile->zName); |
| 621 | fossil_free(pFile->zPrior); |
| @@ -748,11 +767,11 @@ | |
| 748 | |
| 749 | /* The following temp-tables are used to hold information needed for |
| 750 | ** the import. |
| 751 | ** |
| 752 | ** The XMARK table provides a mapping from fast-import "marks" and symbols |
| 753 | ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts). |
| 754 | ** Given any valid fast-import symbol, the corresponding fossil rid and |
| 755 | ** uuid can found by searching against the xmark.tname field. |
| 756 | ** |
| 757 | ** The XBRANCH table maps commit marks and symbols into the branch those |
| 758 | ** commits belong to. If xbranch.tname is a fast-import symbol for a |
| 759 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -12,11 +12,11 @@ | |
| 12 | ** Author contact information: |
| 13 | ** [email protected] |
| 14 | ** |
| 15 | ******************************************************************************* |
| 16 | ** |
| 17 | ** This file contains code used to import the content of a Git |
| 18 | ** repository in the git-fast-import format as a new Fossil |
| 19 | ** repository. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "import.h" |
| @@ -24,11 +24,11 @@ | |
| 24 | |
| 25 | #if INTERFACE |
| 26 | /* |
| 27 | ** A single file change record. |
| 28 | */ |
| 29 | struct ImportFile { |
| 30 | char *zName; /* Name of a file */ |
| 31 | char *zUuid; /* UUID of the file */ |
| 32 | char *zPrior; /* Prior name if the name was changed */ |
| 33 | char isFrom; /* True if obtained from the parent */ |
| 34 | char isExe; /* True if executable */ |
| @@ -80,11 +80,11 @@ | |
| 80 | |
| 81 | /* |
| 82 | ** A no-op "xFinish" method |
| 83 | */ |
| 84 | static void finish_noop(void){} |
| 85 | |
| 86 | /* |
| 87 | ** Deallocate the state information. |
| 88 | ** |
| 89 | ** The azMerge[] and aFile[] arrays are zeroed by allocated space is |
| 90 | ** retained unless the freeAll flag is set. |
| @@ -152,16 +152,16 @@ | |
| 152 | rid = db_last_insert_rowid(); |
| 153 | } |
| 154 | if( zMark ){ |
| 155 | db_multi_exec( |
| 156 | "INSERT OR IGNORE INTO xmark(tname, trid, tuuid)" |
| 157 | "VALUES(%Q,%d,%B)", |
| 158 | zMark, rid, &hash |
| 159 | ); |
| 160 | db_multi_exec( |
| 161 | "INSERT OR IGNORE INTO xmark(tname, trid, tuuid)" |
| 162 | "VALUES(%B,%d,%B)", |
| 163 | &hash, rid, &hash |
| 164 | ); |
| 165 | } |
| 166 | if( saveUuid ){ |
| 167 | fossil_free(gg.zPrevCheckin); |
| @@ -182,11 +182,11 @@ | |
| 182 | blob_reset(&content); |
| 183 | import_reset(0); |
| 184 | } |
| 185 | |
| 186 | /* |
| 187 | ** Use data accumulated in gg from a "tag" record to add a new |
| 188 | ** control artifact to the BLOB table. |
| 189 | */ |
| 190 | static void finish_tag(void){ |
| 191 | Blob record, cksum; |
| 192 | if( gg.zDate && gg.zTag && gg.zFrom && gg.zUser ){ |
| @@ -223,11 +223,11 @@ | |
| 223 | |
| 224 | /* Forward reference */ |
| 225 | static void import_prior_files(void); |
| 226 | |
| 227 | /* |
| 228 | ** Use data accumulated in gg from a "commit" record to add a new |
| 229 | ** manifest artifact to the BLOB table. |
| 230 | */ |
| 231 | static void finish_commit(void){ |
| 232 | int i; |
| 233 | char *zFromBranch; |
| @@ -410,11 +410,11 @@ | |
| 410 | int rid; |
| 411 | ManifestFile *pOld; |
| 412 | ImportFile *pNew; |
| 413 | if( gg.fromLoaded ) return; |
| 414 | gg.fromLoaded = 1; |
| 415 | if( gg.zFrom==0 && gg.zPrevCheckin!=0 |
| 416 | && fossil_strcmp(gg.zBranch, gg.zPrevBranch)==0 |
| 417 | ){ |
| 418 | gg.zFrom = gg.zPrevCheckin; |
| 419 | gg.zPrevCheckin = 0; |
| 420 | } |
| @@ -451,10 +451,27 @@ | |
| 451 | } |
| 452 | i++; |
| 453 | } |
| 454 | return 0; |
| 455 | } |
| 456 | |
| 457 | /* |
| 458 | ** Dequote a fast-export filename. Filenames are normally unquoted. But |
| 459 | ** if the contain some obscure special characters, quotes might be added. |
| 460 | */ |
| 461 | static void dequote_git_filename(char *zName){ |
| 462 | int n, i, j; |
| 463 | if( zName==0 || zName[0]!='"' ) return; |
| 464 | n = (int)strlen(zName); |
| 465 | if( zName[n-1]!='"' ) return; |
| 466 | for(i=0, j=1; j<n-1; j++){ |
| 467 | char c = zName[j]; |
| 468 | if( c=='\\' ) c = zName[++j]; |
| 469 | zName[i++] = c; |
| 470 | } |
| 471 | zName[i] = 0; |
| 472 | } |
| 473 | |
| 474 | |
| 475 | /* |
| 476 | ** Read the git-fast-import format from pIn and insert the corresponding |
| 477 | ** content into the database. |
| @@ -596,26 +613,28 @@ | |
| 613 | import_prior_files(); |
| 614 | z = &zLine[2]; |
| 615 | zPerm = next_token(&z); |
| 616 | zUuid = next_token(&z); |
| 617 | zName = rest_of_line(&z); |
| 618 | dequote_git_filename(zName); |
| 619 | i = 0; |
| 620 | pFile = import_find_file(zName, &i, gg.nFile); |
| 621 | if( pFile==0 ){ |
| 622 | pFile = import_add_file(); |
| 623 | pFile->zName = fossil_strdup(zName); |
| 624 | } |
| 625 | pFile->isExe = (fossil_strcmp(zPerm, "100755")==0); |
| 626 | pFile->isLink = (fossil_strcmp(zPerm, "120000")==0); |
| 627 | fossil_free(pFile->zUuid); |
| 628 | pFile->zUuid = resolve_committish(zUuid); |
| 629 | pFile->isFrom = 0; |
| 630 | }else |
| 631 | if( memcmp(zLine, "D ", 2)==0 ){ |
| 632 | import_prior_files(); |
| 633 | z = &zLine[2]; |
| 634 | zName = rest_of_line(&z); |
| 635 | dequote_git_filename(zName); |
| 636 | i = 0; |
| 637 | while( (pFile = import_find_file(zName, &i, gg.nFile))!=0 ){ |
| 638 | if( pFile->isFrom==0 ) continue; |
| 639 | fossil_free(pFile->zName); |
| 640 | fossil_free(pFile->zPrior); |
| @@ -748,11 +767,11 @@ | |
| 767 | |
| 768 | /* The following temp-tables are used to hold information needed for |
| 769 | ** the import. |
| 770 | ** |
| 771 | ** The XMARK table provides a mapping from fast-import "marks" and symbols |
| 772 | ** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts). |
| 773 | ** Given any valid fast-import symbol, the corresponding fossil rid and |
| 774 | ** uuid can found by searching against the xmark.tname field. |
| 775 | ** |
| 776 | ** The XBRANCH table maps commit marks and symbols into the branch those |
| 777 | ** commits belong to. If xbranch.tname is a fast-import symbol for a |
| 778 |
+49
-12
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -133,10 +133,20 @@ | ||
| 133 | 133 | i += 3; |
| 134 | 134 | } |
| 135 | 135 | return i; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | +/* | |
| 139 | +** Text of boundary markers for merge conflicts. | |
| 140 | +*/ | |
| 141 | +static char const * const mergeMarker[] = { | |
| 142 | + /*123456789 123456789 123456789 123456789 123456789 123456789 123456789*/ | |
| 143 | + "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<\n", | |
| 144 | + "======= COMMON ANCESTOR content follows ============================\n", | |
| 145 | + "======= MERGED IN content follows ==================================\n", | |
| 146 | + ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" | |
| 147 | +}; | |
| 138 | 148 | |
| 139 | 149 | |
| 140 | 150 | /* |
| 141 | 151 | ** Do a three-way merge. Initialize pOut to contain the result. |
| 142 | 152 | ** |
| @@ -154,18 +164,10 @@ | ||
| 154 | 164 | int *aC2; /* Changes from pPivot to pV2 */ |
| 155 | 165 | int i1, i2; /* Index into aC1[] and aC2[] */ |
| 156 | 166 | int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */ |
| 157 | 167 | int limit1, limit2; /* Sizes of aC1[] and aC2[] */ |
| 158 | 168 | int nConflict = 0; /* Number of merge conflicts seen so far */ |
| 159 | - static const char zBegin[] = | |
| 160 | - "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<\n"; | |
| 161 | - static const char zMid1[] = | |
| 162 | - "======= COMMON ANCESTOR content follows ============================\n"; | |
| 163 | - static const char zMid2[] = | |
| 164 | - "======= MERGED IN content follows ==================================\n"; | |
| 165 | - static const char zEnd[] = | |
| 166 | - ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"; | |
| 167 | 169 | |
| 168 | 170 | blob_zero(pOut); /* Merge results stored in pOut */ |
| 169 | 171 | |
| 170 | 172 | /* Compute the edits that occur from pPivot => pV1 (into aC1) |
| 171 | 173 | ** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is |
| @@ -266,17 +268,17 @@ | ||
| 266 | 268 | nConflict++; |
| 267 | 269 | while( !ends_at_CPY(&aC1[i1], sz) || !ends_at_CPY(&aC2[i2], sz) ){ |
| 268 | 270 | sz++; |
| 269 | 271 | } |
| 270 | 272 | DEBUG( printf("CONFLICT %d\n", sz); ) |
| 271 | - blob_appendf(pOut, zBegin); | |
| 273 | + blob_appendf(pOut, mergeMarker[0]); | |
| 272 | 274 | i1 = output_one_side(pOut, pV1, aC1, i1, sz); |
| 273 | - blob_appendf(pOut, zMid1); | |
| 275 | + blob_appendf(pOut, mergeMarker[1]); | |
| 274 | 276 | blob_copy_lines(pOut, pPivot, sz); |
| 275 | - blob_appendf(pOut, zMid2); | |
| 277 | + blob_appendf(pOut, mergeMarker[2]); | |
| 276 | 278 | i2 = output_one_side(pOut, pV2, aC2, i2, sz); |
| 277 | - blob_appendf(pOut, zEnd); | |
| 279 | + blob_appendf(pOut, mergeMarker[3]); | |
| 278 | 280 | } |
| 279 | 281 | |
| 280 | 282 | /* If we are finished with an edit triple, advance to the next |
| 281 | 283 | ** triple. |
| 282 | 284 | */ |
| @@ -301,10 +303,45 @@ | ||
| 301 | 303 | |
| 302 | 304 | free(aC1); |
| 303 | 305 | free(aC2); |
| 304 | 306 | return nConflict; |
| 305 | 307 | } |
| 308 | + | |
| 309 | +/* | |
| 310 | +** Return true if the input string contains a merge marker on a line by | |
| 311 | +** itself. | |
| 312 | +*/ | |
| 313 | +int contains_merge_marker(Blob *p){ | |
| 314 | + int i, j; | |
| 315 | + int len = (int)strlen(mergeMarker[0]); | |
| 316 | + const char *z = blob_buffer(p); | |
| 317 | + int n = blob_size(p) - len + 1; | |
| 318 | + assert( len==(int)strlen(mergeMarker[1]) ); | |
| 319 | + assert( len==(int)strlen(mergeMarker[2]) ); | |
| 320 | + assert( len==(int)strlen(mergeMarker[3]) ); | |
| 321 | + assert( sizeof(mergeMarker)/sizeof(mergeMarker[0])==4 ); | |
| 322 | + for(i=0; i<n; ){ | |
| 323 | + for(j=0; j<4; j++){ | |
| 324 | + if( memcmp(&z[i], mergeMarker[j], len)==0 ) return 1; | |
| 325 | + } | |
| 326 | + while( i<n && z[i]!='\n' ){ i++; } | |
| 327 | + while( i<n && z[i]=='\n' ){ i++; } | |
| 328 | + } | |
| 329 | + return 0; | |
| 330 | +} | |
| 331 | + | |
| 332 | +/* | |
| 333 | +** Return true if the named file contains an unresolved merge marker line. | |
| 334 | +*/ | |
| 335 | +int file_contains_merge_marker(const char *zFullpath){ | |
| 336 | + Blob file; | |
| 337 | + int rc; | |
| 338 | + blob_read_from_file(&file, zFullpath); | |
| 339 | + rc = contains_merge_marker(&file); | |
| 340 | + blob_reset(&file); | |
| 341 | + return rc; | |
| 342 | +} | |
| 306 | 343 | |
| 307 | 344 | /* |
| 308 | 345 | ** COMMAND: test-3-way-merge |
| 309 | 346 | ** |
| 310 | 347 | ** Usage: %fossil test-3-way-merge PIVOT V1 V2 MERGED |
| 311 | 348 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -133,10 +133,20 @@ | |
| 133 | i += 3; |
| 134 | } |
| 135 | return i; |
| 136 | } |
| 137 | |
| 138 | |
| 139 | |
| 140 | /* |
| 141 | ** Do a three-way merge. Initialize pOut to contain the result. |
| 142 | ** |
| @@ -154,18 +164,10 @@ | |
| 154 | int *aC2; /* Changes from pPivot to pV2 */ |
| 155 | int i1, i2; /* Index into aC1[] and aC2[] */ |
| 156 | int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */ |
| 157 | int limit1, limit2; /* Sizes of aC1[] and aC2[] */ |
| 158 | int nConflict = 0; /* Number of merge conflicts seen so far */ |
| 159 | static const char zBegin[] = |
| 160 | "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<\n"; |
| 161 | static const char zMid1[] = |
| 162 | "======= COMMON ANCESTOR content follows ============================\n"; |
| 163 | static const char zMid2[] = |
| 164 | "======= MERGED IN content follows ==================================\n"; |
| 165 | static const char zEnd[] = |
| 166 | ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"; |
| 167 | |
| 168 | blob_zero(pOut); /* Merge results stored in pOut */ |
| 169 | |
| 170 | /* Compute the edits that occur from pPivot => pV1 (into aC1) |
| 171 | ** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is |
| @@ -266,17 +268,17 @@ | |
| 266 | nConflict++; |
| 267 | while( !ends_at_CPY(&aC1[i1], sz) || !ends_at_CPY(&aC2[i2], sz) ){ |
| 268 | sz++; |
| 269 | } |
| 270 | DEBUG( printf("CONFLICT %d\n", sz); ) |
| 271 | blob_appendf(pOut, zBegin); |
| 272 | i1 = output_one_side(pOut, pV1, aC1, i1, sz); |
| 273 | blob_appendf(pOut, zMid1); |
| 274 | blob_copy_lines(pOut, pPivot, sz); |
| 275 | blob_appendf(pOut, zMid2); |
| 276 | i2 = output_one_side(pOut, pV2, aC2, i2, sz); |
| 277 | blob_appendf(pOut, zEnd); |
| 278 | } |
| 279 | |
| 280 | /* If we are finished with an edit triple, advance to the next |
| 281 | ** triple. |
| 282 | */ |
| @@ -301,10 +303,45 @@ | |
| 301 | |
| 302 | free(aC1); |
| 303 | free(aC2); |
| 304 | return nConflict; |
| 305 | } |
| 306 | |
| 307 | /* |
| 308 | ** COMMAND: test-3-way-merge |
| 309 | ** |
| 310 | ** Usage: %fossil test-3-way-merge PIVOT V1 V2 MERGED |
| 311 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -133,10 +133,20 @@ | |
| 133 | i += 3; |
| 134 | } |
| 135 | return i; |
| 136 | } |
| 137 | |
| 138 | /* |
| 139 | ** Text of boundary markers for merge conflicts. |
| 140 | */ |
| 141 | static char const * const mergeMarker[] = { |
| 142 | /*123456789 123456789 123456789 123456789 123456789 123456789 123456789*/ |
| 143 | "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<\n", |
| 144 | "======= COMMON ANCESTOR content follows ============================\n", |
| 145 | "======= MERGED IN content follows ==================================\n", |
| 146 | ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" |
| 147 | }; |
| 148 | |
| 149 | |
| 150 | /* |
| 151 | ** Do a three-way merge. Initialize pOut to contain the result. |
| 152 | ** |
| @@ -154,18 +164,10 @@ | |
| 164 | int *aC2; /* Changes from pPivot to pV2 */ |
| 165 | int i1, i2; /* Index into aC1[] and aC2[] */ |
| 166 | int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */ |
| 167 | int limit1, limit2; /* Sizes of aC1[] and aC2[] */ |
| 168 | int nConflict = 0; /* Number of merge conflicts seen so far */ |
| 169 | |
| 170 | blob_zero(pOut); /* Merge results stored in pOut */ |
| 171 | |
| 172 | /* Compute the edits that occur from pPivot => pV1 (into aC1) |
| 173 | ** and pPivot => pV2 (into aC2). Each of the aC1 and aC2 arrays is |
| @@ -266,17 +268,17 @@ | |
| 268 | nConflict++; |
| 269 | while( !ends_at_CPY(&aC1[i1], sz) || !ends_at_CPY(&aC2[i2], sz) ){ |
| 270 | sz++; |
| 271 | } |
| 272 | DEBUG( printf("CONFLICT %d\n", sz); ) |
| 273 | blob_appendf(pOut, mergeMarker[0]); |
| 274 | i1 = output_one_side(pOut, pV1, aC1, i1, sz); |
| 275 | blob_appendf(pOut, mergeMarker[1]); |
| 276 | blob_copy_lines(pOut, pPivot, sz); |
| 277 | blob_appendf(pOut, mergeMarker[2]); |
| 278 | i2 = output_one_side(pOut, pV2, aC2, i2, sz); |
| 279 | blob_appendf(pOut, mergeMarker[3]); |
| 280 | } |
| 281 | |
| 282 | /* If we are finished with an edit triple, advance to the next |
| 283 | ** triple. |
| 284 | */ |
| @@ -301,10 +303,45 @@ | |
| 303 | |
| 304 | free(aC1); |
| 305 | free(aC2); |
| 306 | return nConflict; |
| 307 | } |
| 308 | |
| 309 | /* |
| 310 | ** Return true if the input string contains a merge marker on a line by |
| 311 | ** itself. |
| 312 | */ |
| 313 | int contains_merge_marker(Blob *p){ |
| 314 | int i, j; |
| 315 | int len = (int)strlen(mergeMarker[0]); |
| 316 | const char *z = blob_buffer(p); |
| 317 | int n = blob_size(p) - len + 1; |
| 318 | assert( len==(int)strlen(mergeMarker[1]) ); |
| 319 | assert( len==(int)strlen(mergeMarker[2]) ); |
| 320 | assert( len==(int)strlen(mergeMarker[3]) ); |
| 321 | assert( sizeof(mergeMarker)/sizeof(mergeMarker[0])==4 ); |
| 322 | for(i=0; i<n; ){ |
| 323 | for(j=0; j<4; j++){ |
| 324 | if( memcmp(&z[i], mergeMarker[j], len)==0 ) return 1; |
| 325 | } |
| 326 | while( i<n && z[i]!='\n' ){ i++; } |
| 327 | while( i<n && z[i]=='\n' ){ i++; } |
| 328 | } |
| 329 | return 0; |
| 330 | } |
| 331 | |
| 332 | /* |
| 333 | ** Return true if the named file contains an unresolved merge marker line. |
| 334 | */ |
| 335 | int file_contains_merge_marker(const char *zFullpath){ |
| 336 | Blob file; |
| 337 | int rc; |
| 338 | blob_read_from_file(&file, zFullpath); |
| 339 | rc = contains_merge_marker(&file); |
| 340 | blob_reset(&file); |
| 341 | return rc; |
| 342 | } |
| 343 | |
| 344 | /* |
| 345 | ** COMMAND: test-3-way-merge |
| 346 | ** |
| 347 | ** Usage: %fossil test-3-way-merge PIVOT V1 V2 MERGED |
| 348 |
+8
-8
| --- src/th_tcl.c | ||
| +++ src/th_tcl.c | ||
| @@ -217,11 +217,11 @@ | ||
| 217 | 217 | struct TclContext *tclContext = (struct TclContext *)ctx; |
| 218 | 218 | tcl_NotifyProc *xNotifyProc; |
| 219 | 219 | |
| 220 | 220 | if ( !tclContext ){ |
| 221 | 221 | Th_ErrorMessage(interp, |
| 222 | - "Invalid Tcl context", (const char *)"", 0); | |
| 222 | + "invalid Tcl context", (const char *)"", 0); | |
| 223 | 223 | return TH_ERROR; |
| 224 | 224 | } |
| 225 | 225 | xNotifyProc = bIsPost ? tclContext->xPostEval : tclContext->xPreEval; |
| 226 | 226 | if ( xNotifyProc ){ |
| 227 | 227 | rc = xNotifyProc(bIsPost ? |
| @@ -397,11 +397,11 @@ | ||
| 397 | 397 | Tcl_DecrRefCount(objPtr); |
| 398 | 398 | Tcl_Release((ClientData)tclInterp); |
| 399 | 399 | return TH_ERROR; |
| 400 | 400 | } |
| 401 | 401 | if( !cmdInfo.objProc ){ |
| 402 | - Th_ErrorMessage(interp, "Cannot invoke Tcl command:", argv[1], argl[1]); | |
| 402 | + Th_ErrorMessage(interp, "cannot invoke Tcl command:", argv[1], argl[1]); | |
| 403 | 403 | Tcl_DecrRefCount(objPtr); |
| 404 | 404 | Tcl_Release((ClientData)tclInterp); |
| 405 | 405 | return TH_ERROR; |
| 406 | 406 | } |
| 407 | 407 | Tcl_DecrRefCount(objPtr); |
| @@ -533,11 +533,11 @@ | ||
| 533 | 533 | #if defined(USE_TCL_STUBS) |
| 534 | 534 | char fileName[] = TCL_LIBRARY_NAME; |
| 535 | 535 | #endif |
| 536 | 536 | if( !pLibrary || !pxFindExecutable || !pxCreateInterp ){ |
| 537 | 537 | Th_ErrorMessage(interp, |
| 538 | - "Invalid Tcl loader argument(s)", (const char *)"", 0); | |
| 538 | + "invalid Tcl loader argument(s)", (const char *)"", 0); | |
| 539 | 539 | return TH_ERROR; |
| 540 | 540 | } |
| 541 | 541 | #if defined(USE_TCL_STUBS) |
| 542 | 542 | do { |
| 543 | 543 | void *library = dlopen(fileName, RTLD_NOW | RTLD_GLOBAL); |
| @@ -549,11 +549,11 @@ | ||
| 549 | 549 | if( !xFindExecutable ){ |
| 550 | 550 | xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName); |
| 551 | 551 | } |
| 552 | 552 | if( !xFindExecutable ){ |
| 553 | 553 | Th_ErrorMessage(interp, |
| 554 | - "Could not locate Tcl_FindExecutable", (const char *)"", 0); | |
| 554 | + "could not locate Tcl_FindExecutable", (const char *)"", 0); | |
| 555 | 555 | dlclose(library); |
| 556 | 556 | return TH_ERROR; |
| 557 | 557 | } |
| 558 | 558 | procName = TCL_CREATEINTERP_NAME; |
| 559 | 559 | xCreateInterp = (tcl_CreateInterpProc *)dlsym(library, procName + 1); |
| @@ -560,11 +560,11 @@ | ||
| 560 | 560 | if( !xCreateInterp ){ |
| 561 | 561 | xCreateInterp = (tcl_CreateInterpProc *)dlsym(library, procName); |
| 562 | 562 | } |
| 563 | 563 | if( !xCreateInterp ){ |
| 564 | 564 | Th_ErrorMessage(interp, |
| 565 | - "Could not locate Tcl_CreateInterp", (const char *)"", 0); | |
| 565 | + "could not locate Tcl_CreateInterp", (const char *)"", 0); | |
| 566 | 566 | dlclose(library); |
| 567 | 567 | return TH_ERROR; |
| 568 | 568 | } |
| 569 | 569 | *pLibrary = library; |
| 570 | 570 | *pxFindExecutable = xFindExecutable; |
| @@ -571,11 +571,11 @@ | ||
| 571 | 571 | *pxCreateInterp = xCreateInterp; |
| 572 | 572 | return TH_OK; |
| 573 | 573 | } |
| 574 | 574 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 575 | 575 | Th_ErrorMessage(interp, |
| 576 | - "Could not load Tcl shared library \"" TCL_LIBRARY_NAME "\"", | |
| 576 | + "could not load Tcl shared library \"" TCL_LIBRARY_NAME "\"", | |
| 577 | 577 | (const char *)"", 0); |
| 578 | 578 | return TH_ERROR; |
| 579 | 579 | #else |
| 580 | 580 | *pLibrary = 0; |
| 581 | 581 | *pxFindExecutable = Tcl_FindExecutable; |
| @@ -656,11 +656,11 @@ | ||
| 656 | 656 | Tcl_Interp *tclInterp; |
| 657 | 657 | char *setup; |
| 658 | 658 | |
| 659 | 659 | if ( !tclContext ){ |
| 660 | 660 | Th_ErrorMessage(interp, |
| 661 | - "Invalid Tcl context", (const char *)"", 0); | |
| 661 | + "invalid Tcl context", (const char *)"", 0); | |
| 662 | 662 | return TH_ERROR; |
| 663 | 663 | } |
| 664 | 664 | if ( tclContext->interp ){ |
| 665 | 665 | return TH_OK; |
| 666 | 666 | } |
| @@ -679,11 +679,11 @@ | ||
| 679 | 679 | #if defined(USE_TCL_STUBS) |
| 680 | 680 | !Tcl_InitStubs(tclInterp, "8.4", 0) || |
| 681 | 681 | #endif |
| 682 | 682 | Tcl_InterpDeleted(tclInterp) ){ |
| 683 | 683 | Th_ErrorMessage(interp, |
| 684 | - "Could not create Tcl interpreter", (const char *)"", 0); | |
| 684 | + "could not create Tcl interpreter", (const char *)"", 0); | |
| 685 | 685 | return TH_ERROR; |
| 686 | 686 | } |
| 687 | 687 | tclContext->interp = tclInterp; |
| 688 | 688 | if( Tcl_Init(tclInterp)!=TCL_OK ){ |
| 689 | 689 | Th_ErrorMessage(interp, |
| 690 | 690 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -217,11 +217,11 @@ | |
| 217 | struct TclContext *tclContext = (struct TclContext *)ctx; |
| 218 | tcl_NotifyProc *xNotifyProc; |
| 219 | |
| 220 | if ( !tclContext ){ |
| 221 | Th_ErrorMessage(interp, |
| 222 | "Invalid Tcl context", (const char *)"", 0); |
| 223 | return TH_ERROR; |
| 224 | } |
| 225 | xNotifyProc = bIsPost ? tclContext->xPostEval : tclContext->xPreEval; |
| 226 | if ( xNotifyProc ){ |
| 227 | rc = xNotifyProc(bIsPost ? |
| @@ -397,11 +397,11 @@ | |
| 397 | Tcl_DecrRefCount(objPtr); |
| 398 | Tcl_Release((ClientData)tclInterp); |
| 399 | return TH_ERROR; |
| 400 | } |
| 401 | if( !cmdInfo.objProc ){ |
| 402 | Th_ErrorMessage(interp, "Cannot invoke Tcl command:", argv[1], argl[1]); |
| 403 | Tcl_DecrRefCount(objPtr); |
| 404 | Tcl_Release((ClientData)tclInterp); |
| 405 | return TH_ERROR; |
| 406 | } |
| 407 | Tcl_DecrRefCount(objPtr); |
| @@ -533,11 +533,11 @@ | |
| 533 | #if defined(USE_TCL_STUBS) |
| 534 | char fileName[] = TCL_LIBRARY_NAME; |
| 535 | #endif |
| 536 | if( !pLibrary || !pxFindExecutable || !pxCreateInterp ){ |
| 537 | Th_ErrorMessage(interp, |
| 538 | "Invalid Tcl loader argument(s)", (const char *)"", 0); |
| 539 | return TH_ERROR; |
| 540 | } |
| 541 | #if defined(USE_TCL_STUBS) |
| 542 | do { |
| 543 | void *library = dlopen(fileName, RTLD_NOW | RTLD_GLOBAL); |
| @@ -549,11 +549,11 @@ | |
| 549 | if( !xFindExecutable ){ |
| 550 | xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName); |
| 551 | } |
| 552 | if( !xFindExecutable ){ |
| 553 | Th_ErrorMessage(interp, |
| 554 | "Could not locate Tcl_FindExecutable", (const char *)"", 0); |
| 555 | dlclose(library); |
| 556 | return TH_ERROR; |
| 557 | } |
| 558 | procName = TCL_CREATEINTERP_NAME; |
| 559 | xCreateInterp = (tcl_CreateInterpProc *)dlsym(library, procName + 1); |
| @@ -560,11 +560,11 @@ | |
| 560 | if( !xCreateInterp ){ |
| 561 | xCreateInterp = (tcl_CreateInterpProc *)dlsym(library, procName); |
| 562 | } |
| 563 | if( !xCreateInterp ){ |
| 564 | Th_ErrorMessage(interp, |
| 565 | "Could not locate Tcl_CreateInterp", (const char *)"", 0); |
| 566 | dlclose(library); |
| 567 | return TH_ERROR; |
| 568 | } |
| 569 | *pLibrary = library; |
| 570 | *pxFindExecutable = xFindExecutable; |
| @@ -571,11 +571,11 @@ | |
| 571 | *pxCreateInterp = xCreateInterp; |
| 572 | return TH_OK; |
| 573 | } |
| 574 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 575 | Th_ErrorMessage(interp, |
| 576 | "Could not load Tcl shared library \"" TCL_LIBRARY_NAME "\"", |
| 577 | (const char *)"", 0); |
| 578 | return TH_ERROR; |
| 579 | #else |
| 580 | *pLibrary = 0; |
| 581 | *pxFindExecutable = Tcl_FindExecutable; |
| @@ -656,11 +656,11 @@ | |
| 656 | Tcl_Interp *tclInterp; |
| 657 | char *setup; |
| 658 | |
| 659 | if ( !tclContext ){ |
| 660 | Th_ErrorMessage(interp, |
| 661 | "Invalid Tcl context", (const char *)"", 0); |
| 662 | return TH_ERROR; |
| 663 | } |
| 664 | if ( tclContext->interp ){ |
| 665 | return TH_OK; |
| 666 | } |
| @@ -679,11 +679,11 @@ | |
| 679 | #if defined(USE_TCL_STUBS) |
| 680 | !Tcl_InitStubs(tclInterp, "8.4", 0) || |
| 681 | #endif |
| 682 | Tcl_InterpDeleted(tclInterp) ){ |
| 683 | Th_ErrorMessage(interp, |
| 684 | "Could not create Tcl interpreter", (const char *)"", 0); |
| 685 | return TH_ERROR; |
| 686 | } |
| 687 | tclContext->interp = tclInterp; |
| 688 | if( Tcl_Init(tclInterp)!=TCL_OK ){ |
| 689 | Th_ErrorMessage(interp, |
| 690 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -217,11 +217,11 @@ | |
| 217 | struct TclContext *tclContext = (struct TclContext *)ctx; |
| 218 | tcl_NotifyProc *xNotifyProc; |
| 219 | |
| 220 | if ( !tclContext ){ |
| 221 | Th_ErrorMessage(interp, |
| 222 | "invalid Tcl context", (const char *)"", 0); |
| 223 | return TH_ERROR; |
| 224 | } |
| 225 | xNotifyProc = bIsPost ? tclContext->xPostEval : tclContext->xPreEval; |
| 226 | if ( xNotifyProc ){ |
| 227 | rc = xNotifyProc(bIsPost ? |
| @@ -397,11 +397,11 @@ | |
| 397 | Tcl_DecrRefCount(objPtr); |
| 398 | Tcl_Release((ClientData)tclInterp); |
| 399 | return TH_ERROR; |
| 400 | } |
| 401 | if( !cmdInfo.objProc ){ |
| 402 | Th_ErrorMessage(interp, "cannot invoke Tcl command:", argv[1], argl[1]); |
| 403 | Tcl_DecrRefCount(objPtr); |
| 404 | Tcl_Release((ClientData)tclInterp); |
| 405 | return TH_ERROR; |
| 406 | } |
| 407 | Tcl_DecrRefCount(objPtr); |
| @@ -533,11 +533,11 @@ | |
| 533 | #if defined(USE_TCL_STUBS) |
| 534 | char fileName[] = TCL_LIBRARY_NAME; |
| 535 | #endif |
| 536 | if( !pLibrary || !pxFindExecutable || !pxCreateInterp ){ |
| 537 | Th_ErrorMessage(interp, |
| 538 | "invalid Tcl loader argument(s)", (const char *)"", 0); |
| 539 | return TH_ERROR; |
| 540 | } |
| 541 | #if defined(USE_TCL_STUBS) |
| 542 | do { |
| 543 | void *library = dlopen(fileName, RTLD_NOW | RTLD_GLOBAL); |
| @@ -549,11 +549,11 @@ | |
| 549 | if( !xFindExecutable ){ |
| 550 | xFindExecutable = (tcl_FindExecutableProc *)dlsym(library, procName); |
| 551 | } |
| 552 | if( !xFindExecutable ){ |
| 553 | Th_ErrorMessage(interp, |
| 554 | "could not locate Tcl_FindExecutable", (const char *)"", 0); |
| 555 | dlclose(library); |
| 556 | return TH_ERROR; |
| 557 | } |
| 558 | procName = TCL_CREATEINTERP_NAME; |
| 559 | xCreateInterp = (tcl_CreateInterpProc *)dlsym(library, procName + 1); |
| @@ -560,11 +560,11 @@ | |
| 560 | if( !xCreateInterp ){ |
| 561 | xCreateInterp = (tcl_CreateInterpProc *)dlsym(library, procName); |
| 562 | } |
| 563 | if( !xCreateInterp ){ |
| 564 | Th_ErrorMessage(interp, |
| 565 | "could not locate Tcl_CreateInterp", (const char *)"", 0); |
| 566 | dlclose(library); |
| 567 | return TH_ERROR; |
| 568 | } |
| 569 | *pLibrary = library; |
| 570 | *pxFindExecutable = xFindExecutable; |
| @@ -571,11 +571,11 @@ | |
| 571 | *pxCreateInterp = xCreateInterp; |
| 572 | return TH_OK; |
| 573 | } |
| 574 | } while( --fileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ |
| 575 | Th_ErrorMessage(interp, |
| 576 | "could not load Tcl shared library \"" TCL_LIBRARY_NAME "\"", |
| 577 | (const char *)"", 0); |
| 578 | return TH_ERROR; |
| 579 | #else |
| 580 | *pLibrary = 0; |
| 581 | *pxFindExecutable = Tcl_FindExecutable; |
| @@ -656,11 +656,11 @@ | |
| 656 | Tcl_Interp *tclInterp; |
| 657 | char *setup; |
| 658 | |
| 659 | if ( !tclContext ){ |
| 660 | Th_ErrorMessage(interp, |
| 661 | "invalid Tcl context", (const char *)"", 0); |
| 662 | return TH_ERROR; |
| 663 | } |
| 664 | if ( tclContext->interp ){ |
| 665 | return TH_OK; |
| 666 | } |
| @@ -679,11 +679,11 @@ | |
| 679 | #if defined(USE_TCL_STUBS) |
| 680 | !Tcl_InitStubs(tclInterp, "8.4", 0) || |
| 681 | #endif |
| 682 | Tcl_InterpDeleted(tclInterp) ){ |
| 683 | Th_ErrorMessage(interp, |
| 684 | "could not create Tcl interpreter", (const char *)"", 0); |
| 685 | return TH_ERROR; |
| 686 | } |
| 687 | tclContext->interp = tclInterp; |
| 688 | if( Tcl_Init(tclInterp)!=TCL_OK ){ |
| 689 | Th_ErrorMessage(interp, |
| 690 |
+1
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -446,10 +446,11 @@ | ||
| 446 | 446 | free(zDate); |
| 447 | 447 | for(i=0; i<nField; i++){ |
| 448 | 448 | if( azAppend[i] ){ |
| 449 | 449 | blob_appendf(&tktchng, "J +%s %z\n", azField[i], |
| 450 | 450 | fossilize(azAppend[i], -1)); |
| 451 | + ++nJ; | |
| 451 | 452 | } |
| 452 | 453 | } |
| 453 | 454 | for(i=0; i<nField; i++){ |
| 454 | 455 | const char *zValue; |
| 455 | 456 | int nValue; |
| 456 | 457 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -446,10 +446,11 @@ | |
| 446 | free(zDate); |
| 447 | for(i=0; i<nField; i++){ |
| 448 | if( azAppend[i] ){ |
| 449 | blob_appendf(&tktchng, "J +%s %z\n", azField[i], |
| 450 | fossilize(azAppend[i], -1)); |
| 451 | } |
| 452 | } |
| 453 | for(i=0; i<nField; i++){ |
| 454 | const char *zValue; |
| 455 | int nValue; |
| 456 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -446,10 +446,11 @@ | |
| 446 | free(zDate); |
| 447 | for(i=0; i<nField; i++){ |
| 448 | if( azAppend[i] ){ |
| 449 | blob_appendf(&tktchng, "J +%s %z\n", azField[i], |
| 450 | fossilize(azAppend[i], -1)); |
| 451 | ++nJ; |
| 452 | } |
| 453 | } |
| 454 | for(i=0; i<nField; i++){ |
| 455 | const char *zValue; |
| 456 | int nValue; |
| 457 |
+78
-17
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -27,10 +27,11 @@ | ||
| 27 | 27 | */ |
| 28 | 28 | #define WIKI_NOFOLLOW 0x001 |
| 29 | 29 | #define WIKI_HTML 0x002 |
| 30 | 30 | #define WIKI_INLINE 0x004 /* Do not surround with <p>..</p> */ |
| 31 | 31 | #define WIKI_NOBLOCK 0x008 /* No block markup of any kind */ |
| 32 | +#define WIKI_BUTTONS 0x010 /* Allow sub-menu buttons */ | |
| 32 | 33 | #endif |
| 33 | 34 | |
| 34 | 35 | |
| 35 | 36 | /* |
| 36 | 37 | ** These are the only markup attributes allowed. |
| @@ -378,19 +379,19 @@ | ||
| 378 | 379 | #define TOKEN_INDENT 9 /* " " */ |
| 379 | 380 | #define TOKEN_RAW 10 /* Output exactly (used when wiki-use-html==1) */ |
| 380 | 381 | #define TOKEN_TEXT 11 /* None of the above */ |
| 381 | 382 | |
| 382 | 383 | /* |
| 383 | -** State flags | |
| 384 | +** State flags. Save the lower 16 bits for the WIKI_* flags. | |
| 384 | 385 | */ |
| 385 | -#define AT_NEWLINE 0x001 /* At start of a line */ | |
| 386 | -#define AT_PARAGRAPH 0x002 /* At start of a paragraph */ | |
| 387 | -#define ALLOW_WIKI 0x004 /* Allow wiki markup */ | |
| 388 | -#define FONT_MARKUP_ONLY 0x008 /* Only allow MUTYPE_FONT markup */ | |
| 389 | -#define INLINE_MARKUP_ONLY 0x010 /* Allow only "inline" markup */ | |
| 390 | -#define IN_LIST 0x020 /* Within wiki <ul> or <ol> */ | |
| 391 | -#define WIKI_USE_HTML 0x040 /* wiki-use-html option = on */ | |
| 386 | +#define AT_NEWLINE 0x0010000 /* At start of a line */ | |
| 387 | +#define AT_PARAGRAPH 0x0020000 /* At start of a paragraph */ | |
| 388 | +#define ALLOW_WIKI 0x0040000 /* Allow wiki markup */ | |
| 389 | +#define FONT_MARKUP_ONLY 0x0080000 /* Only allow MUTYPE_FONT markup */ | |
| 390 | +#define INLINE_MARKUP_ONLY 0x0100000 /* Allow only "inline" markup */ | |
| 391 | +#define IN_LIST 0x0200000 /* Within wiki <ul> or <ol> */ | |
| 392 | +#define WIKI_USE_HTML 0x0400000 /* wiki-use-html option = on */ | |
| 392 | 393 | |
| 393 | 394 | /* |
| 394 | 395 | ** Current state of the rendering engine |
| 395 | 396 | */ |
| 396 | 397 | typedef struct Renderer Renderer; |
| @@ -825,22 +826,72 @@ | ||
| 825 | 826 | z[n] = p->aAttr[i].cTerm; |
| 826 | 827 | } |
| 827 | 828 | } |
| 828 | 829 | |
| 829 | 830 | /* |
| 830 | -** Return the ID attribute for markup. Return NULL if there is no | |
| 831 | +** Return the value of attribute attrId. Return NULL if there is no | |
| 831 | 832 | ** ID attribute. |
| 832 | 833 | */ |
| 833 | -static const char *markupId(ParsedMarkup *p){ | |
| 834 | +static const char *attributeValue(ParsedMarkup *p, int attrId){ | |
| 834 | 835 | int i; |
| 835 | 836 | for(i=0; i<p->nAttr; i++){ |
| 836 | - if( p->aAttr[i].iACode==ATTR_ID ){ | |
| 837 | + if( p->aAttr[i].iACode==attrId ){ | |
| 837 | 838 | return p->aAttr[i].zValue; |
| 838 | 839 | } |
| 839 | 840 | } |
| 840 | 841 | return 0; |
| 841 | 842 | } |
| 843 | + | |
| 844 | +/* | |
| 845 | +** Return the ID attribute for markup. Return NULL if there is no | |
| 846 | +** ID attribute. | |
| 847 | +*/ | |
| 848 | +static const char *markupId(ParsedMarkup *p){ | |
| 849 | + return attributeValue(p, ATTR_ID); | |
| 850 | +} | |
| 851 | + | |
| 852 | +/* | |
| 853 | +** Check markup pMarkup to see if it is a hyperlink with class "button" | |
| 854 | +** that is follows by simple text and an </a> only. Example: | |
| 855 | +** | |
| 856 | +** <a class="button" href="../index.wiki">Index</a> | |
| 857 | +** | |
| 858 | +** If the markup matches this pattern, and if the WIKI_BUTTONS flag was | |
| 859 | +** passed to wiki_convert(), then transform this link into a submenu | |
| 860 | +** button, skip the text, and set *pN equal to the total length of the | |
| 861 | +** text through the end of </a> and return true. If the markup does | |
| 862 | +** not match or if WIKI_BUTTONS is not set, then make no changes to *pN | |
| 863 | +** and return false. | |
| 864 | +*/ | |
| 865 | +static int isButtonHyperlink( | |
| 866 | + Renderer *p, /* Renderer state */ | |
| 867 | + ParsedMarkup *pMarkup, /* Potential button markup */ | |
| 868 | + const char *z, /* Complete text of Wiki */ | |
| 869 | + int *pN /* Characters of z[] consumed */ | |
| 870 | +){ | |
| 871 | + const char *zClass; | |
| 872 | + const char *zHref; | |
| 873 | + char *zTag; | |
| 874 | + int i, j; | |
| 875 | + if( (p->state & WIKI_BUTTONS)==0 ) return 0; | |
| 876 | + zClass = attributeValue(pMarkup, ATTR_CLASS); | |
| 877 | + if( zClass==0 ) return 0; | |
| 878 | + if( fossil_strcmp(zClass, "button")!=0 ) return 0; | |
| 879 | + zHref = attributeValue(pMarkup, ATTR_HREF); | |
| 880 | + if( zHref==0 ) return 0; | |
| 881 | + i = *pN; | |
| 882 | + while( z[i] && z[i]!='<' ){ i++; } | |
| 883 | + if( fossil_strnicmp(&z[i], "</a>",4)!=0 ) return 0; | |
| 884 | + for(j=*pN; fossil_isspace(z[j]); j++){} | |
| 885 | + zTag = mprintf("%.*s", i-j, &z[j]); | |
| 886 | + j = (int)strlen(zTag); | |
| 887 | + while( j>0 && fossil_isspace(zTag[j-1]) ){ j--; } | |
| 888 | + if( j==0 ) return 0; | |
| 889 | + style_submenu_element(zTag, zTag, "%s", zHref); | |
| 890 | + *pN = i+4; | |
| 891 | + return 1; | |
| 892 | +} | |
| 842 | 893 | |
| 843 | 894 | /* |
| 844 | 895 | ** Pop a single element off of the stack. As the element is popped, |
| 845 | 896 | ** output its end tag if it is not a </div> tag. |
| 846 | 897 | */ |
| @@ -1453,14 +1504,16 @@ | ||
| 1453 | 1504 | pushStack(p, markup.iCode); |
| 1454 | 1505 | renderMarkup(p->pOut, &markup); |
| 1455 | 1506 | } |
| 1456 | 1507 | }else |
| 1457 | 1508 | if( markup.iType==MUTYPE_HYPERLINK ){ |
| 1458 | - popStackToTag(p, markup.iCode); | |
| 1459 | - startAutoParagraph(p); | |
| 1460 | - renderMarkup(p->pOut, &markup); | |
| 1461 | - pushStack(p, markup.iCode); | |
| 1509 | + if( !isButtonHyperlink(p, &markup, z, &n) ){ | |
| 1510 | + popStackToTag(p, markup.iCode); | |
| 1511 | + startAutoParagraph(p); | |
| 1512 | + renderMarkup(p->pOut, &markup); | |
| 1513 | + pushStack(p, markup.iCode); | |
| 1514 | + } | |
| 1462 | 1515 | }else |
| 1463 | 1516 | { |
| 1464 | 1517 | if( markup.iType==MUTYPE_FONT ){ |
| 1465 | 1518 | startAutoParagraph(p); |
| 1466 | 1519 | }else if( markup.iType==MUTYPE_BLOCK || markup.iType==MUTYPE_LIST ){ |
| @@ -1508,11 +1561,11 @@ | ||
| 1508 | 1561 | void wiki_convert(Blob *pIn, Blob *pOut, int flags){ |
| 1509 | 1562 | char *z; |
| 1510 | 1563 | Renderer renderer; |
| 1511 | 1564 | |
| 1512 | 1565 | memset(&renderer, 0, sizeof(renderer)); |
| 1513 | - renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH; | |
| 1566 | + renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags; | |
| 1514 | 1567 | if( flags & WIKI_NOBLOCK ){ |
| 1515 | 1568 | renderer.state |= INLINE_MARKUP_ONLY; |
| 1516 | 1569 | } |
| 1517 | 1570 | if( flags & WIKI_INLINE ){ |
| 1518 | 1571 | renderer.wantAutoParagraph = 0; |
| @@ -1538,17 +1591,25 @@ | ||
| 1538 | 1591 | free(renderer.aStack); |
| 1539 | 1592 | } |
| 1540 | 1593 | |
| 1541 | 1594 | /* |
| 1542 | 1595 | ** COMMAND: test-wiki-render |
| 1596 | +** | |
| 1597 | +** %fossil test-wiki-render FILE [OPTIONS] | |
| 1598 | +** | |
| 1599 | +** Options: | |
| 1600 | +** --buttons Set the WIKI_BUTTONS flag | |
| 1543 | 1601 | */ |
| 1544 | 1602 | void test_wiki_render(void){ |
| 1545 | 1603 | Blob in, out; |
| 1604 | + int flags = 0; | |
| 1605 | + if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; | |
| 1606 | + verify_all_options(); | |
| 1546 | 1607 | if( g.argc!=3 ) usage("FILE"); |
| 1547 | 1608 | blob_zero(&out); |
| 1548 | 1609 | blob_read_from_file(&in, g.argv[2]); |
| 1549 | - wiki_convert(&in, &out, 0); | |
| 1610 | + wiki_convert(&in, &out, flags); | |
| 1550 | 1611 | blob_write_to_file(&out, "-"); |
| 1551 | 1612 | } |
| 1552 | 1613 | |
| 1553 | 1614 | /* |
| 1554 | 1615 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1555 | 1616 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -27,10 +27,11 @@ | |
| 27 | */ |
| 28 | #define WIKI_NOFOLLOW 0x001 |
| 29 | #define WIKI_HTML 0x002 |
| 30 | #define WIKI_INLINE 0x004 /* Do not surround with <p>..</p> */ |
| 31 | #define WIKI_NOBLOCK 0x008 /* No block markup of any kind */ |
| 32 | #endif |
| 33 | |
| 34 | |
| 35 | /* |
| 36 | ** These are the only markup attributes allowed. |
| @@ -378,19 +379,19 @@ | |
| 378 | #define TOKEN_INDENT 9 /* " " */ |
| 379 | #define TOKEN_RAW 10 /* Output exactly (used when wiki-use-html==1) */ |
| 380 | #define TOKEN_TEXT 11 /* None of the above */ |
| 381 | |
| 382 | /* |
| 383 | ** State flags |
| 384 | */ |
| 385 | #define AT_NEWLINE 0x001 /* At start of a line */ |
| 386 | #define AT_PARAGRAPH 0x002 /* At start of a paragraph */ |
| 387 | #define ALLOW_WIKI 0x004 /* Allow wiki markup */ |
| 388 | #define FONT_MARKUP_ONLY 0x008 /* Only allow MUTYPE_FONT markup */ |
| 389 | #define INLINE_MARKUP_ONLY 0x010 /* Allow only "inline" markup */ |
| 390 | #define IN_LIST 0x020 /* Within wiki <ul> or <ol> */ |
| 391 | #define WIKI_USE_HTML 0x040 /* wiki-use-html option = on */ |
| 392 | |
| 393 | /* |
| 394 | ** Current state of the rendering engine |
| 395 | */ |
| 396 | typedef struct Renderer Renderer; |
| @@ -825,22 +826,72 @@ | |
| 825 | z[n] = p->aAttr[i].cTerm; |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | /* |
| 830 | ** Return the ID attribute for markup. Return NULL if there is no |
| 831 | ** ID attribute. |
| 832 | */ |
| 833 | static const char *markupId(ParsedMarkup *p){ |
| 834 | int i; |
| 835 | for(i=0; i<p->nAttr; i++){ |
| 836 | if( p->aAttr[i].iACode==ATTR_ID ){ |
| 837 | return p->aAttr[i].zValue; |
| 838 | } |
| 839 | } |
| 840 | return 0; |
| 841 | } |
| 842 | |
| 843 | /* |
| 844 | ** Pop a single element off of the stack. As the element is popped, |
| 845 | ** output its end tag if it is not a </div> tag. |
| 846 | */ |
| @@ -1453,14 +1504,16 @@ | |
| 1453 | pushStack(p, markup.iCode); |
| 1454 | renderMarkup(p->pOut, &markup); |
| 1455 | } |
| 1456 | }else |
| 1457 | if( markup.iType==MUTYPE_HYPERLINK ){ |
| 1458 | popStackToTag(p, markup.iCode); |
| 1459 | startAutoParagraph(p); |
| 1460 | renderMarkup(p->pOut, &markup); |
| 1461 | pushStack(p, markup.iCode); |
| 1462 | }else |
| 1463 | { |
| 1464 | if( markup.iType==MUTYPE_FONT ){ |
| 1465 | startAutoParagraph(p); |
| 1466 | }else if( markup.iType==MUTYPE_BLOCK || markup.iType==MUTYPE_LIST ){ |
| @@ -1508,11 +1561,11 @@ | |
| 1508 | void wiki_convert(Blob *pIn, Blob *pOut, int flags){ |
| 1509 | char *z; |
| 1510 | Renderer renderer; |
| 1511 | |
| 1512 | memset(&renderer, 0, sizeof(renderer)); |
| 1513 | renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH; |
| 1514 | if( flags & WIKI_NOBLOCK ){ |
| 1515 | renderer.state |= INLINE_MARKUP_ONLY; |
| 1516 | } |
| 1517 | if( flags & WIKI_INLINE ){ |
| 1518 | renderer.wantAutoParagraph = 0; |
| @@ -1538,17 +1591,25 @@ | |
| 1538 | free(renderer.aStack); |
| 1539 | } |
| 1540 | |
| 1541 | /* |
| 1542 | ** COMMAND: test-wiki-render |
| 1543 | */ |
| 1544 | void test_wiki_render(void){ |
| 1545 | Blob in, out; |
| 1546 | if( g.argc!=3 ) usage("FILE"); |
| 1547 | blob_zero(&out); |
| 1548 | blob_read_from_file(&in, g.argv[2]); |
| 1549 | wiki_convert(&in, &out, 0); |
| 1550 | blob_write_to_file(&out, "-"); |
| 1551 | } |
| 1552 | |
| 1553 | /* |
| 1554 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1555 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -27,10 +27,11 @@ | |
| 27 | */ |
| 28 | #define WIKI_NOFOLLOW 0x001 |
| 29 | #define WIKI_HTML 0x002 |
| 30 | #define WIKI_INLINE 0x004 /* Do not surround with <p>..</p> */ |
| 31 | #define WIKI_NOBLOCK 0x008 /* No block markup of any kind */ |
| 32 | #define WIKI_BUTTONS 0x010 /* Allow sub-menu buttons */ |
| 33 | #endif |
| 34 | |
| 35 | |
| 36 | /* |
| 37 | ** These are the only markup attributes allowed. |
| @@ -378,19 +379,19 @@ | |
| 379 | #define TOKEN_INDENT 9 /* " " */ |
| 380 | #define TOKEN_RAW 10 /* Output exactly (used when wiki-use-html==1) */ |
| 381 | #define TOKEN_TEXT 11 /* None of the above */ |
| 382 | |
| 383 | /* |
| 384 | ** State flags. Save the lower 16 bits for the WIKI_* flags. |
| 385 | */ |
| 386 | #define AT_NEWLINE 0x0010000 /* At start of a line */ |
| 387 | #define AT_PARAGRAPH 0x0020000 /* At start of a paragraph */ |
| 388 | #define ALLOW_WIKI 0x0040000 /* Allow wiki markup */ |
| 389 | #define FONT_MARKUP_ONLY 0x0080000 /* Only allow MUTYPE_FONT markup */ |
| 390 | #define INLINE_MARKUP_ONLY 0x0100000 /* Allow only "inline" markup */ |
| 391 | #define IN_LIST 0x0200000 /* Within wiki <ul> or <ol> */ |
| 392 | #define WIKI_USE_HTML 0x0400000 /* wiki-use-html option = on */ |
| 393 | |
| 394 | /* |
| 395 | ** Current state of the rendering engine |
| 396 | */ |
| 397 | typedef struct Renderer Renderer; |
| @@ -825,22 +826,72 @@ | |
| 826 | z[n] = p->aAttr[i].cTerm; |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | /* |
| 831 | ** Return the value of attribute attrId. Return NULL if there is no |
| 832 | ** ID attribute. |
| 833 | */ |
| 834 | static const char *attributeValue(ParsedMarkup *p, int attrId){ |
| 835 | int i; |
| 836 | for(i=0; i<p->nAttr; i++){ |
| 837 | if( p->aAttr[i].iACode==attrId ){ |
| 838 | return p->aAttr[i].zValue; |
| 839 | } |
| 840 | } |
| 841 | return 0; |
| 842 | } |
| 843 | |
| 844 | /* |
| 845 | ** Return the ID attribute for markup. Return NULL if there is no |
| 846 | ** ID attribute. |
| 847 | */ |
| 848 | static const char *markupId(ParsedMarkup *p){ |
| 849 | return attributeValue(p, ATTR_ID); |
| 850 | } |
| 851 | |
| 852 | /* |
| 853 | ** Check markup pMarkup to see if it is a hyperlink with class "button" |
| 854 | ** that is follows by simple text and an </a> only. Example: |
| 855 | ** |
| 856 | ** <a class="button" href="../index.wiki">Index</a> |
| 857 | ** |
| 858 | ** If the markup matches this pattern, and if the WIKI_BUTTONS flag was |
| 859 | ** passed to wiki_convert(), then transform this link into a submenu |
| 860 | ** button, skip the text, and set *pN equal to the total length of the |
| 861 | ** text through the end of </a> and return true. If the markup does |
| 862 | ** not match or if WIKI_BUTTONS is not set, then make no changes to *pN |
| 863 | ** and return false. |
| 864 | */ |
| 865 | static int isButtonHyperlink( |
| 866 | Renderer *p, /* Renderer state */ |
| 867 | ParsedMarkup *pMarkup, /* Potential button markup */ |
| 868 | const char *z, /* Complete text of Wiki */ |
| 869 | int *pN /* Characters of z[] consumed */ |
| 870 | ){ |
| 871 | const char *zClass; |
| 872 | const char *zHref; |
| 873 | char *zTag; |
| 874 | int i, j; |
| 875 | if( (p->state & WIKI_BUTTONS)==0 ) return 0; |
| 876 | zClass = attributeValue(pMarkup, ATTR_CLASS); |
| 877 | if( zClass==0 ) return 0; |
| 878 | if( fossil_strcmp(zClass, "button")!=0 ) return 0; |
| 879 | zHref = attributeValue(pMarkup, ATTR_HREF); |
| 880 | if( zHref==0 ) return 0; |
| 881 | i = *pN; |
| 882 | while( z[i] && z[i]!='<' ){ i++; } |
| 883 | if( fossil_strnicmp(&z[i], "</a>",4)!=0 ) return 0; |
| 884 | for(j=*pN; fossil_isspace(z[j]); j++){} |
| 885 | zTag = mprintf("%.*s", i-j, &z[j]); |
| 886 | j = (int)strlen(zTag); |
| 887 | while( j>0 && fossil_isspace(zTag[j-1]) ){ j--; } |
| 888 | if( j==0 ) return 0; |
| 889 | style_submenu_element(zTag, zTag, "%s", zHref); |
| 890 | *pN = i+4; |
| 891 | return 1; |
| 892 | } |
| 893 | |
| 894 | /* |
| 895 | ** Pop a single element off of the stack. As the element is popped, |
| 896 | ** output its end tag if it is not a </div> tag. |
| 897 | */ |
| @@ -1453,14 +1504,16 @@ | |
| 1504 | pushStack(p, markup.iCode); |
| 1505 | renderMarkup(p->pOut, &markup); |
| 1506 | } |
| 1507 | }else |
| 1508 | if( markup.iType==MUTYPE_HYPERLINK ){ |
| 1509 | if( !isButtonHyperlink(p, &markup, z, &n) ){ |
| 1510 | popStackToTag(p, markup.iCode); |
| 1511 | startAutoParagraph(p); |
| 1512 | renderMarkup(p->pOut, &markup); |
| 1513 | pushStack(p, markup.iCode); |
| 1514 | } |
| 1515 | }else |
| 1516 | { |
| 1517 | if( markup.iType==MUTYPE_FONT ){ |
| 1518 | startAutoParagraph(p); |
| 1519 | }else if( markup.iType==MUTYPE_BLOCK || markup.iType==MUTYPE_LIST ){ |
| @@ -1508,11 +1561,11 @@ | |
| 1561 | void wiki_convert(Blob *pIn, Blob *pOut, int flags){ |
| 1562 | char *z; |
| 1563 | Renderer renderer; |
| 1564 | |
| 1565 | memset(&renderer, 0, sizeof(renderer)); |
| 1566 | renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags; |
| 1567 | if( flags & WIKI_NOBLOCK ){ |
| 1568 | renderer.state |= INLINE_MARKUP_ONLY; |
| 1569 | } |
| 1570 | if( flags & WIKI_INLINE ){ |
| 1571 | renderer.wantAutoParagraph = 0; |
| @@ -1538,17 +1591,25 @@ | |
| 1591 | free(renderer.aStack); |
| 1592 | } |
| 1593 | |
| 1594 | /* |
| 1595 | ** COMMAND: test-wiki-render |
| 1596 | ** |
| 1597 | ** %fossil test-wiki-render FILE [OPTIONS] |
| 1598 | ** |
| 1599 | ** Options: |
| 1600 | ** --buttons Set the WIKI_BUTTONS flag |
| 1601 | */ |
| 1602 | void test_wiki_render(void){ |
| 1603 | Blob in, out; |
| 1604 | int flags = 0; |
| 1605 | if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; |
| 1606 | verify_all_options(); |
| 1607 | if( g.argc!=3 ) usage("FILE"); |
| 1608 | blob_zero(&out); |
| 1609 | blob_read_from_file(&in, g.argv[2]); |
| 1610 | wiki_convert(&in, &out, flags); |
| 1611 | blob_write_to_file(&out, "-"); |
| 1612 | } |
| 1613 | |
| 1614 | /* |
| 1615 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1616 |
+70
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -1,6 +1,76 @@ | ||
| 1 | 1 | <title>Change Log</title> |
| 2 | + | |
| 3 | +<h2>Changes For Version 1.24 (2012-10-22)</h2> | |
| 4 | + * Added support for WYSIWYG editing of wiki pages. WYSIWYG is turned off | |
| 5 | + by default and can be turned on by setting a configuration option. | |
| 6 | + * Allow style= attribute to occur in HTML markup on wiki pages. | |
| 7 | + * Added the --tk option to the "fossi diff" and "fossil stash diff" | |
| 8 | + commands, causing color-coded diff output to be displayed in a Tcl/Tk | |
| 9 | + GUI window. This option only works if Tcl/Tk is installed on the | |
| 10 | + host. | |
| 11 | + * On windows, make the "gdiff" command default to use WinDiff.exe. | |
| 12 | + * Update the "fossil stash" command so that it always prompts for a | |
| 13 | + comment if the -m option is omitted. | |
| 14 | + * Enhance the timeline webpages so that a=, b=, c=, d=, p=, and dp= | |
| 15 | + query parameters (and others) can all accept any valid checkin name | |
| 16 | + (such as branch names or labels) instead of just SHA1 hashes. | |
| 17 | + * Added the "fossil stash show" command. | |
| 18 | + * Added the "fileage" webpage with links to this page from the check-in | |
| 19 | + information page and from the file browser. | |
| 20 | + * Added --age and -t options to the "fossil ls" command. | |
| 21 | + * Added the --setmtime option to "fossil update". When used, the mtime | |
| 22 | + of all mananged files is set to the time when the most recent version of | |
| 23 | + the file was checked in. | |
| 24 | + * Changed the "vdiff" webpage to show the complete text of files that | |
| 25 | + were added or removed (the equivelent of using the -N or --newfile | |
| 26 | + options with the "fossil diff" command-line.) | |
| 27 | + * Added the --temp option to "fossil clean" and "fossil extra", causing | |
| 28 | + those commands to only look at temporary files generated by Fossil, | |
| 29 | + such as merge-conflict reports or aborted check-in messages. | |
| 30 | + * Enhance the raw page download so that it can guess the mimetype of | |
| 31 | + attachments based on the filename. | |
| 32 | + * Change the behavior of the from= and to= query parameters on the | |
| 33 | + timeline page so that by default the path between the two specified | |
| 34 | + check-ins avoids merges. | |
| 35 | + * Add the --baseurl option to "fossil server" and "fossil http" commands, | |
| 36 | + so that those commands can be used with reverse proxies. | |
| 37 | + * If unable to determine the command-line user, do not guess. Instead | |
| 38 | + issue an error message. This helps prevent check-ins from accidentally | |
| 39 | + occurring under the wrong username. | |
| 40 | + * Include branch information in the output of file change listings | |
| 41 | + (the "finfo" webpage). | |
| 42 | + * Make the simplified view of file history, rather than the full view, | |
| 43 | + the default. | |
| 44 | + * In the "fossil configuration" command, allow the "css" option for | |
| 45 | + synchronizing, importing, or exporting just the CSS file. This makes | |
| 46 | + it easier to share CSS files across repositories by exporting from | |
| 47 | + one and importing to another. | |
| 48 | + * Add the (unsupported) "fossil test-orphans" command. | |
| 49 | + * Add the --template option to the "fossil init" command, to facilitate | |
| 50 | + creating new repositories based on a template repository. | |
| 51 | + * Add the diff-binary setting, which if enabled causes binary files to | |
| 52 | + be passed to the "gdiff" command for it to deal with, rather than simply | |
| 53 | + printing a "cannot diff binary files" error. | |
| 54 | + * Add the --unified option to the "fossil diff" command to force a unified | |
| 55 | + diff even if the --tk option (which normally implies a side-by-side diff) | |
| 56 | + is used. | |
| 57 | + * Present a choice of nearby branches and versions to diff against on the | |
| 58 | + check-in information page. | |
| 59 | + * Add the --force option to the "fossil merge" command that will force the | |
| 60 | + merge to occur even if it would be a no-op. This is sometimes useful for | |
| 61 | + documentation purposes. | |
| 62 | + * Add another built-in skin: "Enhanced Default". Other minor tweaks to | |
| 63 | + the existing skins. | |
| 64 | + * Add the "urllist" webpage, showing a list of URLs by which a server | |
| 65 | + instance of Fossil has been accessed. Requires "Administrator" privileges. | |
| 66 | + A link is on the "Setup" main page. | |
| 67 | + * Enable dynamic loading of the Tcl runtime for installations that want | |
| 68 | + to use Tcl as part of their configuration. This reduces the size of | |
| 69 | + the Fossil binary and allows any version of Tcl 8.4 or later to be used. | |
| 70 | + * Merge the latest SQLite changes from upstream. | |
| 71 | + * Lots of minor bug fixes. | |
| 2 | 72 | |
| 3 | 73 | <h2>Changes For Version 1.23 (2012-08-08)</h2> |
| 4 | 74 | * The default checkout database name is now ".fslckout" instead of |
| 5 | 75 | "_FOSSIL_" on unix. Both names continue to work. |
| 6 | 76 | * Added the "fossil all changes" command |
| 7 | 77 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,6 +1,76 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes For Version 1.23 (2012-08-08)</h2> |
| 4 | * The default checkout database name is now ".fslckout" instead of |
| 5 | "_FOSSIL_" on unix. Both names continue to work. |
| 6 | * Added the "fossil all changes" command |
| 7 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,6 +1,76 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes For Version 1.24 (2012-10-22)</h2> |
| 4 | * Added support for WYSIWYG editing of wiki pages. WYSIWYG is turned off |
| 5 | by default and can be turned on by setting a configuration option. |
| 6 | * Allow style= attribute to occur in HTML markup on wiki pages. |
| 7 | * Added the --tk option to the "fossi diff" and "fossil stash diff" |
| 8 | commands, causing color-coded diff output to be displayed in a Tcl/Tk |
| 9 | GUI window. This option only works if Tcl/Tk is installed on the |
| 10 | host. |
| 11 | * On windows, make the "gdiff" command default to use WinDiff.exe. |
| 12 | * Update the "fossil stash" command so that it always prompts for a |
| 13 | comment if the -m option is omitted. |
| 14 | * Enhance the timeline webpages so that a=, b=, c=, d=, p=, and dp= |
| 15 | query parameters (and others) can all accept any valid checkin name |
| 16 | (such as branch names or labels) instead of just SHA1 hashes. |
| 17 | * Added the "fossil stash show" command. |
| 18 | * Added the "fileage" webpage with links to this page from the check-in |
| 19 | information page and from the file browser. |
| 20 | * Added --age and -t options to the "fossil ls" command. |
| 21 | * Added the --setmtime option to "fossil update". When used, the mtime |
| 22 | of all mananged files is set to the time when the most recent version of |
| 23 | the file was checked in. |
| 24 | * Changed the "vdiff" webpage to show the complete text of files that |
| 25 | were added or removed (the equivelent of using the -N or --newfile |
| 26 | options with the "fossil diff" command-line.) |
| 27 | * Added the --temp option to "fossil clean" and "fossil extra", causing |
| 28 | those commands to only look at temporary files generated by Fossil, |
| 29 | such as merge-conflict reports or aborted check-in messages. |
| 30 | * Enhance the raw page download so that it can guess the mimetype of |
| 31 | attachments based on the filename. |
| 32 | * Change the behavior of the from= and to= query parameters on the |
| 33 | timeline page so that by default the path between the two specified |
| 34 | check-ins avoids merges. |
| 35 | * Add the --baseurl option to "fossil server" and "fossil http" commands, |
| 36 | so that those commands can be used with reverse proxies. |
| 37 | * If unable to determine the command-line user, do not guess. Instead |
| 38 | issue an error message. This helps prevent check-ins from accidentally |
| 39 | occurring under the wrong username. |
| 40 | * Include branch information in the output of file change listings |
| 41 | (the "finfo" webpage). |
| 42 | * Make the simplified view of file history, rather than the full view, |
| 43 | the default. |
| 44 | * In the "fossil configuration" command, allow the "css" option for |
| 45 | synchronizing, importing, or exporting just the CSS file. This makes |
| 46 | it easier to share CSS files across repositories by exporting from |
| 47 | one and importing to another. |
| 48 | * Add the (unsupported) "fossil test-orphans" command. |
| 49 | * Add the --template option to the "fossil init" command, to facilitate |
| 50 | creating new repositories based on a template repository. |
| 51 | * Add the diff-binary setting, which if enabled causes binary files to |
| 52 | be passed to the "gdiff" command for it to deal with, rather than simply |
| 53 | printing a "cannot diff binary files" error. |
| 54 | * Add the --unified option to the "fossil diff" command to force a unified |
| 55 | diff even if the --tk option (which normally implies a side-by-side diff) |
| 56 | is used. |
| 57 | * Present a choice of nearby branches and versions to diff against on the |
| 58 | check-in information page. |
| 59 | * Add the --force option to the "fossil merge" command that will force the |
| 60 | merge to occur even if it would be a no-op. This is sometimes useful for |
| 61 | documentation purposes. |
| 62 | * Add another built-in skin: "Enhanced Default". Other minor tweaks to |
| 63 | the existing skins. |
| 64 | * Add the "urllist" webpage, showing a list of URLs by which a server |
| 65 | instance of Fossil has been accessed. Requires "Administrator" privileges. |
| 66 | A link is on the "Setup" main page. |
| 67 | * Enable dynamic loading of the Tcl runtime for installations that want |
| 68 | to use Tcl as part of their configuration. This reduces the size of |
| 69 | the Fossil binary and allows any version of Tcl 8.4 or later to be used. |
| 70 | * Merge the latest SQLite changes from upstream. |
| 71 | * Lots of minor bug fixes. |
| 72 | |
| 73 | <h2>Changes For Version 1.23 (2012-08-08)</h2> |
| 74 | * The default checkout database name is now ".fslckout" instead of |
| 75 | "_FOSSIL_" on unix. Both names continue to work. |
| 76 | * Added the "fossil all changes" command |
| 77 |
+1
-1
| --- www/style.wiki | ||
| +++ www/style.wiki | ||
| @@ -23,11 +23,11 @@ | ||
| 23 | 23 | 16. All C-code conforms to ANSI C-89. |
| 24 | 24 | |
| 25 | 25 | 17. All comments and identifiers are in English. |
| 26 | 26 | |
| 27 | 27 | 18. The program is single-threaded. Do not use threads. |
| 28 | - (One except to this is the HTTP server implementation for windows, | |
| 28 | + (One exception to this is the HTTP server implementation for windows, | |
| 29 | 29 | which we do not know how to implement without the use of threads.) |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | <b>C preprocessor macros</b>: |
| 33 | 33 | |
| 34 | 34 |
| --- www/style.wiki | |
| +++ www/style.wiki | |
| @@ -23,11 +23,11 @@ | |
| 23 | 16. All C-code conforms to ANSI C-89. |
| 24 | |
| 25 | 17. All comments and identifiers are in English. |
| 26 | |
| 27 | 18. The program is single-threaded. Do not use threads. |
| 28 | (One except to this is the HTTP server implementation for windows, |
| 29 | which we do not know how to implement without the use of threads.) |
| 30 | |
| 31 | |
| 32 | <b>C preprocessor macros</b>: |
| 33 | |
| 34 |
| --- www/style.wiki | |
| +++ www/style.wiki | |
| @@ -23,11 +23,11 @@ | |
| 23 | 16. All C-code conforms to ANSI C-89. |
| 24 | |
| 25 | 17. All comments and identifiers are in English. |
| 26 | |
| 27 | 18. The program is single-threaded. Do not use threads. |
| 28 | (One exception to this is the HTTP server implementation for windows, |
| 29 | which we do not know how to implement without the use of threads.) |
| 30 | |
| 31 | |
| 32 | <b>C preprocessor macros</b>: |
| 33 | |
| 34 |