Fossil SCM

Unbreak compilation on Cygwin. Allow notpad to be used as unversioned content editor (notepad cannot handle UNIX line-endings)

jan.nijtmans 2016-08-24 14:56 trunk
Commit 6728970b766f7afff069239177c83dc4734ea424
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -138,11 +138,10 @@
138138
static int sqlcmd_autoinit(
139139
sqlite3 *db,
140140
const char **pzErrMsg,
141141
const void *notUsed
142142
){
143
- /* db_set_main_schemaname(db, "repository"); */
144143
add_content_sql_commands(db);
145144
db_add_aux_functions(db);
146145
re_add_sql_func(db);
147146
search_sql_setup(db);
148147
foci_register(db);
149148
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -138,11 +138,10 @@
138 static int sqlcmd_autoinit(
139 sqlite3 *db,
140 const char **pzErrMsg,
141 const void *notUsed
142 ){
143 /* db_set_main_schemaname(db, "repository"); */
144 add_content_sql_commands(db);
145 db_add_aux_functions(db);
146 re_add_sql_func(db);
147 search_sql_setup(db);
148 foci_register(db);
149
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -138,11 +138,10 @@
138 static int sqlcmd_autoinit(
139 sqlite3 *db,
140 const char **pzErrMsg,
141 const void *notUsed
142 ){
 
143 add_content_sql_commands(db);
144 db_add_aux_functions(db);
145 re_add_sql_func(db);
146 search_sql_setup(db);
147 foci_register(db);
148
--- src/unversioned.c
+++ src/unversioned.c
@@ -34,11 +34,11 @@
3434
static const char zUnversionedInit[] =
3535
@ CREATE TABLE IF NOT EXISTS repository.unversioned(
3636
@ name TEXT PRIMARY KEY, -- Name of the uv file
3737
@ rcvid INTEGER, -- Where received from
3838
@ mtime DATETIME, -- timestamp. Seconds since 1970.
39
-@ hash TEXT, -- Content hash. NULL if a delete marker
39
+@ hash TEXT, -- Content hash. NULL if a delete marker
4040
@ sz INTEGER, -- size of content after decompression
4141
@ encoding INT, -- 0: plaintext. 1: zlib compressed
4242
@ content BLOB -- content of the file. NULL if oversized
4343
@ ) WITHOUT ROWID;
4444
;
@@ -290,18 +290,24 @@
290290
fossil_fatal("no such uv-file: %Q", zUVFile);
291291
}
292292
if( looks_like_binary(&content) ){
293293
fossil_fatal("cannot edit binary content");
294294
}
295
+#if defined(_WIN32) || defined(__CYGWIN__)
296
+ blob_add_cr(&content);
297
+#endif
295298
blob_write_to_file(&content, zTFile);
296299
zCmd = mprintf("%s \"%s\"", zEditor, zTFile);
297300
if( fossil_system(zCmd) ){
298301
fossil_fatal("editor aborted: %Q", zCmd);
299302
}
300303
fossil_free(zCmd);
301304
blob_reset(&content);
302305
blob_read_from_file(&content, zTFile);
306
+#if defined(_WIN32) || defined(__CYGWIN__)
307
+ blob_to_lf_only(&content);
308
+#endif
303309
file_delete(zTFile);
304310
if( zMtime==0 ) mtime = time(0);
305311
unversioned_write(zUVFile, &content, mtime);
306312
db_end_transaction(0);
307313
blob_reset(&content);
308314
--- src/unversioned.c
+++ src/unversioned.c
@@ -34,11 +34,11 @@
34 static const char zUnversionedInit[] =
35 @ CREATE TABLE IF NOT EXISTS repository.unversioned(
36 @ name TEXT PRIMARY KEY, -- Name of the uv file
37 @ rcvid INTEGER, -- Where received from
38 @ mtime DATETIME, -- timestamp. Seconds since 1970.
39 @ hash TEXT, -- Content hash. NULL if a delete marker
40 @ sz INTEGER, -- size of content after decompression
41 @ encoding INT, -- 0: plaintext. 1: zlib compressed
42 @ content BLOB -- content of the file. NULL if oversized
43 @ ) WITHOUT ROWID;
44 ;
@@ -290,18 +290,24 @@
290 fossil_fatal("no such uv-file: %Q", zUVFile);
291 }
292 if( looks_like_binary(&content) ){
293 fossil_fatal("cannot edit binary content");
294 }
 
 
 
295 blob_write_to_file(&content, zTFile);
296 zCmd = mprintf("%s \"%s\"", zEditor, zTFile);
297 if( fossil_system(zCmd) ){
298 fossil_fatal("editor aborted: %Q", zCmd);
299 }
300 fossil_free(zCmd);
301 blob_reset(&content);
302 blob_read_from_file(&content, zTFile);
 
 
 
303 file_delete(zTFile);
304 if( zMtime==0 ) mtime = time(0);
305 unversioned_write(zUVFile, &content, mtime);
306 db_end_transaction(0);
307 blob_reset(&content);
308
--- src/unversioned.c
+++ src/unversioned.c
@@ -34,11 +34,11 @@
34 static const char zUnversionedInit[] =
35 @ CREATE TABLE IF NOT EXISTS repository.unversioned(
36 @ name TEXT PRIMARY KEY, -- Name of the uv file
37 @ rcvid INTEGER, -- Where received from
38 @ mtime DATETIME, -- timestamp. Seconds since 1970.
39 @ hash TEXT, -- Content hash. NULL if a delete marker
40 @ sz INTEGER, -- size of content after decompression
41 @ encoding INT, -- 0: plaintext. 1: zlib compressed
42 @ content BLOB -- content of the file. NULL if oversized
43 @ ) WITHOUT ROWID;
44 ;
@@ -290,18 +290,24 @@
290 fossil_fatal("no such uv-file: %Q", zUVFile);
291 }
292 if( looks_like_binary(&content) ){
293 fossil_fatal("cannot edit binary content");
294 }
295 #if defined(_WIN32) || defined(__CYGWIN__)
296 blob_add_cr(&content);
297 #endif
298 blob_write_to_file(&content, zTFile);
299 zCmd = mprintf("%s \"%s\"", zEditor, zTFile);
300 if( fossil_system(zCmd) ){
301 fossil_fatal("editor aborted: %Q", zCmd);
302 }
303 fossil_free(zCmd);
304 blob_reset(&content);
305 blob_read_from_file(&content, zTFile);
306 #if defined(_WIN32) || defined(__CYGWIN__)
307 blob_to_lf_only(&content);
308 #endif
309 file_delete(zTFile);
310 if( zMtime==0 ) mtime = time(0);
311 unversioned_write(zUVFile, &content, mtime);
312 db_end_transaction(0);
313 blob_reset(&content);
314
-1
--- src/util.c
+++ src/util.c
@@ -366,11 +366,10 @@
366366
#if defined(_WIN32) || defined(__CYGWIN__)
367367
if( zEditor==0 ){
368368
zEditor = mprintf("%s\\notepad.exe", fossil_getenv("SYSTEMROOT"));
369369
#if defined(__CYGWIN__)
370370
zEditor = fossil_utf8_to_path(zEditor, 0);
371
- blob_add_cr(pPrompt);
372371
#endif
373372
}
374373
#endif
375374
return zEditor;
376375
}
377376
--- src/util.c
+++ src/util.c
@@ -366,11 +366,10 @@
366 #if defined(_WIN32) || defined(__CYGWIN__)
367 if( zEditor==0 ){
368 zEditor = mprintf("%s\\notepad.exe", fossil_getenv("SYSTEMROOT"));
369 #if defined(__CYGWIN__)
370 zEditor = fossil_utf8_to_path(zEditor, 0);
371 blob_add_cr(pPrompt);
372 #endif
373 }
374 #endif
375 return zEditor;
376 }
377
--- src/util.c
+++ src/util.c
@@ -366,11 +366,10 @@
366 #if defined(_WIN32) || defined(__CYGWIN__)
367 if( zEditor==0 ){
368 zEditor = mprintf("%s\\notepad.exe", fossil_getenv("SYSTEMROOT"));
369 #if defined(__CYGWIN__)
370 zEditor = fossil_utf8_to_path(zEditor, 0);
 
371 #endif
372 }
373 #endif
374 return zEditor;
375 }
376

Keyboard Shortcuts

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