Fossil SCM

Patch provided by Stefan Bellon, >Attached you'll find a patch that adds the "unicode-glob" to the >settings and respects its setting in the check-in. Additionally I >disabled all the check-in warnings (crnl, binary and unicode) in case >--force/-f is set on commit.

jan.nijtmans 2012-11-25 21:42 UTC trunk
Commit 0c2f705c80613594b04033c6928322ec38c71953
+18 -5
--- src/checkin.c
+++ src/checkin.c
@@ -890,10 +890,11 @@
890890
*/
891891
static void commit_warning(
892892
const Blob *p, /* The content of the file being committed. */
893893
int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */
894894
int binOk, /* Non-zero if binary warnings should be disabled. */
895
+ int unicodeOk, /* Non-zero if unicode warnings should be disabled. */
895896
const char *zFilename /* The full name of the file being committed. */
896897
){
897898
int eType; /* return value of looks_like_utf8/utf16() */
898899
int fUnicode; /* return value of starts_with_utf16_bom() */
899900
char *zMsg; /* Warning message */
@@ -907,10 +908,13 @@
907908
const char *zWarning;
908909
Blob ans;
909910
char cReply;
910911
911912
if( eType==-1 && fUnicode ){
913
+ if ( unicodeOk ){
914
+ return; /* We don't want unicode warnings for this file. */
915
+ }
912916
zWarning = "Unicode and CR/NL line endings";
913917
}else if( eType==-1 ){
914918
if( crnlOk ){
915919
return; /* We don't want CR/NL warnings for this file. */
916920
}
@@ -919,10 +923,13 @@
919923
if( binOk ){
920924
return; /* We don't want binary warnings for this file. */
921925
}
922926
zWarning = "binary data";
923927
}else{
928
+ if ( unicodeOk ){
929
+ return; /* We don't want unicode warnings for this file. */
930
+ }
924931
zWarning = "Unicode";
925932
}
926933
file_relative_name(zFilename, &fname, 0);
927934
blob_zero(&ans);
928935
zMsg = mprintf(
@@ -1251,36 +1258,42 @@
12511258
/* Step 1: Insert records for all modified files into the blob
12521259
** table. If there were arguments passed to this command, only
12531260
** the identified files are inserted (if they have been modified).
12541261
*/
12551262
db_prepare(&q,
1256
- "SELECT id, %Q || pathname, mrid, %s, chnged, %s FROM vfile "
1263
+ "SELECT id, %Q || pathname, mrid, %s, chnged, %s, %s FROM vfile "
12571264
"WHERE chnged==1 AND NOT deleted AND is_selected(id)",
1258
- g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")),
1259
- glob_expr("pathname", db_get("binary-glob",""))
1265
+ g.zLocalRoot,
1266
+ glob_expr("pathname", db_get("crnl-glob","")),
1267
+ glob_expr("pathname", db_get("binary-glob","")),
1268
+ glob_expr("pathname", db_get("unicode-glob",""))
12601269
);
12611270
while( db_step(&q)==SQLITE_ROW ){
12621271
int id, rid;
12631272
const char *zFullname;
12641273
Blob content;
1265
- int crnlOk, binOk, chnged;
1274
+ int crnlOk, binOk, unicodeOk, chnged;
12661275
12671276
id = db_column_int(&q, 0);
12681277
zFullname = db_column_text(&q, 1);
12691278
rid = db_column_int(&q, 2);
12701279
crnlOk = db_column_int(&q, 3);
12711280
chnged = db_column_int(&q, 4);
12721281
binOk = binaryOk || db_column_int(&q, 5);
1282
+ unicodeOk = db_column_int(&q, 6);
12731283
12741284
blob_zero(&content);
12751285
if( file_wd_islink(zFullname) ){
12761286
/* Instead of file content, put link destination path */
12771287
blob_read_link(&content, zFullname);
12781288
}else{
12791289
blob_read_from_file(&content, zFullname);
12801290
}
1281
- commit_warning(&content, crnlOk, binOk, zFullname);
1291
+ if( !forceFlag ){
1292
+ /* Do not emit any warnings in force mode. */
1293
+ commit_warning(&content, crnlOk, binOk, unicodeOk, zFullname);
1294
+ }
12821295
if( chnged==1 && contains_merge_marker(&content) ){
12831296
Blob fname; /* Relative pathname of the file */
12841297
12851298
nConflict++;
12861299
file_relative_name(zFullname, &fname, 0);
12871300
--- src/checkin.c
+++ src/checkin.c
@@ -890,10 +890,11 @@
890 */
891 static void commit_warning(
892 const Blob *p, /* The content of the file being committed. */
893 int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */
894 int binOk, /* Non-zero if binary warnings should be disabled. */
 
895 const char *zFilename /* The full name of the file being committed. */
896 ){
897 int eType; /* return value of looks_like_utf8/utf16() */
898 int fUnicode; /* return value of starts_with_utf16_bom() */
899 char *zMsg; /* Warning message */
@@ -907,10 +908,13 @@
907 const char *zWarning;
908 Blob ans;
909 char cReply;
910
911 if( eType==-1 && fUnicode ){
 
 
 
912 zWarning = "Unicode and CR/NL line endings";
913 }else if( eType==-1 ){
914 if( crnlOk ){
915 return; /* We don't want CR/NL warnings for this file. */
916 }
@@ -919,10 +923,13 @@
919 if( binOk ){
920 return; /* We don't want binary warnings for this file. */
921 }
922 zWarning = "binary data";
923 }else{
 
 
 
924 zWarning = "Unicode";
925 }
926 file_relative_name(zFilename, &fname, 0);
927 blob_zero(&ans);
928 zMsg = mprintf(
@@ -1251,36 +1258,42 @@
1251 /* Step 1: Insert records for all modified files into the blob
1252 ** table. If there were arguments passed to this command, only
1253 ** the identified files are inserted (if they have been modified).
1254 */
1255 db_prepare(&q,
1256 "SELECT id, %Q || pathname, mrid, %s, chnged, %s FROM vfile "
1257 "WHERE chnged==1 AND NOT deleted AND is_selected(id)",
1258 g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")),
1259 glob_expr("pathname", db_get("binary-glob",""))
 
 
1260 );
1261 while( db_step(&q)==SQLITE_ROW ){
1262 int id, rid;
1263 const char *zFullname;
1264 Blob content;
1265 int crnlOk, binOk, chnged;
1266
1267 id = db_column_int(&q, 0);
1268 zFullname = db_column_text(&q, 1);
1269 rid = db_column_int(&q, 2);
1270 crnlOk = db_column_int(&q, 3);
1271 chnged = db_column_int(&q, 4);
1272 binOk = binaryOk || db_column_int(&q, 5);
 
1273
1274 blob_zero(&content);
1275 if( file_wd_islink(zFullname) ){
1276 /* Instead of file content, put link destination path */
1277 blob_read_link(&content, zFullname);
1278 }else{
1279 blob_read_from_file(&content, zFullname);
1280 }
1281 commit_warning(&content, crnlOk, binOk, zFullname);
 
 
 
1282 if( chnged==1 && contains_merge_marker(&content) ){
1283 Blob fname; /* Relative pathname of the file */
1284
1285 nConflict++;
1286 file_relative_name(zFullname, &fname, 0);
1287
--- src/checkin.c
+++ src/checkin.c
@@ -890,10 +890,11 @@
890 */
891 static void commit_warning(
892 const Blob *p, /* The content of the file being committed. */
893 int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */
894 int binOk, /* Non-zero if binary warnings should be disabled. */
895 int unicodeOk, /* Non-zero if unicode warnings should be disabled. */
896 const char *zFilename /* The full name of the file being committed. */
897 ){
898 int eType; /* return value of looks_like_utf8/utf16() */
899 int fUnicode; /* return value of starts_with_utf16_bom() */
900 char *zMsg; /* Warning message */
@@ -907,10 +908,13 @@
908 const char *zWarning;
909 Blob ans;
910 char cReply;
911
912 if( eType==-1 && fUnicode ){
913 if ( unicodeOk ){
914 return; /* We don't want unicode warnings for this file. */
915 }
916 zWarning = "Unicode and CR/NL line endings";
917 }else if( eType==-1 ){
918 if( crnlOk ){
919 return; /* We don't want CR/NL warnings for this file. */
920 }
@@ -919,10 +923,13 @@
923 if( binOk ){
924 return; /* We don't want binary warnings for this file. */
925 }
926 zWarning = "binary data";
927 }else{
928 if ( unicodeOk ){
929 return; /* We don't want unicode warnings for this file. */
930 }
931 zWarning = "Unicode";
932 }
933 file_relative_name(zFilename, &fname, 0);
934 blob_zero(&ans);
935 zMsg = mprintf(
@@ -1251,36 +1258,42 @@
1258 /* Step 1: Insert records for all modified files into the blob
1259 ** table. If there were arguments passed to this command, only
1260 ** the identified files are inserted (if they have been modified).
1261 */
1262 db_prepare(&q,
1263 "SELECT id, %Q || pathname, mrid, %s, chnged, %s, %s FROM vfile "
1264 "WHERE chnged==1 AND NOT deleted AND is_selected(id)",
1265 g.zLocalRoot,
1266 glob_expr("pathname", db_get("crnl-glob","")),
1267 glob_expr("pathname", db_get("binary-glob","")),
1268 glob_expr("pathname", db_get("unicode-glob",""))
1269 );
1270 while( db_step(&q)==SQLITE_ROW ){
1271 int id, rid;
1272 const char *zFullname;
1273 Blob content;
1274 int crnlOk, binOk, unicodeOk, chnged;
1275
1276 id = db_column_int(&q, 0);
1277 zFullname = db_column_text(&q, 1);
1278 rid = db_column_int(&q, 2);
1279 crnlOk = db_column_int(&q, 3);
1280 chnged = db_column_int(&q, 4);
1281 binOk = binaryOk || db_column_int(&q, 5);
1282 unicodeOk = db_column_int(&q, 6);
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( !forceFlag ){
1292 /* Do not emit any warnings in force mode. */
1293 commit_warning(&content, crnlOk, binOk, unicodeOk, zFullname);
1294 }
1295 if( chnged==1 && contains_merge_marker(&content) ){
1296 Blob fname; /* Relative pathname of the file */
1297
1298 nConflict++;
1299 file_relative_name(zFullname, &fname, 0);
1300
--- src/configure.c
+++ src/configure.c
@@ -103,10 +103,11 @@
103103
{ "project-description", CONFIGSET_PROJ },
104104
{ "manifest", CONFIGSET_PROJ },
105105
{ "binary-glob", CONFIGSET_PROJ },
106106
{ "ignore-glob", CONFIGSET_PROJ },
107107
{ "crnl-glob", CONFIGSET_PROJ },
108
+ { "unicode-glob", CONFIGSET_PROJ },
108109
{ "empty-dirs", CONFIGSET_PROJ },
109110
{ "allow-symlinks", CONFIGSET_PROJ },
110111
111112
{ "ticket-table", CONFIGSET_TKT },
112113
{ "ticket-common", CONFIGSET_TKT },
113114
--- src/configure.c
+++ src/configure.c
@@ -103,10 +103,11 @@
103 { "project-description", CONFIGSET_PROJ },
104 { "manifest", CONFIGSET_PROJ },
105 { "binary-glob", CONFIGSET_PROJ },
106 { "ignore-glob", CONFIGSET_PROJ },
107 { "crnl-glob", CONFIGSET_PROJ },
 
108 { "empty-dirs", CONFIGSET_PROJ },
109 { "allow-symlinks", CONFIGSET_PROJ },
110
111 { "ticket-table", CONFIGSET_TKT },
112 { "ticket-common", CONFIGSET_TKT },
113
--- src/configure.c
+++ src/configure.c
@@ -103,10 +103,11 @@
103 { "project-description", CONFIGSET_PROJ },
104 { "manifest", CONFIGSET_PROJ },
105 { "binary-glob", CONFIGSET_PROJ },
106 { "ignore-glob", CONFIGSET_PROJ },
107 { "crnl-glob", CONFIGSET_PROJ },
108 { "unicode-glob", CONFIGSET_PROJ },
109 { "empty-dirs", CONFIGSET_PROJ },
110 { "allow-symlinks", CONFIGSET_PROJ },
111
112 { "ticket-table", CONFIGSET_TKT },
113 { "ticket-common", CONFIGSET_TKT },
114
+5
--- src/db.c
+++ src/db.c
@@ -2085,10 +2085,11 @@
20852085
{ "th1-setup", 0, 40, 0, "" },
20862086
#ifdef FOSSIL_ENABLE_TCL
20872087
{ "tcl", 0, 0, 0, "off" },
20882088
{ "tcl-setup", 0, 40, 0, "" },
20892089
#endif
2090
+ { "unicode-glob", 0, 40, 1, "" },
20902091
{ "web-browser", 0, 32, 0, "" },
20912092
{ "white-foreground", 0, 0, 0, "off" },
20922093
{ 0,0,0,0,0 }
20932094
};
20942095
@@ -2262,10 +2263,14 @@
22622263
** is empty and no extra setup is performed.
22632264
**
22642265
** th1-setup This is the setup script to be evaluated after creating
22652266
** and initializing the TH1 interpreter. By default, this
22662267
** is empty and no extra setup is performed.
2268
+**
2269
+** unicode-glob The VALUE is a comma or newline-separated list of
2270
+** (versionable) GLOB patterns of files that should not produce a Unicode
2271
+** warning. Set to "*" to disable Unicode checking.
22672272
**
22682273
** web-browser A shell command used to launch your preferred
22692274
** web browser when given a URL as an argument.
22702275
** Defaults to "start" on windows, "open" on Mac,
22712276
** and "firefox" on Unix.
22722277
--- src/db.c
+++ src/db.c
@@ -2085,10 +2085,11 @@
2085 { "th1-setup", 0, 40, 0, "" },
2086 #ifdef FOSSIL_ENABLE_TCL
2087 { "tcl", 0, 0, 0, "off" },
2088 { "tcl-setup", 0, 40, 0, "" },
2089 #endif
 
2090 { "web-browser", 0, 32, 0, "" },
2091 { "white-foreground", 0, 0, 0, "off" },
2092 { 0,0,0,0,0 }
2093 };
2094
@@ -2262,10 +2263,14 @@
2262 ** is empty and no extra setup is performed.
2263 **
2264 ** th1-setup This is the setup script to be evaluated after creating
2265 ** and initializing the TH1 interpreter. By default, this
2266 ** is empty and no extra setup is performed.
 
 
 
 
2267 **
2268 ** web-browser A shell command used to launch your preferred
2269 ** web browser when given a URL as an argument.
2270 ** Defaults to "start" on windows, "open" on Mac,
2271 ** and "firefox" on Unix.
2272
--- src/db.c
+++ src/db.c
@@ -2085,10 +2085,11 @@
2085 { "th1-setup", 0, 40, 0, "" },
2086 #ifdef FOSSIL_ENABLE_TCL
2087 { "tcl", 0, 0, 0, "off" },
2088 { "tcl-setup", 0, 40, 0, "" },
2089 #endif
2090 { "unicode-glob", 0, 40, 1, "" },
2091 { "web-browser", 0, 32, 0, "" },
2092 { "white-foreground", 0, 0, 0, "off" },
2093 { 0,0,0,0,0 }
2094 };
2095
@@ -2262,10 +2263,14 @@
2263 ** is empty and no extra setup is performed.
2264 **
2265 ** th1-setup This is the setup script to be evaluated after creating
2266 ** and initializing the TH1 interpreter. By default, this
2267 ** is empty and no extra setup is performed.
2268 **
2269 ** unicode-glob The VALUE is a comma or newline-separated list of
2270 ** (versionable) GLOB patterns of files that should not produce a Unicode
2271 ** warning. Set to "*" to disable Unicode checking.
2272 **
2273 ** web-browser A shell command used to launch your preferred
2274 ** web browser when given a URL as an argument.
2275 ** Defaults to "start" on windows, "open" on Mac,
2276 ** and "firefox" on Unix.
2277

Keyboard Shortcuts

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