Fossil SCM
Attempt to get Fossil working on windows systems that do not use UTF8 in the shell.
Commit
e805fa8db90fb3ef4a0d971502d988d6e6b60016
Parent
989fc1f2b6c71b0…
45 files changed
+5
-5
+2
-2
+8
-8
+2
-2
+3
-3
+1
-1
+2
-2
+15
-15
+2
-2
+5
-5
+6
-6
+4
-4
+4
-4
+8
-20
+7
-13
+5
-4
+4
-4
+12
-14
+3
-3
+3
-3
+3
-3
+7
-7
+15
-15
+37
-26
+1
-1
+17
-15
+4
-8
+3
-3
+10
-9
+28
-1
+22
-20
+9
-9
+1
-1
+12
-12
+4
-4
+5
-5
+4
-4
+14
-13
+21
-20
+15
-15
+6
-6
+6
-5
+4
-4
+3
-3
+3
-3
~
src/add.c
~
src/allrepo.c
~
src/bisect.c
~
src/blob.c
~
src/branch.c
~
src/captcha.c
~
src/cgi.c
~
src/checkin.c
~
src/checkout.c
~
src/clone.c
~
src/comformat.c
~
src/configure.c
~
src/content.c
~
src/db.c
~
src/deltacmd.c
~
src/diff.c
~
src/encode.c
~
src/file.c
~
src/finfo.c
~
src/glob.c
~
src/http_transport.c
~
src/import.c
~
src/info.c
~
src/main.c
~
src/md5.c
~
src/merge.c
~
src/merge3.c
~
src/name.c
~
src/path.c
~
src/printf.c
~
src/rebuild.c
~
src/report.c
~
src/sha1.c
~
src/stash.c
~
src/sync.c
~
src/tag.c
~
src/timeline.c
~
src/undo.c
~
src/update.c
~
src/url.c
~
src/user.c
~
src/vfile.c
~
src/wiki.c
~
src/winhttp.c
~
src/xfer.c
+5
-5
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -116,11 +116,11 @@ | ||
| 116 | 116 | "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)" |
| 117 | 117 | "VALUES(%d,0,0,0,%Q,%d)", |
| 118 | 118 | vid, zPath, file_isexe(zFullname)); |
| 119 | 119 | fossil_free(zFullname); |
| 120 | 120 | } |
| 121 | - printf("ADDED %s\n", zPath); | |
| 121 | + fossil_print("ADDED %s\n", zPath); | |
| 122 | 122 | return 1; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /* |
| 126 | 126 | ** Add all files in the sfile temp table. |
| @@ -280,11 +280,11 @@ | ||
| 280 | 280 | blob_reset(&treeName); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | db_prepare(&loop, "SELECT x FROM sfile"); |
| 284 | 284 | while( db_step(&loop)==SQLITE_ROW ){ |
| 285 | - printf("DELETED %s\n", db_column_text(&loop, 0)); | |
| 285 | + fossil_print("DELETED %s\n", db_column_text(&loop, 0)); | |
| 286 | 286 | } |
| 287 | 287 | db_finalize(&loop); |
| 288 | 288 | db_multi_exec( |
| 289 | 289 | "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;" |
| 290 | 290 | "DELETE FROM vfile WHERE rid=0 AND deleted;" |
| @@ -377,17 +377,17 @@ | ||
| 377 | 377 | zPath = db_column_text(&q, 1); |
| 378 | 378 | if( !file_isfile(zPath) ){ |
| 379 | 379 | if( !isTest ){ |
| 380 | 380 | db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile); |
| 381 | 381 | } |
| 382 | - printf("DELETED %s\n", zFile); | |
| 382 | + fossil_print("DELETED %s\n", zFile); | |
| 383 | 383 | nDelete++; |
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | db_finalize(&q); |
| 387 | 387 | /* show cmmand summary */ |
| 388 | - printf("added %d files, deleted %d files\n", nAdd, nDelete); | |
| 388 | + fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); | |
| 389 | 389 | |
| 390 | 390 | db_end_transaction(isTest); |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | |
| @@ -395,11 +395,11 @@ | ||
| 395 | 395 | ** Rename a single file. |
| 396 | 396 | ** |
| 397 | 397 | ** The original name of the file is zOrig. The new filename is zNew. |
| 398 | 398 | */ |
| 399 | 399 | static void mv_one_file(int vid, const char *zOrig, const char *zNew){ |
| 400 | - printf("RENAME %s %s\n", zOrig, zNew); | |
| 400 | + fossil_print("RENAME %s %s\n", zOrig, zNew); | |
| 401 | 401 | db_multi_exec( |
| 402 | 402 | "UPDATE vfile SET pathname='%s' WHERE pathname='%s' AND vid=%d", |
| 403 | 403 | zNew, zOrig, vid |
| 404 | 404 | ); |
| 405 | 405 | } |
| 406 | 406 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -116,11 +116,11 @@ | |
| 116 | "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)" |
| 117 | "VALUES(%d,0,0,0,%Q,%d)", |
| 118 | vid, zPath, file_isexe(zFullname)); |
| 119 | fossil_free(zFullname); |
| 120 | } |
| 121 | printf("ADDED %s\n", zPath); |
| 122 | return 1; |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | ** Add all files in the sfile temp table. |
| @@ -280,11 +280,11 @@ | |
| 280 | blob_reset(&treeName); |
| 281 | } |
| 282 | |
| 283 | db_prepare(&loop, "SELECT x FROM sfile"); |
| 284 | while( db_step(&loop)==SQLITE_ROW ){ |
| 285 | printf("DELETED %s\n", db_column_text(&loop, 0)); |
| 286 | } |
| 287 | db_finalize(&loop); |
| 288 | db_multi_exec( |
| 289 | "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;" |
| 290 | "DELETE FROM vfile WHERE rid=0 AND deleted;" |
| @@ -377,17 +377,17 @@ | |
| 377 | zPath = db_column_text(&q, 1); |
| 378 | if( !file_isfile(zPath) ){ |
| 379 | if( !isTest ){ |
| 380 | db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile); |
| 381 | } |
| 382 | printf("DELETED %s\n", zFile); |
| 383 | nDelete++; |
| 384 | } |
| 385 | } |
| 386 | db_finalize(&q); |
| 387 | /* show cmmand summary */ |
| 388 | printf("added %d files, deleted %d files\n", nAdd, nDelete); |
| 389 | |
| 390 | db_end_transaction(isTest); |
| 391 | } |
| 392 | |
| 393 | |
| @@ -395,11 +395,11 @@ | |
| 395 | ** Rename a single file. |
| 396 | ** |
| 397 | ** The original name of the file is zOrig. The new filename is zNew. |
| 398 | */ |
| 399 | static void mv_one_file(int vid, const char *zOrig, const char *zNew){ |
| 400 | printf("RENAME %s %s\n", zOrig, zNew); |
| 401 | db_multi_exec( |
| 402 | "UPDATE vfile SET pathname='%s' WHERE pathname='%s' AND vid=%d", |
| 403 | zNew, zOrig, vid |
| 404 | ); |
| 405 | } |
| 406 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -116,11 +116,11 @@ | |
| 116 | "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)" |
| 117 | "VALUES(%d,0,0,0,%Q,%d)", |
| 118 | vid, zPath, file_isexe(zFullname)); |
| 119 | fossil_free(zFullname); |
| 120 | } |
| 121 | fossil_print("ADDED %s\n", zPath); |
| 122 | return 1; |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | ** Add all files in the sfile temp table. |
| @@ -280,11 +280,11 @@ | |
| 280 | blob_reset(&treeName); |
| 281 | } |
| 282 | |
| 283 | db_prepare(&loop, "SELECT x FROM sfile"); |
| 284 | while( db_step(&loop)==SQLITE_ROW ){ |
| 285 | fossil_print("DELETED %s\n", db_column_text(&loop, 0)); |
| 286 | } |
| 287 | db_finalize(&loop); |
| 288 | db_multi_exec( |
| 289 | "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;" |
| 290 | "DELETE FROM vfile WHERE rid=0 AND deleted;" |
| @@ -377,17 +377,17 @@ | |
| 377 | zPath = db_column_text(&q, 1); |
| 378 | if( !file_isfile(zPath) ){ |
| 379 | if( !isTest ){ |
| 380 | db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile); |
| 381 | } |
| 382 | fossil_print("DELETED %s\n", zFile); |
| 383 | nDelete++; |
| 384 | } |
| 385 | } |
| 386 | db_finalize(&q); |
| 387 | /* show cmmand summary */ |
| 388 | fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); |
| 389 | |
| 390 | db_end_transaction(isTest); |
| 391 | } |
| 392 | |
| 393 | |
| @@ -395,11 +395,11 @@ | |
| 395 | ** Rename a single file. |
| 396 | ** |
| 397 | ** The original name of the file is zOrig. The new filename is zNew. |
| 398 | */ |
| 399 | static void mv_one_file(int vid, const char *zOrig, const char *zNew){ |
| 400 | fossil_print("RENAME %s %s\n", zOrig, zNew); |
| 401 | db_multi_exec( |
| 402 | "UPDATE vfile SET pathname='%s' WHERE pathname='%s' AND vid=%d", |
| 403 | zNew, zOrig, vid |
| 404 | ); |
| 405 | } |
| 406 |
+2
-2
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -135,16 +135,16 @@ | ||
| 135 | 135 | nMissing++; |
| 136 | 136 | continue; |
| 137 | 137 | } |
| 138 | 138 | if( !file_is_canonical(zFilename) ) nMissing++; |
| 139 | 139 | if( zCmd[0]=='l' ){ |
| 140 | - printf("%s\n", zFilename); | |
| 140 | + fossil_print("%s\n", zFilename); | |
| 141 | 141 | continue; |
| 142 | 142 | } |
| 143 | 143 | zQFilename = quoteFilename(zFilename); |
| 144 | 144 | zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename); |
| 145 | - printf("%s\n", zSyscmd); | |
| 145 | + fossil_print("%s\n", zSyscmd); | |
| 146 | 146 | fflush(stdout); |
| 147 | 147 | rc = fossil_system(zSyscmd); |
| 148 | 148 | free(zSyscmd); |
| 149 | 149 | free(zQFilename); |
| 150 | 150 | if( stopOnError && rc ){ |
| 151 | 151 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -135,16 +135,16 @@ | |
| 135 | nMissing++; |
| 136 | continue; |
| 137 | } |
| 138 | if( !file_is_canonical(zFilename) ) nMissing++; |
| 139 | if( zCmd[0]=='l' ){ |
| 140 | printf("%s\n", zFilename); |
| 141 | continue; |
| 142 | } |
| 143 | zQFilename = quoteFilename(zFilename); |
| 144 | zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename); |
| 145 | printf("%s\n", zSyscmd); |
| 146 | fflush(stdout); |
| 147 | rc = fossil_system(zSyscmd); |
| 148 | free(zSyscmd); |
| 149 | free(zQFilename); |
| 150 | if( stopOnError && rc ){ |
| 151 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -135,16 +135,16 @@ | |
| 135 | nMissing++; |
| 136 | continue; |
| 137 | } |
| 138 | if( !file_is_canonical(zFilename) ) nMissing++; |
| 139 | if( zCmd[0]=='l' ){ |
| 140 | fossil_print("%s\n", zFilename); |
| 141 | continue; |
| 142 | } |
| 143 | zQFilename = quoteFilename(zFilename); |
| 144 | zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename); |
| 145 | fossil_print("%s\n", zSyscmd); |
| 146 | fflush(stdout); |
| 147 | rc = fossil_system(zSyscmd); |
| 148 | free(zSyscmd); |
| 149 | free(zQFilename); |
| 150 | if( stopOnError && rc ){ |
| 151 |
+8
-8
| --- src/bisect.c | ||
| +++ src/bisect.c | ||
| @@ -184,11 +184,11 @@ | ||
| 184 | 184 | }else if( memcmp(zCmd, "options", n)==0 ){ |
| 185 | 185 | if( g.argc==3 ){ |
| 186 | 186 | unsigned int i; |
| 187 | 187 | for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){ |
| 188 | 188 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 189 | - printf(" %-15s %-6s ", aBisectOption[i].zName, | |
| 189 | + fossil_print(" %-15s %-6s ", aBisectOption[i].zName, | |
| 190 | 190 | db_lget(z, (char*)aBisectOption[i].zDefault)); |
| 191 | 191 | fossil_free(z); |
| 192 | 192 | comment_print(aBisectOption[i].zDesc, 27, 79); |
| 193 | 193 | } |
| 194 | 194 | }else if( g.argc==4 || g.argc==5 ){ |
| @@ -198,11 +198,11 @@ | ||
| 198 | 198 | if( memcmp(g.argv[3], aBisectOption[i].zName, n)==0 ){ |
| 199 | 199 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 200 | 200 | if( g.argc==5 ){ |
| 201 | 201 | db_lset(z, g.argv[4]); |
| 202 | 202 | } |
| 203 | - printf("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault)); | |
| 203 | + fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault)); | |
| 204 | 204 | fossil_free(z); |
| 205 | 205 | break; |
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | if( i>=sizeof(aBisectOption)/sizeof(aBisectOption[0]) ){ |
| @@ -230,19 +230,19 @@ | ||
| 230 | 230 | for(p=path_last(), n=0; p; p=p->pFrom, n++){ |
| 231 | 231 | const char *z; |
| 232 | 232 | db_bind_int(&s, ":rid", p->rid); |
| 233 | 233 | if( db_step(&s)==SQLITE_ROW ){ |
| 234 | 234 | z = db_column_text(&s, 0); |
| 235 | - printf("%s", z); | |
| 236 | - if( p->rid==bisect.good ) printf(" GOOD"); | |
| 237 | - if( p->rid==bisect.bad ) printf(" BAD"); | |
| 238 | - if( p->rid==vid ) printf(" CURRENT"); | |
| 239 | - if( nStep>1 && n==nStep/2 ) printf(" NEXT"); | |
| 240 | - printf("\n"); | |
| 235 | + fossil_print("%s", z); | |
| 236 | + if( p->rid==bisect.good ) fossil_print(" GOOD"); | |
| 237 | + if( p->rid==bisect.bad ) fossil_print(" BAD"); | |
| 238 | + if( p->rid==vid ) fossil_print(" CURRENT"); | |
| 239 | + if( nStep>1 && n==nStep/2 ) fossil_print(" NEXT"); | |
| 240 | + fossil_print("\n"); | |
| 241 | 241 | } |
| 242 | 242 | db_reset(&s); |
| 243 | 243 | } |
| 244 | 244 | db_finalize(&s); |
| 245 | 245 | }else{ |
| 246 | 246 | usage("bad|good|next|reset|vlist ..."); |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 |
| --- src/bisect.c | |
| +++ src/bisect.c | |
| @@ -184,11 +184,11 @@ | |
| 184 | }else if( memcmp(zCmd, "options", n)==0 ){ |
| 185 | if( g.argc==3 ){ |
| 186 | unsigned int i; |
| 187 | for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){ |
| 188 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 189 | printf(" %-15s %-6s ", aBisectOption[i].zName, |
| 190 | db_lget(z, (char*)aBisectOption[i].zDefault)); |
| 191 | fossil_free(z); |
| 192 | comment_print(aBisectOption[i].zDesc, 27, 79); |
| 193 | } |
| 194 | }else if( g.argc==4 || g.argc==5 ){ |
| @@ -198,11 +198,11 @@ | |
| 198 | if( memcmp(g.argv[3], aBisectOption[i].zName, n)==0 ){ |
| 199 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 200 | if( g.argc==5 ){ |
| 201 | db_lset(z, g.argv[4]); |
| 202 | } |
| 203 | printf("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault)); |
| 204 | fossil_free(z); |
| 205 | break; |
| 206 | } |
| 207 | } |
| 208 | if( i>=sizeof(aBisectOption)/sizeof(aBisectOption[0]) ){ |
| @@ -230,19 +230,19 @@ | |
| 230 | for(p=path_last(), n=0; p; p=p->pFrom, n++){ |
| 231 | const char *z; |
| 232 | db_bind_int(&s, ":rid", p->rid); |
| 233 | if( db_step(&s)==SQLITE_ROW ){ |
| 234 | z = db_column_text(&s, 0); |
| 235 | printf("%s", z); |
| 236 | if( p->rid==bisect.good ) printf(" GOOD"); |
| 237 | if( p->rid==bisect.bad ) printf(" BAD"); |
| 238 | if( p->rid==vid ) printf(" CURRENT"); |
| 239 | if( nStep>1 && n==nStep/2 ) printf(" NEXT"); |
| 240 | printf("\n"); |
| 241 | } |
| 242 | db_reset(&s); |
| 243 | } |
| 244 | db_finalize(&s); |
| 245 | }else{ |
| 246 | usage("bad|good|next|reset|vlist ..."); |
| 247 | } |
| 248 | } |
| 249 |
| --- src/bisect.c | |
| +++ src/bisect.c | |
| @@ -184,11 +184,11 @@ | |
| 184 | }else if( memcmp(zCmd, "options", n)==0 ){ |
| 185 | if( g.argc==3 ){ |
| 186 | unsigned int i; |
| 187 | for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){ |
| 188 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 189 | fossil_print(" %-15s %-6s ", aBisectOption[i].zName, |
| 190 | db_lget(z, (char*)aBisectOption[i].zDefault)); |
| 191 | fossil_free(z); |
| 192 | comment_print(aBisectOption[i].zDesc, 27, 79); |
| 193 | } |
| 194 | }else if( g.argc==4 || g.argc==5 ){ |
| @@ -198,11 +198,11 @@ | |
| 198 | if( memcmp(g.argv[3], aBisectOption[i].zName, n)==0 ){ |
| 199 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 200 | if( g.argc==5 ){ |
| 201 | db_lset(z, g.argv[4]); |
| 202 | } |
| 203 | fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault)); |
| 204 | fossil_free(z); |
| 205 | break; |
| 206 | } |
| 207 | } |
| 208 | if( i>=sizeof(aBisectOption)/sizeof(aBisectOption[0]) ){ |
| @@ -230,19 +230,19 @@ | |
| 230 | for(p=path_last(), n=0; p; p=p->pFrom, n++){ |
| 231 | const char *z; |
| 232 | db_bind_int(&s, ":rid", p->rid); |
| 233 | if( db_step(&s)==SQLITE_ROW ){ |
| 234 | z = db_column_text(&s, 0); |
| 235 | fossil_print("%s", z); |
| 236 | if( p->rid==bisect.good ) fossil_print(" GOOD"); |
| 237 | if( p->rid==bisect.bad ) fossil_print(" BAD"); |
| 238 | if( p->rid==vid ) fossil_print(" CURRENT"); |
| 239 | if( nStep>1 && n==nStep/2 ) fossil_print(" NEXT"); |
| 240 | fossil_print("\n"); |
| 241 | } |
| 242 | db_reset(&s); |
| 243 | } |
| 244 | db_finalize(&s); |
| 245 | }else{ |
| 246 | usage("bad|good|next|reset|vlist ..."); |
| 247 | } |
| 248 | } |
| 249 |
+2
-2
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -111,11 +111,11 @@ | ||
| 111 | 111 | assert( fossil_isspace((char)i) ); |
| 112 | 112 | }else{ |
| 113 | 113 | assert( !fossil_isspace((char)i) ); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | - printf("All 256 characters OK\n"); | |
| 116 | + fossil_print("All 256 characters OK\n"); | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /* |
| 120 | 120 | ** This routine is called if a blob operation fails because we |
| 121 | 121 | ** have run out of memory. |
| @@ -925,11 +925,11 @@ | ||
| 925 | 925 | } |
| 926 | 926 | blob_reset(&b1); |
| 927 | 927 | blob_reset(&b2); |
| 928 | 928 | blob_reset(&b3); |
| 929 | 929 | } |
| 930 | - printf("ok\n"); | |
| 930 | + fossil_print("ok\n"); | |
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | #if defined(_WIN32) |
| 934 | 934 | /* |
| 935 | 935 | ** Convert every \n character in the given blob into \r\n. |
| 936 | 936 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -111,11 +111,11 @@ | |
| 111 | assert( fossil_isspace((char)i) ); |
| 112 | }else{ |
| 113 | assert( !fossil_isspace((char)i) ); |
| 114 | } |
| 115 | } |
| 116 | printf("All 256 characters OK\n"); |
| 117 | } |
| 118 | |
| 119 | /* |
| 120 | ** This routine is called if a blob operation fails because we |
| 121 | ** have run out of memory. |
| @@ -925,11 +925,11 @@ | |
| 925 | } |
| 926 | blob_reset(&b1); |
| 927 | blob_reset(&b2); |
| 928 | blob_reset(&b3); |
| 929 | } |
| 930 | printf("ok\n"); |
| 931 | } |
| 932 | |
| 933 | #if defined(_WIN32) |
| 934 | /* |
| 935 | ** Convert every \n character in the given blob into \r\n. |
| 936 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -111,11 +111,11 @@ | |
| 111 | assert( fossil_isspace((char)i) ); |
| 112 | }else{ |
| 113 | assert( !fossil_isspace((char)i) ); |
| 114 | } |
| 115 | } |
| 116 | fossil_print("All 256 characters OK\n"); |
| 117 | } |
| 118 | |
| 119 | /* |
| 120 | ** This routine is called if a blob operation fails because we |
| 121 | ** have run out of memory. |
| @@ -925,11 +925,11 @@ | |
| 925 | } |
| 926 | blob_reset(&b1); |
| 927 | blob_reset(&b2); |
| 928 | blob_reset(&b3); |
| 929 | } |
| 930 | fossil_print("ok\n"); |
| 931 | } |
| 932 | |
| 933 | #if defined(_WIN32) |
| 934 | /* |
| 935 | ** Convert every \n character in the given blob into \r\n. |
| 936 |
+3
-3
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -157,13 +157,13 @@ | ||
| 157 | 157 | fossil_panic("unable to install new manifest"); |
| 158 | 158 | } |
| 159 | 159 | assert( blob_is_reset(&branch) ); |
| 160 | 160 | content_deltify(rootid, brid, 0); |
| 161 | 161 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid); |
| 162 | - printf("New branch: %s\n", zUuid); | |
| 162 | + fossil_print("New branch: %s\n", zUuid); | |
| 163 | 163 | if( g.argc==3 ){ |
| 164 | - printf( | |
| 164 | + fossil_print( | |
| 165 | 165 | "\n" |
| 166 | 166 | "Note: the local check-out has not been updated to the new\n" |
| 167 | 167 | " branch. To begin working on the new branch, do this:\n" |
| 168 | 168 | "\n" |
| 169 | 169 | " %s update %s\n", |
| @@ -229,11 +229,11 @@ | ||
| 229 | 229 | TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") |
| 230 | 230 | ); |
| 231 | 231 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | 232 | const char *zBr = db_column_text(&q, 0); |
| 233 | 233 | int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0; |
| 234 | - printf("%s%s\n", (isCur ? "* " : " "), zBr); | |
| 234 | + fossil_print("%s%s\n", (isCur ? "* " : " "), zBr); | |
| 235 | 235 | } |
| 236 | 236 | db_finalize(&q); |
| 237 | 237 | }else{ |
| 238 | 238 | fossil_panic("branch subcommand should be one of: " |
| 239 | 239 | "new list ls"); |
| 240 | 240 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -157,13 +157,13 @@ | |
| 157 | fossil_panic("unable to install new manifest"); |
| 158 | } |
| 159 | assert( blob_is_reset(&branch) ); |
| 160 | content_deltify(rootid, brid, 0); |
| 161 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid); |
| 162 | printf("New branch: %s\n", zUuid); |
| 163 | if( g.argc==3 ){ |
| 164 | printf( |
| 165 | "\n" |
| 166 | "Note: the local check-out has not been updated to the new\n" |
| 167 | " branch. To begin working on the new branch, do this:\n" |
| 168 | "\n" |
| 169 | " %s update %s\n", |
| @@ -229,11 +229,11 @@ | |
| 229 | TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") |
| 230 | ); |
| 231 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | const char *zBr = db_column_text(&q, 0); |
| 233 | int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0; |
| 234 | printf("%s%s\n", (isCur ? "* " : " "), zBr); |
| 235 | } |
| 236 | db_finalize(&q); |
| 237 | }else{ |
| 238 | fossil_panic("branch subcommand should be one of: " |
| 239 | "new list ls"); |
| 240 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -157,13 +157,13 @@ | |
| 157 | fossil_panic("unable to install new manifest"); |
| 158 | } |
| 159 | assert( blob_is_reset(&branch) ); |
| 160 | content_deltify(rootid, brid, 0); |
| 161 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid); |
| 162 | fossil_print("New branch: %s\n", zUuid); |
| 163 | if( g.argc==3 ){ |
| 164 | fossil_print( |
| 165 | "\n" |
| 166 | "Note: the local check-out has not been updated to the new\n" |
| 167 | " branch. To begin working on the new branch, do this:\n" |
| 168 | "\n" |
| 169 | " %s update %s\n", |
| @@ -229,11 +229,11 @@ | |
| 229 | TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") |
| 230 | ); |
| 231 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | const char *zBr = db_column_text(&q, 0); |
| 233 | int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0; |
| 234 | fossil_print("%s%s\n", (isCur ? "* " : " "), zBr); |
| 235 | } |
| 236 | db_finalize(&q); |
| 237 | }else{ |
| 238 | fossil_panic("branch subcommand should be one of: " |
| 239 | "new list ls"); |
| 240 |
+1
-1
| --- src/captcha.c | ||
| +++ src/captcha.c | ||
| @@ -392,11 +392,11 @@ | ||
| 392 | 392 | for(i=2; i<g.argc; i++){ |
| 393 | 393 | char zHex[30]; |
| 394 | 394 | v = (unsigned int)atoi(g.argv[i]); |
| 395 | 395 | sqlite3_snprintf(sizeof(zHex), zHex, "%x", v); |
| 396 | 396 | z = captcha_render(zHex); |
| 397 | - printf("%s:\n%s", zHex, z); | |
| 397 | + fossil_print("%s:\n%s", zHex, z); | |
| 398 | 398 | free(z); |
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /* |
| 403 | 403 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -392,11 +392,11 @@ | |
| 392 | for(i=2; i<g.argc; i++){ |
| 393 | char zHex[30]; |
| 394 | v = (unsigned int)atoi(g.argv[i]); |
| 395 | sqlite3_snprintf(sizeof(zHex), zHex, "%x", v); |
| 396 | z = captcha_render(zHex); |
| 397 | printf("%s:\n%s", zHex, z); |
| 398 | free(z); |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | /* |
| 403 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -392,11 +392,11 @@ | |
| 392 | for(i=2; i<g.argc; i++){ |
| 393 | char zHex[30]; |
| 394 | v = (unsigned int)atoi(g.argv[i]); |
| 395 | sqlite3_snprintf(sizeof(zHex), zHex, "%x", v); |
| 396 | z = captcha_render(zHex); |
| 397 | fossil_print("%s:\n%s", zHex, z); |
| 398 | free(z); |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | /* |
| 403 |
+2
-2
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -2,11 +2,11 @@ | ||
| 2 | 2 | ** Copyright (c) 2006 D. Richard Hipp |
| 3 | 3 | ** |
| 4 | 4 | ** This program is free software; you can redistribute it and/or |
| 5 | 5 | ** modify it under the terms of the Simplified BSD License (also |
| 6 | 6 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 7 | - | |
| 7 | +** | |
| 8 | 8 | ** This program is distributed in the hope that it will be useful, |
| 9 | 9 | ** but without any warranty; without even the implied warranty of |
| 10 | 10 | ** merchantability or fitness for a particular purpose. |
| 11 | 11 | ** |
| 12 | 12 | ** Author contact information: |
| @@ -1116,11 +1116,11 @@ | ||
| 1116 | 1116 | } |
| 1117 | 1117 | } |
| 1118 | 1118 | if( iPort>mxPort ) return 1; |
| 1119 | 1119 | listen(listener,10); |
| 1120 | 1120 | if( iPort>mnPort ){ |
| 1121 | - printf("Listening for HTTP requests on TCP port %d\n", iPort); | |
| 1121 | + fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); | |
| 1122 | 1122 | fflush(stdout); |
| 1123 | 1123 | } |
| 1124 | 1124 | if( zBrowser ){ |
| 1125 | 1125 | zBrowser = mprintf(zBrowser, iPort); |
| 1126 | 1126 | system(zBrowser); |
| 1127 | 1127 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -2,11 +2,11 @@ | |
| 2 | ** Copyright (c) 2006 D. Richard Hipp |
| 3 | ** |
| 4 | ** This program is free software; you can redistribute it and/or |
| 5 | ** modify it under the terms of the Simplified BSD License (also |
| 6 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 7 | |
| 8 | ** This program is distributed in the hope that it will be useful, |
| 9 | ** but without any warranty; without even the implied warranty of |
| 10 | ** merchantability or fitness for a particular purpose. |
| 11 | ** |
| 12 | ** Author contact information: |
| @@ -1116,11 +1116,11 @@ | |
| 1116 | } |
| 1117 | } |
| 1118 | if( iPort>mxPort ) return 1; |
| 1119 | listen(listener,10); |
| 1120 | if( iPort>mnPort ){ |
| 1121 | printf("Listening for HTTP requests on TCP port %d\n", iPort); |
| 1122 | fflush(stdout); |
| 1123 | } |
| 1124 | if( zBrowser ){ |
| 1125 | zBrowser = mprintf(zBrowser, iPort); |
| 1126 | system(zBrowser); |
| 1127 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -2,11 +2,11 @@ | |
| 2 | ** Copyright (c) 2006 D. Richard Hipp |
| 3 | ** |
| 4 | ** This program is free software; you can redistribute it and/or |
| 5 | ** modify it under the terms of the Simplified BSD License (also |
| 6 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 7 | ** |
| 8 | ** This program is distributed in the hope that it will be useful, |
| 9 | ** but without any warranty; without even the implied warranty of |
| 10 | ** merchantability or fitness for a particular purpose. |
| 11 | ** |
| 12 | ** Author contact information: |
| @@ -1116,11 +1116,11 @@ | |
| 1116 | } |
| 1117 | } |
| 1118 | if( iPort>mxPort ) return 1; |
| 1119 | listen(listener,10); |
| 1120 | if( iPort>mnPort ){ |
| 1121 | fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); |
| 1122 | fflush(stdout); |
| 1123 | } |
| 1124 | if( zBrowser ){ |
| 1125 | zBrowser = mprintf(zBrowser, iPort); |
| 1126 | system(zBrowser); |
| 1127 |
+15
-15
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -136,13 +136,13 @@ | ||
| 136 | 136 | */ |
| 137 | 137 | void status_cmd(void){ |
| 138 | 138 | int vid; |
| 139 | 139 | db_must_be_within_tree(); |
| 140 | 140 | /* 012345678901234 */ |
| 141 | - printf("repository: %s\n", db_lget("repository","")); | |
| 142 | - printf("local-root: %s\n", g.zLocalRoot); | |
| 143 | - printf("server-code: %s\n", db_get("server-code", "")); | |
| 141 | + fossil_print("repository: %s\n", db_lget("repository","")); | |
| 142 | + fossil_print("local-root: %s\n", g.zLocalRoot); | |
| 143 | + fossil_print("server-code: %s\n", db_get("server-code", "")); | |
| 144 | 144 | vid = db_lget_int("checkout", 0); |
| 145 | 145 | if( vid ){ |
| 146 | 146 | show_common_info(vid, "checkout:", 1, 1); |
| 147 | 147 | } |
| 148 | 148 | changes_cmd(); |
| @@ -176,27 +176,27 @@ | ||
| 176 | 176 | int isNew = db_column_int(&q,2)==0; |
| 177 | 177 | int chnged = db_column_int(&q,3); |
| 178 | 178 | int renamed = db_column_int(&q,4); |
| 179 | 179 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 180 | 180 | if( isBrief ){ |
| 181 | - printf("%s\n", zPathname); | |
| 181 | + fossil_print("%s\n", zPathname); | |
| 182 | 182 | }else if( isNew ){ |
| 183 | - printf("ADDED %s\n", zPathname); | |
| 183 | + fossil_print("ADDED %s\n", zPathname); | |
| 184 | 184 | }else if( isDeleted ){ |
| 185 | - printf("DELETED %s\n", zPathname); | |
| 185 | + fossil_print("DELETED %s\n", zPathname); | |
| 186 | 186 | }else if( !file_isfile(zFullName) ){ |
| 187 | 187 | if( access(zFullName, 0)==0 ){ |
| 188 | - printf("NOT_A_FILE %s\n", zPathname); | |
| 188 | + fossil_print("NOT_A_FILE %s\n", zPathname); | |
| 189 | 189 | }else{ |
| 190 | - printf("MISSING %s\n", zPathname); | |
| 190 | + fossil_print("MISSING %s\n", zPathname); | |
| 191 | 191 | } |
| 192 | 192 | }else if( chnged ){ |
| 193 | - printf("EDITED %s\n", zPathname); | |
| 193 | + fossil_print("EDITED %s\n", zPathname); | |
| 194 | 194 | }else if( renamed ){ |
| 195 | - printf("RENAMED %s\n", zPathname); | |
| 195 | + fossil_print("RENAMED %s\n", zPathname); | |
| 196 | 196 | }else{ |
| 197 | - printf("UNCHANGED %s\n", zPathname); | |
| 197 | + fossil_print("UNCHANGED %s\n", zPathname); | |
| 198 | 198 | } |
| 199 | 199 | free(zFullName); |
| 200 | 200 | } |
| 201 | 201 | db_finalize(&q); |
| 202 | 202 | } |
| @@ -244,11 +244,11 @@ | ||
| 244 | 244 | ); |
| 245 | 245 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 246 | 246 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 247 | 247 | } |
| 248 | 248 | while( db_step(&q)==SQLITE_ROW ){ |
| 249 | - printf("%s\n", db_column_text(&q, 0)); | |
| 249 | + fossil_print("%s\n", db_column_text(&q, 0)); | |
| 250 | 250 | } |
| 251 | 251 | db_finalize(&q); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /* |
| @@ -395,11 +395,11 @@ | ||
| 395 | 395 | blob_add_cr(&text); |
| 396 | 396 | #endif |
| 397 | 397 | blob_write_to_file(&text, zFile); |
| 398 | 398 | if( zEditor ){ |
| 399 | 399 | zCmd = mprintf("%s \"%s\"", zEditor, zFile); |
| 400 | - printf("%s\n", zCmd); | |
| 400 | + fossil_print("%s\n", zCmd); | |
| 401 | 401 | if( fossil_system(zCmd) ){ |
| 402 | 402 | fossil_panic("editor aborted"); |
| 403 | 403 | } |
| 404 | 404 | blob_reset(&text); |
| 405 | 405 | blob_read_from_file(&text, zFile); |
| @@ -1084,11 +1084,11 @@ | ||
| 1084 | 1084 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid); |
| 1085 | 1085 | manifest_crosslink(nvid, &manifest); |
| 1086 | 1086 | assert( blob_is_reset(&manifest) ); |
| 1087 | 1087 | content_deltify(vid, nvid, 0); |
| 1088 | 1088 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 1089 | - printf("New_Version: %s\n", zUuid); | |
| 1089 | + fossil_print("New_Version: %s\n", zUuid); | |
| 1090 | 1090 | if( outputManifest ){ |
| 1091 | 1091 | zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 1092 | 1092 | blob_zero(&muuid); |
| 1093 | 1093 | blob_appendf(&muuid, "%s\n", zUuid); |
| 1094 | 1094 | blob_write_to_file(&muuid, zManifestFile); |
| @@ -1153,8 +1153,8 @@ | ||
| 1153 | 1153 | |
| 1154 | 1154 | if( !g.markPrivate ){ |
| 1155 | 1155 | autosync(AUTOSYNC_PUSH); |
| 1156 | 1156 | } |
| 1157 | 1157 | if( count_nonbranch_children(vid)>1 ){ |
| 1158 | - printf("**** warning: a fork has occurred *****\n"); | |
| 1158 | + fossil_print("**** warning: a fork has occurred *****\n"); | |
| 1159 | 1159 | } |
| 1160 | 1160 | } |
| 1161 | 1161 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -136,13 +136,13 @@ | |
| 136 | */ |
| 137 | void status_cmd(void){ |
| 138 | int vid; |
| 139 | db_must_be_within_tree(); |
| 140 | /* 012345678901234 */ |
| 141 | printf("repository: %s\n", db_lget("repository","")); |
| 142 | printf("local-root: %s\n", g.zLocalRoot); |
| 143 | printf("server-code: %s\n", db_get("server-code", "")); |
| 144 | vid = db_lget_int("checkout", 0); |
| 145 | if( vid ){ |
| 146 | show_common_info(vid, "checkout:", 1, 1); |
| 147 | } |
| 148 | changes_cmd(); |
| @@ -176,27 +176,27 @@ | |
| 176 | int isNew = db_column_int(&q,2)==0; |
| 177 | int chnged = db_column_int(&q,3); |
| 178 | int renamed = db_column_int(&q,4); |
| 179 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 180 | if( isBrief ){ |
| 181 | printf("%s\n", zPathname); |
| 182 | }else if( isNew ){ |
| 183 | printf("ADDED %s\n", zPathname); |
| 184 | }else if( isDeleted ){ |
| 185 | printf("DELETED %s\n", zPathname); |
| 186 | }else if( !file_isfile(zFullName) ){ |
| 187 | if( access(zFullName, 0)==0 ){ |
| 188 | printf("NOT_A_FILE %s\n", zPathname); |
| 189 | }else{ |
| 190 | printf("MISSING %s\n", zPathname); |
| 191 | } |
| 192 | }else if( chnged ){ |
| 193 | printf("EDITED %s\n", zPathname); |
| 194 | }else if( renamed ){ |
| 195 | printf("RENAMED %s\n", zPathname); |
| 196 | }else{ |
| 197 | printf("UNCHANGED %s\n", zPathname); |
| 198 | } |
| 199 | free(zFullName); |
| 200 | } |
| 201 | db_finalize(&q); |
| 202 | } |
| @@ -244,11 +244,11 @@ | |
| 244 | ); |
| 245 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 246 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 247 | } |
| 248 | while( db_step(&q)==SQLITE_ROW ){ |
| 249 | printf("%s\n", db_column_text(&q, 0)); |
| 250 | } |
| 251 | db_finalize(&q); |
| 252 | } |
| 253 | |
| 254 | /* |
| @@ -395,11 +395,11 @@ | |
| 395 | blob_add_cr(&text); |
| 396 | #endif |
| 397 | blob_write_to_file(&text, zFile); |
| 398 | if( zEditor ){ |
| 399 | zCmd = mprintf("%s \"%s\"", zEditor, zFile); |
| 400 | printf("%s\n", zCmd); |
| 401 | if( fossil_system(zCmd) ){ |
| 402 | fossil_panic("editor aborted"); |
| 403 | } |
| 404 | blob_reset(&text); |
| 405 | blob_read_from_file(&text, zFile); |
| @@ -1084,11 +1084,11 @@ | |
| 1084 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid); |
| 1085 | manifest_crosslink(nvid, &manifest); |
| 1086 | assert( blob_is_reset(&manifest) ); |
| 1087 | content_deltify(vid, nvid, 0); |
| 1088 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 1089 | printf("New_Version: %s\n", zUuid); |
| 1090 | if( outputManifest ){ |
| 1091 | zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 1092 | blob_zero(&muuid); |
| 1093 | blob_appendf(&muuid, "%s\n", zUuid); |
| 1094 | blob_write_to_file(&muuid, zManifestFile); |
| @@ -1153,8 +1153,8 @@ | |
| 1153 | |
| 1154 | if( !g.markPrivate ){ |
| 1155 | autosync(AUTOSYNC_PUSH); |
| 1156 | } |
| 1157 | if( count_nonbranch_children(vid)>1 ){ |
| 1158 | printf("**** warning: a fork has occurred *****\n"); |
| 1159 | } |
| 1160 | } |
| 1161 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -136,13 +136,13 @@ | |
| 136 | */ |
| 137 | void status_cmd(void){ |
| 138 | int vid; |
| 139 | db_must_be_within_tree(); |
| 140 | /* 012345678901234 */ |
| 141 | fossil_print("repository: %s\n", db_lget("repository","")); |
| 142 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 143 | fossil_print("server-code: %s\n", db_get("server-code", "")); |
| 144 | vid = db_lget_int("checkout", 0); |
| 145 | if( vid ){ |
| 146 | show_common_info(vid, "checkout:", 1, 1); |
| 147 | } |
| 148 | changes_cmd(); |
| @@ -176,27 +176,27 @@ | |
| 176 | int isNew = db_column_int(&q,2)==0; |
| 177 | int chnged = db_column_int(&q,3); |
| 178 | int renamed = db_column_int(&q,4); |
| 179 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 180 | if( isBrief ){ |
| 181 | fossil_print("%s\n", zPathname); |
| 182 | }else if( isNew ){ |
| 183 | fossil_print("ADDED %s\n", zPathname); |
| 184 | }else if( isDeleted ){ |
| 185 | fossil_print("DELETED %s\n", zPathname); |
| 186 | }else if( !file_isfile(zFullName) ){ |
| 187 | if( access(zFullName, 0)==0 ){ |
| 188 | fossil_print("NOT_A_FILE %s\n", zPathname); |
| 189 | }else{ |
| 190 | fossil_print("MISSING %s\n", zPathname); |
| 191 | } |
| 192 | }else if( chnged ){ |
| 193 | fossil_print("EDITED %s\n", zPathname); |
| 194 | }else if( renamed ){ |
| 195 | fossil_print("RENAMED %s\n", zPathname); |
| 196 | }else{ |
| 197 | fossil_print("UNCHANGED %s\n", zPathname); |
| 198 | } |
| 199 | free(zFullName); |
| 200 | } |
| 201 | db_finalize(&q); |
| 202 | } |
| @@ -244,11 +244,11 @@ | |
| 244 | ); |
| 245 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 246 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 247 | } |
| 248 | while( db_step(&q)==SQLITE_ROW ){ |
| 249 | fossil_print("%s\n", db_column_text(&q, 0)); |
| 250 | } |
| 251 | db_finalize(&q); |
| 252 | } |
| 253 | |
| 254 | /* |
| @@ -395,11 +395,11 @@ | |
| 395 | blob_add_cr(&text); |
| 396 | #endif |
| 397 | blob_write_to_file(&text, zFile); |
| 398 | if( zEditor ){ |
| 399 | zCmd = mprintf("%s \"%s\"", zEditor, zFile); |
| 400 | fossil_print("%s\n", zCmd); |
| 401 | if( fossil_system(zCmd) ){ |
| 402 | fossil_panic("editor aborted"); |
| 403 | } |
| 404 | blob_reset(&text); |
| 405 | blob_read_from_file(&text, zFile); |
| @@ -1084,11 +1084,11 @@ | |
| 1084 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid); |
| 1085 | manifest_crosslink(nvid, &manifest); |
| 1086 | assert( blob_is_reset(&manifest) ); |
| 1087 | content_deltify(vid, nvid, 0); |
| 1088 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 1089 | fossil_print("New_Version: %s\n", zUuid); |
| 1090 | if( outputManifest ){ |
| 1091 | zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 1092 | blob_zero(&muuid); |
| 1093 | blob_appendf(&muuid, "%s\n", zUuid); |
| 1094 | blob_write_to_file(&muuid, zManifestFile); |
| @@ -1153,8 +1153,8 @@ | |
| 1153 | |
| 1154 | if( !g.markPrivate ){ |
| 1155 | autosync(AUTOSYNC_PUSH); |
| 1156 | } |
| 1157 | if( count_nonbranch_children(vid)>1 ){ |
| 1158 | fossil_print("**** warning: a fork has occurred *****\n"); |
| 1159 | } |
| 1160 | } |
| 1161 |
+2
-2
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -249,14 +249,14 @@ | ||
| 249 | 249 | db_multi_exec("DELETE FROM vmerge"); |
| 250 | 250 | if( !keepFlag && db_get_boolean("repo-cksum",1) ){ |
| 251 | 251 | vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); |
| 252 | 252 | vfile_aggregate_checksum_disk(vid, &cksum2); |
| 253 | 253 | if( blob_compare(&cksum1, &cksum2) ){ |
| 254 | - printf("WARNING: manifest checksum does not agree with disk\n"); | |
| 254 | + fossil_print("WARNING: manifest checksum does not agree with disk\n"); | |
| 255 | 255 | } |
| 256 | 256 | if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){ |
| 257 | - printf("WARNING: manifest checksum does not agree with manifest\n"); | |
| 257 | + fossil_print("WARNING: manifest checksum does not agree with manifest\n"); | |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | db_end_transaction(0); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -249,14 +249,14 @@ | |
| 249 | db_multi_exec("DELETE FROM vmerge"); |
| 250 | if( !keepFlag && db_get_boolean("repo-cksum",1) ){ |
| 251 | vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); |
| 252 | vfile_aggregate_checksum_disk(vid, &cksum2); |
| 253 | if( blob_compare(&cksum1, &cksum2) ){ |
| 254 | printf("WARNING: manifest checksum does not agree with disk\n"); |
| 255 | } |
| 256 | if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){ |
| 257 | printf("WARNING: manifest checksum does not agree with manifest\n"); |
| 258 | } |
| 259 | } |
| 260 | db_end_transaction(0); |
| 261 | } |
| 262 | |
| 263 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -249,14 +249,14 @@ | |
| 249 | db_multi_exec("DELETE FROM vmerge"); |
| 250 | if( !keepFlag && db_get_boolean("repo-cksum",1) ){ |
| 251 | vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); |
| 252 | vfile_aggregate_checksum_disk(vid, &cksum2); |
| 253 | if( blob_compare(&cksum1, &cksum2) ){ |
| 254 | fossil_print("WARNING: manifest checksum does not agree with disk\n"); |
| 255 | } |
| 256 | if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){ |
| 257 | fossil_print("WARNING: manifest checksum does not agree with manifest\n"); |
| 258 | } |
| 259 | } |
| 260 | db_end_transaction(0); |
| 261 | } |
| 262 | |
| 263 |
+5
-5
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -80,11 +80,11 @@ | ||
| 80 | 80 | shun_artifacts(); |
| 81 | 81 | g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); |
| 82 | 82 | if( g.zLogin==0 ){ |
| 83 | 83 | db_create_default_users(1,zDefaultUser); |
| 84 | 84 | } |
| 85 | - printf("Repository cloned into %s\n", g.argv[3]); | |
| 85 | + fossil_print("Repository cloned into %s\n", g.argv[3]); | |
| 86 | 86 | }else{ |
| 87 | 87 | db_create_repository(g.argv[3]); |
| 88 | 88 | db_open_repository(g.argv[3]); |
| 89 | 89 | db_begin_transaction(); |
| 90 | 90 | db_record_repository_filename(g.argv[3]); |
| @@ -110,13 +110,13 @@ | ||
| 110 | 110 | fossil_fatal("server returned an error - clone aborted"); |
| 111 | 111 | } |
| 112 | 112 | db_open_repository(g.argv[3]); |
| 113 | 113 | } |
| 114 | 114 | db_begin_transaction(); |
| 115 | - printf("Rebuilding repository meta-data...\n"); | |
| 115 | + fossil_print("Rebuilding repository meta-data...\n"); | |
| 116 | 116 | rebuild_db(0, 1, 0); |
| 117 | - printf("project-id: %s\n", db_get("project-code", 0)); | |
| 118 | - printf("server-id: %s\n", db_get("server-code", 0)); | |
| 117 | + fossil_print("project-id: %s\n", db_get("project-code", 0)); | |
| 118 | + fossil_print("server-id: %s\n", db_get("server-code", 0)); | |
| 119 | 119 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 120 | - printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); | |
| 120 | + fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); | |
| 121 | 121 | db_end_transaction(0); |
| 122 | 122 | } |
| 123 | 123 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -80,11 +80,11 @@ | |
| 80 | shun_artifacts(); |
| 81 | g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); |
| 82 | if( g.zLogin==0 ){ |
| 83 | db_create_default_users(1,zDefaultUser); |
| 84 | } |
| 85 | printf("Repository cloned into %s\n", g.argv[3]); |
| 86 | }else{ |
| 87 | db_create_repository(g.argv[3]); |
| 88 | db_open_repository(g.argv[3]); |
| 89 | db_begin_transaction(); |
| 90 | db_record_repository_filename(g.argv[3]); |
| @@ -110,13 +110,13 @@ | |
| 110 | fossil_fatal("server returned an error - clone aborted"); |
| 111 | } |
| 112 | db_open_repository(g.argv[3]); |
| 113 | } |
| 114 | db_begin_transaction(); |
| 115 | printf("Rebuilding repository meta-data...\n"); |
| 116 | rebuild_db(0, 1, 0); |
| 117 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 118 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 119 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 120 | printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 121 | db_end_transaction(0); |
| 122 | } |
| 123 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -80,11 +80,11 @@ | |
| 80 | shun_artifacts(); |
| 81 | g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); |
| 82 | if( g.zLogin==0 ){ |
| 83 | db_create_default_users(1,zDefaultUser); |
| 84 | } |
| 85 | fossil_print("Repository cloned into %s\n", g.argv[3]); |
| 86 | }else{ |
| 87 | db_create_repository(g.argv[3]); |
| 88 | db_open_repository(g.argv[3]); |
| 89 | db_begin_transaction(); |
| 90 | db_record_repository_filename(g.argv[3]); |
| @@ -110,13 +110,13 @@ | |
| 110 | fossil_fatal("server returned an error - clone aborted"); |
| 111 | } |
| 112 | db_open_repository(g.argv[3]); |
| 113 | } |
| 114 | db_begin_transaction(); |
| 115 | fossil_print("Rebuilding repository meta-data...\n"); |
| 116 | rebuild_db(0, 1, 0); |
| 117 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 118 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 119 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 120 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 121 | db_end_transaction(0); |
| 122 | } |
| 123 |
+6
-6
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -41,11 +41,11 @@ | ||
| 41 | 41 | |
| 42 | 42 | for(;;){ |
| 43 | 43 | while( fossil_isspace(zText[0]) ){ zText++; } |
| 44 | 44 | if( zText[0]==0 ){ |
| 45 | 45 | if( doIndent==0 ){ |
| 46 | - printf("\n"); | |
| 46 | + fossil_print("\n"); | |
| 47 | 47 | lineCnt = 1; |
| 48 | 48 | } |
| 49 | 49 | return lineCnt; |
| 50 | 50 | } |
| 51 | 51 | for(sk=si=i=k=0; zText[i] && k<tlen; i++){ |
| @@ -64,23 +64,23 @@ | ||
| 64 | 64 | } |
| 65 | 65 | k++; |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | if( doIndent ){ |
| 69 | - printf("%*s", indent, ""); | |
| 69 | + fossil_print("%*s", indent, ""); | |
| 70 | 70 | } |
| 71 | 71 | doIndent = 1; |
| 72 | 72 | if( sk>0 && zText[i] ){ |
| 73 | 73 | zText += si; |
| 74 | 74 | zBuf[sk++] = '\n'; |
| 75 | 75 | zBuf[sk] = 0; |
| 76 | - printf("%s", zBuf); | |
| 76 | + fossil_print("%s", zBuf); | |
| 77 | 77 | }else{ |
| 78 | 78 | zText += i; |
| 79 | 79 | zBuf[k++] = '\n'; |
| 80 | 80 | zBuf[k] = 0; |
| 81 | - printf("%s", zBuf); | |
| 81 | + fossil_print("%s", zBuf); | |
| 82 | 82 | } |
| 83 | 83 | lineCnt++; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| @@ -93,8 +93,8 @@ | ||
| 93 | 93 | int indent; |
| 94 | 94 | if( g.argc!=4 ){ |
| 95 | 95 | usage("PREFIX TEXT"); |
| 96 | 96 | } |
| 97 | 97 | indent = strlen(g.argv[2]) + 1; |
| 98 | - printf("%s ", g.argv[2]); | |
| 99 | - printf("(%d lines output)\n", comment_print(g.argv[3], indent, 79)); | |
| 98 | + fossil_print("%s ", g.argv[2]); | |
| 99 | + fossil_print("(%d lines output)\n", comment_print(g.argv[3], indent, 79)); | |
| 100 | 100 | } |
| 101 | 101 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -41,11 +41,11 @@ | |
| 41 | |
| 42 | for(;;){ |
| 43 | while( fossil_isspace(zText[0]) ){ zText++; } |
| 44 | if( zText[0]==0 ){ |
| 45 | if( doIndent==0 ){ |
| 46 | printf("\n"); |
| 47 | lineCnt = 1; |
| 48 | } |
| 49 | return lineCnt; |
| 50 | } |
| 51 | for(sk=si=i=k=0; zText[i] && k<tlen; i++){ |
| @@ -64,23 +64,23 @@ | |
| 64 | } |
| 65 | k++; |
| 66 | } |
| 67 | } |
| 68 | if( doIndent ){ |
| 69 | printf("%*s", indent, ""); |
| 70 | } |
| 71 | doIndent = 1; |
| 72 | if( sk>0 && zText[i] ){ |
| 73 | zText += si; |
| 74 | zBuf[sk++] = '\n'; |
| 75 | zBuf[sk] = 0; |
| 76 | printf("%s", zBuf); |
| 77 | }else{ |
| 78 | zText += i; |
| 79 | zBuf[k++] = '\n'; |
| 80 | zBuf[k] = 0; |
| 81 | printf("%s", zBuf); |
| 82 | } |
| 83 | lineCnt++; |
| 84 | } |
| 85 | } |
| 86 | |
| @@ -93,8 +93,8 @@ | |
| 93 | int indent; |
| 94 | if( g.argc!=4 ){ |
| 95 | usage("PREFIX TEXT"); |
| 96 | } |
| 97 | indent = strlen(g.argv[2]) + 1; |
| 98 | printf("%s ", g.argv[2]); |
| 99 | printf("(%d lines output)\n", comment_print(g.argv[3], indent, 79)); |
| 100 | } |
| 101 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -41,11 +41,11 @@ | |
| 41 | |
| 42 | for(;;){ |
| 43 | while( fossil_isspace(zText[0]) ){ zText++; } |
| 44 | if( zText[0]==0 ){ |
| 45 | if( doIndent==0 ){ |
| 46 | fossil_print("\n"); |
| 47 | lineCnt = 1; |
| 48 | } |
| 49 | return lineCnt; |
| 50 | } |
| 51 | for(sk=si=i=k=0; zText[i] && k<tlen; i++){ |
| @@ -64,23 +64,23 @@ | |
| 64 | } |
| 65 | k++; |
| 66 | } |
| 67 | } |
| 68 | if( doIndent ){ |
| 69 | fossil_print("%*s", indent, ""); |
| 70 | } |
| 71 | doIndent = 1; |
| 72 | if( sk>0 && zText[i] ){ |
| 73 | zText += si; |
| 74 | zBuf[sk++] = '\n'; |
| 75 | zBuf[sk] = 0; |
| 76 | fossil_print("%s", zBuf); |
| 77 | }else{ |
| 78 | zText += i; |
| 79 | zBuf[k++] = '\n'; |
| 80 | zBuf[k] = 0; |
| 81 | fossil_print("%s", zBuf); |
| 82 | } |
| 83 | lineCnt++; |
| 84 | } |
| 85 | } |
| 86 | |
| @@ -93,8 +93,8 @@ | |
| 93 | int indent; |
| 94 | if( g.argc!=4 ){ |
| 95 | usage("PREFIX TEXT"); |
| 96 | } |
| 97 | indent = strlen(g.argv[2]) + 1; |
| 98 | fossil_print("%s ", g.argv[2]); |
| 99 | fossil_print("(%d lines output)\n", comment_print(g.argv[3], indent, 79)); |
| 100 | } |
| 101 |
+4
-4
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -688,13 +688,13 @@ | ||
| 688 | 688 | if( strncmp(z, &aGroupName[i].zName[1], n)==0 ){ |
| 689 | 689 | return aGroupName[i].groupMask; |
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | if( notFoundIsFatal ){ |
| 693 | - printf("Available configuration areas:\n"); | |
| 693 | + fossil_print("Available configuration areas:\n"); | |
| 694 | 694 | for(i=0; i<count(aGroupName); i++){ |
| 695 | - printf(" %-10s %s\n", &aGroupName[i].zName[1], aGroupName[i].zHelp); | |
| 695 | + fossil_print(" %-10s %s\n", &aGroupName[i].zName[1], aGroupName[i].zHelp); | |
| 696 | 696 | } |
| 697 | 697 | fossil_fatal("no such configuration area: \"%s\"", z); |
| 698 | 698 | } |
| 699 | 699 | return 0; |
| 700 | 700 | } |
| @@ -883,14 +883,14 @@ | ||
| 883 | 883 | }else if( fossil_strcmp(zName,"@reportfmt")==0 ){ |
| 884 | 884 | db_multi_exec("DELETE FROM reportfmt"); |
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | 887 | db_end_transaction(0); |
| 888 | - printf("Configuration reset to factory defaults.\n"); | |
| 889 | - printf("To recover, use: %s %s import %s\n", | |
| 888 | + fossil_print("Configuration reset to factory defaults.\n"); | |
| 889 | + fossil_print("To recover, use: %s %s import %s\n", | |
| 890 | 890 | fossil_nameofexe(), g.argv[1], zBackup); |
| 891 | 891 | }else |
| 892 | 892 | { |
| 893 | 893 | fossil_fatal("METHOD should be one of:" |
| 894 | 894 | " export import merge pull push reset"); |
| 895 | 895 | } |
| 896 | 896 | } |
| 897 | 897 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -688,13 +688,13 @@ | |
| 688 | if( strncmp(z, &aGroupName[i].zName[1], n)==0 ){ |
| 689 | return aGroupName[i].groupMask; |
| 690 | } |
| 691 | } |
| 692 | if( notFoundIsFatal ){ |
| 693 | printf("Available configuration areas:\n"); |
| 694 | for(i=0; i<count(aGroupName); i++){ |
| 695 | printf(" %-10s %s\n", &aGroupName[i].zName[1], aGroupName[i].zHelp); |
| 696 | } |
| 697 | fossil_fatal("no such configuration area: \"%s\"", z); |
| 698 | } |
| 699 | return 0; |
| 700 | } |
| @@ -883,14 +883,14 @@ | |
| 883 | }else if( fossil_strcmp(zName,"@reportfmt")==0 ){ |
| 884 | db_multi_exec("DELETE FROM reportfmt"); |
| 885 | } |
| 886 | } |
| 887 | db_end_transaction(0); |
| 888 | printf("Configuration reset to factory defaults.\n"); |
| 889 | printf("To recover, use: %s %s import %s\n", |
| 890 | fossil_nameofexe(), g.argv[1], zBackup); |
| 891 | }else |
| 892 | { |
| 893 | fossil_fatal("METHOD should be one of:" |
| 894 | " export import merge pull push reset"); |
| 895 | } |
| 896 | } |
| 897 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -688,13 +688,13 @@ | |
| 688 | if( strncmp(z, &aGroupName[i].zName[1], n)==0 ){ |
| 689 | return aGroupName[i].groupMask; |
| 690 | } |
| 691 | } |
| 692 | if( notFoundIsFatal ){ |
| 693 | fossil_print("Available configuration areas:\n"); |
| 694 | for(i=0; i<count(aGroupName); i++){ |
| 695 | fossil_print(" %-10s %s\n", &aGroupName[i].zName[1], aGroupName[i].zHelp); |
| 696 | } |
| 697 | fossil_fatal("no such configuration area: \"%s\"", z); |
| 698 | } |
| 699 | return 0; |
| 700 | } |
| @@ -883,14 +883,14 @@ | |
| 883 | }else if( fossil_strcmp(zName,"@reportfmt")==0 ){ |
| 884 | db_multi_exec("DELETE FROM reportfmt"); |
| 885 | } |
| 886 | } |
| 887 | db_end_transaction(0); |
| 888 | fossil_print("Configuration reset to factory defaults.\n"); |
| 889 | fossil_print("To recover, use: %s %s import %s\n", |
| 890 | fossil_nameofexe(), g.argv[1], zBackup); |
| 891 | }else |
| 892 | { |
| 893 | fossil_fatal("METHOD should be one of:" |
| 894 | " export import merge pull push reset"); |
| 895 | } |
| 896 | } |
| 897 |
+4
-4
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -666,11 +666,11 @@ | ||
| 666 | 666 | if( g.argc!=3 ) usage("FILENAME"); |
| 667 | 667 | db_must_be_within_tree(); |
| 668 | 668 | user_select(); |
| 669 | 669 | blob_read_from_file(&content, g.argv[2]); |
| 670 | 670 | rid = content_put(&content); |
| 671 | - printf("inserted as record %d\n", rid); | |
| 671 | + fossil_print("inserted as record %d\n", rid); | |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | /* |
| 675 | 675 | ** Make sure the content at rid is the original content and is not a |
| 676 | 676 | ** delta. |
| @@ -834,14 +834,14 @@ | ||
| 834 | 834 | while( db_step(&q)==SQLITE_ROW ){ |
| 835 | 835 | int rid = db_column_int(&q, 0); |
| 836 | 836 | const char *zUuid = db_column_text(&q, 1); |
| 837 | 837 | int size = db_column_int(&q, 2); |
| 838 | 838 | n1++; |
| 839 | - printf(" %d/%d\r", n1, total); | |
| 839 | + fossil_print(" %d/%d\r", n1, total); | |
| 840 | 840 | fflush(stdout); |
| 841 | 841 | if( size<0 ){ |
| 842 | - printf("skip phantom %d %s\n", rid, zUuid); | |
| 842 | + fossil_print("skip phantom %d %s\n", rid, zUuid); | |
| 843 | 843 | continue; /* Ignore phantoms */ |
| 844 | 844 | } |
| 845 | 845 | content_get(rid, &content); |
| 846 | 846 | if( blob_size(&content)!=size ){ |
| 847 | 847 | fossil_warning("size mismatch on blob rid=%d: %d vs %d", |
| @@ -855,7 +855,7 @@ | ||
| 855 | 855 | blob_reset(&cksum); |
| 856 | 856 | blob_reset(&content); |
| 857 | 857 | n2++; |
| 858 | 858 | } |
| 859 | 859 | db_finalize(&q); |
| 860 | - printf("%d non-phantom blobs (out of %d total) verified\n", n2, n1); | |
| 860 | + fossil_print("%d non-phantom blobs (out of %d total) verified\n", n2, n1); | |
| 861 | 861 | } |
| 862 | 862 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -666,11 +666,11 @@ | |
| 666 | if( g.argc!=3 ) usage("FILENAME"); |
| 667 | db_must_be_within_tree(); |
| 668 | user_select(); |
| 669 | blob_read_from_file(&content, g.argv[2]); |
| 670 | rid = content_put(&content); |
| 671 | printf("inserted as record %d\n", rid); |
| 672 | } |
| 673 | |
| 674 | /* |
| 675 | ** Make sure the content at rid is the original content and is not a |
| 676 | ** delta. |
| @@ -834,14 +834,14 @@ | |
| 834 | while( db_step(&q)==SQLITE_ROW ){ |
| 835 | int rid = db_column_int(&q, 0); |
| 836 | const char *zUuid = db_column_text(&q, 1); |
| 837 | int size = db_column_int(&q, 2); |
| 838 | n1++; |
| 839 | printf(" %d/%d\r", n1, total); |
| 840 | fflush(stdout); |
| 841 | if( size<0 ){ |
| 842 | printf("skip phantom %d %s\n", rid, zUuid); |
| 843 | continue; /* Ignore phantoms */ |
| 844 | } |
| 845 | content_get(rid, &content); |
| 846 | if( blob_size(&content)!=size ){ |
| 847 | fossil_warning("size mismatch on blob rid=%d: %d vs %d", |
| @@ -855,7 +855,7 @@ | |
| 855 | blob_reset(&cksum); |
| 856 | blob_reset(&content); |
| 857 | n2++; |
| 858 | } |
| 859 | db_finalize(&q); |
| 860 | printf("%d non-phantom blobs (out of %d total) verified\n", n2, n1); |
| 861 | } |
| 862 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -666,11 +666,11 @@ | |
| 666 | if( g.argc!=3 ) usage("FILENAME"); |
| 667 | db_must_be_within_tree(); |
| 668 | user_select(); |
| 669 | blob_read_from_file(&content, g.argv[2]); |
| 670 | rid = content_put(&content); |
| 671 | fossil_print("inserted as record %d\n", rid); |
| 672 | } |
| 673 | |
| 674 | /* |
| 675 | ** Make sure the content at rid is the original content and is not a |
| 676 | ** delta. |
| @@ -834,14 +834,14 @@ | |
| 834 | while( db_step(&q)==SQLITE_ROW ){ |
| 835 | int rid = db_column_int(&q, 0); |
| 836 | const char *zUuid = db_column_text(&q, 1); |
| 837 | int size = db_column_int(&q, 2); |
| 838 | n1++; |
| 839 | fossil_print(" %d/%d\r", n1, total); |
| 840 | fflush(stdout); |
| 841 | if( size<0 ){ |
| 842 | fossil_print("skip phantom %d %s\n", rid, zUuid); |
| 843 | continue; /* Ignore phantoms */ |
| 844 | } |
| 845 | content_get(rid, &content); |
| 846 | if( blob_size(&content)!=size ){ |
| 847 | fossil_warning("size mismatch on blob rid=%d: %d vs %d", |
| @@ -855,7 +855,7 @@ | |
| 855 | blob_reset(&cksum); |
| 856 | blob_reset(&content); |
| 857 | n2++; |
| 858 | } |
| 859 | db_finalize(&q); |
| 860 | fossil_print("%d non-phantom blobs (out of %d total) verified\n", n2, n1); |
| 861 | } |
| 862 |
M
src/db.c
+8
-20
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -565,14 +565,10 @@ | ||
| 565 | 565 | } |
| 566 | 566 | db_finalize(&s); |
| 567 | 567 | return z; |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | -#if defined(_WIN32) | |
| 571 | -extern char *sqlite3_win32_mbcs_to_utf8(const char*); | |
| 572 | -#endif | |
| 573 | - | |
| 574 | 570 | /* |
| 575 | 571 | ** Initialize a new database file with the given schema. If anything |
| 576 | 572 | ** goes wrong, call db_err() to exit. |
| 577 | 573 | */ |
| 578 | 574 | void db_init_database( |
| @@ -583,13 +579,10 @@ | ||
| 583 | 579 | sqlite3 *db; |
| 584 | 580 | int rc; |
| 585 | 581 | const char *zSql; |
| 586 | 582 | va_list ap; |
| 587 | 583 | |
| 588 | -#if defined(_WIN32) | |
| 589 | - zFileName = sqlite3_win32_mbcs_to_utf8(zFileName); | |
| 590 | -#endif | |
| 591 | 584 | rc = sqlite3_open(zFileName, &db); |
| 592 | 585 | if( rc!=SQLITE_OK ){ |
| 593 | 586 | db_err(sqlite3_errmsg(db)); |
| 594 | 587 | } |
| 595 | 588 | sqlite3_busy_timeout(db, 5000); |
| @@ -631,13 +624,10 @@ | ||
| 631 | 624 | int rc; |
| 632 | 625 | const char *zVfs; |
| 633 | 626 | sqlite3 *db; |
| 634 | 627 | |
| 635 | 628 | zVfs = getenv("FOSSIL_VFS"); |
| 636 | -#if defined(_WIN32) | |
| 637 | - zDbName = sqlite3_win32_mbcs_to_utf8(zDbName); | |
| 638 | -#endif | |
| 639 | 629 | rc = sqlite3_open_v2( |
| 640 | 630 | zDbName, &db, |
| 641 | 631 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 642 | 632 | zVfs |
| 643 | 633 | ); |
| @@ -660,13 +650,10 @@ | ||
| 660 | 650 | if( !g.db ){ |
| 661 | 651 | g.db = openDatabase(zDbName); |
| 662 | 652 | g.zMainDbType = zLabel; |
| 663 | 653 | db_connection_init(); |
| 664 | 654 | }else{ |
| 665 | -#if defined(_WIN32) | |
| 666 | - zDbName = sqlite3_win32_mbcs_to_utf8(zDbName); | |
| 667 | -#endif | |
| 668 | 655 | db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel); |
| 669 | 656 | } |
| 670 | 657 | } |
| 671 | 658 | |
| 672 | 659 | /* |
| @@ -1189,14 +1176,15 @@ | ||
| 1189 | 1176 | db_open_repository(g.argv[2]); |
| 1190 | 1177 | db_open_config(0); |
| 1191 | 1178 | db_begin_transaction(); |
| 1192 | 1179 | db_initial_setup(zDate, zDefaultUser, 1); |
| 1193 | 1180 | db_end_transaction(0); |
| 1194 | - printf("project-id: %s\n", db_get("project-code", 0)); | |
| 1195 | - printf("server-id: %s\n", db_get("server-code", 0)); | |
| 1181 | + fossil_print("project-id: %s\n", db_get("project-code", 0)); | |
| 1182 | + fossil_print("server-id: %s\n", db_get("server-code", 0)); | |
| 1196 | 1183 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1197 | - printf("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword); | |
| 1184 | + fossil_print("admin-user: %s (initial password is \"%s\")\n", | |
| 1185 | + g.zLogin, zPassword); | |
| 1198 | 1186 | } |
| 1199 | 1187 | |
| 1200 | 1188 | /* |
| 1201 | 1189 | ** SQL functions for debugging. |
| 1202 | 1190 | ** |
| @@ -1210,11 +1198,11 @@ | ||
| 1210 | 1198 | ){ |
| 1211 | 1199 | int i; |
| 1212 | 1200 | if( g.fSqlPrint ){ |
| 1213 | 1201 | for(i=0; i<argc; i++){ |
| 1214 | 1202 | char c = i==argc-1 ? '\n' : ' '; |
| 1215 | - printf("%s%c", sqlite3_value_text(argv[i]), c); | |
| 1203 | + fossil_print("%s%c", sqlite3_value_text(argv[i]), c); | |
| 1216 | 1204 | } |
| 1217 | 1205 | } |
| 1218 | 1206 | } |
| 1219 | 1207 | static void db_sql_trace(void *notUsed, const char *zSql){ |
| 1220 | 1208 | int n = strlen(zSql); |
| @@ -1613,14 +1601,14 @@ | ||
| 1613 | 1601 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1614 | 1602 | zName |
| 1615 | 1603 | ); |
| 1616 | 1604 | } |
| 1617 | 1605 | if( db_step(&q)==SQLITE_ROW ){ |
| 1618 | - printf("%-20s %-8s %s\n", zName, db_column_text(&q, 0), | |
| 1606 | + fossil_print("%-20s %-8s %s\n", zName, db_column_text(&q, 0), | |
| 1619 | 1607 | db_column_text(&q, 1)); |
| 1620 | 1608 | }else{ |
| 1621 | - printf("%-20s\n", zName); | |
| 1609 | + fossil_print("%-20s\n", zName); | |
| 1622 | 1610 | } |
| 1623 | 1611 | db_finalize(&q); |
| 1624 | 1612 | } |
| 1625 | 1613 | |
| 1626 | 1614 | |
| @@ -1869,9 +1857,9 @@ | ||
| 1869 | 1857 | void test_timespan_cmd(void){ |
| 1870 | 1858 | double rDiff; |
| 1871 | 1859 | if( g.argc!=3 ) usage("TIMESTAMP"); |
| 1872 | 1860 | sqlite3_open(":memory:", &g.db); |
| 1873 | 1861 | rDiff = db_double(0.0, "SELECT julianday('now') - julianday(%Q)", g.argv[2]); |
| 1874 | - printf("Time differences: %s\n", db_timespan_name(rDiff)); | |
| 1862 | + fossil_print("Time differences: %s\n", db_timespan_name(rDiff)); | |
| 1875 | 1863 | sqlite3_close(g.db); |
| 1876 | 1864 | g.db = 0; |
| 1877 | 1865 | } |
| 1878 | 1866 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -565,14 +565,10 @@ | |
| 565 | } |
| 566 | db_finalize(&s); |
| 567 | return z; |
| 568 | } |
| 569 | |
| 570 | #if defined(_WIN32) |
| 571 | extern char *sqlite3_win32_mbcs_to_utf8(const char*); |
| 572 | #endif |
| 573 | |
| 574 | /* |
| 575 | ** Initialize a new database file with the given schema. If anything |
| 576 | ** goes wrong, call db_err() to exit. |
| 577 | */ |
| 578 | void db_init_database( |
| @@ -583,13 +579,10 @@ | |
| 583 | sqlite3 *db; |
| 584 | int rc; |
| 585 | const char *zSql; |
| 586 | va_list ap; |
| 587 | |
| 588 | #if defined(_WIN32) |
| 589 | zFileName = sqlite3_win32_mbcs_to_utf8(zFileName); |
| 590 | #endif |
| 591 | rc = sqlite3_open(zFileName, &db); |
| 592 | if( rc!=SQLITE_OK ){ |
| 593 | db_err(sqlite3_errmsg(db)); |
| 594 | } |
| 595 | sqlite3_busy_timeout(db, 5000); |
| @@ -631,13 +624,10 @@ | |
| 631 | int rc; |
| 632 | const char *zVfs; |
| 633 | sqlite3 *db; |
| 634 | |
| 635 | zVfs = getenv("FOSSIL_VFS"); |
| 636 | #if defined(_WIN32) |
| 637 | zDbName = sqlite3_win32_mbcs_to_utf8(zDbName); |
| 638 | #endif |
| 639 | rc = sqlite3_open_v2( |
| 640 | zDbName, &db, |
| 641 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 642 | zVfs |
| 643 | ); |
| @@ -660,13 +650,10 @@ | |
| 660 | if( !g.db ){ |
| 661 | g.db = openDatabase(zDbName); |
| 662 | g.zMainDbType = zLabel; |
| 663 | db_connection_init(); |
| 664 | }else{ |
| 665 | #if defined(_WIN32) |
| 666 | zDbName = sqlite3_win32_mbcs_to_utf8(zDbName); |
| 667 | #endif |
| 668 | db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel); |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | /* |
| @@ -1189,14 +1176,15 @@ | |
| 1189 | db_open_repository(g.argv[2]); |
| 1190 | db_open_config(0); |
| 1191 | db_begin_transaction(); |
| 1192 | db_initial_setup(zDate, zDefaultUser, 1); |
| 1193 | db_end_transaction(0); |
| 1194 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 1195 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 1196 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1197 | printf("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword); |
| 1198 | } |
| 1199 | |
| 1200 | /* |
| 1201 | ** SQL functions for debugging. |
| 1202 | ** |
| @@ -1210,11 +1198,11 @@ | |
| 1210 | ){ |
| 1211 | int i; |
| 1212 | if( g.fSqlPrint ){ |
| 1213 | for(i=0; i<argc; i++){ |
| 1214 | char c = i==argc-1 ? '\n' : ' '; |
| 1215 | printf("%s%c", sqlite3_value_text(argv[i]), c); |
| 1216 | } |
| 1217 | } |
| 1218 | } |
| 1219 | static void db_sql_trace(void *notUsed, const char *zSql){ |
| 1220 | int n = strlen(zSql); |
| @@ -1613,14 +1601,14 @@ | |
| 1613 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1614 | zName |
| 1615 | ); |
| 1616 | } |
| 1617 | if( db_step(&q)==SQLITE_ROW ){ |
| 1618 | printf("%-20s %-8s %s\n", zName, db_column_text(&q, 0), |
| 1619 | db_column_text(&q, 1)); |
| 1620 | }else{ |
| 1621 | printf("%-20s\n", zName); |
| 1622 | } |
| 1623 | db_finalize(&q); |
| 1624 | } |
| 1625 | |
| 1626 | |
| @@ -1869,9 +1857,9 @@ | |
| 1869 | void test_timespan_cmd(void){ |
| 1870 | double rDiff; |
| 1871 | if( g.argc!=3 ) usage("TIMESTAMP"); |
| 1872 | sqlite3_open(":memory:", &g.db); |
| 1873 | rDiff = db_double(0.0, "SELECT julianday('now') - julianday(%Q)", g.argv[2]); |
| 1874 | printf("Time differences: %s\n", db_timespan_name(rDiff)); |
| 1875 | sqlite3_close(g.db); |
| 1876 | g.db = 0; |
| 1877 | } |
| 1878 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -565,14 +565,10 @@ | |
| 565 | } |
| 566 | db_finalize(&s); |
| 567 | return z; |
| 568 | } |
| 569 | |
| 570 | /* |
| 571 | ** Initialize a new database file with the given schema. If anything |
| 572 | ** goes wrong, call db_err() to exit. |
| 573 | */ |
| 574 | void db_init_database( |
| @@ -583,13 +579,10 @@ | |
| 579 | sqlite3 *db; |
| 580 | int rc; |
| 581 | const char *zSql; |
| 582 | va_list ap; |
| 583 | |
| 584 | rc = sqlite3_open(zFileName, &db); |
| 585 | if( rc!=SQLITE_OK ){ |
| 586 | db_err(sqlite3_errmsg(db)); |
| 587 | } |
| 588 | sqlite3_busy_timeout(db, 5000); |
| @@ -631,13 +624,10 @@ | |
| 624 | int rc; |
| 625 | const char *zVfs; |
| 626 | sqlite3 *db; |
| 627 | |
| 628 | zVfs = getenv("FOSSIL_VFS"); |
| 629 | rc = sqlite3_open_v2( |
| 630 | zDbName, &db, |
| 631 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 632 | zVfs |
| 633 | ); |
| @@ -660,13 +650,10 @@ | |
| 650 | if( !g.db ){ |
| 651 | g.db = openDatabase(zDbName); |
| 652 | g.zMainDbType = zLabel; |
| 653 | db_connection_init(); |
| 654 | }else{ |
| 655 | db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel); |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | /* |
| @@ -1189,14 +1176,15 @@ | |
| 1176 | db_open_repository(g.argv[2]); |
| 1177 | db_open_config(0); |
| 1178 | db_begin_transaction(); |
| 1179 | db_initial_setup(zDate, zDefaultUser, 1); |
| 1180 | db_end_transaction(0); |
| 1181 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 1182 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 1183 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1184 | fossil_print("admin-user: %s (initial password is \"%s\")\n", |
| 1185 | g.zLogin, zPassword); |
| 1186 | } |
| 1187 | |
| 1188 | /* |
| 1189 | ** SQL functions for debugging. |
| 1190 | ** |
| @@ -1210,11 +1198,11 @@ | |
| 1198 | ){ |
| 1199 | int i; |
| 1200 | if( g.fSqlPrint ){ |
| 1201 | for(i=0; i<argc; i++){ |
| 1202 | char c = i==argc-1 ? '\n' : ' '; |
| 1203 | fossil_print("%s%c", sqlite3_value_text(argv[i]), c); |
| 1204 | } |
| 1205 | } |
| 1206 | } |
| 1207 | static void db_sql_trace(void *notUsed, const char *zSql){ |
| 1208 | int n = strlen(zSql); |
| @@ -1613,14 +1601,14 @@ | |
| 1601 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1602 | zName |
| 1603 | ); |
| 1604 | } |
| 1605 | if( db_step(&q)==SQLITE_ROW ){ |
| 1606 | fossil_print("%-20s %-8s %s\n", zName, db_column_text(&q, 0), |
| 1607 | db_column_text(&q, 1)); |
| 1608 | }else{ |
| 1609 | fossil_print("%-20s\n", zName); |
| 1610 | } |
| 1611 | db_finalize(&q); |
| 1612 | } |
| 1613 | |
| 1614 | |
| @@ -1869,9 +1857,9 @@ | |
| 1857 | void test_timespan_cmd(void){ |
| 1858 | double rDiff; |
| 1859 | if( g.argc!=3 ) usage("TIMESTAMP"); |
| 1860 | sqlite3_open(":memory:", &g.db); |
| 1861 | rDiff = db_double(0.0, "SELECT julianday('now') - julianday(%Q)", g.argv[2]); |
| 1862 | fossil_print("Time differences: %s\n", db_timespan_name(rDiff)); |
| 1863 | sqlite3_close(g.db); |
| 1864 | g.db = 0; |
| 1865 | } |
| 1866 |
+7
-13
| --- src/deltacmd.c | ||
| +++ src/deltacmd.c | ||
| @@ -52,21 +52,18 @@ | ||
| 52 | 52 | Blob orig, target, delta; |
| 53 | 53 | if( g.argc!=5 ){ |
| 54 | 54 | usage("ORIGIN TARGET DELTA"); |
| 55 | 55 | } |
| 56 | 56 | if( blob_read_from_file(&orig, g.argv[2])<0 ){ |
| 57 | - fprintf(stderr,"cannot read %s\n", g.argv[2]); | |
| 58 | - fossil_exit(1); | |
| 57 | + fossil_fatal("cannot read %s\n", g.argv[2]); | |
| 59 | 58 | } |
| 60 | 59 | if( blob_read_from_file(&target, g.argv[3])<0 ){ |
| 61 | - fprintf(stderr,"cannot read %s\n", g.argv[3]); | |
| 62 | - fossil_exit(1); | |
| 60 | + fossil_fatal("cannot read %s\n", g.argv[3]); | |
| 63 | 61 | } |
| 64 | 62 | blob_delta_create(&orig, &target, &delta); |
| 65 | 63 | if( blob_write_to_file(&delta, g.argv[4])<blob_size(&delta) ){ |
| 66 | - fprintf(stderr,"cannot write %s\n", g.argv[4]); | |
| 67 | - fossil_exit(1); | |
| 64 | + fossil_fatal("cannot write %s\n", g.argv[4]); | |
| 68 | 65 | } |
| 69 | 66 | blob_reset(&orig); |
| 70 | 67 | blob_reset(&target); |
| 71 | 68 | blob_reset(&delta); |
| 72 | 69 | } |
| @@ -114,21 +111,18 @@ | ||
| 114 | 111 | Blob orig, target, delta; |
| 115 | 112 | if( g.argc!=5 ){ |
| 116 | 113 | usage("ORIGIN DELTA TARGET"); |
| 117 | 114 | } |
| 118 | 115 | if( blob_read_from_file(&orig, g.argv[2])<0 ){ |
| 119 | - fprintf(stderr,"cannot read %s\n", g.argv[2]); | |
| 120 | - fossil_exit(1); | |
| 116 | + fossil_fatal("cannot read %s\n", g.argv[2]); | |
| 121 | 117 | } |
| 122 | 118 | if( blob_read_from_file(&delta, g.argv[3])<0 ){ |
| 123 | - fprintf(stderr,"cannot read %s\n", g.argv[3]); | |
| 124 | - fossil_exit(1); | |
| 119 | + fossil_fatal("cannot read %s\n", g.argv[3]); | |
| 125 | 120 | } |
| 126 | 121 | blob_delta_apply(&orig, &delta, &target); |
| 127 | 122 | if( blob_write_to_file(&target, g.argv[4])<blob_size(&target) ){ |
| 128 | - fprintf(stderr,"cannot write %s\n", g.argv[4]); | |
| 129 | - fossil_exit(1); | |
| 123 | + fossil_fatal("cannot write %s\n", g.argv[4]); | |
| 130 | 124 | } |
| 131 | 125 | blob_reset(&orig); |
| 132 | 126 | blob_reset(&target); |
| 133 | 127 | blob_reset(&delta); |
| 134 | 128 | } |
| @@ -152,7 +146,7 @@ | ||
| 152 | 146 | blob_delta_apply(&f1, &d12, &a2); |
| 153 | 147 | blob_delta_apply(&f2, &d21, &a1); |
| 154 | 148 | if( blob_compare(&f1,&a1) || blob_compare(&f2, &a2) ){ |
| 155 | 149 | fossil_panic("delta test failed"); |
| 156 | 150 | } |
| 157 | - printf("ok\n"); | |
| 151 | + fossil_print("ok\n"); | |
| 158 | 152 | } |
| 159 | 153 |
| --- src/deltacmd.c | |
| +++ src/deltacmd.c | |
| @@ -52,21 +52,18 @@ | |
| 52 | Blob orig, target, delta; |
| 53 | if( g.argc!=5 ){ |
| 54 | usage("ORIGIN TARGET DELTA"); |
| 55 | } |
| 56 | if( blob_read_from_file(&orig, g.argv[2])<0 ){ |
| 57 | fprintf(stderr,"cannot read %s\n", g.argv[2]); |
| 58 | fossil_exit(1); |
| 59 | } |
| 60 | if( blob_read_from_file(&target, g.argv[3])<0 ){ |
| 61 | fprintf(stderr,"cannot read %s\n", g.argv[3]); |
| 62 | fossil_exit(1); |
| 63 | } |
| 64 | blob_delta_create(&orig, &target, &delta); |
| 65 | if( blob_write_to_file(&delta, g.argv[4])<blob_size(&delta) ){ |
| 66 | fprintf(stderr,"cannot write %s\n", g.argv[4]); |
| 67 | fossil_exit(1); |
| 68 | } |
| 69 | blob_reset(&orig); |
| 70 | blob_reset(&target); |
| 71 | blob_reset(&delta); |
| 72 | } |
| @@ -114,21 +111,18 @@ | |
| 114 | Blob orig, target, delta; |
| 115 | if( g.argc!=5 ){ |
| 116 | usage("ORIGIN DELTA TARGET"); |
| 117 | } |
| 118 | if( blob_read_from_file(&orig, g.argv[2])<0 ){ |
| 119 | fprintf(stderr,"cannot read %s\n", g.argv[2]); |
| 120 | fossil_exit(1); |
| 121 | } |
| 122 | if( blob_read_from_file(&delta, g.argv[3])<0 ){ |
| 123 | fprintf(stderr,"cannot read %s\n", g.argv[3]); |
| 124 | fossil_exit(1); |
| 125 | } |
| 126 | blob_delta_apply(&orig, &delta, &target); |
| 127 | if( blob_write_to_file(&target, g.argv[4])<blob_size(&target) ){ |
| 128 | fprintf(stderr,"cannot write %s\n", g.argv[4]); |
| 129 | fossil_exit(1); |
| 130 | } |
| 131 | blob_reset(&orig); |
| 132 | blob_reset(&target); |
| 133 | blob_reset(&delta); |
| 134 | } |
| @@ -152,7 +146,7 @@ | |
| 152 | blob_delta_apply(&f1, &d12, &a2); |
| 153 | blob_delta_apply(&f2, &d21, &a1); |
| 154 | if( blob_compare(&f1,&a1) || blob_compare(&f2, &a2) ){ |
| 155 | fossil_panic("delta test failed"); |
| 156 | } |
| 157 | printf("ok\n"); |
| 158 | } |
| 159 |
| --- src/deltacmd.c | |
| +++ src/deltacmd.c | |
| @@ -52,21 +52,18 @@ | |
| 52 | Blob orig, target, delta; |
| 53 | if( g.argc!=5 ){ |
| 54 | usage("ORIGIN TARGET DELTA"); |
| 55 | } |
| 56 | if( blob_read_from_file(&orig, g.argv[2])<0 ){ |
| 57 | fossil_fatal("cannot read %s\n", g.argv[2]); |
| 58 | } |
| 59 | if( blob_read_from_file(&target, g.argv[3])<0 ){ |
| 60 | fossil_fatal("cannot read %s\n", g.argv[3]); |
| 61 | } |
| 62 | blob_delta_create(&orig, &target, &delta); |
| 63 | if( blob_write_to_file(&delta, g.argv[4])<blob_size(&delta) ){ |
| 64 | fossil_fatal("cannot write %s\n", g.argv[4]); |
| 65 | } |
| 66 | blob_reset(&orig); |
| 67 | blob_reset(&target); |
| 68 | blob_reset(&delta); |
| 69 | } |
| @@ -114,21 +111,18 @@ | |
| 111 | Blob orig, target, delta; |
| 112 | if( g.argc!=5 ){ |
| 113 | usage("ORIGIN DELTA TARGET"); |
| 114 | } |
| 115 | if( blob_read_from_file(&orig, g.argv[2])<0 ){ |
| 116 | fossil_fatal("cannot read %s\n", g.argv[2]); |
| 117 | } |
| 118 | if( blob_read_from_file(&delta, g.argv[3])<0 ){ |
| 119 | fossil_fatal("cannot read %s\n", g.argv[3]); |
| 120 | } |
| 121 | blob_delta_apply(&orig, &delta, &target); |
| 122 | if( blob_write_to_file(&target, g.argv[4])<blob_size(&target) ){ |
| 123 | fossil_fatal("cannot write %s\n", g.argv[4]); |
| 124 | } |
| 125 | blob_reset(&orig); |
| 126 | blob_reset(&target); |
| 127 | blob_reset(&delta); |
| 128 | } |
| @@ -152,7 +146,7 @@ | |
| 146 | blob_delta_apply(&f1, &d12, &a2); |
| 147 | blob_delta_apply(&f2, &d21, &a1); |
| 148 | if( blob_compare(&f1,&a1) || blob_compare(&f2, &a2) ){ |
| 149 | fossil_panic("delta test failed"); |
| 150 | } |
| 151 | fossil_print("ok\n"); |
| 152 | } |
| 153 |
+5
-4
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -590,15 +590,15 @@ | ||
| 590 | 590 | int i; |
| 591 | 591 | int *R; |
| 592 | 592 | if( g.argc<4 ) usage("FILE1 FILE2 ..."); |
| 593 | 593 | blob_read_from_file(&a, g.argv[2]); |
| 594 | 594 | for(i=3; i<g.argc; i++){ |
| 595 | - if( i>3 ) printf("-------------------------------\n"); | |
| 595 | + if( i>3 ) fossil_print("-------------------------------\n"); | |
| 596 | 596 | blob_read_from_file(&b, g.argv[i]); |
| 597 | 597 | R = text_diff(&a, &b, 0, 0, 0); |
| 598 | 598 | for(r=0; R[r] || R[r+1] || R[r+2]; r += 3){ |
| 599 | - printf(" copy %4d delete %4d insert %4d\n", R[r], R[r+1], R[r+2]); | |
| 599 | + fossil_print(" copy %4d delete %4d insert %4d\n", R[r], R[r+1], R[r+2]); | |
| 600 | 600 | } |
| 601 | 601 | /* free(R); */ |
| 602 | 602 | blob_reset(&b); |
| 603 | 603 | } |
| 604 | 604 | } |
| @@ -730,11 +730,11 @@ | ||
| 730 | 730 | } |
| 731 | 731 | } |
| 732 | 732 | for(i=0; i<x.nOrig; i++){ |
| 733 | 733 | const char *zSrc = x.aOrig[i].zSrc; |
| 734 | 734 | if( zSrc==0 ) zSrc = g.argv[g.argc-1]; |
| 735 | - printf("%10s: %.*s\n", zSrc, x.aOrig[i].n, x.aOrig[i].z); | |
| 735 | + fossil_print("%10s: %.*s\n", zSrc, x.aOrig[i].n, x.aOrig[i].z); | |
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | /* |
| 740 | 740 | ** Compute a complete annotation on a file. The file is identified |
| @@ -859,8 +859,9 @@ | ||
| 859 | 859 | if( mid==0 ){ |
| 860 | 860 | fossil_panic("unable to find manifest"); |
| 861 | 861 | } |
| 862 | 862 | annotate_file(&ann, fnid, mid, 0); |
| 863 | 863 | for(i=0; i<ann.nOrig; i++){ |
| 864 | - printf("%s: %.*s\n", ann.aOrig[i].zSrc, ann.aOrig[i].n, ann.aOrig[i].z); | |
| 864 | + fossil_print("%s: %.*s\n", | |
| 865 | + ann.aOrig[i].zSrc, ann.aOrig[i].n, ann.aOrig[i].z); | |
| 865 | 866 | } |
| 866 | 867 | } |
| 867 | 868 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -590,15 +590,15 @@ | |
| 590 | int i; |
| 591 | int *R; |
| 592 | if( g.argc<4 ) usage("FILE1 FILE2 ..."); |
| 593 | blob_read_from_file(&a, g.argv[2]); |
| 594 | for(i=3; i<g.argc; i++){ |
| 595 | if( i>3 ) printf("-------------------------------\n"); |
| 596 | blob_read_from_file(&b, g.argv[i]); |
| 597 | R = text_diff(&a, &b, 0, 0, 0); |
| 598 | for(r=0; R[r] || R[r+1] || R[r+2]; r += 3){ |
| 599 | printf(" copy %4d delete %4d insert %4d\n", R[r], R[r+1], R[r+2]); |
| 600 | } |
| 601 | /* free(R); */ |
| 602 | blob_reset(&b); |
| 603 | } |
| 604 | } |
| @@ -730,11 +730,11 @@ | |
| 730 | } |
| 731 | } |
| 732 | for(i=0; i<x.nOrig; i++){ |
| 733 | const char *zSrc = x.aOrig[i].zSrc; |
| 734 | if( zSrc==0 ) zSrc = g.argv[g.argc-1]; |
| 735 | printf("%10s: %.*s\n", zSrc, x.aOrig[i].n, x.aOrig[i].z); |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | /* |
| 740 | ** Compute a complete annotation on a file. The file is identified |
| @@ -859,8 +859,9 @@ | |
| 859 | if( mid==0 ){ |
| 860 | fossil_panic("unable to find manifest"); |
| 861 | } |
| 862 | annotate_file(&ann, fnid, mid, 0); |
| 863 | for(i=0; i<ann.nOrig; i++){ |
| 864 | printf("%s: %.*s\n", ann.aOrig[i].zSrc, ann.aOrig[i].n, ann.aOrig[i].z); |
| 865 | } |
| 866 | } |
| 867 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -590,15 +590,15 @@ | |
| 590 | int i; |
| 591 | int *R; |
| 592 | if( g.argc<4 ) usage("FILE1 FILE2 ..."); |
| 593 | blob_read_from_file(&a, g.argv[2]); |
| 594 | for(i=3; i<g.argc; i++){ |
| 595 | if( i>3 ) fossil_print("-------------------------------\n"); |
| 596 | blob_read_from_file(&b, g.argv[i]); |
| 597 | R = text_diff(&a, &b, 0, 0, 0); |
| 598 | for(r=0; R[r] || R[r+1] || R[r+2]; r += 3){ |
| 599 | fossil_print(" copy %4d delete %4d insert %4d\n", R[r], R[r+1], R[r+2]); |
| 600 | } |
| 601 | /* free(R); */ |
| 602 | blob_reset(&b); |
| 603 | } |
| 604 | } |
| @@ -730,11 +730,11 @@ | |
| 730 | } |
| 731 | } |
| 732 | for(i=0; i<x.nOrig; i++){ |
| 733 | const char *zSrc = x.aOrig[i].zSrc; |
| 734 | if( zSrc==0 ) zSrc = g.argv[g.argc-1]; |
| 735 | fossil_print("%10s: %.*s\n", zSrc, x.aOrig[i].n, x.aOrig[i].z); |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | /* |
| 740 | ** Compute a complete annotation on a file. The file is identified |
| @@ -859,8 +859,9 @@ | |
| 859 | if( mid==0 ){ |
| 860 | fossil_panic("unable to find manifest"); |
| 861 | } |
| 862 | annotate_file(&ann, fnid, mid, 0); |
| 863 | for(i=0; i<ann.nOrig; i++){ |
| 864 | fossil_print("%s: %.*s\n", |
| 865 | ann.aOrig[i].zSrc, ann.aOrig[i].n, ann.aOrig[i].z); |
| 866 | } |
| 867 | } |
| 868 |
+4
-4
| --- src/encode.c | ||
| +++ src/encode.c | ||
| @@ -340,11 +340,11 @@ | ||
| 340 | 340 | void test_encode64_cmd(void){ |
| 341 | 341 | char *z; |
| 342 | 342 | int i; |
| 343 | 343 | for(i=2; i<g.argc; i++){ |
| 344 | 344 | z = encode64(g.argv[i], -1); |
| 345 | - printf("%s\n", z); | |
| 345 | + fossil_print("%s\n", z); | |
| 346 | 346 | free(z); |
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
| @@ -405,11 +405,11 @@ | ||
| 405 | 405 | void test_decode64_cmd(void){ |
| 406 | 406 | char *z; |
| 407 | 407 | int i, n; |
| 408 | 408 | for(i=2; i<g.argc; i++){ |
| 409 | 409 | z = decode64(g.argv[i], &n); |
| 410 | - printf("%d: %s\n", n, z); | |
| 410 | + fossil_print("%d: %s\n", n, z); | |
| 411 | 411 | free(z); |
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /* |
| @@ -579,13 +579,13 @@ | ||
| 579 | 579 | int i; |
| 580 | 580 | char *z, *z2; |
| 581 | 581 | for(i=2; i<g.argc; i++){ |
| 582 | 582 | z = obscure(g.argv[i]); |
| 583 | 583 | z2 = unobscure(z); |
| 584 | - printf("OBSCURE: %s -> %s (%s)\n", g.argv[i], z, z2); | |
| 584 | + fossil_print("OBSCURE: %s -> %s (%s)\n", g.argv[i], z, z2); | |
| 585 | 585 | free(z); |
| 586 | 586 | free(z2); |
| 587 | 587 | z = unobscure(g.argv[i]); |
| 588 | - printf("UNOBSCURE: %s -> %s\n", g.argv[i], z); | |
| 588 | + fossil_print("UNOBSCURE: %s -> %s\n", g.argv[i], z); | |
| 589 | 589 | free(z); |
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 |
| --- src/encode.c | |
| +++ src/encode.c | |
| @@ -340,11 +340,11 @@ | |
| 340 | void test_encode64_cmd(void){ |
| 341 | char *z; |
| 342 | int i; |
| 343 | for(i=2; i<g.argc; i++){ |
| 344 | z = encode64(g.argv[i], -1); |
| 345 | printf("%s\n", z); |
| 346 | free(z); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | |
| @@ -405,11 +405,11 @@ | |
| 405 | void test_decode64_cmd(void){ |
| 406 | char *z; |
| 407 | int i, n; |
| 408 | for(i=2; i<g.argc; i++){ |
| 409 | z = decode64(g.argv[i], &n); |
| 410 | printf("%d: %s\n", n, z); |
| 411 | free(z); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | /* |
| @@ -579,13 +579,13 @@ | |
| 579 | int i; |
| 580 | char *z, *z2; |
| 581 | for(i=2; i<g.argc; i++){ |
| 582 | z = obscure(g.argv[i]); |
| 583 | z2 = unobscure(z); |
| 584 | printf("OBSCURE: %s -> %s (%s)\n", g.argv[i], z, z2); |
| 585 | free(z); |
| 586 | free(z2); |
| 587 | z = unobscure(g.argv[i]); |
| 588 | printf("UNOBSCURE: %s -> %s\n", g.argv[i], z); |
| 589 | free(z); |
| 590 | } |
| 591 | } |
| 592 |
| --- src/encode.c | |
| +++ src/encode.c | |
| @@ -340,11 +340,11 @@ | |
| 340 | void test_encode64_cmd(void){ |
| 341 | char *z; |
| 342 | int i; |
| 343 | for(i=2; i<g.argc; i++){ |
| 344 | z = encode64(g.argv[i], -1); |
| 345 | fossil_print("%s\n", z); |
| 346 | free(z); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | |
| @@ -405,11 +405,11 @@ | |
| 405 | void test_decode64_cmd(void){ |
| 406 | char *z; |
| 407 | int i, n; |
| 408 | for(i=2; i<g.argc; i++){ |
| 409 | z = decode64(g.argv[i], &n); |
| 410 | fossil_print("%d: %s\n", n, z); |
| 411 | free(z); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | /* |
| @@ -579,13 +579,13 @@ | |
| 579 | int i; |
| 580 | char *z, *z2; |
| 581 | for(i=2; i<g.argc; i++){ |
| 582 | z = obscure(g.argv[i]); |
| 583 | z2 = unobscure(z); |
| 584 | fossil_print("OBSCURE: %s -> %s (%s)\n", g.argv[i], z, z2); |
| 585 | free(z); |
| 586 | free(z2); |
| 587 | z = unobscure(g.argv[i]); |
| 588 | fossil_print("UNOBSCURE: %s -> %s\n", g.argv[i], z); |
| 589 | free(z); |
| 590 | } |
| 591 | } |
| 592 |
+12
-14
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -350,13 +350,13 @@ | ||
| 350 | 350 | void cmd_test_simplify_name(void){ |
| 351 | 351 | int i; |
| 352 | 352 | char *z; |
| 353 | 353 | for(i=2; i<g.argc; i++){ |
| 354 | 354 | z = mprintf("%s", g.argv[i]); |
| 355 | - printf("[%s] -> ", z); | |
| 355 | + fossil_print("[%s] -> ", z); | |
| 356 | 356 | file_simplify_name(z, -1); |
| 357 | - printf("[%s]\n", z); | |
| 357 | + fossil_print("[%s]\n", z); | |
| 358 | 358 | fossil_free(z); |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /* |
| @@ -377,12 +377,11 @@ | ||
| 377 | 377 | blob_set(pOut, zOrigName); |
| 378 | 378 | blob_materialize(pOut); |
| 379 | 379 | }else{ |
| 380 | 380 | char zPwd[2000]; |
| 381 | 381 | if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){ |
| 382 | - fprintf(stderr, "pwd too big: max %d\n", (int)sizeof(zPwd)-20); | |
| 383 | - fossil_exit(1); | |
| 382 | + fossil_fatal("pwd too big: max %d\n", (int)sizeof(zPwd)-20); | |
| 384 | 383 | } |
| 385 | 384 | blob_zero(pOut); |
| 386 | 385 | blob_appendf(pOut, "%//%/", zPwd, zOrigName); |
| 387 | 386 | } |
| 388 | 387 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| @@ -401,19 +400,19 @@ | ||
| 401 | 400 | blob_zero(&x); |
| 402 | 401 | for(i=2; i<g.argc; i++){ |
| 403 | 402 | char zBuf[100]; |
| 404 | 403 | const char *zName = g.argv[i]; |
| 405 | 404 | file_canonical_name(zName, &x); |
| 406 | - printf("[%s] -> [%s]\n", zName, blob_buffer(&x)); | |
| 405 | + fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x)); | |
| 407 | 406 | blob_reset(&x); |
| 408 | 407 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zName)); |
| 409 | - printf(" file_size = %s\n", zBuf); | |
| 408 | + fossil_print(" file_size = %s\n", zBuf); | |
| 410 | 409 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_mtime(zName)); |
| 411 | - printf(" file_mtime = %s\n", zBuf); | |
| 412 | - printf(" file_isfile = %d\n", file_isfile(zName)); | |
| 413 | - printf(" file_isexe = %d\n", file_isexe(zName)); | |
| 414 | - printf(" file_isdir = %d\n", file_isdir(zName)); | |
| 410 | + fossil_print(" file_mtime = %s\n", zBuf); | |
| 411 | + fossil_print(" file_isfile = %d\n", file_isfile(zName)); | |
| 412 | + fossil_print(" file_isexe = %d\n", file_isexe(zName)); | |
| 413 | + fossil_print(" file_isdir = %d\n", file_isdir(zName)); | |
| 415 | 414 | } |
| 416 | 415 | } |
| 417 | 416 | |
| 418 | 417 | /* |
| 419 | 418 | ** Return TRUE if the given filename is canonical. |
| @@ -453,12 +452,11 @@ | ||
| 453 | 452 | if( zPath[0]=='/' ){ |
| 454 | 453 | int i, j; |
| 455 | 454 | Blob tmp; |
| 456 | 455 | char zPwd[2000]; |
| 457 | 456 | if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){ |
| 458 | - fprintf(stderr, "pwd too big: max %d\n", (int)sizeof(zPwd)-20); | |
| 459 | - fossil_exit(1); | |
| 457 | + fossil_fatal("pwd too big: max %d\n", (int)sizeof(zPwd)-20); | |
| 460 | 458 | } |
| 461 | 459 | for(i=1; zPath[i] && zPwd[i]==zPath[i]; i++){} |
| 462 | 460 | if( zPath[i]==0 ){ |
| 463 | 461 | blob_reset(pOut); |
| 464 | 462 | if( zPwd[i]==0 ){ |
| @@ -502,11 +500,11 @@ | ||
| 502 | 500 | int i; |
| 503 | 501 | Blob x; |
| 504 | 502 | blob_zero(&x); |
| 505 | 503 | for(i=2; i<g.argc; i++){ |
| 506 | 504 | file_relative_name(g.argv[i], &x); |
| 507 | - printf("%s\n", blob_buffer(&x)); | |
| 505 | + fossil_print("%s\n", blob_buffer(&x)); | |
| 508 | 506 | blob_reset(&x); |
| 509 | 507 | } |
| 510 | 508 | } |
| 511 | 509 | |
| 512 | 510 | /* |
| @@ -557,11 +555,11 @@ | ||
| 557 | 555 | int i; |
| 558 | 556 | Blob x; |
| 559 | 557 | blob_zero(&x); |
| 560 | 558 | for(i=2; i<g.argc; i++){ |
| 561 | 559 | if( file_tree_name(g.argv[i], &x, 1) ){ |
| 562 | - printf("%s\n", blob_buffer(&x)); | |
| 560 | + fossil_print("%s\n", blob_buffer(&x)); | |
| 563 | 561 | blob_reset(&x); |
| 564 | 562 | } |
| 565 | 563 | } |
| 566 | 564 | } |
| 567 | 565 | |
| 568 | 566 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -350,13 +350,13 @@ | |
| 350 | void cmd_test_simplify_name(void){ |
| 351 | int i; |
| 352 | char *z; |
| 353 | for(i=2; i<g.argc; i++){ |
| 354 | z = mprintf("%s", g.argv[i]); |
| 355 | printf("[%s] -> ", z); |
| 356 | file_simplify_name(z, -1); |
| 357 | printf("[%s]\n", z); |
| 358 | fossil_free(z); |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | /* |
| @@ -377,12 +377,11 @@ | |
| 377 | blob_set(pOut, zOrigName); |
| 378 | blob_materialize(pOut); |
| 379 | }else{ |
| 380 | char zPwd[2000]; |
| 381 | if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){ |
| 382 | fprintf(stderr, "pwd too big: max %d\n", (int)sizeof(zPwd)-20); |
| 383 | fossil_exit(1); |
| 384 | } |
| 385 | blob_zero(pOut); |
| 386 | blob_appendf(pOut, "%//%/", zPwd, zOrigName); |
| 387 | } |
| 388 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| @@ -401,19 +400,19 @@ | |
| 401 | blob_zero(&x); |
| 402 | for(i=2; i<g.argc; i++){ |
| 403 | char zBuf[100]; |
| 404 | const char *zName = g.argv[i]; |
| 405 | file_canonical_name(zName, &x); |
| 406 | printf("[%s] -> [%s]\n", zName, blob_buffer(&x)); |
| 407 | blob_reset(&x); |
| 408 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zName)); |
| 409 | printf(" file_size = %s\n", zBuf); |
| 410 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_mtime(zName)); |
| 411 | printf(" file_mtime = %s\n", zBuf); |
| 412 | printf(" file_isfile = %d\n", file_isfile(zName)); |
| 413 | printf(" file_isexe = %d\n", file_isexe(zName)); |
| 414 | printf(" file_isdir = %d\n", file_isdir(zName)); |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | /* |
| 419 | ** Return TRUE if the given filename is canonical. |
| @@ -453,12 +452,11 @@ | |
| 453 | if( zPath[0]=='/' ){ |
| 454 | int i, j; |
| 455 | Blob tmp; |
| 456 | char zPwd[2000]; |
| 457 | if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){ |
| 458 | fprintf(stderr, "pwd too big: max %d\n", (int)sizeof(zPwd)-20); |
| 459 | fossil_exit(1); |
| 460 | } |
| 461 | for(i=1; zPath[i] && zPwd[i]==zPath[i]; i++){} |
| 462 | if( zPath[i]==0 ){ |
| 463 | blob_reset(pOut); |
| 464 | if( zPwd[i]==0 ){ |
| @@ -502,11 +500,11 @@ | |
| 502 | int i; |
| 503 | Blob x; |
| 504 | blob_zero(&x); |
| 505 | for(i=2; i<g.argc; i++){ |
| 506 | file_relative_name(g.argv[i], &x); |
| 507 | printf("%s\n", blob_buffer(&x)); |
| 508 | blob_reset(&x); |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | /* |
| @@ -557,11 +555,11 @@ | |
| 557 | int i; |
| 558 | Blob x; |
| 559 | blob_zero(&x); |
| 560 | for(i=2; i<g.argc; i++){ |
| 561 | if( file_tree_name(g.argv[i], &x, 1) ){ |
| 562 | printf("%s\n", blob_buffer(&x)); |
| 563 | blob_reset(&x); |
| 564 | } |
| 565 | } |
| 566 | } |
| 567 | |
| 568 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -350,13 +350,13 @@ | |
| 350 | void cmd_test_simplify_name(void){ |
| 351 | int i; |
| 352 | char *z; |
| 353 | for(i=2; i<g.argc; i++){ |
| 354 | z = mprintf("%s", g.argv[i]); |
| 355 | fossil_print("[%s] -> ", z); |
| 356 | file_simplify_name(z, -1); |
| 357 | fossil_print("[%s]\n", z); |
| 358 | fossil_free(z); |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | /* |
| @@ -377,12 +377,11 @@ | |
| 377 | blob_set(pOut, zOrigName); |
| 378 | blob_materialize(pOut); |
| 379 | }else{ |
| 380 | char zPwd[2000]; |
| 381 | if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){ |
| 382 | fossil_fatal("pwd too big: max %d\n", (int)sizeof(zPwd)-20); |
| 383 | } |
| 384 | blob_zero(pOut); |
| 385 | blob_appendf(pOut, "%//%/", zPwd, zOrigName); |
| 386 | } |
| 387 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| @@ -401,19 +400,19 @@ | |
| 400 | blob_zero(&x); |
| 401 | for(i=2; i<g.argc; i++){ |
| 402 | char zBuf[100]; |
| 403 | const char *zName = g.argv[i]; |
| 404 | file_canonical_name(zName, &x); |
| 405 | fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x)); |
| 406 | blob_reset(&x); |
| 407 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zName)); |
| 408 | fossil_print(" file_size = %s\n", zBuf); |
| 409 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_mtime(zName)); |
| 410 | fossil_print(" file_mtime = %s\n", zBuf); |
| 411 | fossil_print(" file_isfile = %d\n", file_isfile(zName)); |
| 412 | fossil_print(" file_isexe = %d\n", file_isexe(zName)); |
| 413 | fossil_print(" file_isdir = %d\n", file_isdir(zName)); |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | /* |
| 418 | ** Return TRUE if the given filename is canonical. |
| @@ -453,12 +452,11 @@ | |
| 452 | if( zPath[0]=='/' ){ |
| 453 | int i, j; |
| 454 | Blob tmp; |
| 455 | char zPwd[2000]; |
| 456 | if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){ |
| 457 | fossil_fatal("pwd too big: max %d\n", (int)sizeof(zPwd)-20); |
| 458 | } |
| 459 | for(i=1; zPath[i] && zPwd[i]==zPath[i]; i++){} |
| 460 | if( zPath[i]==0 ){ |
| 461 | blob_reset(pOut); |
| 462 | if( zPwd[i]==0 ){ |
| @@ -502,11 +500,11 @@ | |
| 500 | int i; |
| 501 | Blob x; |
| 502 | blob_zero(&x); |
| 503 | for(i=2; i<g.argc; i++){ |
| 504 | file_relative_name(g.argv[i], &x); |
| 505 | fossil_print("%s\n", blob_buffer(&x)); |
| 506 | blob_reset(&x); |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | /* |
| @@ -557,11 +555,11 @@ | |
| 555 | int i; |
| 556 | Blob x; |
| 557 | blob_zero(&x); |
| 558 | for(i=2; i<g.argc; i++){ |
| 559 | if( file_tree_name(g.argv[i], &x, 1) ){ |
| 560 | fossil_print("%s\n", blob_buffer(&x)); |
| 561 | blob_reset(&x); |
| 562 | } |
| 563 | } |
| 564 | } |
| 565 | |
| 566 |
+3
-3
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -89,11 +89,11 @@ | ||
| 89 | 89 | blob_reset(&uuid); |
| 90 | 90 | }else{ |
| 91 | 91 | blob_appendf(&line, "unknown 0000000000"); |
| 92 | 92 | } |
| 93 | 93 | db_finalize(&q); |
| 94 | - printf("%s\n", blob_str(&line)); | |
| 94 | + fossil_print("%s\n", blob_str(&line)); | |
| 95 | 95 | blob_reset(&fname); |
| 96 | 96 | blob_reset(&line); |
| 97 | 97 | }else if( find_option("print","p",0) ){ |
| 98 | 98 | Blob record; |
| 99 | 99 | Blob fname; |
| @@ -152,21 +152,21 @@ | ||
| 152 | 152 | " ORDER BY event.mtime DESC LIMIT %d OFFSET %d", |
| 153 | 153 | zFilename, iLimit, iOffset |
| 154 | 154 | ); |
| 155 | 155 | blob_zero(&line); |
| 156 | 156 | if( iBrief ){ |
| 157 | - printf("History of %s\n", blob_str(&fname)); | |
| 157 | + fossil_print("History of %s\n", blob_str(&fname)); | |
| 158 | 158 | } |
| 159 | 159 | while( db_step(&q)==SQLITE_ROW ){ |
| 160 | 160 | const char *zFileUuid = db_column_text(&q, 0); |
| 161 | 161 | const char *zCiUuid = db_column_text(&q,1); |
| 162 | 162 | const char *zDate = db_column_text(&q, 2); |
| 163 | 163 | const char *zCom = db_column_text(&q, 3); |
| 164 | 164 | const char *zUser = db_column_text(&q, 4); |
| 165 | 165 | char *zOut; |
| 166 | 166 | if( iBrief ){ |
| 167 | - printf("%s ", zDate); | |
| 167 | + fossil_print("%s ", zDate); | |
| 168 | 168 | zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])", |
| 169 | 169 | zCiUuid, zCom, zUser, zFileUuid); |
| 170 | 170 | comment_print(zOut, 11, 79); |
| 171 | 171 | sqlite3_free(zOut); |
| 172 | 172 | }else{ |
| 173 | 173 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -89,11 +89,11 @@ | |
| 89 | blob_reset(&uuid); |
| 90 | }else{ |
| 91 | blob_appendf(&line, "unknown 0000000000"); |
| 92 | } |
| 93 | db_finalize(&q); |
| 94 | printf("%s\n", blob_str(&line)); |
| 95 | blob_reset(&fname); |
| 96 | blob_reset(&line); |
| 97 | }else if( find_option("print","p",0) ){ |
| 98 | Blob record; |
| 99 | Blob fname; |
| @@ -152,21 +152,21 @@ | |
| 152 | " ORDER BY event.mtime DESC LIMIT %d OFFSET %d", |
| 153 | zFilename, iLimit, iOffset |
| 154 | ); |
| 155 | blob_zero(&line); |
| 156 | if( iBrief ){ |
| 157 | printf("History of %s\n", blob_str(&fname)); |
| 158 | } |
| 159 | while( db_step(&q)==SQLITE_ROW ){ |
| 160 | const char *zFileUuid = db_column_text(&q, 0); |
| 161 | const char *zCiUuid = db_column_text(&q,1); |
| 162 | const char *zDate = db_column_text(&q, 2); |
| 163 | const char *zCom = db_column_text(&q, 3); |
| 164 | const char *zUser = db_column_text(&q, 4); |
| 165 | char *zOut; |
| 166 | if( iBrief ){ |
| 167 | printf("%s ", zDate); |
| 168 | zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])", |
| 169 | zCiUuid, zCom, zUser, zFileUuid); |
| 170 | comment_print(zOut, 11, 79); |
| 171 | sqlite3_free(zOut); |
| 172 | }else{ |
| 173 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -89,11 +89,11 @@ | |
| 89 | blob_reset(&uuid); |
| 90 | }else{ |
| 91 | blob_appendf(&line, "unknown 0000000000"); |
| 92 | } |
| 93 | db_finalize(&q); |
| 94 | fossil_print("%s\n", blob_str(&line)); |
| 95 | blob_reset(&fname); |
| 96 | blob_reset(&line); |
| 97 | }else if( find_option("print","p",0) ){ |
| 98 | Blob record; |
| 99 | Blob fname; |
| @@ -152,21 +152,21 @@ | |
| 152 | " ORDER BY event.mtime DESC LIMIT %d OFFSET %d", |
| 153 | zFilename, iLimit, iOffset |
| 154 | ); |
| 155 | blob_zero(&line); |
| 156 | if( iBrief ){ |
| 157 | fossil_print("History of %s\n", blob_str(&fname)); |
| 158 | } |
| 159 | while( db_step(&q)==SQLITE_ROW ){ |
| 160 | const char *zFileUuid = db_column_text(&q, 0); |
| 161 | const char *zCiUuid = db_column_text(&q,1); |
| 162 | const char *zDate = db_column_text(&q, 2); |
| 163 | const char *zCom = db_column_text(&q, 3); |
| 164 | const char *zUser = db_column_text(&q, 4); |
| 165 | char *zOut; |
| 166 | if( iBrief ){ |
| 167 | fossil_print("%s ", zDate); |
| 168 | zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])", |
| 169 | zCiUuid, zCom, zUser, zFileUuid); |
| 170 | comment_print(zOut, 11, 79); |
| 171 | sqlite3_free(zOut); |
| 172 | }else{ |
| 173 |
+3
-3
| --- src/glob.c | ||
| +++ src/glob.c | ||
| @@ -250,15 +250,15 @@ | ||
| 250 | 250 | */ |
| 251 | 251 | void glob_test_cmd(void){ |
| 252 | 252 | Glob *pGlob; |
| 253 | 253 | int i; |
| 254 | 254 | if( g.argc<4 ) usage("PATTERN STRING ..."); |
| 255 | - printf("SQL expression: %s\n", glob_expr("x", g.argv[2])); | |
| 255 | + fossil_print("SQL expression: %s\n", glob_expr("x", g.argv[2])); | |
| 256 | 256 | pGlob = glob_create(g.argv[2]); |
| 257 | 257 | for(i=0; i<pGlob->nPattern; i++){ |
| 258 | - printf("pattern[%d] = [%s]\n", i, pGlob->azPattern[i]); | |
| 258 | + fossil_print("pattern[%d] = [%s]\n", i, pGlob->azPattern[i]); | |
| 259 | 259 | } |
| 260 | 260 | for(i=3; i<g.argc; i++){ |
| 261 | - printf("%d %s\n", glob_match(pGlob, g.argv[i]), g.argv[i]); | |
| 261 | + fossil_print("%d %s\n", glob_match(pGlob, g.argv[i]), g.argv[i]); | |
| 262 | 262 | } |
| 263 | 263 | glob_free(pGlob); |
| 264 | 264 | } |
| 265 | 265 |
| --- src/glob.c | |
| +++ src/glob.c | |
| @@ -250,15 +250,15 @@ | |
| 250 | */ |
| 251 | void glob_test_cmd(void){ |
| 252 | Glob *pGlob; |
| 253 | int i; |
| 254 | if( g.argc<4 ) usage("PATTERN STRING ..."); |
| 255 | printf("SQL expression: %s\n", glob_expr("x", g.argv[2])); |
| 256 | pGlob = glob_create(g.argv[2]); |
| 257 | for(i=0; i<pGlob->nPattern; i++){ |
| 258 | printf("pattern[%d] = [%s]\n", i, pGlob->azPattern[i]); |
| 259 | } |
| 260 | for(i=3; i<g.argc; i++){ |
| 261 | printf("%d %s\n", glob_match(pGlob, g.argv[i]), g.argv[i]); |
| 262 | } |
| 263 | glob_free(pGlob); |
| 264 | } |
| 265 |
| --- src/glob.c | |
| +++ src/glob.c | |
| @@ -250,15 +250,15 @@ | |
| 250 | */ |
| 251 | void glob_test_cmd(void){ |
| 252 | Glob *pGlob; |
| 253 | int i; |
| 254 | if( g.argc<4 ) usage("PATTERN STRING ..."); |
| 255 | fossil_print("SQL expression: %s\n", glob_expr("x", g.argv[2])); |
| 256 | pGlob = glob_create(g.argv[2]); |
| 257 | for(i=0; i<pGlob->nPattern; i++){ |
| 258 | fossil_print("pattern[%d] = [%s]\n", i, pGlob->azPattern[i]); |
| 259 | } |
| 260 | for(i=3; i<g.argc; i++){ |
| 261 | fossil_print("%d %s\n", glob_match(pGlob, g.argv[i]), g.argv[i]); |
| 262 | } |
| 263 | glob_free(pGlob); |
| 264 | } |
| 265 |
+3
-3
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -120,11 +120,11 @@ | ||
| 120 | 120 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 121 | 121 | #else |
| 122 | 122 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 123 | 123 | #endif |
| 124 | 124 | } |
| 125 | - printf("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ | |
| 125 | + fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ | |
| 126 | 126 | if( g.urlUser && g.urlUser[0] ){ |
| 127 | 127 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 128 | 128 | #ifdef __MINGW32__ |
| 129 | 129 | /* Only win32 (and specifically PLINK.EXE) support the -pw option */ |
| 130 | 130 | if( g.urlPasswd && g.urlPasswd[0] ){ |
| @@ -139,19 +139,19 @@ | ||
| 139 | 139 | blob_init(&pw, g.urlPasswd, -1); |
| 140 | 140 | } |
| 141 | 141 | blob_append(&zCmd, " -pw ", -1); |
| 142 | 142 | shell_escape(&zCmd, blob_str(&pw)); |
| 143 | 143 | blob_reset(&pw); |
| 144 | - printf(" -pw ********"); /* Do not show the password text */ | |
| 144 | + fossil_print(" -pw ********"); /* Do not show the password text */ | |
| 145 | 145 | } |
| 146 | 146 | #endif |
| 147 | 147 | }else{ |
| 148 | 148 | zHost = mprintf("%s", g.urlName); |
| 149 | 149 | } |
| 150 | 150 | blob_append(&zCmd, " ", 1); |
| 151 | 151 | shell_escape(&zCmd, zHost); |
| 152 | - printf(" %s\n", zHost); /* Show the conclusion of the SSH command */ | |
| 152 | + fossil_print(" %s\n", zHost); /* Show the conclusion of the SSH command */ | |
| 153 | 153 | free(zHost); |
| 154 | 154 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 155 | 155 | if( sshPid==0 ){ |
| 156 | 156 | fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd); |
| 157 | 157 | } |
| 158 | 158 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -120,11 +120,11 @@ | |
| 120 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 121 | #else |
| 122 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 123 | #endif |
| 124 | } |
| 125 | printf("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ |
| 126 | if( g.urlUser && g.urlUser[0] ){ |
| 127 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 128 | #ifdef __MINGW32__ |
| 129 | /* Only win32 (and specifically PLINK.EXE) support the -pw option */ |
| 130 | if( g.urlPasswd && g.urlPasswd[0] ){ |
| @@ -139,19 +139,19 @@ | |
| 139 | blob_init(&pw, g.urlPasswd, -1); |
| 140 | } |
| 141 | blob_append(&zCmd, " -pw ", -1); |
| 142 | shell_escape(&zCmd, blob_str(&pw)); |
| 143 | blob_reset(&pw); |
| 144 | printf(" -pw ********"); /* Do not show the password text */ |
| 145 | } |
| 146 | #endif |
| 147 | }else{ |
| 148 | zHost = mprintf("%s", g.urlName); |
| 149 | } |
| 150 | blob_append(&zCmd, " ", 1); |
| 151 | shell_escape(&zCmd, zHost); |
| 152 | printf(" %s\n", zHost); /* Show the conclusion of the SSH command */ |
| 153 | free(zHost); |
| 154 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 155 | if( sshPid==0 ){ |
| 156 | fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd); |
| 157 | } |
| 158 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -120,11 +120,11 @@ | |
| 120 | blob_appendf(&zCmd, " -P %d", g.urlPort); |
| 121 | #else |
| 122 | blob_appendf(&zCmd, " -p %d", g.urlPort); |
| 123 | #endif |
| 124 | } |
| 125 | fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ |
| 126 | if( g.urlUser && g.urlUser[0] ){ |
| 127 | zHost = mprintf("%s@%s", g.urlUser, g.urlName); |
| 128 | #ifdef __MINGW32__ |
| 129 | /* Only win32 (and specifically PLINK.EXE) support the -pw option */ |
| 130 | if( g.urlPasswd && g.urlPasswd[0] ){ |
| @@ -139,19 +139,19 @@ | |
| 139 | blob_init(&pw, g.urlPasswd, -1); |
| 140 | } |
| 141 | blob_append(&zCmd, " -pw ", -1); |
| 142 | shell_escape(&zCmd, blob_str(&pw)); |
| 143 | blob_reset(&pw); |
| 144 | fossil_print(" -pw ********"); /* Do not show the password text */ |
| 145 | } |
| 146 | #endif |
| 147 | }else{ |
| 148 | zHost = mprintf("%s", g.urlName); |
| 149 | } |
| 150 | blob_append(&zCmd, " ", 1); |
| 151 | shell_escape(&zCmd, zHost); |
| 152 | fossil_print(" %s\n", zHost); /* Show the conclusion of the SSH command */ |
| 153 | free(zHost); |
| 154 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 155 | if( sshPid==0 ){ |
| 156 | fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd); |
| 157 | } |
| 158 |
+7
-7
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -497,11 +497,11 @@ | ||
| 497 | 497 | gg.xFinish(); |
| 498 | 498 | }else |
| 499 | 499 | if( memcmp(zLine, "progress ", 9)==0 ){ |
| 500 | 500 | gg.xFinish(); |
| 501 | 501 | trim_newline(&zLine[9]); |
| 502 | - printf("%s\n", &zLine[9]); | |
| 502 | + fossil_print("%s\n", &zLine[9]); | |
| 503 | 503 | fflush(stdout); |
| 504 | 504 | }else |
| 505 | 505 | if( memcmp(zLine, "data ", 5)==0 ){ |
| 506 | 506 | fossil_free(gg.aData); gg.aData = 0; |
| 507 | 507 | gg.nData = atoi(&zLine[5]); |
| @@ -742,19 +742,19 @@ | ||
| 742 | 742 | import_reset(0); |
| 743 | 743 | } |
| 744 | 744 | db_finalize(&q); |
| 745 | 745 | db_end_transaction(0); |
| 746 | 746 | db_begin_transaction(); |
| 747 | - printf("Rebuilding repository meta-data...\n"); | |
| 747 | + fossil_print("Rebuilding repository meta-data...\n"); | |
| 748 | 748 | rebuild_db(0, 1, !incrFlag); |
| 749 | 749 | verify_cancel(); |
| 750 | 750 | db_end_transaction(0); |
| 751 | - printf("Vacuuming..."); fflush(stdout); | |
| 751 | + fossil_print("Vacuuming..."); fflush(stdout); | |
| 752 | 752 | db_multi_exec("VACUUM"); |
| 753 | - printf(" ok\n"); | |
| 753 | + fossil_print(" ok\n"); | |
| 754 | 754 | if( !incrFlag ){ |
| 755 | - printf("project-id: %s\n", db_get("project-code", 0)); | |
| 756 | - printf("server-id: %s\n", db_get("server-code", 0)); | |
| 755 | + fossil_print("project-id: %s\n", db_get("project-code", 0)); | |
| 756 | + fossil_print("server-id: %s\n", db_get("server-code", 0)); | |
| 757 | 757 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 758 | - printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); | |
| 758 | + fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); | |
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -497,11 +497,11 @@ | |
| 497 | gg.xFinish(); |
| 498 | }else |
| 499 | if( memcmp(zLine, "progress ", 9)==0 ){ |
| 500 | gg.xFinish(); |
| 501 | trim_newline(&zLine[9]); |
| 502 | printf("%s\n", &zLine[9]); |
| 503 | fflush(stdout); |
| 504 | }else |
| 505 | if( memcmp(zLine, "data ", 5)==0 ){ |
| 506 | fossil_free(gg.aData); gg.aData = 0; |
| 507 | gg.nData = atoi(&zLine[5]); |
| @@ -742,19 +742,19 @@ | |
| 742 | import_reset(0); |
| 743 | } |
| 744 | db_finalize(&q); |
| 745 | db_end_transaction(0); |
| 746 | db_begin_transaction(); |
| 747 | printf("Rebuilding repository meta-data...\n"); |
| 748 | rebuild_db(0, 1, !incrFlag); |
| 749 | verify_cancel(); |
| 750 | db_end_transaction(0); |
| 751 | printf("Vacuuming..."); fflush(stdout); |
| 752 | db_multi_exec("VACUUM"); |
| 753 | printf(" ok\n"); |
| 754 | if( !incrFlag ){ |
| 755 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 756 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 757 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 758 | printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 759 | } |
| 760 | } |
| 761 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -497,11 +497,11 @@ | |
| 497 | gg.xFinish(); |
| 498 | }else |
| 499 | if( memcmp(zLine, "progress ", 9)==0 ){ |
| 500 | gg.xFinish(); |
| 501 | trim_newline(&zLine[9]); |
| 502 | fossil_print("%s\n", &zLine[9]); |
| 503 | fflush(stdout); |
| 504 | }else |
| 505 | if( memcmp(zLine, "data ", 5)==0 ){ |
| 506 | fossil_free(gg.aData); gg.aData = 0; |
| 507 | gg.nData = atoi(&zLine[5]); |
| @@ -742,19 +742,19 @@ | |
| 742 | import_reset(0); |
| 743 | } |
| 744 | db_finalize(&q); |
| 745 | db_end_transaction(0); |
| 746 | db_begin_transaction(); |
| 747 | fossil_print("Rebuilding repository meta-data...\n"); |
| 748 | rebuild_db(0, 1, !incrFlag); |
| 749 | verify_cancel(); |
| 750 | db_end_transaction(0); |
| 751 | fossil_print("Vacuuming..."); fflush(stdout); |
| 752 | db_multi_exec("VACUUM"); |
| 753 | fossil_print(" ok\n"); |
| 754 | if( !incrFlag ){ |
| 755 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 756 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 757 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 758 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 759 | } |
| 760 | } |
| 761 |
+15
-15
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -67,11 +67,11 @@ | ||
| 67 | 67 | zDate = db_text(0, |
| 68 | 68 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 69 | 69 | rid |
| 70 | 70 | ); |
| 71 | 71 | /* 01234567890123 */ |
| 72 | - printf("%-13s %s %s\n", zUuidName, zUuid, zDate ? zDate : ""); | |
| 72 | + fossil_print("%-13s %s %s\n", zUuidName, zUuid, zDate ? zDate : ""); | |
| 73 | 73 | free(zUuid); |
| 74 | 74 | free(zDate); |
| 75 | 75 | } |
| 76 | 76 | if( zUuid && showComment ){ |
| 77 | 77 | zComment = db_text(0, |
| @@ -88,11 +88,11 @@ | ||
| 88 | 88 | const char *zUuid = db_column_text(&q, 0); |
| 89 | 89 | zDate = db_text("", |
| 90 | 90 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 91 | 91 | db_column_int(&q, 1) |
| 92 | 92 | ); |
| 93 | - printf("parent: %s %s\n", zUuid, zDate); | |
| 93 | + fossil_print("parent: %s %s\n", zUuid, zDate); | |
| 94 | 94 | free(zDate); |
| 95 | 95 | } |
| 96 | 96 | db_finalize(&q); |
| 97 | 97 | db_prepare(&q, "SELECT uuid, cid FROM plink JOIN blob ON cid=rid " |
| 98 | 98 | " WHERE pid=%d", rid); |
| @@ -100,22 +100,22 @@ | ||
| 100 | 100 | const char *zUuid = db_column_text(&q, 0); |
| 101 | 101 | zDate = db_text("", |
| 102 | 102 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 103 | 103 | db_column_int(&q, 1) |
| 104 | 104 | ); |
| 105 | - printf("child: %s %s\n", zUuid, zDate); | |
| 105 | + fossil_print("child: %s %s\n", zUuid, zDate); | |
| 106 | 106 | free(zDate); |
| 107 | 107 | } |
| 108 | 108 | db_finalize(&q); |
| 109 | 109 | } |
| 110 | 110 | zTags = info_tags_of_checkin(rid, 0); |
| 111 | 111 | if( zTags && zTags[0] ){ |
| 112 | - printf("tags: %s\n", zTags); | |
| 112 | + fossil_print("tags: %s\n", zTags); | |
| 113 | 113 | } |
| 114 | 114 | free(zTags); |
| 115 | 115 | if( zComment ){ |
| 116 | - printf("comment: "); | |
| 116 | + fossil_print("comment: "); | |
| 117 | 117 | comment_print(zComment, 14, 79); |
| 118 | 118 | free(zComment); |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| @@ -141,33 +141,33 @@ | ||
| 141 | 141 | } |
| 142 | 142 | if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){ |
| 143 | 143 | db_open_config(0); |
| 144 | 144 | db_record_repository_filename(g.argv[2]); |
| 145 | 145 | db_open_repository(g.argv[2]); |
| 146 | - printf("project-name: %s\n", db_get("project-name", "<unnamed>")); | |
| 147 | - printf("project-code: %s\n", db_get("project-code", "<none>")); | |
| 148 | - printf("server-code: %s\n", db_get("server-code", "<none>")); | |
| 146 | + fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); | |
| 147 | + fossil_print("project-code: %s\n", db_get("project-code", "<none>")); | |
| 148 | + fossil_print("server-code: %s\n", db_get("server-code", "<none>")); | |
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 151 | db_must_be_within_tree(); |
| 152 | 152 | if( g.argc==2 ){ |
| 153 | 153 | int vid; |
| 154 | 154 | /* 012345678901234 */ |
| 155 | 155 | db_record_repository_filename(0); |
| 156 | - printf("project-name: %s\n", db_get("project-name", "<unnamed>")); | |
| 157 | - printf("repository: %s\n", db_lget("repository", "")); | |
| 158 | - printf("local-root: %s\n", g.zLocalRoot); | |
| 156 | + fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); | |
| 157 | + fossil_print("repository: %s\n", db_lget("repository", "")); | |
| 158 | + fossil_print("local-root: %s\n", g.zLocalRoot); | |
| 159 | 159 | #if defined(_WIN32) |
| 160 | 160 | if( g.zHome ){ |
| 161 | - printf("user-home: %s\n", g.zHome); | |
| 161 | + fossil_print("user-home: %s\n", g.zHome); | |
| 162 | 162 | } |
| 163 | 163 | #endif |
| 164 | - printf("project-code: %s\n", db_get("project-code", "")); | |
| 165 | - printf("server-code: %s\n", db_get("server-code", "")); | |
| 164 | + fossil_print("project-code: %s\n", db_get("project-code", "")); | |
| 165 | + fossil_print("server-code: %s\n", db_get("server-code", "")); | |
| 166 | 166 | vid = db_lget_int("checkout", 0); |
| 167 | 167 | if( vid==0 ){ |
| 168 | - printf("checkout: nil\n"); | |
| 168 | + fossil_print("checkout: nil\n"); | |
| 169 | 169 | }else{ |
| 170 | 170 | show_common_info(vid, "checkout:", 1, 1); |
| 171 | 171 | } |
| 172 | 172 | }else{ |
| 173 | 173 | int rid; |
| 174 | 174 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -67,11 +67,11 @@ | |
| 67 | zDate = db_text(0, |
| 68 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 69 | rid |
| 70 | ); |
| 71 | /* 01234567890123 */ |
| 72 | printf("%-13s %s %s\n", zUuidName, zUuid, zDate ? zDate : ""); |
| 73 | free(zUuid); |
| 74 | free(zDate); |
| 75 | } |
| 76 | if( zUuid && showComment ){ |
| 77 | zComment = db_text(0, |
| @@ -88,11 +88,11 @@ | |
| 88 | const char *zUuid = db_column_text(&q, 0); |
| 89 | zDate = db_text("", |
| 90 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 91 | db_column_int(&q, 1) |
| 92 | ); |
| 93 | printf("parent: %s %s\n", zUuid, zDate); |
| 94 | free(zDate); |
| 95 | } |
| 96 | db_finalize(&q); |
| 97 | db_prepare(&q, "SELECT uuid, cid FROM plink JOIN blob ON cid=rid " |
| 98 | " WHERE pid=%d", rid); |
| @@ -100,22 +100,22 @@ | |
| 100 | const char *zUuid = db_column_text(&q, 0); |
| 101 | zDate = db_text("", |
| 102 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 103 | db_column_int(&q, 1) |
| 104 | ); |
| 105 | printf("child: %s %s\n", zUuid, zDate); |
| 106 | free(zDate); |
| 107 | } |
| 108 | db_finalize(&q); |
| 109 | } |
| 110 | zTags = info_tags_of_checkin(rid, 0); |
| 111 | if( zTags && zTags[0] ){ |
| 112 | printf("tags: %s\n", zTags); |
| 113 | } |
| 114 | free(zTags); |
| 115 | if( zComment ){ |
| 116 | printf("comment: "); |
| 117 | comment_print(zComment, 14, 79); |
| 118 | free(zComment); |
| 119 | } |
| 120 | } |
| 121 | |
| @@ -141,33 +141,33 @@ | |
| 141 | } |
| 142 | if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){ |
| 143 | db_open_config(0); |
| 144 | db_record_repository_filename(g.argv[2]); |
| 145 | db_open_repository(g.argv[2]); |
| 146 | printf("project-name: %s\n", db_get("project-name", "<unnamed>")); |
| 147 | printf("project-code: %s\n", db_get("project-code", "<none>")); |
| 148 | printf("server-code: %s\n", db_get("server-code", "<none>")); |
| 149 | return; |
| 150 | } |
| 151 | db_must_be_within_tree(); |
| 152 | if( g.argc==2 ){ |
| 153 | int vid; |
| 154 | /* 012345678901234 */ |
| 155 | db_record_repository_filename(0); |
| 156 | printf("project-name: %s\n", db_get("project-name", "<unnamed>")); |
| 157 | printf("repository: %s\n", db_lget("repository", "")); |
| 158 | printf("local-root: %s\n", g.zLocalRoot); |
| 159 | #if defined(_WIN32) |
| 160 | if( g.zHome ){ |
| 161 | printf("user-home: %s\n", g.zHome); |
| 162 | } |
| 163 | #endif |
| 164 | printf("project-code: %s\n", db_get("project-code", "")); |
| 165 | printf("server-code: %s\n", db_get("server-code", "")); |
| 166 | vid = db_lget_int("checkout", 0); |
| 167 | if( vid==0 ){ |
| 168 | printf("checkout: nil\n"); |
| 169 | }else{ |
| 170 | show_common_info(vid, "checkout:", 1, 1); |
| 171 | } |
| 172 | }else{ |
| 173 | int rid; |
| 174 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -67,11 +67,11 @@ | |
| 67 | zDate = db_text(0, |
| 68 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 69 | rid |
| 70 | ); |
| 71 | /* 01234567890123 */ |
| 72 | fossil_print("%-13s %s %s\n", zUuidName, zUuid, zDate ? zDate : ""); |
| 73 | free(zUuid); |
| 74 | free(zDate); |
| 75 | } |
| 76 | if( zUuid && showComment ){ |
| 77 | zComment = db_text(0, |
| @@ -88,11 +88,11 @@ | |
| 88 | const char *zUuid = db_column_text(&q, 0); |
| 89 | zDate = db_text("", |
| 90 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 91 | db_column_int(&q, 1) |
| 92 | ); |
| 93 | fossil_print("parent: %s %s\n", zUuid, zDate); |
| 94 | free(zDate); |
| 95 | } |
| 96 | db_finalize(&q); |
| 97 | db_prepare(&q, "SELECT uuid, cid FROM plink JOIN blob ON cid=rid " |
| 98 | " WHERE pid=%d", rid); |
| @@ -100,22 +100,22 @@ | |
| 100 | const char *zUuid = db_column_text(&q, 0); |
| 101 | zDate = db_text("", |
| 102 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 103 | db_column_int(&q, 1) |
| 104 | ); |
| 105 | fossil_print("child: %s %s\n", zUuid, zDate); |
| 106 | free(zDate); |
| 107 | } |
| 108 | db_finalize(&q); |
| 109 | } |
| 110 | zTags = info_tags_of_checkin(rid, 0); |
| 111 | if( zTags && zTags[0] ){ |
| 112 | fossil_print("tags: %s\n", zTags); |
| 113 | } |
| 114 | free(zTags); |
| 115 | if( zComment ){ |
| 116 | fossil_print("comment: "); |
| 117 | comment_print(zComment, 14, 79); |
| 118 | free(zComment); |
| 119 | } |
| 120 | } |
| 121 | |
| @@ -141,33 +141,33 @@ | |
| 141 | } |
| 142 | if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){ |
| 143 | db_open_config(0); |
| 144 | db_record_repository_filename(g.argv[2]); |
| 145 | db_open_repository(g.argv[2]); |
| 146 | fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); |
| 147 | fossil_print("project-code: %s\n", db_get("project-code", "<none>")); |
| 148 | fossil_print("server-code: %s\n", db_get("server-code", "<none>")); |
| 149 | return; |
| 150 | } |
| 151 | db_must_be_within_tree(); |
| 152 | if( g.argc==2 ){ |
| 153 | int vid; |
| 154 | /* 012345678901234 */ |
| 155 | db_record_repository_filename(0); |
| 156 | fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); |
| 157 | fossil_print("repository: %s\n", db_lget("repository", "")); |
| 158 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 159 | #if defined(_WIN32) |
| 160 | if( g.zHome ){ |
| 161 | fossil_print("user-home: %s\n", g.zHome); |
| 162 | } |
| 163 | #endif |
| 164 | fossil_print("project-code: %s\n", db_get("project-code", "")); |
| 165 | fossil_print("server-code: %s\n", db_get("server-code", "")); |
| 166 | vid = db_lget_int("checkout", 0); |
| 167 | if( vid==0 ){ |
| 168 | fossil_print("checkout: nil\n"); |
| 169 | }else{ |
| 170 | show_common_info(vid, "checkout:", 1, 1); |
| 171 | } |
| 172 | }else{ |
| 173 | int rid; |
| 174 |
+37
-26
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -232,18 +232,26 @@ | ||
| 232 | 232 | |
| 233 | 233 | sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0); |
| 234 | 234 | g.now = time(0); |
| 235 | 235 | g.argc = argc; |
| 236 | 236 | g.argv = argv; |
| 237 | +#if defined(_WIN32) | |
| 238 | + { | |
| 239 | + int i; | |
| 240 | + extern char *sqlite3_win32_mbcs_to_utf8(const char*); | |
| 241 | + for(i=0; i<argc; i++){ | |
| 242 | + g.argv[i] = sqlite3_win32_mbcs_to_utf8(argv[i]); | |
| 243 | + } | |
| 244 | + } | |
| 245 | +#endif | |
| 237 | 246 | if( getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){ |
| 238 | 247 | zCmdName = "cgi"; |
| 239 | 248 | }else if( argc<2 ){ |
| 240 | - fprintf(stderr, "Usage: %s COMMAND ...\n" | |
| 241 | - "\"%s help\" for a list of available commands\n" | |
| 242 | - "\"%s help COMMAND\" for specific details\n", | |
| 243 | - argv[0], argv[0], argv[0]); | |
| 244 | - fossil_exit(1); | |
| 249 | + fossil_fatal("Usage: %s COMMAND ...\n" | |
| 250 | + "\"%s help\" for a list of available commands\n" | |
| 251 | + "\"%s help COMMAND\" for specific details\n", | |
| 252 | + argv[0], argv[0], argv[0]); | |
| 245 | 253 | }else{ |
| 246 | 254 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 247 | 255 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 248 | 256 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 249 | 257 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| @@ -264,14 +272,13 @@ | ||
| 264 | 272 | } |
| 265 | 273 | zCmdName = g.argv[1]; |
| 266 | 274 | } |
| 267 | 275 | rc = name_search(zCmdName, aCommand, count(aCommand), &idx); |
| 268 | 276 | if( rc==1 ){ |
| 269 | - fprintf(stderr,"%s: unknown command: %s\n" | |
| 270 | - "%s: use \"help\" for more information\n", | |
| 277 | + fossil_fatal("%s: unknown command: %s\n" | |
| 278 | + "%s: use \"help\" for more information\n", | |
| 271 | 279 | argv[0], zCmdName, argv[0]); |
| 272 | - fossil_exit(1); | |
| 273 | 280 | }else if( rc==2 ){ |
| 274 | 281 | int i, n; |
| 275 | 282 | Blob couldbe; |
| 276 | 283 | blob_zero(&couldbe); |
| 277 | 284 | n = strlen(zCmdName); |
| @@ -278,15 +285,14 @@ | ||
| 278 | 285 | for(i=0; i<count(aCommand); i++){ |
| 279 | 286 | if( memcmp(zCmdName, aCommand[i].zName, n)==0 ){ |
| 280 | 287 | blob_appendf(&couldbe, " %s", aCommand[i].zName); |
| 281 | 288 | } |
| 282 | 289 | } |
| 283 | - fprintf(stderr,"%s: ambiguous command prefix: %s\n" | |
| 284 | - "%s: could be any of:%s\n" | |
| 285 | - "%s: use \"help\" for more information\n", | |
| 286 | - argv[0], zCmdName, argv[0], blob_str(&couldbe), argv[0]); | |
| 287 | - fossil_exit(1); | |
| 290 | + fossil_fatal("%s: ambiguous command prefix: %s\n" | |
| 291 | + "%s: could be any of:%s\n" | |
| 292 | + "%s: use \"help\" for more information\n", | |
| 293 | + argv[0], zCmdName, argv[0], blob_str(&couldbe), argv[0]); | |
| 288 | 294 | } |
| 289 | 295 | aCommand[idx].xFunc(); |
| 290 | 296 | fossil_exit(0); |
| 291 | 297 | /*NOT_REACHED*/ |
| 292 | 298 | return 0; |
| @@ -333,11 +339,12 @@ | ||
| 333 | 339 | if( g.cgiOutput && once ){ |
| 334 | 340 | once = 0; |
| 335 | 341 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 336 | 342 | cgi_reply(); |
| 337 | 343 | }else{ |
| 338 | - fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z); | |
| 344 | + char *zOut = mprintf("%s: %s\n", fossil_nameofexe(), z); | |
| 345 | + fossil_puts(zOut, 1); | |
| 339 | 346 | } |
| 340 | 347 | db_force_rollback(); |
| 341 | 348 | fossil_exit(1); |
| 342 | 349 | } |
| 343 | 350 | void fossil_fatal(const char *zFormat, ...){ |
| @@ -350,11 +357,12 @@ | ||
| 350 | 357 | if( g.cgiOutput ){ |
| 351 | 358 | g.cgiOutput = 0; |
| 352 | 359 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 353 | 360 | cgi_reply(); |
| 354 | 361 | }else{ |
| 355 | - fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); | |
| 362 | + char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); | |
| 363 | + fossil_puts(zOut, 1); | |
| 356 | 364 | } |
| 357 | 365 | db_force_rollback(); |
| 358 | 366 | fossil_exit(1); |
| 359 | 367 | } |
| 360 | 368 | |
| @@ -378,11 +386,12 @@ | ||
| 378 | 386 | if( g.cgiOutput ){ |
| 379 | 387 | g.cgiOutput = 0; |
| 380 | 388 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 381 | 389 | cgi_reply(); |
| 382 | 390 | }else{ |
| 383 | - fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); | |
| 391 | + char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); | |
| 392 | + fossil_puts(zOut, 1); | |
| 384 | 393 | } |
| 385 | 394 | db_force_rollback(); |
| 386 | 395 | fossil_exit(1); |
| 387 | 396 | } |
| 388 | 397 | |
| @@ -395,11 +404,13 @@ | ||
| 395 | 404 | z = vmprintf(zFormat, ap); |
| 396 | 405 | va_end(ap); |
| 397 | 406 | if( g.cgiOutput ){ |
| 398 | 407 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 399 | 408 | }else{ |
| 400 | - fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); | |
| 409 | + char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); | |
| 410 | + fossil_puts(zOut, 1); | |
| 411 | + free(zOut); | |
| 401 | 412 | } |
| 402 | 413 | } |
| 403 | 414 | |
| 404 | 415 | /* |
| 405 | 416 | ** Malloc and free routines that cannot fail |
| @@ -507,12 +518,11 @@ | ||
| 507 | 518 | |
| 508 | 519 | /* |
| 509 | 520 | ** Print a usage comment and quit |
| 510 | 521 | */ |
| 511 | 522 | void usage(const char *zFormat){ |
| 512 | - fprintf(stderr, "Usage: %s %s %s\n", fossil_nameofexe(), g.argv[1], zFormat); | |
| 513 | - fossil_exit(1); | |
| 523 | + fossil_fatal("Usage: %s %s %s\n", fossil_nameofexe(), g.argv[1], zFormat); | |
| 514 | 524 | } |
| 515 | 525 | |
| 516 | 526 | /* |
| 517 | 527 | ** Remove n elements from g.argv beginning with the i-th element. |
| 518 | 528 | */ |
| @@ -601,14 +611,14 @@ | ||
| 601 | 611 | if( nCol==0 ) nCol = 1; |
| 602 | 612 | nRow = (nWord + nCol - 1)/nCol; |
| 603 | 613 | for(i=0; i<nRow; i++){ |
| 604 | 614 | const char *zSpacer = ""; |
| 605 | 615 | for(j=i; j<nWord; j+=nRow){ |
| 606 | - printf("%s%-*s", zSpacer, mxLen, azWord[j]); | |
| 616 | + fossil_print("%s%-*s", zSpacer, mxLen, azWord[j]); | |
| 607 | 617 | zSpacer = " "; |
| 608 | 618 | } |
| 609 | - printf("\n"); | |
| 619 | + fossil_print("\n"); | |
| 610 | 620 | } |
| 611 | 621 | } |
| 612 | 622 | |
| 613 | 623 | /* |
| 614 | 624 | ** List of commands starting with zPrefix, or all commands if zPrefix is NULL. |
| @@ -650,11 +660,12 @@ | ||
| 650 | 660 | ** Usage: %fossil version |
| 651 | 661 | ** |
| 652 | 662 | ** Print the source code version number for the fossil executable. |
| 653 | 663 | */ |
| 654 | 664 | void version_cmd(void){ |
| 655 | - printf("This is fossil version " MANIFEST_VERSION " " MANIFEST_DATE " UTC\n"); | |
| 665 | + fossil_print("This is fossil version " | |
| 666 | + MANIFEST_VERSION " " MANIFEST_DATE " UTC\n"); | |
| 656 | 667 | } |
| 657 | 668 | |
| 658 | 669 | |
| 659 | 670 | /* |
| 660 | 671 | ** COMMAND: help |
| @@ -665,12 +676,12 @@ | ||
| 665 | 676 | */ |
| 666 | 677 | void help_cmd(void){ |
| 667 | 678 | int rc, idx; |
| 668 | 679 | const char *z; |
| 669 | 680 | if( g.argc<3 ){ |
| 670 | - printf("Usage: %s help COMMAND.\nAvailable COMMANDs:\n", | |
| 671 | - fossil_nameofexe()); | |
| 681 | + fossil_print("Usage: %s help COMMAND.\nAvailable COMMANDs:\n", | |
| 682 | + fossil_nameofexe()); | |
| 672 | 683 | cmd_cmd_list(0); |
| 673 | 684 | version_cmd(); |
| 674 | 685 | return; |
| 675 | 686 | } |
| 676 | 687 | rc = name_search(g.argv[2], aCommand, count(aCommand), &idx); |
| @@ -689,11 +700,11 @@ | ||
| 689 | 700 | fossil_fatal("no help available for the %s command", |
| 690 | 701 | aCommand[idx].zName); |
| 691 | 702 | } |
| 692 | 703 | while( *z ){ |
| 693 | 704 | if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){ |
| 694 | - printf("%s", fossil_nameofexe()); | |
| 705 | + fossil_print("%s", fossil_nameofexe()); | |
| 695 | 706 | z += 7; |
| 696 | 707 | }else{ |
| 697 | 708 | putchar(*z); |
| 698 | 709 | z++; |
| 699 | 710 | } |
| @@ -1454,8 +1465,8 @@ | ||
| 1454 | 1465 | ** wildcard expansion behavior of the host shell can be investigated. |
| 1455 | 1466 | */ |
| 1456 | 1467 | void test_echo_cmd(void){ |
| 1457 | 1468 | int i; |
| 1458 | 1469 | for(i=0; i<g.argc; i++){ |
| 1459 | - printf("argv[%d] = [%s]\n", i, g.argv[i]); | |
| 1470 | + fossil_print("argv[%d] = [%s]\n", i, g.argv[i]); | |
| 1460 | 1471 | } |
| 1461 | 1472 | } |
| 1462 | 1473 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -232,18 +232,26 @@ | |
| 232 | |
| 233 | sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0); |
| 234 | g.now = time(0); |
| 235 | g.argc = argc; |
| 236 | g.argv = argv; |
| 237 | if( getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){ |
| 238 | zCmdName = "cgi"; |
| 239 | }else if( argc<2 ){ |
| 240 | fprintf(stderr, "Usage: %s COMMAND ...\n" |
| 241 | "\"%s help\" for a list of available commands\n" |
| 242 | "\"%s help COMMAND\" for specific details\n", |
| 243 | argv[0], argv[0], argv[0]); |
| 244 | fossil_exit(1); |
| 245 | }else{ |
| 246 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 247 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 248 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 249 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| @@ -264,14 +272,13 @@ | |
| 264 | } |
| 265 | zCmdName = g.argv[1]; |
| 266 | } |
| 267 | rc = name_search(zCmdName, aCommand, count(aCommand), &idx); |
| 268 | if( rc==1 ){ |
| 269 | fprintf(stderr,"%s: unknown command: %s\n" |
| 270 | "%s: use \"help\" for more information\n", |
| 271 | argv[0], zCmdName, argv[0]); |
| 272 | fossil_exit(1); |
| 273 | }else if( rc==2 ){ |
| 274 | int i, n; |
| 275 | Blob couldbe; |
| 276 | blob_zero(&couldbe); |
| 277 | n = strlen(zCmdName); |
| @@ -278,15 +285,14 @@ | |
| 278 | for(i=0; i<count(aCommand); i++){ |
| 279 | if( memcmp(zCmdName, aCommand[i].zName, n)==0 ){ |
| 280 | blob_appendf(&couldbe, " %s", aCommand[i].zName); |
| 281 | } |
| 282 | } |
| 283 | fprintf(stderr,"%s: ambiguous command prefix: %s\n" |
| 284 | "%s: could be any of:%s\n" |
| 285 | "%s: use \"help\" for more information\n", |
| 286 | argv[0], zCmdName, argv[0], blob_str(&couldbe), argv[0]); |
| 287 | fossil_exit(1); |
| 288 | } |
| 289 | aCommand[idx].xFunc(); |
| 290 | fossil_exit(0); |
| 291 | /*NOT_REACHED*/ |
| 292 | return 0; |
| @@ -333,11 +339,12 @@ | |
| 333 | if( g.cgiOutput && once ){ |
| 334 | once = 0; |
| 335 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 336 | cgi_reply(); |
| 337 | }else{ |
| 338 | fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z); |
| 339 | } |
| 340 | db_force_rollback(); |
| 341 | fossil_exit(1); |
| 342 | } |
| 343 | void fossil_fatal(const char *zFormat, ...){ |
| @@ -350,11 +357,12 @@ | |
| 350 | if( g.cgiOutput ){ |
| 351 | g.cgiOutput = 0; |
| 352 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 353 | cgi_reply(); |
| 354 | }else{ |
| 355 | fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); |
| 356 | } |
| 357 | db_force_rollback(); |
| 358 | fossil_exit(1); |
| 359 | } |
| 360 | |
| @@ -378,11 +386,12 @@ | |
| 378 | if( g.cgiOutput ){ |
| 379 | g.cgiOutput = 0; |
| 380 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 381 | cgi_reply(); |
| 382 | }else{ |
| 383 | fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); |
| 384 | } |
| 385 | db_force_rollback(); |
| 386 | fossil_exit(1); |
| 387 | } |
| 388 | |
| @@ -395,11 +404,13 @@ | |
| 395 | z = vmprintf(zFormat, ap); |
| 396 | va_end(ap); |
| 397 | if( g.cgiOutput ){ |
| 398 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 399 | }else{ |
| 400 | fprintf(stderr, "\r%s: %s\n", fossil_nameofexe(), z); |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | /* |
| 405 | ** Malloc and free routines that cannot fail |
| @@ -507,12 +518,11 @@ | |
| 507 | |
| 508 | /* |
| 509 | ** Print a usage comment and quit |
| 510 | */ |
| 511 | void usage(const char *zFormat){ |
| 512 | fprintf(stderr, "Usage: %s %s %s\n", fossil_nameofexe(), g.argv[1], zFormat); |
| 513 | fossil_exit(1); |
| 514 | } |
| 515 | |
| 516 | /* |
| 517 | ** Remove n elements from g.argv beginning with the i-th element. |
| 518 | */ |
| @@ -601,14 +611,14 @@ | |
| 601 | if( nCol==0 ) nCol = 1; |
| 602 | nRow = (nWord + nCol - 1)/nCol; |
| 603 | for(i=0; i<nRow; i++){ |
| 604 | const char *zSpacer = ""; |
| 605 | for(j=i; j<nWord; j+=nRow){ |
| 606 | printf("%s%-*s", zSpacer, mxLen, azWord[j]); |
| 607 | zSpacer = " "; |
| 608 | } |
| 609 | printf("\n"); |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | /* |
| 614 | ** List of commands starting with zPrefix, or all commands if zPrefix is NULL. |
| @@ -650,11 +660,12 @@ | |
| 650 | ** Usage: %fossil version |
| 651 | ** |
| 652 | ** Print the source code version number for the fossil executable. |
| 653 | */ |
| 654 | void version_cmd(void){ |
| 655 | printf("This is fossil version " MANIFEST_VERSION " " MANIFEST_DATE " UTC\n"); |
| 656 | } |
| 657 | |
| 658 | |
| 659 | /* |
| 660 | ** COMMAND: help |
| @@ -665,12 +676,12 @@ | |
| 665 | */ |
| 666 | void help_cmd(void){ |
| 667 | int rc, idx; |
| 668 | const char *z; |
| 669 | if( g.argc<3 ){ |
| 670 | printf("Usage: %s help COMMAND.\nAvailable COMMANDs:\n", |
| 671 | fossil_nameofexe()); |
| 672 | cmd_cmd_list(0); |
| 673 | version_cmd(); |
| 674 | return; |
| 675 | } |
| 676 | rc = name_search(g.argv[2], aCommand, count(aCommand), &idx); |
| @@ -689,11 +700,11 @@ | |
| 689 | fossil_fatal("no help available for the %s command", |
| 690 | aCommand[idx].zName); |
| 691 | } |
| 692 | while( *z ){ |
| 693 | if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){ |
| 694 | printf("%s", fossil_nameofexe()); |
| 695 | z += 7; |
| 696 | }else{ |
| 697 | putchar(*z); |
| 698 | z++; |
| 699 | } |
| @@ -1454,8 +1465,8 @@ | |
| 1454 | ** wildcard expansion behavior of the host shell can be investigated. |
| 1455 | */ |
| 1456 | void test_echo_cmd(void){ |
| 1457 | int i; |
| 1458 | for(i=0; i<g.argc; i++){ |
| 1459 | printf("argv[%d] = [%s]\n", i, g.argv[i]); |
| 1460 | } |
| 1461 | } |
| 1462 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -232,18 +232,26 @@ | |
| 232 | |
| 233 | sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0); |
| 234 | g.now = time(0); |
| 235 | g.argc = argc; |
| 236 | g.argv = argv; |
| 237 | #if defined(_WIN32) |
| 238 | { |
| 239 | int i; |
| 240 | extern char *sqlite3_win32_mbcs_to_utf8(const char*); |
| 241 | for(i=0; i<argc; i++){ |
| 242 | g.argv[i] = sqlite3_win32_mbcs_to_utf8(argv[i]); |
| 243 | } |
| 244 | } |
| 245 | #endif |
| 246 | if( getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){ |
| 247 | zCmdName = "cgi"; |
| 248 | }else if( argc<2 ){ |
| 249 | fossil_fatal("Usage: %s COMMAND ...\n" |
| 250 | "\"%s help\" for a list of available commands\n" |
| 251 | "\"%s help COMMAND\" for specific details\n", |
| 252 | argv[0], argv[0], argv[0]); |
| 253 | }else{ |
| 254 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 255 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 256 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 257 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| @@ -264,14 +272,13 @@ | |
| 272 | } |
| 273 | zCmdName = g.argv[1]; |
| 274 | } |
| 275 | rc = name_search(zCmdName, aCommand, count(aCommand), &idx); |
| 276 | if( rc==1 ){ |
| 277 | fossil_fatal("%s: unknown command: %s\n" |
| 278 | "%s: use \"help\" for more information\n", |
| 279 | argv[0], zCmdName, argv[0]); |
| 280 | }else if( rc==2 ){ |
| 281 | int i, n; |
| 282 | Blob couldbe; |
| 283 | blob_zero(&couldbe); |
| 284 | n = strlen(zCmdName); |
| @@ -278,15 +285,14 @@ | |
| 285 | for(i=0; i<count(aCommand); i++){ |
| 286 | if( memcmp(zCmdName, aCommand[i].zName, n)==0 ){ |
| 287 | blob_appendf(&couldbe, " %s", aCommand[i].zName); |
| 288 | } |
| 289 | } |
| 290 | fossil_fatal("%s: ambiguous command prefix: %s\n" |
| 291 | "%s: could be any of:%s\n" |
| 292 | "%s: use \"help\" for more information\n", |
| 293 | argv[0], zCmdName, argv[0], blob_str(&couldbe), argv[0]); |
| 294 | } |
| 295 | aCommand[idx].xFunc(); |
| 296 | fossil_exit(0); |
| 297 | /*NOT_REACHED*/ |
| 298 | return 0; |
| @@ -333,11 +339,12 @@ | |
| 339 | if( g.cgiOutput && once ){ |
| 340 | once = 0; |
| 341 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 342 | cgi_reply(); |
| 343 | }else{ |
| 344 | char *zOut = mprintf("%s: %s\n", fossil_nameofexe(), z); |
| 345 | fossil_puts(zOut, 1); |
| 346 | } |
| 347 | db_force_rollback(); |
| 348 | fossil_exit(1); |
| 349 | } |
| 350 | void fossil_fatal(const char *zFormat, ...){ |
| @@ -350,11 +357,12 @@ | |
| 357 | if( g.cgiOutput ){ |
| 358 | g.cgiOutput = 0; |
| 359 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 360 | cgi_reply(); |
| 361 | }else{ |
| 362 | char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); |
| 363 | fossil_puts(zOut, 1); |
| 364 | } |
| 365 | db_force_rollback(); |
| 366 | fossil_exit(1); |
| 367 | } |
| 368 | |
| @@ -378,11 +386,12 @@ | |
| 386 | if( g.cgiOutput ){ |
| 387 | g.cgiOutput = 0; |
| 388 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 389 | cgi_reply(); |
| 390 | }else{ |
| 391 | char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); |
| 392 | fossil_puts(zOut, 1); |
| 393 | } |
| 394 | db_force_rollback(); |
| 395 | fossil_exit(1); |
| 396 | } |
| 397 | |
| @@ -395,11 +404,13 @@ | |
| 404 | z = vmprintf(zFormat, ap); |
| 405 | va_end(ap); |
| 406 | if( g.cgiOutput ){ |
| 407 | cgi_printf("<p class=\"generalError\">%h</p>", z); |
| 408 | }else{ |
| 409 | char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); |
| 410 | fossil_puts(zOut, 1); |
| 411 | free(zOut); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | /* |
| 416 | ** Malloc and free routines that cannot fail |
| @@ -507,12 +518,11 @@ | |
| 518 | |
| 519 | /* |
| 520 | ** Print a usage comment and quit |
| 521 | */ |
| 522 | void usage(const char *zFormat){ |
| 523 | fossil_fatal("Usage: %s %s %s\n", fossil_nameofexe(), g.argv[1], zFormat); |
| 524 | } |
| 525 | |
| 526 | /* |
| 527 | ** Remove n elements from g.argv beginning with the i-th element. |
| 528 | */ |
| @@ -601,14 +611,14 @@ | |
| 611 | if( nCol==0 ) nCol = 1; |
| 612 | nRow = (nWord + nCol - 1)/nCol; |
| 613 | for(i=0; i<nRow; i++){ |
| 614 | const char *zSpacer = ""; |
| 615 | for(j=i; j<nWord; j+=nRow){ |
| 616 | fossil_print("%s%-*s", zSpacer, mxLen, azWord[j]); |
| 617 | zSpacer = " "; |
| 618 | } |
| 619 | fossil_print("\n"); |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | /* |
| 624 | ** List of commands starting with zPrefix, or all commands if zPrefix is NULL. |
| @@ -650,11 +660,12 @@ | |
| 660 | ** Usage: %fossil version |
| 661 | ** |
| 662 | ** Print the source code version number for the fossil executable. |
| 663 | */ |
| 664 | void version_cmd(void){ |
| 665 | fossil_print("This is fossil version " |
| 666 | MANIFEST_VERSION " " MANIFEST_DATE " UTC\n"); |
| 667 | } |
| 668 | |
| 669 | |
| 670 | /* |
| 671 | ** COMMAND: help |
| @@ -665,12 +676,12 @@ | |
| 676 | */ |
| 677 | void help_cmd(void){ |
| 678 | int rc, idx; |
| 679 | const char *z; |
| 680 | if( g.argc<3 ){ |
| 681 | fossil_print("Usage: %s help COMMAND.\nAvailable COMMANDs:\n", |
| 682 | fossil_nameofexe()); |
| 683 | cmd_cmd_list(0); |
| 684 | version_cmd(); |
| 685 | return; |
| 686 | } |
| 687 | rc = name_search(g.argv[2], aCommand, count(aCommand), &idx); |
| @@ -689,11 +700,11 @@ | |
| 700 | fossil_fatal("no help available for the %s command", |
| 701 | aCommand[idx].zName); |
| 702 | } |
| 703 | while( *z ){ |
| 704 | if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){ |
| 705 | fossil_print("%s", fossil_nameofexe()); |
| 706 | z += 7; |
| 707 | }else{ |
| 708 | putchar(*z); |
| 709 | z++; |
| 710 | } |
| @@ -1454,8 +1465,8 @@ | |
| 1465 | ** wildcard expansion behavior of the host shell can be investigated. |
| 1466 | */ |
| 1467 | void test_echo_cmd(void){ |
| 1468 | int i; |
| 1469 | for(i=0; i<g.argc; i++){ |
| 1470 | fossil_print("argv[%d] = [%s]\n", i, g.argv[i]); |
| 1471 | } |
| 1472 | } |
| 1473 |
+1
-1
| --- src/md5.c | ||
| +++ src/md5.c | ||
| @@ -438,9 +438,9 @@ | ||
| 438 | 438 | blob_read_from_channel(&in, stdin, -1); |
| 439 | 439 | md5sum_blob(&in, &cksum); |
| 440 | 440 | }else{ |
| 441 | 441 | md5sum_file(g.argv[i], &cksum); |
| 442 | 442 | } |
| 443 | - printf("%s %s\n", blob_str(&cksum), g.argv[i]); | |
| 443 | + fossil_print("%s %s\n", blob_str(&cksum), g.argv[i]); | |
| 444 | 444 | blob_reset(&cksum); |
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 |
| --- src/md5.c | |
| +++ src/md5.c | |
| @@ -438,9 +438,9 @@ | |
| 438 | blob_read_from_channel(&in, stdin, -1); |
| 439 | md5sum_blob(&in, &cksum); |
| 440 | }else{ |
| 441 | md5sum_file(g.argv[i], &cksum); |
| 442 | } |
| 443 | printf("%s %s\n", blob_str(&cksum), g.argv[i]); |
| 444 | blob_reset(&cksum); |
| 445 | } |
| 446 | } |
| 447 |
| --- src/md5.c | |
| +++ src/md5.c | |
| @@ -438,9 +438,9 @@ | |
| 438 | blob_read_from_channel(&in, stdin, -1); |
| 439 | md5sum_blob(&in, &cksum); |
| 440 | }else{ |
| 441 | md5sum_file(g.argv[i], &cksum); |
| 442 | } |
| 443 | fossil_print("%s %s\n", blob_str(&cksum), g.argv[i]); |
| 444 | blob_reset(&cksum); |
| 445 | } |
| 446 | } |
| 447 |
+17
-15
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -249,20 +249,20 @@ | ||
| 249 | 249 | if( debugFlag ){ |
| 250 | 250 | db_prepare(&q, |
| 251 | 251 | "SELECT rowid, fn, fnp, fnm, chnged, ridv, ridp, ridm, isexe FROM fv" |
| 252 | 252 | ); |
| 253 | 253 | while( db_step(&q)==SQLITE_ROW ){ |
| 254 | - printf("%3d: ridv=%-4d ridp=%-4d ridm=%-4d chnged=%d isexe=%d\n", | |
| 254 | + fossil_print("%3d: ridv=%-4d ridp=%-4d ridm=%-4d chnged=%d isexe=%d\n", | |
| 255 | 255 | db_column_int(&q, 0), |
| 256 | 256 | db_column_int(&q, 5), |
| 257 | 257 | db_column_int(&q, 6), |
| 258 | 258 | db_column_int(&q, 7), |
| 259 | 259 | db_column_int(&q, 4), |
| 260 | 260 | db_column_int(&q, 8)); |
| 261 | - printf(" fn = [%s]\n", db_column_text(&q, 1)); | |
| 262 | - printf(" fnp = [%s]\n", db_column_text(&q, 2)); | |
| 263 | - printf(" fnm = [%s]\n", db_column_text(&q, 3)); | |
| 261 | + fossil_print(" fn = [%s]\n", db_column_text(&q, 1)); | |
| 262 | + fossil_print(" fnp = [%s]\n", db_column_text(&q, 2)); | |
| 263 | + fossil_print(" fnm = [%s]\n", db_column_text(&q, 3)); | |
| 264 | 264 | } |
| 265 | 265 | db_finalize(&q); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /* |
| @@ -274,11 +274,11 @@ | ||
| 274 | 274 | "SELECT idm FROM fv WHERE idp=0 AND idv>0 AND idm>0" |
| 275 | 275 | ); |
| 276 | 276 | while( db_step(&q)==SQLITE_ROW ){ |
| 277 | 277 | int idm = db_column_int(&q, 0); |
| 278 | 278 | char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idm); |
| 279 | - printf("WARNING - no common ancestor: %s\n", zName); | |
| 279 | + fossil_warning("WARNING - no common ancestor: %s\n", zName); | |
| 280 | 280 | free(zName); |
| 281 | 281 | db_multi_exec("UPDATE fv SET idm=0 WHERE idm=%d", idm); |
| 282 | 282 | } |
| 283 | 283 | db_finalize(&q); |
| 284 | 284 | |
| @@ -300,11 +300,11 @@ | ||
| 300 | 300 | vid, idm |
| 301 | 301 | ); |
| 302 | 302 | idv = db_last_insert_rowid(); |
| 303 | 303 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 304 | 304 | zName = db_column_text(&q, 2); |
| 305 | - printf("ADDED %s\n", zName); | |
| 305 | + fossil_print("ADDED %s\n", zName); | |
| 306 | 306 | if( !nochangeFlag ){ |
| 307 | 307 | undo_save(zName); |
| 308 | 308 | vfile_to_disk(0, idm, 0, 0); |
| 309 | 309 | } |
| 310 | 310 | } |
| @@ -322,11 +322,11 @@ | ||
| 322 | 322 | while( db_step(&q)==SQLITE_ROW ){ |
| 323 | 323 | int idv = db_column_int(&q, 0); |
| 324 | 324 | int ridm = db_column_int(&q, 1); |
| 325 | 325 | const char *zName = db_column_text(&q, 2); |
| 326 | 326 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 327 | - printf("UPDATE %s\n", zName); | |
| 327 | + fossil_print("UPDATE %s\n", zName); | |
| 328 | 328 | if( !nochangeFlag ){ |
| 329 | 329 | undo_save(zName); |
| 330 | 330 | db_multi_exec( |
| 331 | 331 | "UPDATE vfile SET mtime=0, mrid=%d, chnged=2 WHERE id=%d", ridm, idv |
| 332 | 332 | ); |
| @@ -355,13 +355,14 @@ | ||
| 355 | 355 | int rc; |
| 356 | 356 | char *zFullPath; |
| 357 | 357 | Blob m, p, r; |
| 358 | 358 | /* Do a 3-way merge of idp->idm into idp->idv. The results go into idv. */ |
| 359 | 359 | if( detailFlag ){ |
| 360 | - printf("MERGE %s (pivot=%d v1=%d v2=%d)\n", zName, ridp, ridm, ridv); | |
| 360 | + fossil_print("MERGE %s (pivot=%d v1=%d v2=%d)\n", | |
| 361 | + zName, ridp, ridm, ridv); | |
| 361 | 362 | }else{ |
| 362 | - printf("MERGE %s\n", zName); | |
| 363 | + fossil_print("MERGE %s\n", zName); | |
| 363 | 364 | } |
| 364 | 365 | undo_save(zName); |
| 365 | 366 | zFullPath = mprintf("%s/%s", g.zLocalRoot, zName); |
| 366 | 367 | content_get(ridp, &p); |
| 367 | 368 | content_get(ridm, &m); |
| @@ -376,15 +377,15 @@ | ||
| 376 | 377 | blob_write_to_file(&r, zFullPath); |
| 377 | 378 | file_setexe(zFullPath, isExe); |
| 378 | 379 | } |
| 379 | 380 | db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv); |
| 380 | 381 | if( rc>0 ){ |
| 381 | - printf("***** %d merge conflicts in %s\n", rc, zName); | |
| 382 | + fossil_print("***** %d merge conflicts in %s\n", rc, zName); | |
| 382 | 383 | nConflict++; |
| 383 | 384 | } |
| 384 | 385 | }else{ |
| 385 | - printf("***** Cannot merge binary file %s\n", zName); | |
| 386 | + fossil_print("***** Cannot merge binary file %s\n", zName); | |
| 386 | 387 | nConflict++; |
| 387 | 388 | } |
| 388 | 389 | blob_reset(&p); |
| 389 | 390 | blob_reset(&m); |
| 390 | 391 | blob_reset(&r); |
| @@ -403,13 +404,13 @@ | ||
| 403 | 404 | while( db_step(&q)==SQLITE_ROW ){ |
| 404 | 405 | int idv = db_column_int(&q, 0); |
| 405 | 406 | const char *zName = db_column_text(&q, 1); |
| 406 | 407 | int chnged = db_column_int(&q, 2); |
| 407 | 408 | /* Delete the file idv */ |
| 408 | - printf("DELETE %s\n", zName); | |
| 409 | + fossil_print("DELETE %s\n", zName); | |
| 409 | 410 | if( chnged ){ |
| 410 | - printf("WARNING: local edits lost for %s\n", zName); | |
| 411 | + fossil_warning("WARNING: local edits lost for %s\n", zName); | |
| 411 | 412 | nConflict++; |
| 412 | 413 | } |
| 413 | 414 | undo_save(zName); |
| 414 | 415 | db_multi_exec( |
| 415 | 416 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| @@ -433,11 +434,11 @@ | ||
| 433 | 434 | ); |
| 434 | 435 | while( db_step(&q)==SQLITE_ROW ){ |
| 435 | 436 | int idv = db_column_int(&q, 0); |
| 436 | 437 | const char *zOldName = db_column_text(&q, 1); |
| 437 | 438 | const char *zNewName = db_column_text(&q, 2); |
| 438 | - printf("RENAME %s -> %s\n", zOldName, zNewName); | |
| 439 | + fossil_print("RENAME %s -> %s\n", zOldName, zNewName); | |
| 439 | 440 | undo_save(zOldName); |
| 440 | 441 | undo_save(zNewName); |
| 441 | 442 | db_multi_exec( |
| 442 | 443 | "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)" |
| 443 | 444 | " WHERE id=%d AND vid=%d", zNewName, idv, vid |
| @@ -455,11 +456,12 @@ | ||
| 455 | 456 | |
| 456 | 457 | |
| 457 | 458 | /* Report on conflicts |
| 458 | 459 | */ |
| 459 | 460 | if( nConflict && !nochangeFlag ){ |
| 460 | - printf("WARNING: merge conflicts - see messages above for details.\n"); | |
| 461 | + fossil_warning( | |
| 462 | + "WARNING: merge conflicts - see messages above for details.\n"); | |
| 461 | 463 | } |
| 462 | 464 | |
| 463 | 465 | /* |
| 464 | 466 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 465 | 467 | */ |
| 466 | 468 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -249,20 +249,20 @@ | |
| 249 | if( debugFlag ){ |
| 250 | db_prepare(&q, |
| 251 | "SELECT rowid, fn, fnp, fnm, chnged, ridv, ridp, ridm, isexe FROM fv" |
| 252 | ); |
| 253 | while( db_step(&q)==SQLITE_ROW ){ |
| 254 | printf("%3d: ridv=%-4d ridp=%-4d ridm=%-4d chnged=%d isexe=%d\n", |
| 255 | db_column_int(&q, 0), |
| 256 | db_column_int(&q, 5), |
| 257 | db_column_int(&q, 6), |
| 258 | db_column_int(&q, 7), |
| 259 | db_column_int(&q, 4), |
| 260 | db_column_int(&q, 8)); |
| 261 | printf(" fn = [%s]\n", db_column_text(&q, 1)); |
| 262 | printf(" fnp = [%s]\n", db_column_text(&q, 2)); |
| 263 | printf(" fnm = [%s]\n", db_column_text(&q, 3)); |
| 264 | } |
| 265 | db_finalize(&q); |
| 266 | } |
| 267 | |
| 268 | /* |
| @@ -274,11 +274,11 @@ | |
| 274 | "SELECT idm FROM fv WHERE idp=0 AND idv>0 AND idm>0" |
| 275 | ); |
| 276 | while( db_step(&q)==SQLITE_ROW ){ |
| 277 | int idm = db_column_int(&q, 0); |
| 278 | char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idm); |
| 279 | printf("WARNING - no common ancestor: %s\n", zName); |
| 280 | free(zName); |
| 281 | db_multi_exec("UPDATE fv SET idm=0 WHERE idm=%d", idm); |
| 282 | } |
| 283 | db_finalize(&q); |
| 284 | |
| @@ -300,11 +300,11 @@ | |
| 300 | vid, idm |
| 301 | ); |
| 302 | idv = db_last_insert_rowid(); |
| 303 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 304 | zName = db_column_text(&q, 2); |
| 305 | printf("ADDED %s\n", zName); |
| 306 | if( !nochangeFlag ){ |
| 307 | undo_save(zName); |
| 308 | vfile_to_disk(0, idm, 0, 0); |
| 309 | } |
| 310 | } |
| @@ -322,11 +322,11 @@ | |
| 322 | while( db_step(&q)==SQLITE_ROW ){ |
| 323 | int idv = db_column_int(&q, 0); |
| 324 | int ridm = db_column_int(&q, 1); |
| 325 | const char *zName = db_column_text(&q, 2); |
| 326 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 327 | printf("UPDATE %s\n", zName); |
| 328 | if( !nochangeFlag ){ |
| 329 | undo_save(zName); |
| 330 | db_multi_exec( |
| 331 | "UPDATE vfile SET mtime=0, mrid=%d, chnged=2 WHERE id=%d", ridm, idv |
| 332 | ); |
| @@ -355,13 +355,14 @@ | |
| 355 | int rc; |
| 356 | char *zFullPath; |
| 357 | Blob m, p, r; |
| 358 | /* Do a 3-way merge of idp->idm into idp->idv. The results go into idv. */ |
| 359 | if( detailFlag ){ |
| 360 | printf("MERGE %s (pivot=%d v1=%d v2=%d)\n", zName, ridp, ridm, ridv); |
| 361 | }else{ |
| 362 | printf("MERGE %s\n", zName); |
| 363 | } |
| 364 | undo_save(zName); |
| 365 | zFullPath = mprintf("%s/%s", g.zLocalRoot, zName); |
| 366 | content_get(ridp, &p); |
| 367 | content_get(ridm, &m); |
| @@ -376,15 +377,15 @@ | |
| 376 | blob_write_to_file(&r, zFullPath); |
| 377 | file_setexe(zFullPath, isExe); |
| 378 | } |
| 379 | db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv); |
| 380 | if( rc>0 ){ |
| 381 | printf("***** %d merge conflicts in %s\n", rc, zName); |
| 382 | nConflict++; |
| 383 | } |
| 384 | }else{ |
| 385 | printf("***** Cannot merge binary file %s\n", zName); |
| 386 | nConflict++; |
| 387 | } |
| 388 | blob_reset(&p); |
| 389 | blob_reset(&m); |
| 390 | blob_reset(&r); |
| @@ -403,13 +404,13 @@ | |
| 403 | while( db_step(&q)==SQLITE_ROW ){ |
| 404 | int idv = db_column_int(&q, 0); |
| 405 | const char *zName = db_column_text(&q, 1); |
| 406 | int chnged = db_column_int(&q, 2); |
| 407 | /* Delete the file idv */ |
| 408 | printf("DELETE %s\n", zName); |
| 409 | if( chnged ){ |
| 410 | printf("WARNING: local edits lost for %s\n", zName); |
| 411 | nConflict++; |
| 412 | } |
| 413 | undo_save(zName); |
| 414 | db_multi_exec( |
| 415 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| @@ -433,11 +434,11 @@ | |
| 433 | ); |
| 434 | while( db_step(&q)==SQLITE_ROW ){ |
| 435 | int idv = db_column_int(&q, 0); |
| 436 | const char *zOldName = db_column_text(&q, 1); |
| 437 | const char *zNewName = db_column_text(&q, 2); |
| 438 | printf("RENAME %s -> %s\n", zOldName, zNewName); |
| 439 | undo_save(zOldName); |
| 440 | undo_save(zNewName); |
| 441 | db_multi_exec( |
| 442 | "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)" |
| 443 | " WHERE id=%d AND vid=%d", zNewName, idv, vid |
| @@ -455,11 +456,12 @@ | |
| 455 | |
| 456 | |
| 457 | /* Report on conflicts |
| 458 | */ |
| 459 | if( nConflict && !nochangeFlag ){ |
| 460 | printf("WARNING: merge conflicts - see messages above for details.\n"); |
| 461 | } |
| 462 | |
| 463 | /* |
| 464 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 465 | */ |
| 466 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -249,20 +249,20 @@ | |
| 249 | if( debugFlag ){ |
| 250 | db_prepare(&q, |
| 251 | "SELECT rowid, fn, fnp, fnm, chnged, ridv, ridp, ridm, isexe FROM fv" |
| 252 | ); |
| 253 | while( db_step(&q)==SQLITE_ROW ){ |
| 254 | fossil_print("%3d: ridv=%-4d ridp=%-4d ridm=%-4d chnged=%d isexe=%d\n", |
| 255 | db_column_int(&q, 0), |
| 256 | db_column_int(&q, 5), |
| 257 | db_column_int(&q, 6), |
| 258 | db_column_int(&q, 7), |
| 259 | db_column_int(&q, 4), |
| 260 | db_column_int(&q, 8)); |
| 261 | fossil_print(" fn = [%s]\n", db_column_text(&q, 1)); |
| 262 | fossil_print(" fnp = [%s]\n", db_column_text(&q, 2)); |
| 263 | fossil_print(" fnm = [%s]\n", db_column_text(&q, 3)); |
| 264 | } |
| 265 | db_finalize(&q); |
| 266 | } |
| 267 | |
| 268 | /* |
| @@ -274,11 +274,11 @@ | |
| 274 | "SELECT idm FROM fv WHERE idp=0 AND idv>0 AND idm>0" |
| 275 | ); |
| 276 | while( db_step(&q)==SQLITE_ROW ){ |
| 277 | int idm = db_column_int(&q, 0); |
| 278 | char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idm); |
| 279 | fossil_warning("WARNING - no common ancestor: %s\n", zName); |
| 280 | free(zName); |
| 281 | db_multi_exec("UPDATE fv SET idm=0 WHERE idm=%d", idm); |
| 282 | } |
| 283 | db_finalize(&q); |
| 284 | |
| @@ -300,11 +300,11 @@ | |
| 300 | vid, idm |
| 301 | ); |
| 302 | idv = db_last_insert_rowid(); |
| 303 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 304 | zName = db_column_text(&q, 2); |
| 305 | fossil_print("ADDED %s\n", zName); |
| 306 | if( !nochangeFlag ){ |
| 307 | undo_save(zName); |
| 308 | vfile_to_disk(0, idm, 0, 0); |
| 309 | } |
| 310 | } |
| @@ -322,11 +322,11 @@ | |
| 322 | while( db_step(&q)==SQLITE_ROW ){ |
| 323 | int idv = db_column_int(&q, 0); |
| 324 | int ridm = db_column_int(&q, 1); |
| 325 | const char *zName = db_column_text(&q, 2); |
| 326 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 327 | fossil_print("UPDATE %s\n", zName); |
| 328 | if( !nochangeFlag ){ |
| 329 | undo_save(zName); |
| 330 | db_multi_exec( |
| 331 | "UPDATE vfile SET mtime=0, mrid=%d, chnged=2 WHERE id=%d", ridm, idv |
| 332 | ); |
| @@ -355,13 +355,14 @@ | |
| 355 | int rc; |
| 356 | char *zFullPath; |
| 357 | Blob m, p, r; |
| 358 | /* Do a 3-way merge of idp->idm into idp->idv. The results go into idv. */ |
| 359 | if( detailFlag ){ |
| 360 | fossil_print("MERGE %s (pivot=%d v1=%d v2=%d)\n", |
| 361 | zName, ridp, ridm, ridv); |
| 362 | }else{ |
| 363 | fossil_print("MERGE %s\n", zName); |
| 364 | } |
| 365 | undo_save(zName); |
| 366 | zFullPath = mprintf("%s/%s", g.zLocalRoot, zName); |
| 367 | content_get(ridp, &p); |
| 368 | content_get(ridm, &m); |
| @@ -376,15 +377,15 @@ | |
| 377 | blob_write_to_file(&r, zFullPath); |
| 378 | file_setexe(zFullPath, isExe); |
| 379 | } |
| 380 | db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv); |
| 381 | if( rc>0 ){ |
| 382 | fossil_print("***** %d merge conflicts in %s\n", rc, zName); |
| 383 | nConflict++; |
| 384 | } |
| 385 | }else{ |
| 386 | fossil_print("***** Cannot merge binary file %s\n", zName); |
| 387 | nConflict++; |
| 388 | } |
| 389 | blob_reset(&p); |
| 390 | blob_reset(&m); |
| 391 | blob_reset(&r); |
| @@ -403,13 +404,13 @@ | |
| 404 | while( db_step(&q)==SQLITE_ROW ){ |
| 405 | int idv = db_column_int(&q, 0); |
| 406 | const char *zName = db_column_text(&q, 1); |
| 407 | int chnged = db_column_int(&q, 2); |
| 408 | /* Delete the file idv */ |
| 409 | fossil_print("DELETE %s\n", zName); |
| 410 | if( chnged ){ |
| 411 | fossil_warning("WARNING: local edits lost for %s\n", zName); |
| 412 | nConflict++; |
| 413 | } |
| 414 | undo_save(zName); |
| 415 | db_multi_exec( |
| 416 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| @@ -433,11 +434,11 @@ | |
| 434 | ); |
| 435 | while( db_step(&q)==SQLITE_ROW ){ |
| 436 | int idv = db_column_int(&q, 0); |
| 437 | const char *zOldName = db_column_text(&q, 1); |
| 438 | const char *zNewName = db_column_text(&q, 2); |
| 439 | fossil_print("RENAME %s -> %s\n", zOldName, zNewName); |
| 440 | undo_save(zOldName); |
| 441 | undo_save(zNewName); |
| 442 | db_multi_exec( |
| 443 | "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)" |
| 444 | " WHERE id=%d AND vid=%d", zNewName, idv, vid |
| @@ -455,11 +456,12 @@ | |
| 456 | |
| 457 | |
| 458 | /* Report on conflicts |
| 459 | */ |
| 460 | if( nConflict && !nochangeFlag ){ |
| 461 | fossil_warning( |
| 462 | "WARNING: merge conflicts - see messages above for details.\n"); |
| 463 | } |
| 464 | |
| 465 | /* |
| 466 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 467 | */ |
| 468 |
+4
-8
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -314,25 +314,21 @@ | ||
| 314 | 314 | Blob pivot, v1, v2, merged; |
| 315 | 315 | if( g.argc!=6 ){ |
| 316 | 316 | usage("PIVOT V1 V2 MERGED"); |
| 317 | 317 | } |
| 318 | 318 | if( blob_read_from_file(&pivot, g.argv[2])<0 ){ |
| 319 | - fprintf(stderr,"cannot read %s\n", g.argv[2]); | |
| 320 | - fossil_exit(1); | |
| 319 | + fossil_fatal("cannot read %s\n", g.argv[2]); | |
| 321 | 320 | } |
| 322 | 321 | if( blob_read_from_file(&v1, g.argv[3])<0 ){ |
| 323 | - fprintf(stderr,"cannot read %s\n", g.argv[3]); | |
| 324 | - fossil_exit(1); | |
| 322 | + fossil_fatal("cannot read %s\n", g.argv[3]); | |
| 325 | 323 | } |
| 326 | 324 | if( blob_read_from_file(&v2, g.argv[4])<0 ){ |
| 327 | - fprintf(stderr,"cannot read %s\n", g.argv[4]); | |
| 328 | - fossil_exit(1); | |
| 325 | + fossil_fatal("cannot read %s\n", g.argv[4]); | |
| 329 | 326 | } |
| 330 | 327 | blob_merge(&pivot, &v1, &v2, &merged); |
| 331 | 328 | if( blob_write_to_file(&merged, g.argv[5])<blob_size(&merged) ){ |
| 332 | - fprintf(stderr,"cannot write %s\n", g.argv[4]); | |
| 333 | - fossil_exit(1); | |
| 329 | + fossil_fatal("cannot write %s\n", g.argv[4]); | |
| 334 | 330 | } |
| 335 | 331 | blob_reset(&pivot); |
| 336 | 332 | blob_reset(&v1); |
| 337 | 333 | blob_reset(&v2); |
| 338 | 334 | blob_reset(&merged); |
| 339 | 335 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -314,25 +314,21 @@ | |
| 314 | Blob pivot, v1, v2, merged; |
| 315 | if( g.argc!=6 ){ |
| 316 | usage("PIVOT V1 V2 MERGED"); |
| 317 | } |
| 318 | if( blob_read_from_file(&pivot, g.argv[2])<0 ){ |
| 319 | fprintf(stderr,"cannot read %s\n", g.argv[2]); |
| 320 | fossil_exit(1); |
| 321 | } |
| 322 | if( blob_read_from_file(&v1, g.argv[3])<0 ){ |
| 323 | fprintf(stderr,"cannot read %s\n", g.argv[3]); |
| 324 | fossil_exit(1); |
| 325 | } |
| 326 | if( blob_read_from_file(&v2, g.argv[4])<0 ){ |
| 327 | fprintf(stderr,"cannot read %s\n", g.argv[4]); |
| 328 | fossil_exit(1); |
| 329 | } |
| 330 | blob_merge(&pivot, &v1, &v2, &merged); |
| 331 | if( blob_write_to_file(&merged, g.argv[5])<blob_size(&merged) ){ |
| 332 | fprintf(stderr,"cannot write %s\n", g.argv[4]); |
| 333 | fossil_exit(1); |
| 334 | } |
| 335 | blob_reset(&pivot); |
| 336 | blob_reset(&v1); |
| 337 | blob_reset(&v2); |
| 338 | blob_reset(&merged); |
| 339 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -314,25 +314,21 @@ | |
| 314 | Blob pivot, v1, v2, merged; |
| 315 | if( g.argc!=6 ){ |
| 316 | usage("PIVOT V1 V2 MERGED"); |
| 317 | } |
| 318 | if( blob_read_from_file(&pivot, g.argv[2])<0 ){ |
| 319 | fossil_fatal("cannot read %s\n", g.argv[2]); |
| 320 | } |
| 321 | if( blob_read_from_file(&v1, g.argv[3])<0 ){ |
| 322 | fossil_fatal("cannot read %s\n", g.argv[3]); |
| 323 | } |
| 324 | if( blob_read_from_file(&v2, g.argv[4])<0 ){ |
| 325 | fossil_fatal("cannot read %s\n", g.argv[4]); |
| 326 | } |
| 327 | blob_merge(&pivot, &v1, &v2, &merged); |
| 328 | if( blob_write_to_file(&merged, g.argv[5])<blob_size(&merged) ){ |
| 329 | fossil_fatal("cannot write %s\n", g.argv[4]); |
| 330 | } |
| 331 | blob_reset(&pivot); |
| 332 | blob_reset(&v1); |
| 333 | blob_reset(&v2); |
| 334 | blob_reset(&merged); |
| 335 |
+3
-3
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -267,16 +267,16 @@ | ||
| 267 | 267 | int i; |
| 268 | 268 | Blob name; |
| 269 | 269 | db_must_be_within_tree(); |
| 270 | 270 | for(i=2; i<g.argc; i++){ |
| 271 | 271 | blob_init(&name, g.argv[i], -1); |
| 272 | - printf("%s -> ", g.argv[i]); | |
| 272 | + fossil_print("%s -> ", g.argv[i]); | |
| 273 | 273 | if( name_to_uuid(&name, 1) ){ |
| 274 | - printf("ERROR: %s\n", g.zErrMsg); | |
| 274 | + fossil_print("ERROR: %s\n", g.zErrMsg); | |
| 275 | 275 | fossil_error_reset(); |
| 276 | 276 | }else{ |
| 277 | - printf("%s\n", blob_buffer(&name)); | |
| 277 | + fossil_print("%s\n", blob_buffer(&name)); | |
| 278 | 278 | } |
| 279 | 279 | blob_reset(&name); |
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -267,16 +267,16 @@ | |
| 267 | int i; |
| 268 | Blob name; |
| 269 | db_must_be_within_tree(); |
| 270 | for(i=2; i<g.argc; i++){ |
| 271 | blob_init(&name, g.argv[i], -1); |
| 272 | printf("%s -> ", g.argv[i]); |
| 273 | if( name_to_uuid(&name, 1) ){ |
| 274 | printf("ERROR: %s\n", g.zErrMsg); |
| 275 | fossil_error_reset(); |
| 276 | }else{ |
| 277 | printf("%s\n", blob_buffer(&name)); |
| 278 | } |
| 279 | blob_reset(&name); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -267,16 +267,16 @@ | |
| 267 | int i; |
| 268 | Blob name; |
| 269 | db_must_be_within_tree(); |
| 270 | for(i=2; i<g.argc; i++){ |
| 271 | blob_init(&name, g.argv[i], -1); |
| 272 | fossil_print("%s -> ", g.argv[i]); |
| 273 | if( name_to_uuid(&name, 1) ){ |
| 274 | fossil_print("ERROR: %s\n", g.zErrMsg); |
| 275 | fossil_error_reset(); |
| 276 | }else{ |
| 277 | fossil_print("%s\n", blob_buffer(&name)); |
| 278 | } |
| 279 | blob_reset(&name); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 |
+10
-9
| --- src/path.c | ||
| +++ src/path.c | ||
| @@ -213,16 +213,17 @@ | ||
| 213 | 213 | z = db_text(0, |
| 214 | 214 | "SELECT substr(uuid,1,12) || ' ' || datetime(mtime)" |
| 215 | 215 | " FROM blob, event" |
| 216 | 216 | " WHERE blob.rid=%d AND event.objid=%d AND event.type='ci'", |
| 217 | 217 | p->rid, p->rid); |
| 218 | - printf("%4d: %s", n, z); | |
| 218 | + fossil_print("%4d: %s", n, z); | |
| 219 | 219 | fossil_free(z); |
| 220 | 220 | if( p->u.pTo ){ |
| 221 | - printf(" is a %s of\n", p->u.pTo->fromIsParent ? "parent" : "child"); | |
| 221 | + fossil_print(" is a %s of\n", | |
| 222 | + p->u.pTo->fromIsParent ? "parent" : "child"); | |
| 222 | 223 | }else{ |
| 223 | - printf("\n"); | |
| 224 | + fossil_print("\n"); | |
| 224 | 225 | } |
| 225 | 226 | } |
| 226 | 227 | } |
| 227 | 228 | |
| 228 | 229 | /* |
| @@ -312,16 +313,16 @@ | ||
| 312 | 313 | z = db_text(0, |
| 313 | 314 | "SELECT substr(uuid,1,12) || ' ' || datetime(mtime)" |
| 314 | 315 | " FROM blob, event" |
| 315 | 316 | " WHERE blob.rid=%d AND event.objid=%d AND event.type='ci'", |
| 316 | 317 | p->rid, p->rid); |
| 317 | - printf("%4d: %s", n, z); | |
| 318 | + fossil_print("%4d: %s", n, z); | |
| 318 | 319 | fossil_free(z); |
| 319 | - if( p->rid==iFrom ) printf(" VERSION1"); | |
| 320 | - if( p->rid==iTo ) printf(" VERSION2"); | |
| 321 | - if( p->rid==iPivot ) printf(" PIVOT"); | |
| 322 | - printf("\n"); | |
| 320 | + if( p->rid==iFrom ) fossil_print(" VERSION1"); | |
| 321 | + if( p->rid==iTo ) fossil_print(" VERSION2"); | |
| 322 | + if( p->rid==iPivot ) fossil_print(" PIVOT"); | |
| 323 | + fossil_print("\n"); | |
| 323 | 324 | } |
| 324 | 325 | } |
| 325 | 326 | |
| 326 | 327 | |
| 327 | 328 | /* |
| @@ -445,11 +446,11 @@ | ||
| 445 | 446 | for(i=0; i<nChng; i++){ |
| 446 | 447 | char *zFrom, *zTo; |
| 447 | 448 | |
| 448 | 449 | zFrom = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2]); |
| 449 | 450 | zTo = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2+1]); |
| 450 | - printf("[%s] -> [%s]\n", zFrom, zTo); | |
| 451 | + fossil_print("[%s] -> [%s]\n", zFrom, zTo); | |
| 451 | 452 | fossil_free(zFrom); |
| 452 | 453 | fossil_free(zTo); |
| 453 | 454 | } |
| 454 | 455 | fossil_free(aChng); |
| 455 | 456 | } |
| 456 | 457 |
| --- src/path.c | |
| +++ src/path.c | |
| @@ -213,16 +213,17 @@ | |
| 213 | z = db_text(0, |
| 214 | "SELECT substr(uuid,1,12) || ' ' || datetime(mtime)" |
| 215 | " FROM blob, event" |
| 216 | " WHERE blob.rid=%d AND event.objid=%d AND event.type='ci'", |
| 217 | p->rid, p->rid); |
| 218 | printf("%4d: %s", n, z); |
| 219 | fossil_free(z); |
| 220 | if( p->u.pTo ){ |
| 221 | printf(" is a %s of\n", p->u.pTo->fromIsParent ? "parent" : "child"); |
| 222 | }else{ |
| 223 | printf("\n"); |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | /* |
| @@ -312,16 +313,16 @@ | |
| 312 | z = db_text(0, |
| 313 | "SELECT substr(uuid,1,12) || ' ' || datetime(mtime)" |
| 314 | " FROM blob, event" |
| 315 | " WHERE blob.rid=%d AND event.objid=%d AND event.type='ci'", |
| 316 | p->rid, p->rid); |
| 317 | printf("%4d: %s", n, z); |
| 318 | fossil_free(z); |
| 319 | if( p->rid==iFrom ) printf(" VERSION1"); |
| 320 | if( p->rid==iTo ) printf(" VERSION2"); |
| 321 | if( p->rid==iPivot ) printf(" PIVOT"); |
| 322 | printf("\n"); |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | |
| 327 | /* |
| @@ -445,11 +446,11 @@ | |
| 445 | for(i=0; i<nChng; i++){ |
| 446 | char *zFrom, *zTo; |
| 447 | |
| 448 | zFrom = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2]); |
| 449 | zTo = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2+1]); |
| 450 | printf("[%s] -> [%s]\n", zFrom, zTo); |
| 451 | fossil_free(zFrom); |
| 452 | fossil_free(zTo); |
| 453 | } |
| 454 | fossil_free(aChng); |
| 455 | } |
| 456 |
| --- src/path.c | |
| +++ src/path.c | |
| @@ -213,16 +213,17 @@ | |
| 213 | z = db_text(0, |
| 214 | "SELECT substr(uuid,1,12) || ' ' || datetime(mtime)" |
| 215 | " FROM blob, event" |
| 216 | " WHERE blob.rid=%d AND event.objid=%d AND event.type='ci'", |
| 217 | p->rid, p->rid); |
| 218 | fossil_print("%4d: %s", n, z); |
| 219 | fossil_free(z); |
| 220 | if( p->u.pTo ){ |
| 221 | fossil_print(" is a %s of\n", |
| 222 | p->u.pTo->fromIsParent ? "parent" : "child"); |
| 223 | }else{ |
| 224 | fossil_print("\n"); |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | /* |
| @@ -312,16 +313,16 @@ | |
| 313 | z = db_text(0, |
| 314 | "SELECT substr(uuid,1,12) || ' ' || datetime(mtime)" |
| 315 | " FROM blob, event" |
| 316 | " WHERE blob.rid=%d AND event.objid=%d AND event.type='ci'", |
| 317 | p->rid, p->rid); |
| 318 | fossil_print("%4d: %s", n, z); |
| 319 | fossil_free(z); |
| 320 | if( p->rid==iFrom ) fossil_print(" VERSION1"); |
| 321 | if( p->rid==iTo ) fossil_print(" VERSION2"); |
| 322 | if( p->rid==iPivot ) fossil_print(" PIVOT"); |
| 323 | fossil_print("\n"); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | |
| 328 | /* |
| @@ -445,11 +446,11 @@ | |
| 446 | for(i=0; i<nChng; i++){ |
| 447 | char *zFrom, *zTo; |
| 448 | |
| 449 | zFrom = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2]); |
| 450 | zTo = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2+1]); |
| 451 | fossil_print("[%s] -> [%s]\n", zFrom, zTo); |
| 452 | fossil_free(zFrom); |
| 453 | fossil_free(zTo); |
| 454 | } |
| 455 | fossil_free(aChng); |
| 456 | } |
| 457 |
+28
-1
| --- src/printf.c | ||
| +++ src/printf.c | ||
| @@ -797,10 +797,37 @@ | ||
| 797 | 797 | void fossil_error_reset(void){ |
| 798 | 798 | free(g.zErrMsg); |
| 799 | 799 | g.zErrMsg = 0; |
| 800 | 800 | g.iErrPriority = 0; |
| 801 | 801 | } |
| 802 | + | |
| 803 | +/* | |
| 804 | +** Write to standard output or standard error. | |
| 805 | +** | |
| 806 | +** On windows, transform the output into the current terminal encoding | |
| 807 | +** if the output is going to the screen. If output is redirected into | |
| 808 | +** a file, no translation occurs. No translation ever occurs on unix. | |
| 809 | +*/ | |
| 810 | +void fossil_puts(const char *z, int toStdErr){ | |
| 811 | +#if defined(_WIN32) | |
| 812 | + extern char *sqlite3_win32_utf8_to_mbcs(const char*); | |
| 813 | + static int once = 1; | |
| 814 | + static int istty[2]; | |
| 815 | + char *zToFree = 0; | |
| 816 | + if( once ){ | |
| 817 | + istty[0] = _isatty(fileno(stdout)); | |
| 818 | + istty[1] = _isatty(fileno(stderr)); | |
| 819 | + once = 0; | |
| 820 | + } | |
| 821 | + assert( toStdErr==0 || toStdErr==1 ); | |
| 822 | + if( istty[toStdErr] ) z = zToFree = sqlite3_win32_utf8_to_mbcs(z); | |
| 823 | + fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout); | |
| 824 | + free(zToFree); | |
| 825 | +#else | |
| 826 | + fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout); | |
| 827 | +#endif | |
| 828 | +} | |
| 802 | 829 | |
| 803 | 830 | /* |
| 804 | 831 | ** Write output for user consumption. If g.cgiOutput is enabled, then |
| 805 | 832 | ** send the output as part of the CGI reply. If g.cgiOutput is false, |
| 806 | 833 | ** then write on standard output. |
| @@ -811,11 +838,11 @@ | ||
| 811 | 838 | if( g.cgiOutput ){ |
| 812 | 839 | cgi_vprintf(zFormat, ap); |
| 813 | 840 | }else{ |
| 814 | 841 | Blob b = empty_blob; |
| 815 | 842 | vxprintf(&b, zFormat, ap); |
| 816 | - fwrite(blob_buffer(&b), 1, blob_size(&b), stdout); | |
| 843 | + fossil_puts(blob_str(&b), 0); | |
| 817 | 844 | blob_reset(&b); |
| 818 | 845 | } |
| 819 | 846 | } |
| 820 | 847 | |
| 821 | 848 | /* |
| 822 | 849 |
| --- src/printf.c | |
| +++ src/printf.c | |
| @@ -797,10 +797,37 @@ | |
| 797 | void fossil_error_reset(void){ |
| 798 | free(g.zErrMsg); |
| 799 | g.zErrMsg = 0; |
| 800 | g.iErrPriority = 0; |
| 801 | } |
| 802 | |
| 803 | /* |
| 804 | ** Write output for user consumption. If g.cgiOutput is enabled, then |
| 805 | ** send the output as part of the CGI reply. If g.cgiOutput is false, |
| 806 | ** then write on standard output. |
| @@ -811,11 +838,11 @@ | |
| 811 | if( g.cgiOutput ){ |
| 812 | cgi_vprintf(zFormat, ap); |
| 813 | }else{ |
| 814 | Blob b = empty_blob; |
| 815 | vxprintf(&b, zFormat, ap); |
| 816 | fwrite(blob_buffer(&b), 1, blob_size(&b), stdout); |
| 817 | blob_reset(&b); |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | /* |
| 822 |
| --- src/printf.c | |
| +++ src/printf.c | |
| @@ -797,10 +797,37 @@ | |
| 797 | void fossil_error_reset(void){ |
| 798 | free(g.zErrMsg); |
| 799 | g.zErrMsg = 0; |
| 800 | g.iErrPriority = 0; |
| 801 | } |
| 802 | |
| 803 | /* |
| 804 | ** Write to standard output or standard error. |
| 805 | ** |
| 806 | ** On windows, transform the output into the current terminal encoding |
| 807 | ** if the output is going to the screen. If output is redirected into |
| 808 | ** a file, no translation occurs. No translation ever occurs on unix. |
| 809 | */ |
| 810 | void fossil_puts(const char *z, int toStdErr){ |
| 811 | #if defined(_WIN32) |
| 812 | extern char *sqlite3_win32_utf8_to_mbcs(const char*); |
| 813 | static int once = 1; |
| 814 | static int istty[2]; |
| 815 | char *zToFree = 0; |
| 816 | if( once ){ |
| 817 | istty[0] = _isatty(fileno(stdout)); |
| 818 | istty[1] = _isatty(fileno(stderr)); |
| 819 | once = 0; |
| 820 | } |
| 821 | assert( toStdErr==0 || toStdErr==1 ); |
| 822 | if( istty[toStdErr] ) z = zToFree = sqlite3_win32_utf8_to_mbcs(z); |
| 823 | fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout); |
| 824 | free(zToFree); |
| 825 | #else |
| 826 | fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout); |
| 827 | #endif |
| 828 | } |
| 829 | |
| 830 | /* |
| 831 | ** Write output for user consumption. If g.cgiOutput is enabled, then |
| 832 | ** send the output as part of the CGI reply. If g.cgiOutput is false, |
| 833 | ** then write on standard output. |
| @@ -811,11 +838,11 @@ | |
| 838 | if( g.cgiOutput ){ |
| 839 | cgi_vprintf(zFormat, ap); |
| 840 | }else{ |
| 841 | Blob b = empty_blob; |
| 842 | vxprintf(&b, zFormat, ap); |
| 843 | fossil_puts(blob_str(&b), 0); |
| 844 | blob_reset(&b); |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | /* |
| 849 |
+22
-20
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -176,11 +176,11 @@ | ||
| 176 | 176 | ** The input is actually the permill complete. |
| 177 | 177 | */ |
| 178 | 178 | static void percent_complete(int permill){ |
| 179 | 179 | static int lastOutput = -1; |
| 180 | 180 | if( permill>lastOutput ){ |
| 181 | - printf(" %d.%d%% complete...\r", permill/10, permill%10); | |
| 181 | + fossil_print(" %d.%d%% complete...\r", permill/10, permill%10); | |
| 182 | 182 | fflush(stdout); |
| 183 | 183 | lastOutput = permill; |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| @@ -420,11 +420,11 @@ | ||
| 420 | 420 | if( !g.fQuiet && totalSize>0 ){ |
| 421 | 421 | processCnt += incrSize; |
| 422 | 422 | percent_complete((processCnt*1000)/totalSize); |
| 423 | 423 | } |
| 424 | 424 | if(!g.fQuiet && ttyOutput ){ |
| 425 | - printf("\n"); | |
| 425 | + fossil_print("\n"); | |
| 426 | 426 | } |
| 427 | 427 | return errCnt; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /* |
| @@ -549,32 +549,34 @@ | ||
| 549 | 549 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema','%s',now());" |
| 550 | 550 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema','%s',now());", |
| 551 | 551 | CONTENT_SCHEMA, AUX_SCHEMA |
| 552 | 552 | ); |
| 553 | 553 | if( errCnt && !forceFlag ){ |
| 554 | - printf("%d errors. Rolling back changes. Use --force to force a commit.\n", | |
| 555 | - errCnt); | |
| 554 | + fossil_print( | |
| 555 | + "%d errors. Rolling back changes. Use --force to force a commit.\n", | |
| 556 | + errCnt | |
| 557 | + ); | |
| 556 | 558 | db_end_transaction(1); |
| 557 | 559 | }else{ |
| 558 | 560 | if( runCompress ){ |
| 559 | - printf("Extra delta compression... "); fflush(stdout); | |
| 561 | + fossil_print("Extra delta compression... "); fflush(stdout); | |
| 560 | 562 | extra_deltification(); |
| 561 | 563 | runVacuum = 1; |
| 562 | 564 | } |
| 563 | 565 | if( omitVerify ) verify_cancel(); |
| 564 | 566 | db_end_transaction(0); |
| 565 | - if( runCompress ) printf("done\n"); | |
| 567 | + if( runCompress ) fossil_print("done\n"); | |
| 566 | 568 | db_close(0); |
| 567 | 569 | db_open_repository(g.zRepositoryName); |
| 568 | 570 | if( newPagesize ){ |
| 569 | 571 | db_multi_exec("PRAGMA page_size=%d", newPagesize); |
| 570 | 572 | runVacuum = 1; |
| 571 | 573 | } |
| 572 | 574 | if( runVacuum ){ |
| 573 | - printf("Vacuuming the database... "); fflush(stdout); | |
| 575 | + fossil_print("Vacuuming the database... "); fflush(stdout); | |
| 574 | 576 | db_multi_exec("VACUUM"); |
| 575 | - printf("done\n"); | |
| 577 | + fossil_print("done\n"); | |
| 576 | 578 | } |
| 577 | 579 | if( activateWal ){ |
| 578 | 580 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 579 | 581 | } |
| 580 | 582 | } |
| @@ -678,16 +680,16 @@ | ||
| 678 | 680 | manifest_destroy(p); |
| 679 | 681 | } |
| 680 | 682 | n = db_int(0, "SELECT count(*) FROM /*scan*/" |
| 681 | 683 | " (SELECT rid FROM blob EXCEPT SELECT x FROM xdone)"); |
| 682 | 684 | if( n==0 ){ |
| 683 | - printf("all artifacts reachable through clusters\n"); | |
| 685 | + fossil_print("all artifacts reachable through clusters\n"); | |
| 684 | 686 | }else{ |
| 685 | - printf("%d unreachable artifacts:\n", n); | |
| 687 | + fossil_print("%d unreachable artifacts:\n", n); | |
| 686 | 688 | db_prepare(&q, "SELECT rid, uuid FROM blob WHERE rid NOT IN xdone"); |
| 687 | 689 | while( db_step(&q)==SQLITE_ROW ){ |
| 688 | - printf(" %3d %s\n", db_column_int(&q,0), db_column_text(&q,1)); | |
| 690 | + fossil_print(" %3d %s\n", db_column_int(&q,0), db_column_text(&q,1)); | |
| 689 | 691 | } |
| 690 | 692 | db_finalize(&q); |
| 691 | 693 | } |
| 692 | 694 | } |
| 693 | 695 | |
| @@ -797,11 +799,11 @@ | ||
| 797 | 799 | } |
| 798 | 800 | content_put(&aContent); |
| 799 | 801 | blob_reset(&path); |
| 800 | 802 | blob_reset(&aContent); |
| 801 | 803 | free(zSubpath); |
| 802 | - printf("\r%d", ++nFileRead); | |
| 804 | + fossil_print("\r%d", ++nFileRead); | |
| 803 | 805 | fflush(stdout); |
| 804 | 806 | } |
| 805 | 807 | closedir(d); |
| 806 | 808 | }else { |
| 807 | 809 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| @@ -824,22 +826,22 @@ | ||
| 824 | 826 | char *zPassword; |
| 825 | 827 | if( g.argc!=4 ){ |
| 826 | 828 | usage("FILENAME DIRECTORY"); |
| 827 | 829 | } |
| 828 | 830 | if( file_isdir(g.argv[3])!=1 ){ |
| 829 | - printf("\"%s\" is not a directory\n\n", g.argv[3]); | |
| 831 | + fossil_print("\"%s\" is not a directory\n\n", g.argv[3]); | |
| 830 | 832 | usage("FILENAME DIRECTORY"); |
| 831 | 833 | } |
| 832 | 834 | db_create_repository(g.argv[2]); |
| 833 | 835 | db_open_repository(g.argv[2]); |
| 834 | 836 | db_open_config(0); |
| 835 | 837 | db_begin_transaction(); |
| 836 | 838 | db_initial_setup(0, 0, 1); |
| 837 | 839 | |
| 838 | - printf("Reading files from directory \"%s\"...\n", g.argv[3]); | |
| 840 | + fossil_print("Reading files from directory \"%s\"...\n", g.argv[3]); | |
| 839 | 841 | recon_read_dir(g.argv[3]); |
| 840 | - printf("\nBuilding the Fossil repository...\n"); | |
| 842 | + fossil_print("\nBuilding the Fossil repository...\n"); | |
| 841 | 843 | |
| 842 | 844 | rebuild_db(0, 1, 1); |
| 843 | 845 | |
| 844 | 846 | /* Reconstruct the private table. The private table contains the rid |
| 845 | 847 | ** of every manifest that is tagged with "private" and every file that |
| @@ -861,14 +863,14 @@ | ||
| 861 | 863 | ** long time. |
| 862 | 864 | */ |
| 863 | 865 | verify_cancel(); |
| 864 | 866 | |
| 865 | 867 | db_end_transaction(0); |
| 866 | - printf("project-id: %s\n", db_get("project-code", 0)); | |
| 867 | - printf("server-id: %s\n", db_get("server-code", 0)); | |
| 868 | + fossil_print("project-id: %s\n", db_get("project-code", 0)); | |
| 869 | + fossil_print("server-id: %s\n", db_get("server-code", 0)); | |
| 868 | 870 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 869 | - printf("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword); | |
| 871 | + fossil_print("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword); | |
| 870 | 872 | } |
| 871 | 873 | |
| 872 | 874 | /* |
| 873 | 875 | ** COMMAND: deconstruct |
| 874 | 876 | ** |
| @@ -928,11 +930,11 @@ | ||
| 928 | 930 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 929 | 931 | bag_init(&bagDone); |
| 930 | 932 | ttyOutput = 1; |
| 931 | 933 | processCnt = 0; |
| 932 | 934 | if (!g.fQuiet) { |
| 933 | - printf("0 (0%%)...\r"); | |
| 935 | + fossil_print("0 (0%%)...\r"); | |
| 934 | 936 | fflush(stdout); |
| 935 | 937 | } |
| 936 | 938 | totalSize = db_int(0, "SELECT count(*) FROM blob"); |
| 937 | 939 | db_prepare(&s, |
| 938 | 940 | "SELECT rid, size FROM blob /*scan*/" |
| @@ -964,12 +966,12 @@ | ||
| 964 | 966 | } |
| 965 | 967 | } |
| 966 | 968 | } |
| 967 | 969 | db_finalize(&s); |
| 968 | 970 | if(!g.fQuiet && ttyOutput ){ |
| 969 | - printf("\n"); | |
| 971 | + fossil_print("\n"); | |
| 970 | 972 | } |
| 971 | 973 | |
| 972 | 974 | /* free filename format string */ |
| 973 | 975 | free(zFNameFormat); |
| 974 | 976 | zFNameFormat = 0; |
| 975 | 977 | } |
| 976 | 978 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -176,11 +176,11 @@ | |
| 176 | ** The input is actually the permill complete. |
| 177 | */ |
| 178 | static void percent_complete(int permill){ |
| 179 | static int lastOutput = -1; |
| 180 | if( permill>lastOutput ){ |
| 181 | printf(" %d.%d%% complete...\r", permill/10, permill%10); |
| 182 | fflush(stdout); |
| 183 | lastOutput = permill; |
| 184 | } |
| 185 | } |
| 186 | |
| @@ -420,11 +420,11 @@ | |
| 420 | if( !g.fQuiet && totalSize>0 ){ |
| 421 | processCnt += incrSize; |
| 422 | percent_complete((processCnt*1000)/totalSize); |
| 423 | } |
| 424 | if(!g.fQuiet && ttyOutput ){ |
| 425 | printf("\n"); |
| 426 | } |
| 427 | return errCnt; |
| 428 | } |
| 429 | |
| 430 | /* |
| @@ -549,32 +549,34 @@ | |
| 549 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema','%s',now());" |
| 550 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema','%s',now());", |
| 551 | CONTENT_SCHEMA, AUX_SCHEMA |
| 552 | ); |
| 553 | if( errCnt && !forceFlag ){ |
| 554 | printf("%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 555 | errCnt); |
| 556 | db_end_transaction(1); |
| 557 | }else{ |
| 558 | if( runCompress ){ |
| 559 | printf("Extra delta compression... "); fflush(stdout); |
| 560 | extra_deltification(); |
| 561 | runVacuum = 1; |
| 562 | } |
| 563 | if( omitVerify ) verify_cancel(); |
| 564 | db_end_transaction(0); |
| 565 | if( runCompress ) printf("done\n"); |
| 566 | db_close(0); |
| 567 | db_open_repository(g.zRepositoryName); |
| 568 | if( newPagesize ){ |
| 569 | db_multi_exec("PRAGMA page_size=%d", newPagesize); |
| 570 | runVacuum = 1; |
| 571 | } |
| 572 | if( runVacuum ){ |
| 573 | printf("Vacuuming the database... "); fflush(stdout); |
| 574 | db_multi_exec("VACUUM"); |
| 575 | printf("done\n"); |
| 576 | } |
| 577 | if( activateWal ){ |
| 578 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 579 | } |
| 580 | } |
| @@ -678,16 +680,16 @@ | |
| 678 | manifest_destroy(p); |
| 679 | } |
| 680 | n = db_int(0, "SELECT count(*) FROM /*scan*/" |
| 681 | " (SELECT rid FROM blob EXCEPT SELECT x FROM xdone)"); |
| 682 | if( n==0 ){ |
| 683 | printf("all artifacts reachable through clusters\n"); |
| 684 | }else{ |
| 685 | printf("%d unreachable artifacts:\n", n); |
| 686 | db_prepare(&q, "SELECT rid, uuid FROM blob WHERE rid NOT IN xdone"); |
| 687 | while( db_step(&q)==SQLITE_ROW ){ |
| 688 | printf(" %3d %s\n", db_column_int(&q,0), db_column_text(&q,1)); |
| 689 | } |
| 690 | db_finalize(&q); |
| 691 | } |
| 692 | } |
| 693 | |
| @@ -797,11 +799,11 @@ | |
| 797 | } |
| 798 | content_put(&aContent); |
| 799 | blob_reset(&path); |
| 800 | blob_reset(&aContent); |
| 801 | free(zSubpath); |
| 802 | printf("\r%d", ++nFileRead); |
| 803 | fflush(stdout); |
| 804 | } |
| 805 | closedir(d); |
| 806 | }else { |
| 807 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| @@ -824,22 +826,22 @@ | |
| 824 | char *zPassword; |
| 825 | if( g.argc!=4 ){ |
| 826 | usage("FILENAME DIRECTORY"); |
| 827 | } |
| 828 | if( file_isdir(g.argv[3])!=1 ){ |
| 829 | printf("\"%s\" is not a directory\n\n", g.argv[3]); |
| 830 | usage("FILENAME DIRECTORY"); |
| 831 | } |
| 832 | db_create_repository(g.argv[2]); |
| 833 | db_open_repository(g.argv[2]); |
| 834 | db_open_config(0); |
| 835 | db_begin_transaction(); |
| 836 | db_initial_setup(0, 0, 1); |
| 837 | |
| 838 | printf("Reading files from directory \"%s\"...\n", g.argv[3]); |
| 839 | recon_read_dir(g.argv[3]); |
| 840 | printf("\nBuilding the Fossil repository...\n"); |
| 841 | |
| 842 | rebuild_db(0, 1, 1); |
| 843 | |
| 844 | /* Reconstruct the private table. The private table contains the rid |
| 845 | ** of every manifest that is tagged with "private" and every file that |
| @@ -861,14 +863,14 @@ | |
| 861 | ** long time. |
| 862 | */ |
| 863 | verify_cancel(); |
| 864 | |
| 865 | db_end_transaction(0); |
| 866 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 867 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 868 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 869 | printf("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword); |
| 870 | } |
| 871 | |
| 872 | /* |
| 873 | ** COMMAND: deconstruct |
| 874 | ** |
| @@ -928,11 +930,11 @@ | |
| 928 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 929 | bag_init(&bagDone); |
| 930 | ttyOutput = 1; |
| 931 | processCnt = 0; |
| 932 | if (!g.fQuiet) { |
| 933 | printf("0 (0%%)...\r"); |
| 934 | fflush(stdout); |
| 935 | } |
| 936 | totalSize = db_int(0, "SELECT count(*) FROM blob"); |
| 937 | db_prepare(&s, |
| 938 | "SELECT rid, size FROM blob /*scan*/" |
| @@ -964,12 +966,12 @@ | |
| 964 | } |
| 965 | } |
| 966 | } |
| 967 | db_finalize(&s); |
| 968 | if(!g.fQuiet && ttyOutput ){ |
| 969 | printf("\n"); |
| 970 | } |
| 971 | |
| 972 | /* free filename format string */ |
| 973 | free(zFNameFormat); |
| 974 | zFNameFormat = 0; |
| 975 | } |
| 976 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -176,11 +176,11 @@ | |
| 176 | ** The input is actually the permill complete. |
| 177 | */ |
| 178 | static void percent_complete(int permill){ |
| 179 | static int lastOutput = -1; |
| 180 | if( permill>lastOutput ){ |
| 181 | fossil_print(" %d.%d%% complete...\r", permill/10, permill%10); |
| 182 | fflush(stdout); |
| 183 | lastOutput = permill; |
| 184 | } |
| 185 | } |
| 186 | |
| @@ -420,11 +420,11 @@ | |
| 420 | if( !g.fQuiet && totalSize>0 ){ |
| 421 | processCnt += incrSize; |
| 422 | percent_complete((processCnt*1000)/totalSize); |
| 423 | } |
| 424 | if(!g.fQuiet && ttyOutput ){ |
| 425 | fossil_print("\n"); |
| 426 | } |
| 427 | return errCnt; |
| 428 | } |
| 429 | |
| 430 | /* |
| @@ -549,32 +549,34 @@ | |
| 549 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema','%s',now());" |
| 550 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema','%s',now());", |
| 551 | CONTENT_SCHEMA, AUX_SCHEMA |
| 552 | ); |
| 553 | if( errCnt && !forceFlag ){ |
| 554 | fossil_print( |
| 555 | "%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 556 | errCnt |
| 557 | ); |
| 558 | db_end_transaction(1); |
| 559 | }else{ |
| 560 | if( runCompress ){ |
| 561 | fossil_print("Extra delta compression... "); fflush(stdout); |
| 562 | extra_deltification(); |
| 563 | runVacuum = 1; |
| 564 | } |
| 565 | if( omitVerify ) verify_cancel(); |
| 566 | db_end_transaction(0); |
| 567 | if( runCompress ) fossil_print("done\n"); |
| 568 | db_close(0); |
| 569 | db_open_repository(g.zRepositoryName); |
| 570 | if( newPagesize ){ |
| 571 | db_multi_exec("PRAGMA page_size=%d", newPagesize); |
| 572 | runVacuum = 1; |
| 573 | } |
| 574 | if( runVacuum ){ |
| 575 | fossil_print("Vacuuming the database... "); fflush(stdout); |
| 576 | db_multi_exec("VACUUM"); |
| 577 | fossil_print("done\n"); |
| 578 | } |
| 579 | if( activateWal ){ |
| 580 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 581 | } |
| 582 | } |
| @@ -678,16 +680,16 @@ | |
| 680 | manifest_destroy(p); |
| 681 | } |
| 682 | n = db_int(0, "SELECT count(*) FROM /*scan*/" |
| 683 | " (SELECT rid FROM blob EXCEPT SELECT x FROM xdone)"); |
| 684 | if( n==0 ){ |
| 685 | fossil_print("all artifacts reachable through clusters\n"); |
| 686 | }else{ |
| 687 | fossil_print("%d unreachable artifacts:\n", n); |
| 688 | db_prepare(&q, "SELECT rid, uuid FROM blob WHERE rid NOT IN xdone"); |
| 689 | while( db_step(&q)==SQLITE_ROW ){ |
| 690 | fossil_print(" %3d %s\n", db_column_int(&q,0), db_column_text(&q,1)); |
| 691 | } |
| 692 | db_finalize(&q); |
| 693 | } |
| 694 | } |
| 695 | |
| @@ -797,11 +799,11 @@ | |
| 799 | } |
| 800 | content_put(&aContent); |
| 801 | blob_reset(&path); |
| 802 | blob_reset(&aContent); |
| 803 | free(zSubpath); |
| 804 | fossil_print("\r%d", ++nFileRead); |
| 805 | fflush(stdout); |
| 806 | } |
| 807 | closedir(d); |
| 808 | }else { |
| 809 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| @@ -824,22 +826,22 @@ | |
| 826 | char *zPassword; |
| 827 | if( g.argc!=4 ){ |
| 828 | usage("FILENAME DIRECTORY"); |
| 829 | } |
| 830 | if( file_isdir(g.argv[3])!=1 ){ |
| 831 | fossil_print("\"%s\" is not a directory\n\n", g.argv[3]); |
| 832 | usage("FILENAME DIRECTORY"); |
| 833 | } |
| 834 | db_create_repository(g.argv[2]); |
| 835 | db_open_repository(g.argv[2]); |
| 836 | db_open_config(0); |
| 837 | db_begin_transaction(); |
| 838 | db_initial_setup(0, 0, 1); |
| 839 | |
| 840 | fossil_print("Reading files from directory \"%s\"...\n", g.argv[3]); |
| 841 | recon_read_dir(g.argv[3]); |
| 842 | fossil_print("\nBuilding the Fossil repository...\n"); |
| 843 | |
| 844 | rebuild_db(0, 1, 1); |
| 845 | |
| 846 | /* Reconstruct the private table. The private table contains the rid |
| 847 | ** of every manifest that is tagged with "private" and every file that |
| @@ -861,14 +863,14 @@ | |
| 863 | ** long time. |
| 864 | */ |
| 865 | verify_cancel(); |
| 866 | |
| 867 | db_end_transaction(0); |
| 868 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 869 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 870 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 871 | fossil_print("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword); |
| 872 | } |
| 873 | |
| 874 | /* |
| 875 | ** COMMAND: deconstruct |
| 876 | ** |
| @@ -928,11 +930,11 @@ | |
| 930 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 931 | bag_init(&bagDone); |
| 932 | ttyOutput = 1; |
| 933 | processCnt = 0; |
| 934 | if (!g.fQuiet) { |
| 935 | fossil_print("0 (0%%)...\r"); |
| 936 | fflush(stdout); |
| 937 | } |
| 938 | totalSize = db_int(0, "SELECT count(*) FROM blob"); |
| 939 | db_prepare(&s, |
| 940 | "SELECT rid, size FROM blob /*scan*/" |
| @@ -964,12 +966,12 @@ | |
| 966 | } |
| 967 | } |
| 968 | } |
| 969 | db_finalize(&s); |
| 970 | if(!g.fQuiet && ttyOutput ){ |
| 971 | fossil_print("\n"); |
| 972 | } |
| 973 | |
| 974 | /* free filename format string */ |
| 975 | free(zFNameFormat); |
| 976 | zFNameFormat = 0; |
| 977 | } |
| 978 |
+9
-9
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -1000,19 +1000,19 @@ | ||
| 1000 | 1000 | */ |
| 1001 | 1001 | void rpt_list_reports(void){ |
| 1002 | 1002 | Stmt q; |
| 1003 | 1003 | char const aRptOutFrmt[] = "%s\t%s\n"; |
| 1004 | 1004 | |
| 1005 | - printf("Available reports:\n"); | |
| 1006 | - printf(aRptOutFrmt,"report number","report title"); | |
| 1007 | - printf(aRptOutFrmt,zFullTicketRptRn,zFullTicketRptTitle); | |
| 1005 | + fossil_print("Available reports:\n"); | |
| 1006 | + fossil_print(aRptOutFrmt,"report number","report title"); | |
| 1007 | + fossil_print(aRptOutFrmt,zFullTicketRptRn,zFullTicketRptTitle); | |
| 1008 | 1008 | db_prepare(&q,"SELECT rn,title FROM reportfmt ORDER BY rn"); |
| 1009 | 1009 | while( db_step(&q)==SQLITE_ROW ){ |
| 1010 | 1010 | const char *zRn = db_column_text(&q, 0); |
| 1011 | 1011 | const char *zTitle = db_column_text(&q, 1); |
| 1012 | 1012 | |
| 1013 | - printf(aRptOutFrmt,zRn,zTitle); | |
| 1013 | + fossil_print(aRptOutFrmt,zRn,zTitle); | |
| 1014 | 1014 | } |
| 1015 | 1015 | db_finalize(&q); |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | /* |
| @@ -1037,25 +1037,25 @@ | ||
| 1037 | 1037 | case tktFossilize: |
| 1038 | 1038 | { char *zFosZ; |
| 1039 | 1039 | |
| 1040 | 1040 | if( z && *z ){ |
| 1041 | 1041 | zFosZ = fossilize(z,-1); |
| 1042 | - printf("%s",zFosZ); | |
| 1042 | + fossil_print("%s",zFosZ); | |
| 1043 | 1043 | free(zFosZ); |
| 1044 | 1044 | } |
| 1045 | 1045 | break; |
| 1046 | 1046 | } |
| 1047 | 1047 | default: |
| 1048 | 1048 | while( z && z[0] ){ |
| 1049 | 1049 | int i, j; |
| 1050 | 1050 | for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){} |
| 1051 | 1051 | if( i>0 ){ |
| 1052 | - printf("%.*s", i, z); | |
| 1052 | + fossil_print("%.*s", i, z); | |
| 1053 | 1053 | } |
| 1054 | 1054 | for(j=i; fossil_isspace(z[j]); j++){} |
| 1055 | 1055 | if( j>i ){ |
| 1056 | - printf("%*s", j-i, ""); | |
| 1056 | + fossil_print("%*s", j-i, ""); | |
| 1057 | 1057 | } |
| 1058 | 1058 | z += j; |
| 1059 | 1059 | } |
| 1060 | 1060 | break; |
| 1061 | 1061 | } |
| @@ -1074,17 +1074,17 @@ | ||
| 1074 | 1074 | int i; |
| 1075 | 1075 | |
| 1076 | 1076 | if( *pCount==0 ){ |
| 1077 | 1077 | for(i=0; i<nArg; i++){ |
| 1078 | 1078 | output_no_tabs_file(azName[i]); |
| 1079 | - printf("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n"); | |
| 1079 | + fossil_print("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n"); | |
| 1080 | 1080 | } |
| 1081 | 1081 | } |
| 1082 | 1082 | ++*pCount; |
| 1083 | 1083 | for(i=0; i<nArg; i++){ |
| 1084 | 1084 | output_no_tabs_file(azArg[i]); |
| 1085 | - printf("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n"); | |
| 1085 | + fossil_print("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n"); | |
| 1086 | 1086 | } |
| 1087 | 1087 | return 0; |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | /* |
| 1091 | 1091 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -1000,19 +1000,19 @@ | |
| 1000 | */ |
| 1001 | void rpt_list_reports(void){ |
| 1002 | Stmt q; |
| 1003 | char const aRptOutFrmt[] = "%s\t%s\n"; |
| 1004 | |
| 1005 | printf("Available reports:\n"); |
| 1006 | printf(aRptOutFrmt,"report number","report title"); |
| 1007 | printf(aRptOutFrmt,zFullTicketRptRn,zFullTicketRptTitle); |
| 1008 | db_prepare(&q,"SELECT rn,title FROM reportfmt ORDER BY rn"); |
| 1009 | while( db_step(&q)==SQLITE_ROW ){ |
| 1010 | const char *zRn = db_column_text(&q, 0); |
| 1011 | const char *zTitle = db_column_text(&q, 1); |
| 1012 | |
| 1013 | printf(aRptOutFrmt,zRn,zTitle); |
| 1014 | } |
| 1015 | db_finalize(&q); |
| 1016 | } |
| 1017 | |
| 1018 | /* |
| @@ -1037,25 +1037,25 @@ | |
| 1037 | case tktFossilize: |
| 1038 | { char *zFosZ; |
| 1039 | |
| 1040 | if( z && *z ){ |
| 1041 | zFosZ = fossilize(z,-1); |
| 1042 | printf("%s",zFosZ); |
| 1043 | free(zFosZ); |
| 1044 | } |
| 1045 | break; |
| 1046 | } |
| 1047 | default: |
| 1048 | while( z && z[0] ){ |
| 1049 | int i, j; |
| 1050 | for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){} |
| 1051 | if( i>0 ){ |
| 1052 | printf("%.*s", i, z); |
| 1053 | } |
| 1054 | for(j=i; fossil_isspace(z[j]); j++){} |
| 1055 | if( j>i ){ |
| 1056 | printf("%*s", j-i, ""); |
| 1057 | } |
| 1058 | z += j; |
| 1059 | } |
| 1060 | break; |
| 1061 | } |
| @@ -1074,17 +1074,17 @@ | |
| 1074 | int i; |
| 1075 | |
| 1076 | if( *pCount==0 ){ |
| 1077 | for(i=0; i<nArg; i++){ |
| 1078 | output_no_tabs_file(azName[i]); |
| 1079 | printf("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n"); |
| 1080 | } |
| 1081 | } |
| 1082 | ++*pCount; |
| 1083 | for(i=0; i<nArg; i++){ |
| 1084 | output_no_tabs_file(azArg[i]); |
| 1085 | printf("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n"); |
| 1086 | } |
| 1087 | return 0; |
| 1088 | } |
| 1089 | |
| 1090 | /* |
| 1091 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -1000,19 +1000,19 @@ | |
| 1000 | */ |
| 1001 | void rpt_list_reports(void){ |
| 1002 | Stmt q; |
| 1003 | char const aRptOutFrmt[] = "%s\t%s\n"; |
| 1004 | |
| 1005 | fossil_print("Available reports:\n"); |
| 1006 | fossil_print(aRptOutFrmt,"report number","report title"); |
| 1007 | fossil_print(aRptOutFrmt,zFullTicketRptRn,zFullTicketRptTitle); |
| 1008 | db_prepare(&q,"SELECT rn,title FROM reportfmt ORDER BY rn"); |
| 1009 | while( db_step(&q)==SQLITE_ROW ){ |
| 1010 | const char *zRn = db_column_text(&q, 0); |
| 1011 | const char *zTitle = db_column_text(&q, 1); |
| 1012 | |
| 1013 | fossil_print(aRptOutFrmt,zRn,zTitle); |
| 1014 | } |
| 1015 | db_finalize(&q); |
| 1016 | } |
| 1017 | |
| 1018 | /* |
| @@ -1037,25 +1037,25 @@ | |
| 1037 | case tktFossilize: |
| 1038 | { char *zFosZ; |
| 1039 | |
| 1040 | if( z && *z ){ |
| 1041 | zFosZ = fossilize(z,-1); |
| 1042 | fossil_print("%s",zFosZ); |
| 1043 | free(zFosZ); |
| 1044 | } |
| 1045 | break; |
| 1046 | } |
| 1047 | default: |
| 1048 | while( z && z[0] ){ |
| 1049 | int i, j; |
| 1050 | for(i=0; z[i] && (!fossil_isspace(z[i]) || z[i]==' '); i++){} |
| 1051 | if( i>0 ){ |
| 1052 | fossil_print("%.*s", i, z); |
| 1053 | } |
| 1054 | for(j=i; fossil_isspace(z[j]); j++){} |
| 1055 | if( j>i ){ |
| 1056 | fossil_print("%*s", j-i, ""); |
| 1057 | } |
| 1058 | z += j; |
| 1059 | } |
| 1060 | break; |
| 1061 | } |
| @@ -1074,17 +1074,17 @@ | |
| 1074 | int i; |
| 1075 | |
| 1076 | if( *pCount==0 ){ |
| 1077 | for(i=0; i<nArg; i++){ |
| 1078 | output_no_tabs_file(azName[i]); |
| 1079 | fossil_print("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n"); |
| 1080 | } |
| 1081 | } |
| 1082 | ++*pCount; |
| 1083 | for(i=0; i<nArg; i++){ |
| 1084 | output_no_tabs_file(azArg[i]); |
| 1085 | fossil_print("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n"); |
| 1086 | } |
| 1087 | return 0; |
| 1088 | } |
| 1089 | |
| 1090 | /* |
| 1091 |
+1
-1
| --- src/sha1.c | ||
| +++ src/sha1.c | ||
| @@ -430,9 +430,9 @@ | ||
| 430 | 430 | blob_read_from_channel(&in, stdin, -1); |
| 431 | 431 | sha1sum_blob(&in, &cksum); |
| 432 | 432 | }else{ |
| 433 | 433 | sha1sum_file(g.argv[i], &cksum); |
| 434 | 434 | } |
| 435 | - printf("%s %s\n", blob_str(&cksum), g.argv[i]); | |
| 435 | + fossil_print("%s %s\n", blob_str(&cksum), g.argv[i]); | |
| 436 | 436 | blob_reset(&cksum); |
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 |
| --- src/sha1.c | |
| +++ src/sha1.c | |
| @@ -430,9 +430,9 @@ | |
| 430 | blob_read_from_channel(&in, stdin, -1); |
| 431 | sha1sum_blob(&in, &cksum); |
| 432 | }else{ |
| 433 | sha1sum_file(g.argv[i], &cksum); |
| 434 | } |
| 435 | printf("%s %s\n", blob_str(&cksum), g.argv[i]); |
| 436 | blob_reset(&cksum); |
| 437 | } |
| 438 | } |
| 439 |
| --- src/sha1.c | |
| +++ src/sha1.c | |
| @@ -430,9 +430,9 @@ | |
| 430 | blob_read_from_channel(&in, stdin, -1); |
| 431 | sha1sum_blob(&in, &cksum); |
| 432 | }else{ |
| 433 | sha1sum_file(g.argv[i], &cksum); |
| 434 | } |
| 435 | fossil_print("%s %s\n", blob_str(&cksum), g.argv[i]); |
| 436 | blob_reset(&cksum); |
| 437 | } |
| 438 | } |
| 439 |
+12
-12
| --- src/stash.c | ||
| +++ src/stash.c | ||
| @@ -185,13 +185,13 @@ | ||
| 185 | 185 | blob_zero(&delta); |
| 186 | 186 | if( rid==0 ){ |
| 187 | 187 | db_ephemeral_blob(&q, 5, &delta); |
| 188 | 188 | blob_write_to_file(&delta, zNPath); |
| 189 | 189 | file_setexe(zNPath, isExec); |
| 190 | - printf("ADD %s\n", zNew); | |
| 190 | + fossil_print("ADD %s\n", zNew); | |
| 191 | 191 | }else if( isRemoved ){ |
| 192 | - printf("DELETE %s\n", zOrig); | |
| 192 | + fossil_print("DELETE %s\n", zOrig); | |
| 193 | 193 | unlink(zOPath); |
| 194 | 194 | }else{ |
| 195 | 195 | Blob a, b, out, disk; |
| 196 | 196 | db_ephemeral_blob(&q, 5, &delta); |
| 197 | 197 | blob_read_from_file(&disk, zOPath); |
| @@ -198,20 +198,20 @@ | ||
| 198 | 198 | content_get(rid, &a); |
| 199 | 199 | blob_delta_apply(&a, &delta, &b); |
| 200 | 200 | if( blob_compare(&disk, &a)==0 ){ |
| 201 | 201 | blob_write_to_file(&b, zNPath); |
| 202 | 202 | file_setexe(zNPath, isExec); |
| 203 | - printf("UPDATE %s\n", zNew); | |
| 203 | + fossil_print("UPDATE %s\n", zNew); | |
| 204 | 204 | }else{ |
| 205 | 205 | int rc = merge_3way(&a, zOPath, &b, &out); |
| 206 | 206 | blob_write_to_file(&out, zNPath); |
| 207 | 207 | file_setexe(zNPath, isExec); |
| 208 | 208 | if( rc ){ |
| 209 | - printf("CONFLICT %s\n", zNew); | |
| 209 | + fossil_print("CONFLICT %s\n", zNew); | |
| 210 | 210 | nConflict++; |
| 211 | 211 | }else{ |
| 212 | - printf("MERGE %s\n", zNew); | |
| 212 | + fossil_print("MERGE %s\n", zNew); | |
| 213 | 213 | } |
| 214 | 214 | blob_reset(&out); |
| 215 | 215 | } |
| 216 | 216 | blob_reset(&a); |
| 217 | 217 | blob_reset(&b); |
| @@ -223,11 +223,11 @@ | ||
| 223 | 223 | unlink(zOPath); |
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | db_finalize(&q); |
| 227 | 227 | if( nConflict ){ |
| 228 | - printf("WARNING: merge conflicts - see messages above for details.\n"); | |
| 228 | + fossil_print("WARNING: merge conflicts - see messages above for details.\n"); | |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /* |
| 233 | 233 | ** Show the diffs associate with a single stash. |
| @@ -248,25 +248,25 @@ | ||
| 248 | 248 | const char *zNew = db_column_text(&q, 4); |
| 249 | 249 | char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig); |
| 250 | 250 | Blob delta; |
| 251 | 251 | if( rid==0 ){ |
| 252 | 252 | db_ephemeral_blob(&q, 5, &delta); |
| 253 | - printf("ADDED %s\n", zNew); | |
| 253 | + fossil_print("ADDED %s\n", zNew); | |
| 254 | 254 | diff_print_index(zNew); |
| 255 | 255 | diff_file_mem(&empty, &delta, zNew, zDiffCmd, 0); |
| 256 | 256 | }else if( isRemoved ){ |
| 257 | - printf("DELETE %s\n", zOrig); | |
| 257 | + fossil_print("DELETE %s\n", zOrig); | |
| 258 | 258 | blob_read_from_file(&delta, zOPath); |
| 259 | 259 | diff_print_index(zNew); |
| 260 | 260 | diff_file_mem(&delta, &empty, zOrig, zDiffCmd, 0); |
| 261 | 261 | }else{ |
| 262 | 262 | Blob a, b, disk; |
| 263 | 263 | db_ephemeral_blob(&q, 5, &delta); |
| 264 | 264 | blob_read_from_file(&disk, zOPath); |
| 265 | 265 | content_get(rid, &a); |
| 266 | 266 | blob_delta_apply(&a, &delta, &b); |
| 267 | - printf("CHANGED %s\n", zNew); | |
| 267 | + fossil_print("CHANGED %s\n", zNew); | |
| 268 | 268 | diff_file_mem(&disk, &b, zNew, zDiffCmd, 0); |
| 269 | 269 | blob_reset(&a); |
| 270 | 270 | blob_reset(&b); |
| 271 | 271 | blob_reset(&disk); |
| 272 | 272 | } |
| @@ -413,23 +413,23 @@ | ||
| 413 | 413 | " ORDER BY ctime DESC" |
| 414 | 414 | ); |
| 415 | 415 | while( db_step(&q)==SQLITE_ROW ){ |
| 416 | 416 | const char *zCom; |
| 417 | 417 | n++; |
| 418 | - printf("%5d: [%.14s] on %s\n", | |
| 418 | + fossil_print("%5d: [%.14s] on %s\n", | |
| 419 | 419 | db_column_int(&q, 0), |
| 420 | 420 | db_column_text(&q, 1), |
| 421 | 421 | db_column_text(&q, 3) |
| 422 | 422 | ); |
| 423 | 423 | zCom = db_column_text(&q, 2); |
| 424 | 424 | if( zCom && zCom[0] ){ |
| 425 | - printf(" "); | |
| 425 | + fossil_print(" "); | |
| 426 | 426 | comment_print(zCom, 7, 79); |
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | db_finalize(&q); |
| 430 | - if( n==0 ) printf("empty stash\n"); | |
| 430 | + if( n==0 ) fossil_print("empty stash\n"); | |
| 431 | 431 | }else |
| 432 | 432 | if( memcmp(zCmd, "drop", nCmd)==0 ){ |
| 433 | 433 | int allFlag = find_option("all", 0, 0)!=0; |
| 434 | 434 | if( g.argc>4 ) usage("stash apply STASHID"); |
| 435 | 435 | if( allFlag ){ |
| 436 | 436 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -185,13 +185,13 @@ | |
| 185 | blob_zero(&delta); |
| 186 | if( rid==0 ){ |
| 187 | db_ephemeral_blob(&q, 5, &delta); |
| 188 | blob_write_to_file(&delta, zNPath); |
| 189 | file_setexe(zNPath, isExec); |
| 190 | printf("ADD %s\n", zNew); |
| 191 | }else if( isRemoved ){ |
| 192 | printf("DELETE %s\n", zOrig); |
| 193 | unlink(zOPath); |
| 194 | }else{ |
| 195 | Blob a, b, out, disk; |
| 196 | db_ephemeral_blob(&q, 5, &delta); |
| 197 | blob_read_from_file(&disk, zOPath); |
| @@ -198,20 +198,20 @@ | |
| 198 | content_get(rid, &a); |
| 199 | blob_delta_apply(&a, &delta, &b); |
| 200 | if( blob_compare(&disk, &a)==0 ){ |
| 201 | blob_write_to_file(&b, zNPath); |
| 202 | file_setexe(zNPath, isExec); |
| 203 | printf("UPDATE %s\n", zNew); |
| 204 | }else{ |
| 205 | int rc = merge_3way(&a, zOPath, &b, &out); |
| 206 | blob_write_to_file(&out, zNPath); |
| 207 | file_setexe(zNPath, isExec); |
| 208 | if( rc ){ |
| 209 | printf("CONFLICT %s\n", zNew); |
| 210 | nConflict++; |
| 211 | }else{ |
| 212 | printf("MERGE %s\n", zNew); |
| 213 | } |
| 214 | blob_reset(&out); |
| 215 | } |
| 216 | blob_reset(&a); |
| 217 | blob_reset(&b); |
| @@ -223,11 +223,11 @@ | |
| 223 | unlink(zOPath); |
| 224 | } |
| 225 | } |
| 226 | db_finalize(&q); |
| 227 | if( nConflict ){ |
| 228 | printf("WARNING: merge conflicts - see messages above for details.\n"); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | /* |
| 233 | ** Show the diffs associate with a single stash. |
| @@ -248,25 +248,25 @@ | |
| 248 | const char *zNew = db_column_text(&q, 4); |
| 249 | char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig); |
| 250 | Blob delta; |
| 251 | if( rid==0 ){ |
| 252 | db_ephemeral_blob(&q, 5, &delta); |
| 253 | printf("ADDED %s\n", zNew); |
| 254 | diff_print_index(zNew); |
| 255 | diff_file_mem(&empty, &delta, zNew, zDiffCmd, 0); |
| 256 | }else if( isRemoved ){ |
| 257 | printf("DELETE %s\n", zOrig); |
| 258 | blob_read_from_file(&delta, zOPath); |
| 259 | diff_print_index(zNew); |
| 260 | diff_file_mem(&delta, &empty, zOrig, zDiffCmd, 0); |
| 261 | }else{ |
| 262 | Blob a, b, disk; |
| 263 | db_ephemeral_blob(&q, 5, &delta); |
| 264 | blob_read_from_file(&disk, zOPath); |
| 265 | content_get(rid, &a); |
| 266 | blob_delta_apply(&a, &delta, &b); |
| 267 | printf("CHANGED %s\n", zNew); |
| 268 | diff_file_mem(&disk, &b, zNew, zDiffCmd, 0); |
| 269 | blob_reset(&a); |
| 270 | blob_reset(&b); |
| 271 | blob_reset(&disk); |
| 272 | } |
| @@ -413,23 +413,23 @@ | |
| 413 | " ORDER BY ctime DESC" |
| 414 | ); |
| 415 | while( db_step(&q)==SQLITE_ROW ){ |
| 416 | const char *zCom; |
| 417 | n++; |
| 418 | printf("%5d: [%.14s] on %s\n", |
| 419 | db_column_int(&q, 0), |
| 420 | db_column_text(&q, 1), |
| 421 | db_column_text(&q, 3) |
| 422 | ); |
| 423 | zCom = db_column_text(&q, 2); |
| 424 | if( zCom && zCom[0] ){ |
| 425 | printf(" "); |
| 426 | comment_print(zCom, 7, 79); |
| 427 | } |
| 428 | } |
| 429 | db_finalize(&q); |
| 430 | if( n==0 ) printf("empty stash\n"); |
| 431 | }else |
| 432 | if( memcmp(zCmd, "drop", nCmd)==0 ){ |
| 433 | int allFlag = find_option("all", 0, 0)!=0; |
| 434 | if( g.argc>4 ) usage("stash apply STASHID"); |
| 435 | if( allFlag ){ |
| 436 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -185,13 +185,13 @@ | |
| 185 | blob_zero(&delta); |
| 186 | if( rid==0 ){ |
| 187 | db_ephemeral_blob(&q, 5, &delta); |
| 188 | blob_write_to_file(&delta, zNPath); |
| 189 | file_setexe(zNPath, isExec); |
| 190 | fossil_print("ADD %s\n", zNew); |
| 191 | }else if( isRemoved ){ |
| 192 | fossil_print("DELETE %s\n", zOrig); |
| 193 | unlink(zOPath); |
| 194 | }else{ |
| 195 | Blob a, b, out, disk; |
| 196 | db_ephemeral_blob(&q, 5, &delta); |
| 197 | blob_read_from_file(&disk, zOPath); |
| @@ -198,20 +198,20 @@ | |
| 198 | content_get(rid, &a); |
| 199 | blob_delta_apply(&a, &delta, &b); |
| 200 | if( blob_compare(&disk, &a)==0 ){ |
| 201 | blob_write_to_file(&b, zNPath); |
| 202 | file_setexe(zNPath, isExec); |
| 203 | fossil_print("UPDATE %s\n", zNew); |
| 204 | }else{ |
| 205 | int rc = merge_3way(&a, zOPath, &b, &out); |
| 206 | blob_write_to_file(&out, zNPath); |
| 207 | file_setexe(zNPath, isExec); |
| 208 | if( rc ){ |
| 209 | fossil_print("CONFLICT %s\n", zNew); |
| 210 | nConflict++; |
| 211 | }else{ |
| 212 | fossil_print("MERGE %s\n", zNew); |
| 213 | } |
| 214 | blob_reset(&out); |
| 215 | } |
| 216 | blob_reset(&a); |
| 217 | blob_reset(&b); |
| @@ -223,11 +223,11 @@ | |
| 223 | unlink(zOPath); |
| 224 | } |
| 225 | } |
| 226 | db_finalize(&q); |
| 227 | if( nConflict ){ |
| 228 | fossil_print("WARNING: merge conflicts - see messages above for details.\n"); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | /* |
| 233 | ** Show the diffs associate with a single stash. |
| @@ -248,25 +248,25 @@ | |
| 248 | const char *zNew = db_column_text(&q, 4); |
| 249 | char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig); |
| 250 | Blob delta; |
| 251 | if( rid==0 ){ |
| 252 | db_ephemeral_blob(&q, 5, &delta); |
| 253 | fossil_print("ADDED %s\n", zNew); |
| 254 | diff_print_index(zNew); |
| 255 | diff_file_mem(&empty, &delta, zNew, zDiffCmd, 0); |
| 256 | }else if( isRemoved ){ |
| 257 | fossil_print("DELETE %s\n", zOrig); |
| 258 | blob_read_from_file(&delta, zOPath); |
| 259 | diff_print_index(zNew); |
| 260 | diff_file_mem(&delta, &empty, zOrig, zDiffCmd, 0); |
| 261 | }else{ |
| 262 | Blob a, b, disk; |
| 263 | db_ephemeral_blob(&q, 5, &delta); |
| 264 | blob_read_from_file(&disk, zOPath); |
| 265 | content_get(rid, &a); |
| 266 | blob_delta_apply(&a, &delta, &b); |
| 267 | fossil_print("CHANGED %s\n", zNew); |
| 268 | diff_file_mem(&disk, &b, zNew, zDiffCmd, 0); |
| 269 | blob_reset(&a); |
| 270 | blob_reset(&b); |
| 271 | blob_reset(&disk); |
| 272 | } |
| @@ -413,23 +413,23 @@ | |
| 413 | " ORDER BY ctime DESC" |
| 414 | ); |
| 415 | while( db_step(&q)==SQLITE_ROW ){ |
| 416 | const char *zCom; |
| 417 | n++; |
| 418 | fossil_print("%5d: [%.14s] on %s\n", |
| 419 | db_column_int(&q, 0), |
| 420 | db_column_text(&q, 1), |
| 421 | db_column_text(&q, 3) |
| 422 | ); |
| 423 | zCom = db_column_text(&q, 2); |
| 424 | if( zCom && zCom[0] ){ |
| 425 | fossil_print(" "); |
| 426 | comment_print(zCom, 7, 79); |
| 427 | } |
| 428 | } |
| 429 | db_finalize(&q); |
| 430 | if( n==0 ) fossil_print("empty stash\n"); |
| 431 | }else |
| 432 | if( memcmp(zCmd, "drop", nCmd)==0 ){ |
| 433 | int allFlag = find_option("all", 0, 0)!=0; |
| 434 | if( g.argc>4 ) usage("stash apply STASHID"); |
| 435 | if( allFlag ){ |
| 436 |
+4
-4
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -76,11 +76,11 @@ | ||
| 76 | 76 | ** autosync, or something? |
| 77 | 77 | */ |
| 78 | 78 | configSync = CONFIGSET_SHUN; |
| 79 | 79 | } |
| 80 | 80 | #endif |
| 81 | - printf("Autosync: %s\n", g.urlCanonical); | |
| 81 | + fossil_print("Autosync: %s\n", g.urlCanonical); | |
| 82 | 82 | url_enable_proxy("via proxy: "); |
| 83 | 83 | rc = client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0, 0, configSync, 0); |
| 84 | 84 | if( rc ) fossil_warning("Autosync failed"); |
| 85 | 85 | return rc; |
| 86 | 86 | } |
| @@ -124,11 +124,11 @@ | ||
| 124 | 124 | db_set("last-sync-url", g.urlCanonical, 0); |
| 125 | 125 | if( g.urlPasswd ) db_set("last-sync-pw", obscure(g.urlPasswd), 0); |
| 126 | 126 | } |
| 127 | 127 | user_select(); |
| 128 | 128 | if( g.argc==2 ){ |
| 129 | - printf("Server: %s\n", g.urlCanonical); | |
| 129 | + fossil_print("Server: %s\n", g.urlCanonical); | |
| 130 | 130 | } |
| 131 | 131 | url_enable_proxy("via proxy: "); |
| 132 | 132 | *pConfigSync = configSync; |
| 133 | 133 | } |
| 134 | 134 | |
| @@ -263,12 +263,12 @@ | ||
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | zUrl = db_get("last-sync-url", 0); |
| 267 | 267 | if( zUrl==0 ){ |
| 268 | - printf("off\n"); | |
| 268 | + fossil_print("off\n"); | |
| 269 | 269 | return; |
| 270 | 270 | }else{ |
| 271 | 271 | url_parse(zUrl); |
| 272 | - printf("%s\n", g.urlCanonical); | |
| 272 | + fossil_print("%s\n", g.urlCanonical); | |
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -76,11 +76,11 @@ | |
| 76 | ** autosync, or something? |
| 77 | */ |
| 78 | configSync = CONFIGSET_SHUN; |
| 79 | } |
| 80 | #endif |
| 81 | printf("Autosync: %s\n", g.urlCanonical); |
| 82 | url_enable_proxy("via proxy: "); |
| 83 | rc = client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0, 0, configSync, 0); |
| 84 | if( rc ) fossil_warning("Autosync failed"); |
| 85 | return rc; |
| 86 | } |
| @@ -124,11 +124,11 @@ | |
| 124 | db_set("last-sync-url", g.urlCanonical, 0); |
| 125 | if( g.urlPasswd ) db_set("last-sync-pw", obscure(g.urlPasswd), 0); |
| 126 | } |
| 127 | user_select(); |
| 128 | if( g.argc==2 ){ |
| 129 | printf("Server: %s\n", g.urlCanonical); |
| 130 | } |
| 131 | url_enable_proxy("via proxy: "); |
| 132 | *pConfigSync = configSync; |
| 133 | } |
| 134 | |
| @@ -263,12 +263,12 @@ | |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | zUrl = db_get("last-sync-url", 0); |
| 267 | if( zUrl==0 ){ |
| 268 | printf("off\n"); |
| 269 | return; |
| 270 | }else{ |
| 271 | url_parse(zUrl); |
| 272 | printf("%s\n", g.urlCanonical); |
| 273 | } |
| 274 | } |
| 275 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -76,11 +76,11 @@ | |
| 76 | ** autosync, or something? |
| 77 | */ |
| 78 | configSync = CONFIGSET_SHUN; |
| 79 | } |
| 80 | #endif |
| 81 | fossil_print("Autosync: %s\n", g.urlCanonical); |
| 82 | url_enable_proxy("via proxy: "); |
| 83 | rc = client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0, 0, configSync, 0); |
| 84 | if( rc ) fossil_warning("Autosync failed"); |
| 85 | return rc; |
| 86 | } |
| @@ -124,11 +124,11 @@ | |
| 124 | db_set("last-sync-url", g.urlCanonical, 0); |
| 125 | if( g.urlPasswd ) db_set("last-sync-pw", obscure(g.urlPasswd), 0); |
| 126 | } |
| 127 | user_select(); |
| 128 | if( g.argc==2 ){ |
| 129 | fossil_print("Server: %s\n", g.urlCanonical); |
| 130 | } |
| 131 | url_enable_proxy("via proxy: "); |
| 132 | *pConfigSync = configSync; |
| 133 | } |
| 134 | |
| @@ -263,12 +263,12 @@ | |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | zUrl = db_get("last-sync-url", 0); |
| 267 | if( zUrl==0 ){ |
| 268 | fossil_print("off\n"); |
| 269 | return; |
| 270 | }else{ |
| 271 | url_parse(zUrl); |
| 272 | fossil_print("%s\n", g.urlCanonical); |
| 273 | } |
| 274 | } |
| 275 |
+5
-5
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -438,11 +438,11 @@ | ||
| 438 | 438 | " AND tagxref.tagtype>0" |
| 439 | 439 | " AND blob.rid=tagxref.rid", |
| 440 | 440 | g.argv[3] |
| 441 | 441 | ); |
| 442 | 442 | while( db_step(&q)==SQLITE_ROW ){ |
| 443 | - printf("%s\n", db_column_text(&q, 0)); | |
| 443 | + fossil_print("%s\n", db_column_text(&q, 0)); | |
| 444 | 444 | } |
| 445 | 445 | db_finalize(&q); |
| 446 | 446 | }else{ |
| 447 | 447 | int tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", |
| 448 | 448 | g.argv[3]); |
| @@ -473,13 +473,13 @@ | ||
| 473 | 473 | " ORDER BY tagname" |
| 474 | 474 | ); |
| 475 | 475 | while( db_step(&q)==SQLITE_ROW ){ |
| 476 | 476 | const char *zName = db_column_text(&q, 0); |
| 477 | 477 | if( fRaw ){ |
| 478 | - printf("%s\n", zName); | |
| 478 | + fossil_print("%s\n", zName); | |
| 479 | 479 | }else if( strncmp(zName, "sym-", 4)==0 ){ |
| 480 | - printf("%s\n", &zName[4]); | |
| 480 | + fossil_print("%s\n", &zName[4]); | |
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | db_finalize(&q); |
| 484 | 484 | }else if( g.argc==4 ){ |
| 485 | 485 | int rid = name_to_rid(g.argv[3]); |
| @@ -497,13 +497,13 @@ | ||
| 497 | 497 | if( fRaw==0 ){ |
| 498 | 498 | if( strncmp(zName, "sym-", 4)!=0 ) continue; |
| 499 | 499 | zName += 4; |
| 500 | 500 | } |
| 501 | 501 | if( zValue && zValue[0] ){ |
| 502 | - printf("%s=%s\n", zName, zValue); | |
| 502 | + fossil_print("%s=%s\n", zName, zValue); | |
| 503 | 503 | }else{ |
| 504 | - printf("%s\n", zName); | |
| 504 | + fossil_print("%s\n", zName); | |
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | 507 | db_finalize(&q); |
| 508 | 508 | }else{ |
| 509 | 509 | usage("tag list ?CHECK-IN?"); |
| 510 | 510 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -438,11 +438,11 @@ | |
| 438 | " AND tagxref.tagtype>0" |
| 439 | " AND blob.rid=tagxref.rid", |
| 440 | g.argv[3] |
| 441 | ); |
| 442 | while( db_step(&q)==SQLITE_ROW ){ |
| 443 | printf("%s\n", db_column_text(&q, 0)); |
| 444 | } |
| 445 | db_finalize(&q); |
| 446 | }else{ |
| 447 | int tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", |
| 448 | g.argv[3]); |
| @@ -473,13 +473,13 @@ | |
| 473 | " ORDER BY tagname" |
| 474 | ); |
| 475 | while( db_step(&q)==SQLITE_ROW ){ |
| 476 | const char *zName = db_column_text(&q, 0); |
| 477 | if( fRaw ){ |
| 478 | printf("%s\n", zName); |
| 479 | }else if( strncmp(zName, "sym-", 4)==0 ){ |
| 480 | printf("%s\n", &zName[4]); |
| 481 | } |
| 482 | } |
| 483 | db_finalize(&q); |
| 484 | }else if( g.argc==4 ){ |
| 485 | int rid = name_to_rid(g.argv[3]); |
| @@ -497,13 +497,13 @@ | |
| 497 | if( fRaw==0 ){ |
| 498 | if( strncmp(zName, "sym-", 4)!=0 ) continue; |
| 499 | zName += 4; |
| 500 | } |
| 501 | if( zValue && zValue[0] ){ |
| 502 | printf("%s=%s\n", zName, zValue); |
| 503 | }else{ |
| 504 | printf("%s\n", zName); |
| 505 | } |
| 506 | } |
| 507 | db_finalize(&q); |
| 508 | }else{ |
| 509 | usage("tag list ?CHECK-IN?"); |
| 510 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -438,11 +438,11 @@ | |
| 438 | " AND tagxref.tagtype>0" |
| 439 | " AND blob.rid=tagxref.rid", |
| 440 | g.argv[3] |
| 441 | ); |
| 442 | while( db_step(&q)==SQLITE_ROW ){ |
| 443 | fossil_print("%s\n", db_column_text(&q, 0)); |
| 444 | } |
| 445 | db_finalize(&q); |
| 446 | }else{ |
| 447 | int tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", |
| 448 | g.argv[3]); |
| @@ -473,13 +473,13 @@ | |
| 473 | " ORDER BY tagname" |
| 474 | ); |
| 475 | while( db_step(&q)==SQLITE_ROW ){ |
| 476 | const char *zName = db_column_text(&q, 0); |
| 477 | if( fRaw ){ |
| 478 | fossil_print("%s\n", zName); |
| 479 | }else if( strncmp(zName, "sym-", 4)==0 ){ |
| 480 | fossil_print("%s\n", &zName[4]); |
| 481 | } |
| 482 | } |
| 483 | db_finalize(&q); |
| 484 | }else if( g.argc==4 ){ |
| 485 | int rid = name_to_rid(g.argv[3]); |
| @@ -497,13 +497,13 @@ | |
| 497 | if( fRaw==0 ){ |
| 498 | if( strncmp(zName, "sym-", 4)!=0 ) continue; |
| 499 | zName += 4; |
| 500 | } |
| 501 | if( zValue && zValue[0] ){ |
| 502 | fossil_print("%s=%s\n", zName, zValue); |
| 503 | }else{ |
| 504 | fossil_print("%s\n", zName); |
| 505 | } |
| 506 | } |
| 507 | db_finalize(&q); |
| 508 | }else{ |
| 509 | usage("tag list ?CHECK-IN?"); |
| 510 |
+4
-4
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1203,16 +1203,16 @@ | ||
| 1203 | 1203 | char zPrefix[80]; |
| 1204 | 1204 | char zUuid[UUID_SIZE+1]; |
| 1205 | 1205 | |
| 1206 | 1206 | sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId); |
| 1207 | 1207 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 1208 | - printf("=== %.10s ===\n", zDate); | |
| 1208 | + fossil_print("=== %.10s ===\n", zDate); | |
| 1209 | 1209 | memcpy(zPrevDate, zDate, 10); |
| 1210 | 1210 | nLine++; |
| 1211 | 1211 | } |
| 1212 | 1212 | if( zCom==0 ) zCom = ""; |
| 1213 | - printf("%.8s ", &zDate[11]); | |
| 1213 | + fossil_print("%.8s ", &zDate[11]); | |
| 1214 | 1214 | zPrefix[0] = 0; |
| 1215 | 1215 | if( nParent>1 ){ |
| 1216 | 1216 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); |
| 1217 | 1217 | n = strlen(zPrefix); |
| 1218 | 1218 | } |
| @@ -1453,13 +1453,13 @@ | ||
| 1453 | 1453 | " FROM plink p, plink c" |
| 1454 | 1454 | " WHERE p.cid=c.pid AND p.mtime>c.mtime" |
| 1455 | 1455 | ); |
| 1456 | 1456 | while( db_step(&q)==SQLITE_ROW ){ |
| 1457 | 1457 | if( !showDetail ){ |
| 1458 | - printf("%s\n", db_column_text(&q, 1)); | |
| 1458 | + fossil_print("%s\n", db_column_text(&q, 1)); | |
| 1459 | 1459 | }else{ |
| 1460 | - printf("%.14s -> %.14s %s -> %s\n", | |
| 1460 | + fossil_print("%.14s -> %.14s %s -> %s\n", | |
| 1461 | 1461 | db_column_text(&q, 0), |
| 1462 | 1462 | db_column_text(&q, 1), |
| 1463 | 1463 | db_column_text(&q, 2), |
| 1464 | 1464 | db_column_text(&q, 3)); |
| 1465 | 1465 | } |
| 1466 | 1466 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1203,16 +1203,16 @@ | |
| 1203 | char zPrefix[80]; |
| 1204 | char zUuid[UUID_SIZE+1]; |
| 1205 | |
| 1206 | sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId); |
| 1207 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 1208 | printf("=== %.10s ===\n", zDate); |
| 1209 | memcpy(zPrevDate, zDate, 10); |
| 1210 | nLine++; |
| 1211 | } |
| 1212 | if( zCom==0 ) zCom = ""; |
| 1213 | printf("%.8s ", &zDate[11]); |
| 1214 | zPrefix[0] = 0; |
| 1215 | if( nParent>1 ){ |
| 1216 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); |
| 1217 | n = strlen(zPrefix); |
| 1218 | } |
| @@ -1453,13 +1453,13 @@ | |
| 1453 | " FROM plink p, plink c" |
| 1454 | " WHERE p.cid=c.pid AND p.mtime>c.mtime" |
| 1455 | ); |
| 1456 | while( db_step(&q)==SQLITE_ROW ){ |
| 1457 | if( !showDetail ){ |
| 1458 | printf("%s\n", db_column_text(&q, 1)); |
| 1459 | }else{ |
| 1460 | printf("%.14s -> %.14s %s -> %s\n", |
| 1461 | db_column_text(&q, 0), |
| 1462 | db_column_text(&q, 1), |
| 1463 | db_column_text(&q, 2), |
| 1464 | db_column_text(&q, 3)); |
| 1465 | } |
| 1466 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1203,16 +1203,16 @@ | |
| 1203 | char zPrefix[80]; |
| 1204 | char zUuid[UUID_SIZE+1]; |
| 1205 | |
| 1206 | sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId); |
| 1207 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 1208 | fossil_print("=== %.10s ===\n", zDate); |
| 1209 | memcpy(zPrevDate, zDate, 10); |
| 1210 | nLine++; |
| 1211 | } |
| 1212 | if( zCom==0 ) zCom = ""; |
| 1213 | fossil_print("%.8s ", &zDate[11]); |
| 1214 | zPrefix[0] = 0; |
| 1215 | if( nParent>1 ){ |
| 1216 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); |
| 1217 | n = strlen(zPrefix); |
| 1218 | } |
| @@ -1453,13 +1453,13 @@ | |
| 1453 | " FROM plink p, plink c" |
| 1454 | " WHERE p.cid=c.pid AND p.mtime>c.mtime" |
| 1455 | ); |
| 1456 | while( db_step(&q)==SQLITE_ROW ){ |
| 1457 | if( !showDetail ){ |
| 1458 | fossil_print("%s\n", db_column_text(&q, 1)); |
| 1459 | }else{ |
| 1460 | fossil_print("%.14s -> %.14s %s -> %s\n", |
| 1461 | db_column_text(&q, 0), |
| 1462 | db_column_text(&q, 1), |
| 1463 | db_column_text(&q, 2), |
| 1464 | db_column_text(&q, 3)); |
| 1465 | } |
| 1466 |
+14
-13
| --- src/undo.c | ||
| +++ src/undo.c | ||
| @@ -58,18 +58,18 @@ | ||
| 58 | 58 | if( old_exists ){ |
| 59 | 59 | db_ephemeral_blob(&q, 0, &new); |
| 60 | 60 | } |
| 61 | 61 | if( old_exists ){ |
| 62 | 62 | if( new_exists ){ |
| 63 | - printf("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); | |
| 63 | + fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); | |
| 64 | 64 | }else{ |
| 65 | - printf("NEW %s\n", zPathname); | |
| 65 | + fossil_print("NEW %s\n", zPathname); | |
| 66 | 66 | } |
| 67 | 67 | blob_write_to_file(&new, zFullname); |
| 68 | 68 | file_setexe(zFullname, old_exe); |
| 69 | 69 | }else{ |
| 70 | - printf("DELETE %s\n", zPathname); | |
| 70 | + fossil_print("DELETE %s\n", zPathname); | |
| 71 | 71 | unlink(zFullname); |
| 72 | 72 | } |
| 73 | 73 | blob_reset(&new); |
| 74 | 74 | free(zFullname); |
| 75 | 75 | db_finalize(&q); |
| @@ -297,11 +297,11 @@ | ||
| 297 | 297 | ** Complete the undo process is one is currently in process. |
| 298 | 298 | */ |
| 299 | 299 | void undo_finish(void){ |
| 300 | 300 | if( undoActive ){ |
| 301 | 301 | if( undoNeedRollback ){ |
| 302 | - printf("\"fossil undo\" is available to undo changes" | |
| 302 | + fossil_print("\"fossil undo\" is available to undo changes" | |
| 303 | 303 | " to the working checkout.\n"); |
| 304 | 304 | } |
| 305 | 305 | undoActive = 0; |
| 306 | 306 | undoNeedRollback = 0; |
| 307 | 307 | } |
| @@ -319,11 +319,11 @@ | ||
| 319 | 319 | void undo_rollback(void){ |
| 320 | 320 | if( !undoNeedRollback ) return; |
| 321 | 321 | assert( undoActive ); |
| 322 | 322 | undoNeedRollback = 0; |
| 323 | 323 | undoActive = 0; |
| 324 | - printf("Rolling back prior filesystem changes...\n"); | |
| 324 | + fossil_print("Rolling back prior filesystem changes...\n"); | |
| 325 | 325 | undo_all_filesystem(0); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /* |
| 329 | 329 | ** COMMAND: undo |
| @@ -360,34 +360,35 @@ | ||
| 360 | 360 | verify_all_options(); |
| 361 | 361 | db_begin_transaction(); |
| 362 | 362 | undo_available = db_lget_int("undo_available", 0); |
| 363 | 363 | if( explainFlag ){ |
| 364 | 364 | if( undo_available==0 ){ |
| 365 | - printf("No undo or redo is available\n"); | |
| 365 | + fossil_print("No undo or redo is available\n"); | |
| 366 | 366 | }else{ |
| 367 | 367 | Stmt q; |
| 368 | 368 | int nChng = 0; |
| 369 | 369 | zCmd = undo_available==1 ? "undo" : "redo"; |
| 370 | - printf("A %s is available for the following command:\n\n %s %s\n\n", | |
| 371 | - zCmd, g.argv[0], db_lget("undo_cmdline", "???")); | |
| 370 | + fossil_print("A %s is available for the following command:\n\n" | |
| 371 | + " %s %s\n\n", | |
| 372 | + zCmd, g.argv[0], db_lget("undo_cmdline", "???")); | |
| 372 | 373 | db_prepare(&q, |
| 373 | 374 | "SELECT existsflag, pathname FROM undo ORDER BY pathname" |
| 374 | 375 | ); |
| 375 | 376 | while( db_step(&q)==SQLITE_ROW ){ |
| 376 | 377 | if( nChng==0 ){ |
| 377 | - printf("The following file changes would occur if the " | |
| 378 | - "command above is %sne:\n\n", zCmd); | |
| 378 | + fossil_print("The following file changes would occur if the " | |
| 379 | + "command above is %sne:\n\n", zCmd); | |
| 379 | 380 | } |
| 380 | 381 | nChng++; |
| 381 | - printf("%s %s\n", | |
| 382 | + fossil_print("%s %s\n", | |
| 382 | 383 | db_column_int(&q,0) ? "UPDATE" : "DELETE", |
| 383 | 384 | db_column_text(&q, 1) |
| 384 | 385 | ); |
| 385 | 386 | } |
| 386 | 387 | db_finalize(&q); |
| 387 | 388 | if( nChng==0 ){ |
| 388 | - printf("No file changes would occur with this undo/redo.\n"); | |
| 389 | + fossil_print("No file changes would occur with this undo/redo.\n"); | |
| 389 | 390 | } |
| 390 | 391 | } |
| 391 | 392 | }else{ |
| 392 | 393 | int vid1 = db_lget_int("checkout", 0); |
| 393 | 394 | int vid2; |
| @@ -410,11 +411,11 @@ | ||
| 410 | 411 | blob_reset(&path); |
| 411 | 412 | } |
| 412 | 413 | } |
| 413 | 414 | vid2 = db_lget_int("checkout", 0); |
| 414 | 415 | if( vid1!=vid2 ){ |
| 415 | - printf("--------------------\n"); | |
| 416 | + fossil_print("--------------------\n"); | |
| 416 | 417 | show_common_info(vid2, "updated-to:", 1, 0); |
| 417 | 418 | } |
| 418 | 419 | } |
| 419 | 420 | db_end_transaction(0); |
| 420 | 421 | } |
| 421 | 422 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -58,18 +58,18 @@ | |
| 58 | if( old_exists ){ |
| 59 | db_ephemeral_blob(&q, 0, &new); |
| 60 | } |
| 61 | if( old_exists ){ |
| 62 | if( new_exists ){ |
| 63 | printf("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); |
| 64 | }else{ |
| 65 | printf("NEW %s\n", zPathname); |
| 66 | } |
| 67 | blob_write_to_file(&new, zFullname); |
| 68 | file_setexe(zFullname, old_exe); |
| 69 | }else{ |
| 70 | printf("DELETE %s\n", zPathname); |
| 71 | unlink(zFullname); |
| 72 | } |
| 73 | blob_reset(&new); |
| 74 | free(zFullname); |
| 75 | db_finalize(&q); |
| @@ -297,11 +297,11 @@ | |
| 297 | ** Complete the undo process is one is currently in process. |
| 298 | */ |
| 299 | void undo_finish(void){ |
| 300 | if( undoActive ){ |
| 301 | if( undoNeedRollback ){ |
| 302 | printf("\"fossil undo\" is available to undo changes" |
| 303 | " to the working checkout.\n"); |
| 304 | } |
| 305 | undoActive = 0; |
| 306 | undoNeedRollback = 0; |
| 307 | } |
| @@ -319,11 +319,11 @@ | |
| 319 | void undo_rollback(void){ |
| 320 | if( !undoNeedRollback ) return; |
| 321 | assert( undoActive ); |
| 322 | undoNeedRollback = 0; |
| 323 | undoActive = 0; |
| 324 | printf("Rolling back prior filesystem changes...\n"); |
| 325 | undo_all_filesystem(0); |
| 326 | } |
| 327 | |
| 328 | /* |
| 329 | ** COMMAND: undo |
| @@ -360,34 +360,35 @@ | |
| 360 | verify_all_options(); |
| 361 | db_begin_transaction(); |
| 362 | undo_available = db_lget_int("undo_available", 0); |
| 363 | if( explainFlag ){ |
| 364 | if( undo_available==0 ){ |
| 365 | printf("No undo or redo is available\n"); |
| 366 | }else{ |
| 367 | Stmt q; |
| 368 | int nChng = 0; |
| 369 | zCmd = undo_available==1 ? "undo" : "redo"; |
| 370 | printf("A %s is available for the following command:\n\n %s %s\n\n", |
| 371 | zCmd, g.argv[0], db_lget("undo_cmdline", "???")); |
| 372 | db_prepare(&q, |
| 373 | "SELECT existsflag, pathname FROM undo ORDER BY pathname" |
| 374 | ); |
| 375 | while( db_step(&q)==SQLITE_ROW ){ |
| 376 | if( nChng==0 ){ |
| 377 | printf("The following file changes would occur if the " |
| 378 | "command above is %sne:\n\n", zCmd); |
| 379 | } |
| 380 | nChng++; |
| 381 | printf("%s %s\n", |
| 382 | db_column_int(&q,0) ? "UPDATE" : "DELETE", |
| 383 | db_column_text(&q, 1) |
| 384 | ); |
| 385 | } |
| 386 | db_finalize(&q); |
| 387 | if( nChng==0 ){ |
| 388 | printf("No file changes would occur with this undo/redo.\n"); |
| 389 | } |
| 390 | } |
| 391 | }else{ |
| 392 | int vid1 = db_lget_int("checkout", 0); |
| 393 | int vid2; |
| @@ -410,11 +411,11 @@ | |
| 410 | blob_reset(&path); |
| 411 | } |
| 412 | } |
| 413 | vid2 = db_lget_int("checkout", 0); |
| 414 | if( vid1!=vid2 ){ |
| 415 | printf("--------------------\n"); |
| 416 | show_common_info(vid2, "updated-to:", 1, 0); |
| 417 | } |
| 418 | } |
| 419 | db_end_transaction(0); |
| 420 | } |
| 421 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -58,18 +58,18 @@ | |
| 58 | if( old_exists ){ |
| 59 | db_ephemeral_blob(&q, 0, &new); |
| 60 | } |
| 61 | if( old_exists ){ |
| 62 | if( new_exists ){ |
| 63 | fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); |
| 64 | }else{ |
| 65 | fossil_print("NEW %s\n", zPathname); |
| 66 | } |
| 67 | blob_write_to_file(&new, zFullname); |
| 68 | file_setexe(zFullname, old_exe); |
| 69 | }else{ |
| 70 | fossil_print("DELETE %s\n", zPathname); |
| 71 | unlink(zFullname); |
| 72 | } |
| 73 | blob_reset(&new); |
| 74 | free(zFullname); |
| 75 | db_finalize(&q); |
| @@ -297,11 +297,11 @@ | |
| 297 | ** Complete the undo process is one is currently in process. |
| 298 | */ |
| 299 | void undo_finish(void){ |
| 300 | if( undoActive ){ |
| 301 | if( undoNeedRollback ){ |
| 302 | fossil_print("\"fossil undo\" is available to undo changes" |
| 303 | " to the working checkout.\n"); |
| 304 | } |
| 305 | undoActive = 0; |
| 306 | undoNeedRollback = 0; |
| 307 | } |
| @@ -319,11 +319,11 @@ | |
| 319 | void undo_rollback(void){ |
| 320 | if( !undoNeedRollback ) return; |
| 321 | assert( undoActive ); |
| 322 | undoNeedRollback = 0; |
| 323 | undoActive = 0; |
| 324 | fossil_print("Rolling back prior filesystem changes...\n"); |
| 325 | undo_all_filesystem(0); |
| 326 | } |
| 327 | |
| 328 | /* |
| 329 | ** COMMAND: undo |
| @@ -360,34 +360,35 @@ | |
| 360 | verify_all_options(); |
| 361 | db_begin_transaction(); |
| 362 | undo_available = db_lget_int("undo_available", 0); |
| 363 | if( explainFlag ){ |
| 364 | if( undo_available==0 ){ |
| 365 | fossil_print("No undo or redo is available\n"); |
| 366 | }else{ |
| 367 | Stmt q; |
| 368 | int nChng = 0; |
| 369 | zCmd = undo_available==1 ? "undo" : "redo"; |
| 370 | fossil_print("A %s is available for the following command:\n\n" |
| 371 | " %s %s\n\n", |
| 372 | zCmd, g.argv[0], db_lget("undo_cmdline", "???")); |
| 373 | db_prepare(&q, |
| 374 | "SELECT existsflag, pathname FROM undo ORDER BY pathname" |
| 375 | ); |
| 376 | while( db_step(&q)==SQLITE_ROW ){ |
| 377 | if( nChng==0 ){ |
| 378 | fossil_print("The following file changes would occur if the " |
| 379 | "command above is %sne:\n\n", zCmd); |
| 380 | } |
| 381 | nChng++; |
| 382 | fossil_print("%s %s\n", |
| 383 | db_column_int(&q,0) ? "UPDATE" : "DELETE", |
| 384 | db_column_text(&q, 1) |
| 385 | ); |
| 386 | } |
| 387 | db_finalize(&q); |
| 388 | if( nChng==0 ){ |
| 389 | fossil_print("No file changes would occur with this undo/redo.\n"); |
| 390 | } |
| 391 | } |
| 392 | }else{ |
| 393 | int vid1 = db_lget_int("checkout", 0); |
| 394 | int vid2; |
| @@ -410,11 +411,11 @@ | |
| 411 | blob_reset(&path); |
| 412 | } |
| 413 | } |
| 414 | vid2 = db_lget_int("checkout", 0); |
| 415 | if( vid1!=vid2 ){ |
| 416 | fossil_print("--------------------\n"); |
| 417 | show_common_info(vid2, "updated-to:", 1, 0); |
| 418 | } |
| 419 | } |
| 420 | db_end_transaction(0); |
| 421 | } |
| 422 |
+21
-20
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -253,18 +253,18 @@ | ||
| 253 | 253 | if( debugFlag ){ |
| 254 | 254 | db_prepare(&q, |
| 255 | 255 | "SELECT rowid, fn, fnt, chnged, ridv, ridt, isexe FROM fv" |
| 256 | 256 | ); |
| 257 | 257 | while( db_step(&q)==SQLITE_ROW ){ |
| 258 | - printf("%3d: ridv=%-4d ridt=%-4d chnged=%d isexe=%d\n", | |
| 258 | + fossil_print("%3d: ridv=%-4d ridt=%-4d chnged=%d isexe=%d\n", | |
| 259 | 259 | db_column_int(&q, 0), |
| 260 | 260 | db_column_int(&q, 4), |
| 261 | 261 | db_column_int(&q, 5), |
| 262 | 262 | db_column_int(&q, 3), |
| 263 | 263 | db_column_int(&q, 6)); |
| 264 | - printf(" fnv = [%s]\n", db_column_text(&q, 1)); | |
| 265 | - printf(" fnt = [%s]\n", db_column_text(&q, 2)); | |
| 264 | + fossil_print(" fnv = [%s]\n", db_column_text(&q, 1)); | |
| 265 | + fossil_print(" fnt = [%s]\n", db_column_text(&q, 2)); | |
| 266 | 266 | } |
| 267 | 267 | db_finalize(&q); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /* If FILES appear on the command-line, remove from the "fv" table |
| @@ -331,26 +331,26 @@ | ||
| 331 | 331 | nameChng = fossil_strcmp(zName, zNewName); |
| 332 | 332 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 333 | 333 | /* Conflict. This file has been added to the current checkout |
| 334 | 334 | ** but also exists in the target checkout. Use the current version. |
| 335 | 335 | */ |
| 336 | - printf("CONFLICT %s\n", zName); | |
| 336 | + fossil_print("CONFLICT %s\n", zName); | |
| 337 | 337 | nConflict++; |
| 338 | 338 | }else if( idt>0 && idv==0 ){ |
| 339 | 339 | /* File added in the target. */ |
| 340 | - printf("ADD %s\n", zName); | |
| 340 | + fossil_print("ADD %s\n", zName); | |
| 341 | 341 | undo_save(zName); |
| 342 | 342 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 343 | 343 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged==0 ){ |
| 344 | 344 | /* The file is unedited. Change it to the target version */ |
| 345 | 345 | undo_save(zName); |
| 346 | - printf("UPDATE %s\n", zName); | |
| 346 | + fossil_print("UPDATE %s\n", zName); | |
| 347 | 347 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 348 | 348 | }else if( idt>0 && idv>0 && file_size(zFullPath)<0 ){ |
| 349 | 349 | /* The file missing from the local check-out. Restore it to the |
| 350 | 350 | ** version that appears in the target. */ |
| 351 | - printf("UPDATE %s\n", zName); | |
| 351 | + fossil_print("UPDATE %s\n", zName); | |
| 352 | 352 | undo_save(zName); |
| 353 | 353 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 354 | 354 | }else if( idt==0 && idv>0 ){ |
| 355 | 355 | if( ridv==0 ){ |
| 356 | 356 | /* Added in current checkout. Continue to hold the file as |
| @@ -357,25 +357,26 @@ | ||
| 357 | 357 | ** as an addition */ |
| 358 | 358 | db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv); |
| 359 | 359 | }else if( chnged ){ |
| 360 | 360 | /* Edited locally but deleted from the target. Do not track the |
| 361 | 361 | ** file but keep the edited version around. */ |
| 362 | - printf("CONFLICT %s - edited locally but deleted by update\n", zName); | |
| 362 | + fossil_print("CONFLICT %s - edited locally but deleted by update\n", | |
| 363 | + zName); | |
| 363 | 364 | nConflict++; |
| 364 | 365 | }else{ |
| 365 | - printf("REMOVE %s\n", zName); | |
| 366 | + fossil_print("REMOVE %s\n", zName); | |
| 366 | 367 | undo_save(zName); |
| 367 | 368 | if( !nochangeFlag ) unlink(zFullPath); |
| 368 | 369 | } |
| 369 | 370 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 370 | 371 | /* Merge the changes in the current tree into the target version */ |
| 371 | 372 | Blob r, t, v; |
| 372 | 373 | int rc; |
| 373 | 374 | if( nameChng ){ |
| 374 | - printf("MERGE %s -> %s\n", zName, zNewName); | |
| 375 | + fossil_print("MERGE %s -> %s\n", zName, zNewName); | |
| 375 | 376 | }else{ |
| 376 | - printf("MERGE %s\n", zName); | |
| 377 | + fossil_print("MERGE %s\n", zName); | |
| 377 | 378 | } |
| 378 | 379 | undo_save(zName); |
| 379 | 380 | content_get(ridt, &t); |
| 380 | 381 | content_get(ridv, &v); |
| 381 | 382 | rc = merge_3way(&v, zFullPath, &t, &r); |
| @@ -383,51 +384,51 @@ | ||
| 383 | 384 | if( !nochangeFlag ){ |
| 384 | 385 | blob_write_to_file(&r, zFullNewPath); |
| 385 | 386 | file_setexe(zFullNewPath, isexe); |
| 386 | 387 | } |
| 387 | 388 | if( rc>0 ){ |
| 388 | - printf("***** %d merge conflicts in %s\n", rc, zNewName); | |
| 389 | + fossil_print("***** %d merge conflicts in %s\n", rc, zNewName); | |
| 389 | 390 | nConflict++; |
| 390 | 391 | } |
| 391 | 392 | }else{ |
| 392 | 393 | if( !nochangeFlag ){ |
| 393 | 394 | blob_write_to_file(&t, zFullNewPath); |
| 394 | 395 | file_setexe(zFullNewPath, isexe); |
| 395 | 396 | } |
| 396 | - printf("***** Cannot merge binary file %s\n", zNewName); | |
| 397 | + fossil_print("***** Cannot merge binary file %s\n", zNewName); | |
| 397 | 398 | nConflict++; |
| 398 | 399 | } |
| 399 | 400 | if( nameChng && !nochangeFlag ) unlink(zFullPath); |
| 400 | 401 | blob_reset(&v); |
| 401 | 402 | blob_reset(&t); |
| 402 | 403 | blob_reset(&r); |
| 403 | 404 | }else{ |
| 404 | 405 | if( chnged ){ |
| 405 | - if( verboseFlag ) printf("EDITED %s\n", zName); | |
| 406 | + if( verboseFlag ) fossil_print("EDITED %s\n", zName); | |
| 406 | 407 | }else{ |
| 407 | 408 | db_bind_int(&mtimeXfer, ":idv", idv); |
| 408 | 409 | db_bind_int(&mtimeXfer, ":idt", idt); |
| 409 | 410 | db_step(&mtimeXfer); |
| 410 | 411 | db_reset(&mtimeXfer); |
| 411 | - if( verboseFlag ) printf("UNCHANGED %s\n", zName); | |
| 412 | + if( verboseFlag ) fossil_print("UNCHANGED %s\n", zName); | |
| 412 | 413 | } |
| 413 | 414 | } |
| 414 | 415 | free(zFullPath); |
| 415 | 416 | free(zFullNewPath); |
| 416 | 417 | } |
| 417 | 418 | db_finalize(&q); |
| 418 | 419 | db_finalize(&mtimeXfer); |
| 419 | - printf("--------------\n"); | |
| 420 | + fossil_print("--------------\n"); | |
| 420 | 421 | show_common_info(tid, "updated-to:", 1, 0); |
| 421 | 422 | |
| 422 | 423 | /* Report on conflicts |
| 423 | 424 | */ |
| 424 | 425 | if( nConflict && !nochangeFlag ){ |
| 425 | 426 | if( internalUpdate ){ |
| 426 | 427 | internalConflictCnt = nConflict; |
| 427 | 428 | }else{ |
| 428 | - printf("WARNING: %d merge conflicts - see messages above for details.\n", | |
| 429 | + fossil_print("WARNING: %d merge conflicts - see messages above for details.\n", | |
| 429 | 430 | nConflict); |
| 430 | 431 | } |
| 431 | 432 | } |
| 432 | 433 | |
| 433 | 434 | /* |
| @@ -570,23 +571,23 @@ | ||
| 570 | 571 | zFile = db_column_text(&q, 0); |
| 571 | 572 | zFull = mprintf("%/%/", g.zLocalRoot, zFile); |
| 572 | 573 | errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2); |
| 573 | 574 | if( errCode==2 ){ |
| 574 | 575 | if( db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFile)==0 ){ |
| 575 | - printf("UNMANAGE: %s\n", zFile); | |
| 576 | + fossil_print("UNMANAGE: %s\n", zFile); | |
| 576 | 577 | }else{ |
| 577 | 578 | undo_save(zFile); |
| 578 | 579 | unlink(zFull); |
| 579 | - printf("DELETE: %s\n", zFile); | |
| 580 | + fossil_print("DELETE: %s\n", zFile); | |
| 580 | 581 | } |
| 581 | 582 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 582 | 583 | }else{ |
| 583 | 584 | sqlite3_int64 mtime; |
| 584 | 585 | undo_save(zFile); |
| 585 | 586 | blob_write_to_file(&record, zFull); |
| 586 | 587 | file_setexe(zFull, isExe); |
| 587 | - printf("REVERTED: %s\n", zFile); | |
| 588 | + fossil_print("REVERTED: %s\n", zFile); | |
| 588 | 589 | mtime = file_mtime(zFull); |
| 589 | 590 | db_multi_exec( |
| 590 | 591 | "UPDATE vfile" |
| 591 | 592 | " SET mtime=%lld, chnged=0, deleted=0, isexe=%d, mrid=rid," |
| 592 | 593 | " pathname=coalesce(origname,pathname), origname=NULL" |
| 593 | 594 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -253,18 +253,18 @@ | |
| 253 | if( debugFlag ){ |
| 254 | db_prepare(&q, |
| 255 | "SELECT rowid, fn, fnt, chnged, ridv, ridt, isexe FROM fv" |
| 256 | ); |
| 257 | while( db_step(&q)==SQLITE_ROW ){ |
| 258 | printf("%3d: ridv=%-4d ridt=%-4d chnged=%d isexe=%d\n", |
| 259 | db_column_int(&q, 0), |
| 260 | db_column_int(&q, 4), |
| 261 | db_column_int(&q, 5), |
| 262 | db_column_int(&q, 3), |
| 263 | db_column_int(&q, 6)); |
| 264 | printf(" fnv = [%s]\n", db_column_text(&q, 1)); |
| 265 | printf(" fnt = [%s]\n", db_column_text(&q, 2)); |
| 266 | } |
| 267 | db_finalize(&q); |
| 268 | } |
| 269 | |
| 270 | /* If FILES appear on the command-line, remove from the "fv" table |
| @@ -331,26 +331,26 @@ | |
| 331 | nameChng = fossil_strcmp(zName, zNewName); |
| 332 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 333 | /* Conflict. This file has been added to the current checkout |
| 334 | ** but also exists in the target checkout. Use the current version. |
| 335 | */ |
| 336 | printf("CONFLICT %s\n", zName); |
| 337 | nConflict++; |
| 338 | }else if( idt>0 && idv==0 ){ |
| 339 | /* File added in the target. */ |
| 340 | printf("ADD %s\n", zName); |
| 341 | undo_save(zName); |
| 342 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 343 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged==0 ){ |
| 344 | /* The file is unedited. Change it to the target version */ |
| 345 | undo_save(zName); |
| 346 | printf("UPDATE %s\n", zName); |
| 347 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 348 | }else if( idt>0 && idv>0 && file_size(zFullPath)<0 ){ |
| 349 | /* The file missing from the local check-out. Restore it to the |
| 350 | ** version that appears in the target. */ |
| 351 | printf("UPDATE %s\n", zName); |
| 352 | undo_save(zName); |
| 353 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 354 | }else if( idt==0 && idv>0 ){ |
| 355 | if( ridv==0 ){ |
| 356 | /* Added in current checkout. Continue to hold the file as |
| @@ -357,25 +357,26 @@ | |
| 357 | ** as an addition */ |
| 358 | db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv); |
| 359 | }else if( chnged ){ |
| 360 | /* Edited locally but deleted from the target. Do not track the |
| 361 | ** file but keep the edited version around. */ |
| 362 | printf("CONFLICT %s - edited locally but deleted by update\n", zName); |
| 363 | nConflict++; |
| 364 | }else{ |
| 365 | printf("REMOVE %s\n", zName); |
| 366 | undo_save(zName); |
| 367 | if( !nochangeFlag ) unlink(zFullPath); |
| 368 | } |
| 369 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 370 | /* Merge the changes in the current tree into the target version */ |
| 371 | Blob r, t, v; |
| 372 | int rc; |
| 373 | if( nameChng ){ |
| 374 | printf("MERGE %s -> %s\n", zName, zNewName); |
| 375 | }else{ |
| 376 | printf("MERGE %s\n", zName); |
| 377 | } |
| 378 | undo_save(zName); |
| 379 | content_get(ridt, &t); |
| 380 | content_get(ridv, &v); |
| 381 | rc = merge_3way(&v, zFullPath, &t, &r); |
| @@ -383,51 +384,51 @@ | |
| 383 | if( !nochangeFlag ){ |
| 384 | blob_write_to_file(&r, zFullNewPath); |
| 385 | file_setexe(zFullNewPath, isexe); |
| 386 | } |
| 387 | if( rc>0 ){ |
| 388 | printf("***** %d merge conflicts in %s\n", rc, zNewName); |
| 389 | nConflict++; |
| 390 | } |
| 391 | }else{ |
| 392 | if( !nochangeFlag ){ |
| 393 | blob_write_to_file(&t, zFullNewPath); |
| 394 | file_setexe(zFullNewPath, isexe); |
| 395 | } |
| 396 | printf("***** Cannot merge binary file %s\n", zNewName); |
| 397 | nConflict++; |
| 398 | } |
| 399 | if( nameChng && !nochangeFlag ) unlink(zFullPath); |
| 400 | blob_reset(&v); |
| 401 | blob_reset(&t); |
| 402 | blob_reset(&r); |
| 403 | }else{ |
| 404 | if( chnged ){ |
| 405 | if( verboseFlag ) printf("EDITED %s\n", zName); |
| 406 | }else{ |
| 407 | db_bind_int(&mtimeXfer, ":idv", idv); |
| 408 | db_bind_int(&mtimeXfer, ":idt", idt); |
| 409 | db_step(&mtimeXfer); |
| 410 | db_reset(&mtimeXfer); |
| 411 | if( verboseFlag ) printf("UNCHANGED %s\n", zName); |
| 412 | } |
| 413 | } |
| 414 | free(zFullPath); |
| 415 | free(zFullNewPath); |
| 416 | } |
| 417 | db_finalize(&q); |
| 418 | db_finalize(&mtimeXfer); |
| 419 | printf("--------------\n"); |
| 420 | show_common_info(tid, "updated-to:", 1, 0); |
| 421 | |
| 422 | /* Report on conflicts |
| 423 | */ |
| 424 | if( nConflict && !nochangeFlag ){ |
| 425 | if( internalUpdate ){ |
| 426 | internalConflictCnt = nConflict; |
| 427 | }else{ |
| 428 | printf("WARNING: %d merge conflicts - see messages above for details.\n", |
| 429 | nConflict); |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | /* |
| @@ -570,23 +571,23 @@ | |
| 570 | zFile = db_column_text(&q, 0); |
| 571 | zFull = mprintf("%/%/", g.zLocalRoot, zFile); |
| 572 | errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2); |
| 573 | if( errCode==2 ){ |
| 574 | if( db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFile)==0 ){ |
| 575 | printf("UNMANAGE: %s\n", zFile); |
| 576 | }else{ |
| 577 | undo_save(zFile); |
| 578 | unlink(zFull); |
| 579 | printf("DELETE: %s\n", zFile); |
| 580 | } |
| 581 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 582 | }else{ |
| 583 | sqlite3_int64 mtime; |
| 584 | undo_save(zFile); |
| 585 | blob_write_to_file(&record, zFull); |
| 586 | file_setexe(zFull, isExe); |
| 587 | printf("REVERTED: %s\n", zFile); |
| 588 | mtime = file_mtime(zFull); |
| 589 | db_multi_exec( |
| 590 | "UPDATE vfile" |
| 591 | " SET mtime=%lld, chnged=0, deleted=0, isexe=%d, mrid=rid," |
| 592 | " pathname=coalesce(origname,pathname), origname=NULL" |
| 593 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -253,18 +253,18 @@ | |
| 253 | if( debugFlag ){ |
| 254 | db_prepare(&q, |
| 255 | "SELECT rowid, fn, fnt, chnged, ridv, ridt, isexe FROM fv" |
| 256 | ); |
| 257 | while( db_step(&q)==SQLITE_ROW ){ |
| 258 | fossil_print("%3d: ridv=%-4d ridt=%-4d chnged=%d isexe=%d\n", |
| 259 | db_column_int(&q, 0), |
| 260 | db_column_int(&q, 4), |
| 261 | db_column_int(&q, 5), |
| 262 | db_column_int(&q, 3), |
| 263 | db_column_int(&q, 6)); |
| 264 | fossil_print(" fnv = [%s]\n", db_column_text(&q, 1)); |
| 265 | fossil_print(" fnt = [%s]\n", db_column_text(&q, 2)); |
| 266 | } |
| 267 | db_finalize(&q); |
| 268 | } |
| 269 | |
| 270 | /* If FILES appear on the command-line, remove from the "fv" table |
| @@ -331,26 +331,26 @@ | |
| 331 | nameChng = fossil_strcmp(zName, zNewName); |
| 332 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 333 | /* Conflict. This file has been added to the current checkout |
| 334 | ** but also exists in the target checkout. Use the current version. |
| 335 | */ |
| 336 | fossil_print("CONFLICT %s\n", zName); |
| 337 | nConflict++; |
| 338 | }else if( idt>0 && idv==0 ){ |
| 339 | /* File added in the target. */ |
| 340 | fossil_print("ADD %s\n", zName); |
| 341 | undo_save(zName); |
| 342 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 343 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged==0 ){ |
| 344 | /* The file is unedited. Change it to the target version */ |
| 345 | undo_save(zName); |
| 346 | fossil_print("UPDATE %s\n", zName); |
| 347 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 348 | }else if( idt>0 && idv>0 && file_size(zFullPath)<0 ){ |
| 349 | /* The file missing from the local check-out. Restore it to the |
| 350 | ** version that appears in the target. */ |
| 351 | fossil_print("UPDATE %s\n", zName); |
| 352 | undo_save(zName); |
| 353 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 354 | }else if( idt==0 && idv>0 ){ |
| 355 | if( ridv==0 ){ |
| 356 | /* Added in current checkout. Continue to hold the file as |
| @@ -357,25 +357,26 @@ | |
| 357 | ** as an addition */ |
| 358 | db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv); |
| 359 | }else if( chnged ){ |
| 360 | /* Edited locally but deleted from the target. Do not track the |
| 361 | ** file but keep the edited version around. */ |
| 362 | fossil_print("CONFLICT %s - edited locally but deleted by update\n", |
| 363 | zName); |
| 364 | nConflict++; |
| 365 | }else{ |
| 366 | fossil_print("REMOVE %s\n", zName); |
| 367 | undo_save(zName); |
| 368 | if( !nochangeFlag ) unlink(zFullPath); |
| 369 | } |
| 370 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 371 | /* Merge the changes in the current tree into the target version */ |
| 372 | Blob r, t, v; |
| 373 | int rc; |
| 374 | if( nameChng ){ |
| 375 | fossil_print("MERGE %s -> %s\n", zName, zNewName); |
| 376 | }else{ |
| 377 | fossil_print("MERGE %s\n", zName); |
| 378 | } |
| 379 | undo_save(zName); |
| 380 | content_get(ridt, &t); |
| 381 | content_get(ridv, &v); |
| 382 | rc = merge_3way(&v, zFullPath, &t, &r); |
| @@ -383,51 +384,51 @@ | |
| 384 | if( !nochangeFlag ){ |
| 385 | blob_write_to_file(&r, zFullNewPath); |
| 386 | file_setexe(zFullNewPath, isexe); |
| 387 | } |
| 388 | if( rc>0 ){ |
| 389 | fossil_print("***** %d merge conflicts in %s\n", rc, zNewName); |
| 390 | nConflict++; |
| 391 | } |
| 392 | }else{ |
| 393 | if( !nochangeFlag ){ |
| 394 | blob_write_to_file(&t, zFullNewPath); |
| 395 | file_setexe(zFullNewPath, isexe); |
| 396 | } |
| 397 | fossil_print("***** Cannot merge binary file %s\n", zNewName); |
| 398 | nConflict++; |
| 399 | } |
| 400 | if( nameChng && !nochangeFlag ) unlink(zFullPath); |
| 401 | blob_reset(&v); |
| 402 | blob_reset(&t); |
| 403 | blob_reset(&r); |
| 404 | }else{ |
| 405 | if( chnged ){ |
| 406 | if( verboseFlag ) fossil_print("EDITED %s\n", zName); |
| 407 | }else{ |
| 408 | db_bind_int(&mtimeXfer, ":idv", idv); |
| 409 | db_bind_int(&mtimeXfer, ":idt", idt); |
| 410 | db_step(&mtimeXfer); |
| 411 | db_reset(&mtimeXfer); |
| 412 | if( verboseFlag ) fossil_print("UNCHANGED %s\n", zName); |
| 413 | } |
| 414 | } |
| 415 | free(zFullPath); |
| 416 | free(zFullNewPath); |
| 417 | } |
| 418 | db_finalize(&q); |
| 419 | db_finalize(&mtimeXfer); |
| 420 | fossil_print("--------------\n"); |
| 421 | show_common_info(tid, "updated-to:", 1, 0); |
| 422 | |
| 423 | /* Report on conflicts |
| 424 | */ |
| 425 | if( nConflict && !nochangeFlag ){ |
| 426 | if( internalUpdate ){ |
| 427 | internalConflictCnt = nConflict; |
| 428 | }else{ |
| 429 | fossil_print("WARNING: %d merge conflicts - see messages above for details.\n", |
| 430 | nConflict); |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | /* |
| @@ -570,23 +571,23 @@ | |
| 571 | zFile = db_column_text(&q, 0); |
| 572 | zFull = mprintf("%/%/", g.zLocalRoot, zFile); |
| 573 | errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2); |
| 574 | if( errCode==2 ){ |
| 575 | if( db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFile)==0 ){ |
| 576 | fossil_print("UNMANAGE: %s\n", zFile); |
| 577 | }else{ |
| 578 | undo_save(zFile); |
| 579 | unlink(zFull); |
| 580 | fossil_print("DELETE: %s\n", zFile); |
| 581 | } |
| 582 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 583 | }else{ |
| 584 | sqlite3_int64 mtime; |
| 585 | undo_save(zFile); |
| 586 | blob_write_to_file(&record, zFull); |
| 587 | file_setexe(zFull, isExe); |
| 588 | fossil_print("REVERTED: %s\n", zFile); |
| 589 | mtime = file_mtime(zFull); |
| 590 | db_multi_exec( |
| 591 | "UPDATE vfile" |
| 592 | " SET mtime=%lld, chnged=0, deleted=0, isexe=%d, mrid=rid," |
| 593 | " pathname=coalesce(origname,pathname), origname=NULL" |
| 594 |
+15
-15
| --- src/url.c | ||
| +++ src/url.c | ||
| @@ -208,26 +208,26 @@ | ||
| 208 | 208 | if( g.argc!=3 && g.argc!=4 ){ |
| 209 | 209 | usage("URL"); |
| 210 | 210 | } |
| 211 | 211 | url_parse(g.argv[2]); |
| 212 | 212 | for(i=0; i<2; i++){ |
| 213 | - printf("g.urlIsFile = %d\n", g.urlIsFile); | |
| 214 | - printf("g.urlIsHttps = %d\n", g.urlIsHttps); | |
| 215 | - printf("g.urlIsSsh = %d\n", g.urlIsSsh); | |
| 216 | - printf("g.urlProtocol = %s\n", g.urlProtocol); | |
| 217 | - printf("g.urlName = %s\n", g.urlName); | |
| 218 | - printf("g.urlPort = %d\n", g.urlPort); | |
| 219 | - printf("g.urlDfltPort = %d\n", g.urlDfltPort); | |
| 220 | - printf("g.urlHostname = %s\n", g.urlHostname); | |
| 221 | - printf("g.urlPath = %s\n", g.urlPath); | |
| 222 | - printf("g.urlUser = %s\n", g.urlUser); | |
| 223 | - printf("g.urlPasswd = %s\n", g.urlPasswd); | |
| 224 | - printf("g.urlCanonical = %s\n", g.urlCanonical); | |
| 225 | - printf("g.urlFossil = %s\n", g.urlFossil); | |
| 213 | + fossil_print("g.urlIsFile = %d\n", g.urlIsFile); | |
| 214 | + fossil_print("g.urlIsHttps = %d\n", g.urlIsHttps); | |
| 215 | + fossil_print("g.urlIsSsh = %d\n", g.urlIsSsh); | |
| 216 | + fossil_print("g.urlProtocol = %s\n", g.urlProtocol); | |
| 217 | + fossil_print("g.urlName = %s\n", g.urlName); | |
| 218 | + fossil_print("g.urlPort = %d\n", g.urlPort); | |
| 219 | + fossil_print("g.urlDfltPort = %d\n", g.urlDfltPort); | |
| 220 | + fossil_print("g.urlHostname = %s\n", g.urlHostname); | |
| 221 | + fossil_print("g.urlPath = %s\n", g.urlPath); | |
| 222 | + fossil_print("g.urlUser = %s\n", g.urlUser); | |
| 223 | + fossil_print("g.urlPasswd = %s\n", g.urlPasswd); | |
| 224 | + fossil_print("g.urlCanonical = %s\n", g.urlCanonical); | |
| 225 | + fossil_print("g.urlFossil = %s\n", g.urlFossil); | |
| 226 | 226 | if( g.urlIsFile || g.urlIsSsh ) break; |
| 227 | 227 | if( i==0 ){ |
| 228 | - printf("********\n"); | |
| 228 | + fossil_print("********\n"); | |
| 229 | 229 | url_enable_proxy("Using proxy: "); |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| @@ -276,11 +276,11 @@ | ||
| 276 | 276 | char *zOriginalUser = g.urlUser; |
| 277 | 277 | char *zOriginalPasswd = g.urlPasswd; |
| 278 | 278 | g.urlUser = 0; |
| 279 | 279 | g.urlPasswd = ""; |
| 280 | 280 | url_parse(zProxy); |
| 281 | - if( zMsg ) printf("%s%s\n", zMsg, g.urlCanonical); | |
| 281 | + if( zMsg ) fossil_print("%s%s\n", zMsg, g.urlCanonical); | |
| 282 | 282 | g.urlPath = zOriginalUrl; |
| 283 | 283 | g.urlHostname = zOriginalHost; |
| 284 | 284 | if( g.urlUser ){ |
| 285 | 285 | char *zCredentials1 = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 286 | 286 | char *zCredentials2 = encode64(zCredentials1, -1); |
| 287 | 287 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -208,26 +208,26 @@ | |
| 208 | if( g.argc!=3 && g.argc!=4 ){ |
| 209 | usage("URL"); |
| 210 | } |
| 211 | url_parse(g.argv[2]); |
| 212 | for(i=0; i<2; i++){ |
| 213 | printf("g.urlIsFile = %d\n", g.urlIsFile); |
| 214 | printf("g.urlIsHttps = %d\n", g.urlIsHttps); |
| 215 | printf("g.urlIsSsh = %d\n", g.urlIsSsh); |
| 216 | printf("g.urlProtocol = %s\n", g.urlProtocol); |
| 217 | printf("g.urlName = %s\n", g.urlName); |
| 218 | printf("g.urlPort = %d\n", g.urlPort); |
| 219 | printf("g.urlDfltPort = %d\n", g.urlDfltPort); |
| 220 | printf("g.urlHostname = %s\n", g.urlHostname); |
| 221 | printf("g.urlPath = %s\n", g.urlPath); |
| 222 | printf("g.urlUser = %s\n", g.urlUser); |
| 223 | printf("g.urlPasswd = %s\n", g.urlPasswd); |
| 224 | printf("g.urlCanonical = %s\n", g.urlCanonical); |
| 225 | printf("g.urlFossil = %s\n", g.urlFossil); |
| 226 | if( g.urlIsFile || g.urlIsSsh ) break; |
| 227 | if( i==0 ){ |
| 228 | printf("********\n"); |
| 229 | url_enable_proxy("Using proxy: "); |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
| @@ -276,11 +276,11 @@ | |
| 276 | char *zOriginalUser = g.urlUser; |
| 277 | char *zOriginalPasswd = g.urlPasswd; |
| 278 | g.urlUser = 0; |
| 279 | g.urlPasswd = ""; |
| 280 | url_parse(zProxy); |
| 281 | if( zMsg ) printf("%s%s\n", zMsg, g.urlCanonical); |
| 282 | g.urlPath = zOriginalUrl; |
| 283 | g.urlHostname = zOriginalHost; |
| 284 | if( g.urlUser ){ |
| 285 | char *zCredentials1 = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 286 | char *zCredentials2 = encode64(zCredentials1, -1); |
| 287 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -208,26 +208,26 @@ | |
| 208 | if( g.argc!=3 && g.argc!=4 ){ |
| 209 | usage("URL"); |
| 210 | } |
| 211 | url_parse(g.argv[2]); |
| 212 | for(i=0; i<2; i++){ |
| 213 | fossil_print("g.urlIsFile = %d\n", g.urlIsFile); |
| 214 | fossil_print("g.urlIsHttps = %d\n", g.urlIsHttps); |
| 215 | fossil_print("g.urlIsSsh = %d\n", g.urlIsSsh); |
| 216 | fossil_print("g.urlProtocol = %s\n", g.urlProtocol); |
| 217 | fossil_print("g.urlName = %s\n", g.urlName); |
| 218 | fossil_print("g.urlPort = %d\n", g.urlPort); |
| 219 | fossil_print("g.urlDfltPort = %d\n", g.urlDfltPort); |
| 220 | fossil_print("g.urlHostname = %s\n", g.urlHostname); |
| 221 | fossil_print("g.urlPath = %s\n", g.urlPath); |
| 222 | fossil_print("g.urlUser = %s\n", g.urlUser); |
| 223 | fossil_print("g.urlPasswd = %s\n", g.urlPasswd); |
| 224 | fossil_print("g.urlCanonical = %s\n", g.urlCanonical); |
| 225 | fossil_print("g.urlFossil = %s\n", g.urlFossil); |
| 226 | if( g.urlIsFile || g.urlIsSsh ) break; |
| 227 | if( i==0 ){ |
| 228 | fossil_print("********\n"); |
| 229 | url_enable_proxy("Using proxy: "); |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
| @@ -276,11 +276,11 @@ | |
| 276 | char *zOriginalUser = g.urlUser; |
| 277 | char *zOriginalPasswd = g.urlPasswd; |
| 278 | g.urlUser = 0; |
| 279 | g.urlPasswd = ""; |
| 280 | url_parse(zProxy); |
| 281 | if( zMsg ) fossil_print("%s%s\n", zMsg, g.urlCanonical); |
| 282 | g.urlPath = zOriginalUrl; |
| 283 | g.urlHostname = zOriginalHost; |
| 284 | if( g.urlUser ){ |
| 285 | char *zCredentials1 = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 286 | char *zCredentials2 = encode64(zCredentials1, -1); |
| 287 |
+6
-6
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -117,11 +117,11 @@ | ||
| 117 | 117 | prompt_for_passphrase(zPrompt, pPassphrase); |
| 118 | 118 | if( verify==0 ) break; |
| 119 | 119 | if( verify==1 && blob_size(pPassphrase)==0 ) break; |
| 120 | 120 | prompt_for_passphrase("Retype new password: ", &secondTry); |
| 121 | 121 | if( blob_compare(pPassphrase, &secondTry) ){ |
| 122 | - printf("Passphrases do not match. Try again...\n"); | |
| 122 | + fossil_print("Passphrases do not match. Try again...\n"); | |
| 123 | 123 | }else{ |
| 124 | 124 | break; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | blob_reset(&secondTry); |
| @@ -132,11 +132,11 @@ | ||
| 132 | 132 | */ |
| 133 | 133 | void prompt_user(const char *zPrompt, Blob *pIn){ |
| 134 | 134 | char *z; |
| 135 | 135 | char zLine[1000]; |
| 136 | 136 | blob_zero(pIn); |
| 137 | - printf("%s", zPrompt); | |
| 137 | + fossil_print("%s", zPrompt); | |
| 138 | 138 | fflush(stdout); |
| 139 | 139 | z = fgets(zLine, sizeof(zLine), stdin); |
| 140 | 140 | if( z ){ |
| 141 | 141 | strip_string(pIn, z); |
| 142 | 142 | } |
| @@ -212,11 +212,11 @@ | ||
| 212 | 212 | ); |
| 213 | 213 | free(zPw); |
| 214 | 214 | }else if( n>=2 && strncmp(g.argv[2],"default",n)==0 ){ |
| 215 | 215 | user_select(); |
| 216 | 216 | if( g.argc==3 ){ |
| 217 | - printf("%s\n", g.zLogin); | |
| 217 | + fossil_print("%s\n", g.zLogin); | |
| 218 | 218 | }else{ |
| 219 | 219 | if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.argv[3]) ){ |
| 220 | 220 | fossil_fatal("no such user: %s", g.argv[3]); |
| 221 | 221 | } |
| 222 | 222 | if( g.localOpen ){ |
| @@ -227,11 +227,11 @@ | ||
| 227 | 227 | } |
| 228 | 228 | }else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){ |
| 229 | 229 | Stmt q; |
| 230 | 230 | db_prepare(&q, "SELECT login, info FROM user ORDER BY login"); |
| 231 | 231 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | - printf("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1)); | |
| 232 | + fossil_print("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1)); | |
| 233 | 233 | } |
| 234 | 234 | db_finalize(&q); |
| 235 | 235 | }else if( n>=2 && strncmp(g.argv[2],"password",2)==0 ){ |
| 236 | 236 | char *zPrompt; |
| 237 | 237 | int uid; |
| @@ -246,11 +246,11 @@ | ||
| 246 | 246 | }else{ |
| 247 | 247 | zPrompt = mprintf("New password for %s: ", g.argv[3]); |
| 248 | 248 | prompt_for_password(zPrompt, &pw, 1); |
| 249 | 249 | } |
| 250 | 250 | if( blob_size(&pw)==0 ){ |
| 251 | - printf("password unchanged\n"); | |
| 251 | + fossil_print("password unchanged\n"); | |
| 252 | 252 | }else{ |
| 253 | 253 | char *zSecret = sha1_shared_secret(blob_str(&pw), g.argv[3], 0); |
| 254 | 254 | db_multi_exec("UPDATE user SET pw=%Q, mtime=now() WHERE uid=%d", |
| 255 | 255 | zSecret, uid); |
| 256 | 256 | free(zSecret); |
| @@ -268,11 +268,11 @@ | ||
| 268 | 268 | db_multi_exec( |
| 269 | 269 | "UPDATE user SET cap=%Q, mtime=now() WHERE uid=%d", |
| 270 | 270 | g.argv[4], uid |
| 271 | 271 | ); |
| 272 | 272 | } |
| 273 | - printf("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid)); | |
| 273 | + fossil_print("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid)); | |
| 274 | 274 | }else{ |
| 275 | 275 | fossil_panic("user subcommand should be one of: " |
| 276 | 276 | "capabilities default list new password"); |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -117,11 +117,11 @@ | |
| 117 | prompt_for_passphrase(zPrompt, pPassphrase); |
| 118 | if( verify==0 ) break; |
| 119 | if( verify==1 && blob_size(pPassphrase)==0 ) break; |
| 120 | prompt_for_passphrase("Retype new password: ", &secondTry); |
| 121 | if( blob_compare(pPassphrase, &secondTry) ){ |
| 122 | printf("Passphrases do not match. Try again...\n"); |
| 123 | }else{ |
| 124 | break; |
| 125 | } |
| 126 | } |
| 127 | blob_reset(&secondTry); |
| @@ -132,11 +132,11 @@ | |
| 132 | */ |
| 133 | void prompt_user(const char *zPrompt, Blob *pIn){ |
| 134 | char *z; |
| 135 | char zLine[1000]; |
| 136 | blob_zero(pIn); |
| 137 | printf("%s", zPrompt); |
| 138 | fflush(stdout); |
| 139 | z = fgets(zLine, sizeof(zLine), stdin); |
| 140 | if( z ){ |
| 141 | strip_string(pIn, z); |
| 142 | } |
| @@ -212,11 +212,11 @@ | |
| 212 | ); |
| 213 | free(zPw); |
| 214 | }else if( n>=2 && strncmp(g.argv[2],"default",n)==0 ){ |
| 215 | user_select(); |
| 216 | if( g.argc==3 ){ |
| 217 | printf("%s\n", g.zLogin); |
| 218 | }else{ |
| 219 | if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.argv[3]) ){ |
| 220 | fossil_fatal("no such user: %s", g.argv[3]); |
| 221 | } |
| 222 | if( g.localOpen ){ |
| @@ -227,11 +227,11 @@ | |
| 227 | } |
| 228 | }else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){ |
| 229 | Stmt q; |
| 230 | db_prepare(&q, "SELECT login, info FROM user ORDER BY login"); |
| 231 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | printf("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1)); |
| 233 | } |
| 234 | db_finalize(&q); |
| 235 | }else if( n>=2 && strncmp(g.argv[2],"password",2)==0 ){ |
| 236 | char *zPrompt; |
| 237 | int uid; |
| @@ -246,11 +246,11 @@ | |
| 246 | }else{ |
| 247 | zPrompt = mprintf("New password for %s: ", g.argv[3]); |
| 248 | prompt_for_password(zPrompt, &pw, 1); |
| 249 | } |
| 250 | if( blob_size(&pw)==0 ){ |
| 251 | printf("password unchanged\n"); |
| 252 | }else{ |
| 253 | char *zSecret = sha1_shared_secret(blob_str(&pw), g.argv[3], 0); |
| 254 | db_multi_exec("UPDATE user SET pw=%Q, mtime=now() WHERE uid=%d", |
| 255 | zSecret, uid); |
| 256 | free(zSecret); |
| @@ -268,11 +268,11 @@ | |
| 268 | db_multi_exec( |
| 269 | "UPDATE user SET cap=%Q, mtime=now() WHERE uid=%d", |
| 270 | g.argv[4], uid |
| 271 | ); |
| 272 | } |
| 273 | printf("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid)); |
| 274 | }else{ |
| 275 | fossil_panic("user subcommand should be one of: " |
| 276 | "capabilities default list new password"); |
| 277 | } |
| 278 | } |
| 279 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -117,11 +117,11 @@ | |
| 117 | prompt_for_passphrase(zPrompt, pPassphrase); |
| 118 | if( verify==0 ) break; |
| 119 | if( verify==1 && blob_size(pPassphrase)==0 ) break; |
| 120 | prompt_for_passphrase("Retype new password: ", &secondTry); |
| 121 | if( blob_compare(pPassphrase, &secondTry) ){ |
| 122 | fossil_print("Passphrases do not match. Try again...\n"); |
| 123 | }else{ |
| 124 | break; |
| 125 | } |
| 126 | } |
| 127 | blob_reset(&secondTry); |
| @@ -132,11 +132,11 @@ | |
| 132 | */ |
| 133 | void prompt_user(const char *zPrompt, Blob *pIn){ |
| 134 | char *z; |
| 135 | char zLine[1000]; |
| 136 | blob_zero(pIn); |
| 137 | fossil_print("%s", zPrompt); |
| 138 | fflush(stdout); |
| 139 | z = fgets(zLine, sizeof(zLine), stdin); |
| 140 | if( z ){ |
| 141 | strip_string(pIn, z); |
| 142 | } |
| @@ -212,11 +212,11 @@ | |
| 212 | ); |
| 213 | free(zPw); |
| 214 | }else if( n>=2 && strncmp(g.argv[2],"default",n)==0 ){ |
| 215 | user_select(); |
| 216 | if( g.argc==3 ){ |
| 217 | fossil_print("%s\n", g.zLogin); |
| 218 | }else{ |
| 219 | if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.argv[3]) ){ |
| 220 | fossil_fatal("no such user: %s", g.argv[3]); |
| 221 | } |
| 222 | if( g.localOpen ){ |
| @@ -227,11 +227,11 @@ | |
| 227 | } |
| 228 | }else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){ |
| 229 | Stmt q; |
| 230 | db_prepare(&q, "SELECT login, info FROM user ORDER BY login"); |
| 231 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | fossil_print("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1)); |
| 233 | } |
| 234 | db_finalize(&q); |
| 235 | }else if( n>=2 && strncmp(g.argv[2],"password",2)==0 ){ |
| 236 | char *zPrompt; |
| 237 | int uid; |
| @@ -246,11 +246,11 @@ | |
| 246 | }else{ |
| 247 | zPrompt = mprintf("New password for %s: ", g.argv[3]); |
| 248 | prompt_for_password(zPrompt, &pw, 1); |
| 249 | } |
| 250 | if( blob_size(&pw)==0 ){ |
| 251 | fossil_print("password unchanged\n"); |
| 252 | }else{ |
| 253 | char *zSecret = sha1_shared_secret(blob_str(&pw), g.argv[3], 0); |
| 254 | db_multi_exec("UPDATE user SET pw=%Q, mtime=now() WHERE uid=%d", |
| 255 | zSecret, uid); |
| 256 | free(zSecret); |
| @@ -268,11 +268,11 @@ | |
| 268 | db_multi_exec( |
| 269 | "UPDATE user SET cap=%Q, mtime=now() WHERE uid=%d", |
| 270 | g.argv[4], uid |
| 271 | ); |
| 272 | } |
| 273 | fossil_print("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid)); |
| 274 | }else{ |
| 275 | fossil_panic("user subcommand should be one of: " |
| 276 | "capabilities default list new password"); |
| 277 | } |
| 278 | } |
| 279 |
+6
-5
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -264,11 +264,11 @@ | ||
| 264 | 264 | if( cReply=='n' || cReply=='N' ){ |
| 265 | 265 | blob_reset(&content); |
| 266 | 266 | continue; |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | - if( verbose ) printf("%s\n", &zName[nRepos]); | |
| 269 | + if( verbose ) fossil_print("%s\n", &zName[nRepos]); | |
| 270 | 270 | blob_write_to_file(&content, zName); |
| 271 | 271 | file_setexe(zName, isExe); |
| 272 | 272 | blob_reset(&content); |
| 273 | 273 | db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d", |
| 274 | 274 | file_mtime(zName), id); |
| @@ -491,26 +491,27 @@ | ||
| 491 | 491 | int rid = db_column_int(&q, 2); |
| 492 | 492 | |
| 493 | 493 | blob_zero(&disk); |
| 494 | 494 | rc = blob_read_from_file(&disk, zFullpath); |
| 495 | 495 | if( rc<0 ){ |
| 496 | - printf("ERROR: cannot read file [%s]\n", zFullpath); | |
| 496 | + fossil_print("ERROR: cannot read file [%s]\n", zFullpath); | |
| 497 | 497 | blob_reset(&disk); |
| 498 | 498 | continue; |
| 499 | 499 | } |
| 500 | 500 | blob_zero(&repo); |
| 501 | 501 | content_get(rid, &repo); |
| 502 | 502 | if( blob_size(&repo)!=blob_size(&disk) ){ |
| 503 | - printf("ERROR: [%s] is %d bytes on disk but %d in the repository\n", | |
| 503 | + fossil_print("ERROR: [%s] is %d bytes on disk but %d in the repository\n", | |
| 504 | 504 | zName, blob_size(&disk), blob_size(&repo)); |
| 505 | 505 | blob_reset(&disk); |
| 506 | 506 | blob_reset(&repo); |
| 507 | 507 | continue; |
| 508 | 508 | } |
| 509 | 509 | if( blob_compare(&repo, &disk) ){ |
| 510 | - printf("ERROR: [%s] is different on disk compared to the repository\n", | |
| 511 | - zName); | |
| 510 | + fossil_print( | |
| 511 | + "ERROR: [%s] is different on disk compared to the repository\n", | |
| 512 | + zName); | |
| 512 | 513 | } |
| 513 | 514 | blob_reset(&disk); |
| 514 | 515 | blob_reset(&repo); |
| 515 | 516 | } |
| 516 | 517 | db_finalize(&q); |
| 517 | 518 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -264,11 +264,11 @@ | |
| 264 | if( cReply=='n' || cReply=='N' ){ |
| 265 | blob_reset(&content); |
| 266 | continue; |
| 267 | } |
| 268 | } |
| 269 | if( verbose ) printf("%s\n", &zName[nRepos]); |
| 270 | blob_write_to_file(&content, zName); |
| 271 | file_setexe(zName, isExe); |
| 272 | blob_reset(&content); |
| 273 | db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d", |
| 274 | file_mtime(zName), id); |
| @@ -491,26 +491,27 @@ | |
| 491 | int rid = db_column_int(&q, 2); |
| 492 | |
| 493 | blob_zero(&disk); |
| 494 | rc = blob_read_from_file(&disk, zFullpath); |
| 495 | if( rc<0 ){ |
| 496 | printf("ERROR: cannot read file [%s]\n", zFullpath); |
| 497 | blob_reset(&disk); |
| 498 | continue; |
| 499 | } |
| 500 | blob_zero(&repo); |
| 501 | content_get(rid, &repo); |
| 502 | if( blob_size(&repo)!=blob_size(&disk) ){ |
| 503 | printf("ERROR: [%s] is %d bytes on disk but %d in the repository\n", |
| 504 | zName, blob_size(&disk), blob_size(&repo)); |
| 505 | blob_reset(&disk); |
| 506 | blob_reset(&repo); |
| 507 | continue; |
| 508 | } |
| 509 | if( blob_compare(&repo, &disk) ){ |
| 510 | printf("ERROR: [%s] is different on disk compared to the repository\n", |
| 511 | zName); |
| 512 | } |
| 513 | blob_reset(&disk); |
| 514 | blob_reset(&repo); |
| 515 | } |
| 516 | db_finalize(&q); |
| 517 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -264,11 +264,11 @@ | |
| 264 | if( cReply=='n' || cReply=='N' ){ |
| 265 | blob_reset(&content); |
| 266 | continue; |
| 267 | } |
| 268 | } |
| 269 | if( verbose ) fossil_print("%s\n", &zName[nRepos]); |
| 270 | blob_write_to_file(&content, zName); |
| 271 | file_setexe(zName, isExe); |
| 272 | blob_reset(&content); |
| 273 | db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d", |
| 274 | file_mtime(zName), id); |
| @@ -491,26 +491,27 @@ | |
| 491 | int rid = db_column_int(&q, 2); |
| 492 | |
| 493 | blob_zero(&disk); |
| 494 | rc = blob_read_from_file(&disk, zFullpath); |
| 495 | if( rc<0 ){ |
| 496 | fossil_print("ERROR: cannot read file [%s]\n", zFullpath); |
| 497 | blob_reset(&disk); |
| 498 | continue; |
| 499 | } |
| 500 | blob_zero(&repo); |
| 501 | content_get(rid, &repo); |
| 502 | if( blob_size(&repo)!=blob_size(&disk) ){ |
| 503 | fossil_print("ERROR: [%s] is %d bytes on disk but %d in the repository\n", |
| 504 | zName, blob_size(&disk), blob_size(&repo)); |
| 505 | blob_reset(&disk); |
| 506 | blob_reset(&repo); |
| 507 | continue; |
| 508 | } |
| 509 | if( blob_compare(&repo, &disk) ){ |
| 510 | fossil_print( |
| 511 | "ERROR: [%s] is different on disk compared to the repository\n", |
| 512 | zName); |
| 513 | } |
| 514 | blob_reset(&disk); |
| 515 | blob_reset(&repo); |
| 516 | } |
| 517 | db_finalize(&q); |
| 518 |
+4
-4
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -925,11 +925,11 @@ | ||
| 925 | 925 | fossil_fatal("wiki export could not open output file for writing."); |
| 926 | 926 | } |
| 927 | 927 | fprintf(zF,"%.*s\n", i, zBody); |
| 928 | 928 | if( doClose ) fclose(zF); |
| 929 | 929 | }else{ |
| 930 | - printf("%.*s\n", i, zBody); | |
| 930 | + fossil_print("%.*s\n", i, zBody); | |
| 931 | 931 | } |
| 932 | 932 | manifest_destroy(pWiki); |
| 933 | 933 | return; |
| 934 | 934 | }else |
| 935 | 935 | if( strncmp(g.argv[2],"commit",n)==0 |
| @@ -945,14 +945,14 @@ | ||
| 945 | 945 | }else{ |
| 946 | 946 | blob_read_from_file(&content, g.argv[4]); |
| 947 | 947 | } |
| 948 | 948 | if( g.argv[2][1]=='r' ){ |
| 949 | 949 | wiki_cmd_commit(zPageName, 1, &content); |
| 950 | - printf("Created new wiki page %s.\n", zPageName); | |
| 950 | + fossil_print("Created new wiki page %s.\n", zPageName); | |
| 951 | 951 | }else{ |
| 952 | 952 | wiki_cmd_commit(zPageName, 0, &content); |
| 953 | - printf("Updated wiki page %s.\n", zPageName); | |
| 953 | + fossil_print("Updated wiki page %s.\n", zPageName); | |
| 954 | 954 | } |
| 955 | 955 | blob_reset(&content); |
| 956 | 956 | }else |
| 957 | 957 | if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 958 | 958 | if( g.argc!=5 ){ |
| @@ -966,11 +966,11 @@ | ||
| 966 | 966 | "SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'" |
| 967 | 967 | " ORDER BY lower(tagname) /*sort*/" |
| 968 | 968 | ); |
| 969 | 969 | while( db_step(&q)==SQLITE_ROW ){ |
| 970 | 970 | const char *zName = db_column_text(&q, 0); |
| 971 | - printf( "%s\n",zName); | |
| 971 | + fossil_print( "%s\n",zName); | |
| 972 | 972 | } |
| 973 | 973 | db_finalize(&q); |
| 974 | 974 | }else |
| 975 | 975 | { |
| 976 | 976 | goto wiki_cmd_usage; |
| 977 | 977 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -925,11 +925,11 @@ | |
| 925 | fossil_fatal("wiki export could not open output file for writing."); |
| 926 | } |
| 927 | fprintf(zF,"%.*s\n", i, zBody); |
| 928 | if( doClose ) fclose(zF); |
| 929 | }else{ |
| 930 | printf("%.*s\n", i, zBody); |
| 931 | } |
| 932 | manifest_destroy(pWiki); |
| 933 | return; |
| 934 | }else |
| 935 | if( strncmp(g.argv[2],"commit",n)==0 |
| @@ -945,14 +945,14 @@ | |
| 945 | }else{ |
| 946 | blob_read_from_file(&content, g.argv[4]); |
| 947 | } |
| 948 | if( g.argv[2][1]=='r' ){ |
| 949 | wiki_cmd_commit(zPageName, 1, &content); |
| 950 | printf("Created new wiki page %s.\n", zPageName); |
| 951 | }else{ |
| 952 | wiki_cmd_commit(zPageName, 0, &content); |
| 953 | printf("Updated wiki page %s.\n", zPageName); |
| 954 | } |
| 955 | blob_reset(&content); |
| 956 | }else |
| 957 | if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 958 | if( g.argc!=5 ){ |
| @@ -966,11 +966,11 @@ | |
| 966 | "SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'" |
| 967 | " ORDER BY lower(tagname) /*sort*/" |
| 968 | ); |
| 969 | while( db_step(&q)==SQLITE_ROW ){ |
| 970 | const char *zName = db_column_text(&q, 0); |
| 971 | printf( "%s\n",zName); |
| 972 | } |
| 973 | db_finalize(&q); |
| 974 | }else |
| 975 | { |
| 976 | goto wiki_cmd_usage; |
| 977 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -925,11 +925,11 @@ | |
| 925 | fossil_fatal("wiki export could not open output file for writing."); |
| 926 | } |
| 927 | fprintf(zF,"%.*s\n", i, zBody); |
| 928 | if( doClose ) fclose(zF); |
| 929 | }else{ |
| 930 | fossil_print("%.*s\n", i, zBody); |
| 931 | } |
| 932 | manifest_destroy(pWiki); |
| 933 | return; |
| 934 | }else |
| 935 | if( strncmp(g.argv[2],"commit",n)==0 |
| @@ -945,14 +945,14 @@ | |
| 945 | }else{ |
| 946 | blob_read_from_file(&content, g.argv[4]); |
| 947 | } |
| 948 | if( g.argv[2][1]=='r' ){ |
| 949 | wiki_cmd_commit(zPageName, 1, &content); |
| 950 | fossil_print("Created new wiki page %s.\n", zPageName); |
| 951 | }else{ |
| 952 | wiki_cmd_commit(zPageName, 0, &content); |
| 953 | fossil_print("Updated wiki page %s.\n", zPageName); |
| 954 | } |
| 955 | blob_reset(&content); |
| 956 | }else |
| 957 | if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 958 | if( g.argc!=5 ){ |
| @@ -966,11 +966,11 @@ | |
| 966 | "SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'" |
| 967 | " ORDER BY lower(tagname) /*sort*/" |
| 968 | ); |
| 969 | while( db_step(&q)==SQLITE_ROW ){ |
| 970 | const char *zName = db_column_text(&q, 0); |
| 971 | fossil_print( "%s\n",zName); |
| 972 | } |
| 973 | db_finalize(&q); |
| 974 | }else |
| 975 | { |
| 976 | goto wiki_cmd_usage; |
| 977 |
+3
-3
| --- src/winhttp.c | ||
| +++ src/winhttp.c | ||
| @@ -190,17 +190,17 @@ | ||
| 190 | 190 | fossil_fatal("unable to open listening socket on any" |
| 191 | 191 | " port in the range %d..%d", mnPort, mxPort); |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | zTempPrefix = mprintf("fossil_server_P%d_", iPort); |
| 195 | - printf("Listening for HTTP requests on TCP port %d\n", iPort); | |
| 195 | + fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); | |
| 196 | 196 | if( zBrowser ){ |
| 197 | 197 | zBrowser = mprintf(zBrowser, iPort); |
| 198 | - printf("Launch webbrowser: %s\n", zBrowser); | |
| 198 | + fossil_print("Launch webbrowser: %s\n", zBrowser); | |
| 199 | 199 | fossil_system(zBrowser); |
| 200 | 200 | } |
| 201 | - printf("Type Ctrl-C to stop the HTTP server\n"); | |
| 201 | + fossil_print("Type Ctrl-C to stop the HTTP server\n"); | |
| 202 | 202 | for(;;){ |
| 203 | 203 | SOCKET client; |
| 204 | 204 | SOCKADDR_IN client_addr; |
| 205 | 205 | HttpRequest *p; |
| 206 | 206 | int len = sizeof(client_addr); |
| 207 | 207 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -190,17 +190,17 @@ | |
| 190 | fossil_fatal("unable to open listening socket on any" |
| 191 | " port in the range %d..%d", mnPort, mxPort); |
| 192 | } |
| 193 | } |
| 194 | zTempPrefix = mprintf("fossil_server_P%d_", iPort); |
| 195 | printf("Listening for HTTP requests on TCP port %d\n", iPort); |
| 196 | if( zBrowser ){ |
| 197 | zBrowser = mprintf(zBrowser, iPort); |
| 198 | printf("Launch webbrowser: %s\n", zBrowser); |
| 199 | fossil_system(zBrowser); |
| 200 | } |
| 201 | printf("Type Ctrl-C to stop the HTTP server\n"); |
| 202 | for(;;){ |
| 203 | SOCKET client; |
| 204 | SOCKADDR_IN client_addr; |
| 205 | HttpRequest *p; |
| 206 | int len = sizeof(client_addr); |
| 207 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -190,17 +190,17 @@ | |
| 190 | fossil_fatal("unable to open listening socket on any" |
| 191 | " port in the range %d..%d", mnPort, mxPort); |
| 192 | } |
| 193 | } |
| 194 | zTempPrefix = mprintf("fossil_server_P%d_", iPort); |
| 195 | fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); |
| 196 | if( zBrowser ){ |
| 197 | zBrowser = mprintf(zBrowser, iPort); |
| 198 | fossil_print("Launch webbrowser: %s\n", zBrowser); |
| 199 | fossil_system(zBrowser); |
| 200 | } |
| 201 | fossil_print("Type Ctrl-C to stop the HTTP server\n"); |
| 202 | for(;;){ |
| 203 | SOCKET client; |
| 204 | SOCKADDR_IN client_addr; |
| 205 | HttpRequest *p; |
| 206 | int len = sizeof(client_addr); |
| 207 |
+3
-3
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1202,11 +1202,11 @@ | ||
| 1202 | 1202 | } |
| 1203 | 1203 | blob_zero(&g.cgiIn); |
| 1204 | 1204 | blob_read_from_file(&g.cgiIn, g.argc==2 ? "-" : g.argv[2]); |
| 1205 | 1205 | disableLogin = 1; |
| 1206 | 1206 | page_xfer(); |
| 1207 | - printf("%s\n", cgi_extract_content(¬Used)); | |
| 1207 | + fossil_print("%s\n", cgi_extract_content(¬Used)); | |
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /* |
| 1211 | 1211 | ** Format strings for progress reporting. |
| 1212 | 1212 | */ |
| @@ -1386,11 +1386,11 @@ | ||
| 1386 | 1386 | xfer.nFileSent = 0; |
| 1387 | 1387 | xfer.nDeltaSent = 0; |
| 1388 | 1388 | xfer.nGimmeSent = 0; |
| 1389 | 1389 | xfer.nIGotSent = 0; |
| 1390 | 1390 | if( !g.cgiOutput && !g.fQuiet ){ |
| 1391 | - printf("waiting for server..."); | |
| 1391 | + fossil_print("waiting for server..."); | |
| 1392 | 1392 | } |
| 1393 | 1393 | fflush(stdout); |
| 1394 | 1394 | if( http_exchange(&send, &recv, cloneFlag==0 || nCycle>0) ){ |
| 1395 | 1395 | nErr++; |
| 1396 | 1396 | break; |
| @@ -1442,11 +1442,11 @@ | ||
| 1442 | 1442 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1443 | 1443 | nCardRcvd++; |
| 1444 | 1444 | if( !g.cgiOutput && !g.fQuiet && recv.nUsed>0 ){ |
| 1445 | 1445 | pctDone = (recv.iCursor*100)/recv.nUsed; |
| 1446 | 1446 | if( pctDone!=lastPctDone ){ |
| 1447 | - printf("\rprocessed: %d%% ", pctDone); | |
| 1447 | + fossil_print("\rprocessed: %d%% ", pctDone); | |
| 1448 | 1448 | lastPctDone = pctDone; |
| 1449 | 1449 | fflush(stdout); |
| 1450 | 1450 | } |
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | 1453 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1202,11 +1202,11 @@ | |
| 1202 | } |
| 1203 | blob_zero(&g.cgiIn); |
| 1204 | blob_read_from_file(&g.cgiIn, g.argc==2 ? "-" : g.argv[2]); |
| 1205 | disableLogin = 1; |
| 1206 | page_xfer(); |
| 1207 | printf("%s\n", cgi_extract_content(¬Used)); |
| 1208 | } |
| 1209 | |
| 1210 | /* |
| 1211 | ** Format strings for progress reporting. |
| 1212 | */ |
| @@ -1386,11 +1386,11 @@ | |
| 1386 | xfer.nFileSent = 0; |
| 1387 | xfer.nDeltaSent = 0; |
| 1388 | xfer.nGimmeSent = 0; |
| 1389 | xfer.nIGotSent = 0; |
| 1390 | if( !g.cgiOutput && !g.fQuiet ){ |
| 1391 | printf("waiting for server..."); |
| 1392 | } |
| 1393 | fflush(stdout); |
| 1394 | if( http_exchange(&send, &recv, cloneFlag==0 || nCycle>0) ){ |
| 1395 | nErr++; |
| 1396 | break; |
| @@ -1442,11 +1442,11 @@ | |
| 1442 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1443 | nCardRcvd++; |
| 1444 | if( !g.cgiOutput && !g.fQuiet && recv.nUsed>0 ){ |
| 1445 | pctDone = (recv.iCursor*100)/recv.nUsed; |
| 1446 | if( pctDone!=lastPctDone ){ |
| 1447 | printf("\rprocessed: %d%% ", pctDone); |
| 1448 | lastPctDone = pctDone; |
| 1449 | fflush(stdout); |
| 1450 | } |
| 1451 | } |
| 1452 | |
| 1453 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1202,11 +1202,11 @@ | |
| 1202 | } |
| 1203 | blob_zero(&g.cgiIn); |
| 1204 | blob_read_from_file(&g.cgiIn, g.argc==2 ? "-" : g.argv[2]); |
| 1205 | disableLogin = 1; |
| 1206 | page_xfer(); |
| 1207 | fossil_print("%s\n", cgi_extract_content(¬Used)); |
| 1208 | } |
| 1209 | |
| 1210 | /* |
| 1211 | ** Format strings for progress reporting. |
| 1212 | */ |
| @@ -1386,11 +1386,11 @@ | |
| 1386 | xfer.nFileSent = 0; |
| 1387 | xfer.nDeltaSent = 0; |
| 1388 | xfer.nGimmeSent = 0; |
| 1389 | xfer.nIGotSent = 0; |
| 1390 | if( !g.cgiOutput && !g.fQuiet ){ |
| 1391 | fossil_print("waiting for server..."); |
| 1392 | } |
| 1393 | fflush(stdout); |
| 1394 | if( http_exchange(&send, &recv, cloneFlag==0 || nCycle>0) ){ |
| 1395 | nErr++; |
| 1396 | break; |
| @@ -1442,11 +1442,11 @@ | |
| 1442 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1443 | nCardRcvd++; |
| 1444 | if( !g.cgiOutput && !g.fQuiet && recv.nUsed>0 ){ |
| 1445 | pctDone = (recv.iCursor*100)/recv.nUsed; |
| 1446 | if( pctDone!=lastPctDone ){ |
| 1447 | fossil_print("\rprocessed: %d%% ", pctDone); |
| 1448 | lastPctDone = pctDone; |
| 1449 | fflush(stdout); |
| 1450 | } |
| 1451 | } |
| 1452 | |
| 1453 |