Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch convert_before_commit Excluding Merge-Ins
This is equivalent to a diff from e5b8eb1235 to 7e7dcdd2c9
2012-11-19
| ||
13:54 | Make no transformation to wiki hyperlinks (text inside [..]) if the content is not a valid hyperlink. Formerly, the faulty hyperlink would be displayed within <span class="brokenlink">..<span>. check-in: 90676f48f0 user: drh tags: trunk | |
04:39 | Modularize byte-order-mark and blob UTF-8 conversion handling. check-in: d29dd5449c user: mistachkin tags: convert_before_commit_v2 | |
2012-11-17
| ||
20:19 | merge trunk Closed-Leaf check-in: 7e7dcdd2c9 user: jan.nijtmans tags: convert_before_commit | |
19:16 | Fix the server-side sync operation so that it will not generate a delta loop when a file changes from its original state through two or more intermediate states and back to its original state and all versions of the file attempt to sync in a single transaction. check-in: e5b8eb1235 user: drh tags: trunk | |
19:07 | Avoid the <nobr> tag in generated HTML. check-in: 8ea929ca55 user: drh tags: trunk | |
15:03 | Only show the "pull only - not authorized to push" message once when syncing with a repo for which there is read-only permission. Leaf check-in: 6cc262207d user: drh tags: fix-sync-delta-loop | |
2012-11-12
| ||
13:16 | revert unrelated changes check-in: 2c5844b1be user: jan.nijtmans tags: convert_before_commit | |
Changes to src/checkin.c.
884 884 if( pnFBcard ) *pnFBcard = nFBcard; 885 885 } 886 886 887 887 /* 888 888 ** Issue a warning and give the user an opportunity to abandon out 889 889 ** if a Unicode (UTF-16) byte-order-mark (BOM) or a \r\n line ending 890 890 ** is seen in a text file. 891 +** 892 +** Return 1 if the user pressed 'c'. In that case, the file will have 893 +** been converted to UTF-8 (if it was UTF-16) with NL line-endings, 894 +** and the original file will have been renamed to "<filename>-original". 891 895 */ 892 -static void commit_warning( 893 - const Blob *p, /* The content of the file being committed. */ 896 +static int commit_warning( 897 + Blob *p, /* The content of the file being committed. */ 894 898 int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */ 895 899 int binOk, /* Non-zero if binary warnings should be disabled. */ 896 900 const char *zFilename /* The full name of the file being committed. */ 897 901 ){ 898 902 int eType; /* return value of looks_like_utf8/utf16() */ 899 903 int fUnicode; /* return value of starts_with_utf16_bom() */ 900 904 char *zMsg; /* Warning message */ 901 905 Blob fname; /* Relative pathname of the file */ 902 906 static int allOk = 0; /* Set to true to disable this routine */ 903 907 904 - if( allOk ) return; 908 + if( allOk ) return 0; 905 909 fUnicode = starts_with_utf16_bom(p); 906 910 eType = fUnicode ? looks_like_utf16(p) : looks_like_utf8(p); 907 911 if( eType==0 || eType==-1 || fUnicode ){ 908 912 const char *zWarning; 913 + const char *c = "c=convert/"; 909 914 Blob ans; 910 915 char cReply; 911 916 912 917 if( eType==-1 && fUnicode ){ 913 918 zWarning = "Unicode and CR/NL line endings"; 914 919 }else if( eType==-1 ){ 915 920 if( crnlOk ){ 916 - return; /* We don't want CR/NL warnings for this file. */ 921 + return 0; /* We don't want CR/NL warnings for this file. */ 917 922 } 918 923 zWarning = "CR/NL line endings"; 919 924 }else if( eType==0 ){ 920 925 if( binOk ){ 921 - return; /* We don't want binary warnings for this file. */ 926 + return 0; /* We don't want binary warnings for this file. */ 922 927 } 923 928 zWarning = "binary data"; 929 + c = ""; /* We cannot automatically convert binary files */ 924 930 }else{ 925 931 zWarning = "Unicode"; 932 +#ifndef _WIN32 933 + c = ""; /* On UNIX, we cannot automatically convert unicode files */ 934 +#endif 926 935 } 927 936 file_relative_name(zFilename, &fname, 0); 928 937 blob_zero(&ans); 929 938 zMsg = mprintf( 930 - "%s contains %s. commit anyhow (a=all/y/N)? ", 931 - blob_str(&fname), zWarning); 939 + "%s contains %s. commit anyhow (a=all/%sy/N)? ", 940 + blob_str(&fname), zWarning, c); 932 941 prompt_user(zMsg, &ans); 933 942 fossil_free(zMsg); 934 943 cReply = blob_str(&ans)[0]; 935 944 if( cReply=='a' || cReply=='A' ){ 936 945 allOk = 1; 946 + }else if( (c[0] != 0) && (cReply=='c' || cReply=='C') ){ 947 + char *zOrig = file_newname(zFilename, "original", 1); 948 + FILE *f; 949 + blob_write_to_file(p, zOrig); 950 + fossil_free(zOrig); 951 + f = fossil_fopen(zFilename, "wb"); 952 + if( fUnicode ) { 953 + static const unsigned char bom[] = { 0xEF, 0xBB, 0xBF }; 954 + fwrite(bom, 1, 3, f); 955 + blob_strip_bom(p, 0); 956 + } 957 + blob_remove_cr(p); 958 + fwrite(blob_buffer(p), 1, blob_size(p), f); 959 + fclose(f); 960 + return 1; 937 961 }else if( cReply!='y' && cReply!='Y' ){ 938 962 fossil_fatal("Abandoning commit due to %s in %s", 939 963 zWarning, blob_str(&fname)); 940 964 } 941 965 blob_reset(&ans); 942 966 blob_reset(&fname); 943 967 } 968 + return 0; 944 969 } 945 970 946 971 /* 947 972 ** qsort() comparison routine for an array of pointers to strings. 948 973 */ 949 974 static int tagCmp(const void *a, const void *b){ 950 975 char **pA = (char**)a; ................................................................................ 1040 1065 Blob manifest; /* Manifest in baseline form */ 1041 1066 Blob muuid; /* Manifest uuid */ 1042 1067 Blob cksum1, cksum2; /* Before and after commit checksums */ 1043 1068 Blob cksum1b; /* Checksum recorded in the manifest */ 1044 1069 int szD; /* Size of the delta manifest */ 1045 1070 int szB; /* Size of the baseline manifest */ 1046 1071 int nConflict = 0; /* Number of unresolved merge conflicts */ 1072 + int abortCommit = 0; 1047 1073 Blob ans; 1048 1074 char cReply; 1049 1075 1050 1076 url_proxy_options(); 1051 1077 noSign = find_option("nosign",0,0)!=0; 1052 1078 forceDelta = find_option("delta",0,0)!=0; 1053 1079 forceBaseline = find_option("baseline",0,0)!=0; ................................................................................ 1275 1301 blob_zero(&content); 1276 1302 if( file_wd_islink(zFullname) ){ 1277 1303 /* Instead of file content, put link destination path */ 1278 1304 blob_read_link(&content, zFullname); 1279 1305 }else{ 1280 1306 blob_read_from_file(&content, zFullname); 1281 1307 } 1282 - commit_warning(&content, crnlOk, binOk, zFullname); 1308 + abortCommit |= commit_warning(&content, crnlOk, binOk, zFullname); 1283 1309 if( chnged==1 && contains_merge_marker(&content) ){ 1284 1310 Blob fname; /* Relative pathname of the file */ 1285 1311 1286 1312 nConflict++; 1287 1313 file_relative_name(zFullname, &fname, 0); 1288 1314 fossil_print("possible unresolved merge conflict in %s\n", 1289 1315 blob_str(&fname)); ................................................................................ 1296 1322 } 1297 1323 db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id); 1298 1324 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); 1299 1325 } 1300 1326 db_finalize(&q); 1301 1327 if( nConflict && !allowConflict ){ 1302 1328 fossil_fatal("abort due to unresolve merge conflicts"); 1329 + } else if( abortCommit ){ 1330 + fossil_fatal("files are converted on your request. Please re-test before committing"); 1303 1331 } 1304 1332 1305 1333 /* Create the new manifest */ 1306 1334 if( blob_size(&comment)==0 ){ 1307 1335 blob_append(&comment, "(no comment)", -1); 1308 1336 } 1309 1337 if( forceDelta ){