Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch windows-i18n Through [4373976553] Excluding Merge-Ins
This is equivalent to a diff from 9a63d1f048 to 4373976553
|
2011-05-09
| ||
| 15:50 | Pull the latest trunk changes over into the windows-i18n branch. ... (check-in: bbba160840 user: drh tags: windows-i18n) | |
| 12:26 | Add lines describing the login to the /test_env page. ... (check-in: c53fbe5d41 user: drh tags: trunk) | |
|
2011-05-07
| ||
| 11:42 | Convert the fopen() in blob_write_to_file() into fossil_fopen(). ... (check-in: 4373976553 user: drh tags: windows-i18n) | |
|
2011-05-06
| ||
| 16:55 | Merge the latest trunk changes into windows-i18n branch. ... (check-in: 59ddd3c8ae user: drh tags: windows-i18n) | |
| 16:44 | Show the artifact numbers on the From and To of a file diff. ... (check-in: 9a63d1f048 user: drh tags: trunk) | |
| 16:32 | Improvements to the annotation algorithm so that if a line changes from X to Y then back to X, the annotation shows the second X not the first. Ticket [f0f9aff371f26] ... (check-in: 73c38a3add user: drh tags: trunk) | |
Changes to src/add.c.
| ︙ | |||
114 115 116 117 118 119 120 | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | - + |
char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
db_multi_exec(
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)"
"VALUES(%d,0,0,0,%Q,%d)",
vid, zPath, file_isexe(zFullname));
fossil_free(zFullname);
}
|
| ︙ | |||
213 214 215 216 217 218 219 | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | - + |
file_canonical_name(g.argv[i], &fullName);
zName = blob_str(&fullName);
isDir = file_isdir(zName);
if( isDir==1 ){
vfile_scan(&fullName, nRoot-1, includeDotFiles, pIgnore);
}else if( isDir==0 ){
fossil_fatal("not found: %s", zName);
|
| ︙ | |||
278 279 280 281 282 283 284 | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | - + |
zTreeName, zTreeName, zTreeName
);
blob_reset(&treeName);
}
db_prepare(&loop, "SELECT x FROM sfile");
while( db_step(&loop)==SQLITE_ROW ){
|
| ︙ | |||
375 376 377 378 379 380 381 | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | - + - + - + |
zFile = db_column_text(&q, 0);
zPath = db_column_text(&q, 1);
if( !file_isfile(zPath) ){
if( !isTest ){
db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
}
|
| ︙ |
Changes to src/allrepo.c.
| ︙ | |||
127 128 129 130 131 132 133 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | - + - + - + - + |
db_prepare(&q,
"SELECT DISTINCT substr(name, 6) COLLATE nocase"
" FROM global_config"
" WHERE substr(name, 1, 5)=='repo:' ORDER BY 1"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zFilename = db_column_text(&q, 0);
|
| ︙ |
Changes to src/bisect.c.
| ︙ | |||
182 183 184 185 186 187 188 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - + - + |
g.fNoSync = 1;
update_cmd();
}else if( memcmp(zCmd, "options", n)==0 ){
if( g.argc==3 ){
unsigned int i;
for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){
char *z = mprintf("bisect-%s", aBisectOption[i].zName);
|
| ︙ | |||
228 229 230 231 232 233 234 | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | - - - - - - + + + + + + |
" AND event.type='ci'");
nStep = path_length();
for(p=path_last(), n=0; p; p=p->pFrom, n++){
const char *z;
db_bind_int(&s, ":rid", p->rid);
if( db_step(&s)==SQLITE_ROW ){
z = db_column_text(&s, 0);
|
Changes to src/blob.c.
| ︙ | |||
109 110 111 112 113 114 115 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - + |
if( i==' ' || i=='\n' || i=='\t' || i=='\v'
|| i=='\f' || i=='\r' ){
assert( fossil_isspace((char)i) );
}else{
assert( !fossil_isspace((char)i) );
}
}
|
| ︙ | |||
688 689 690 691 692 693 694 | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | - + |
if( size<0 ){
fossil_fatal("no such file: %s", zFilename);
}
if( size==0 ){
return 0;
}
blob_resize(pBlob, size);
|
| ︙ | |||
748 749 750 751 752 753 754 | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | - + |
}
#if defined(_WIN32)
}
#endif
zName[i] = '/';
}
}
|
| ︙ | |||
923 924 925 926 927 928 929 | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | - + |
if( blob_compare(&b1, &b3) ){
fossil_panic("compress/uncompress cycle failed for %s", g.argv[i]);
}
blob_reset(&b1);
blob_reset(&b2);
blob_reset(&b3);
}
|
| ︙ |
Changes to src/branch.c.
| ︙ | |||
155 156 157 158 159 160 161 | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | - + - + |
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
if( manifest_crosslink(brid, &branch)==0 ){
fossil_panic("unable to install new manifest");
}
assert( blob_is_reset(&branch) );
content_deltify(rootid, brid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
|
| ︙ | |||
227 228 229 230 231 232 233 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - + |
" AND NOT %z"
" ORDER BY value /*sort*/",
TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
);
while( db_step(&q)==SQLITE_ROW ){
const char *zBr = db_column_text(&q, 0);
int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
|
| ︙ |
Changes to src/captcha.c.
| ︙ | |||
390 391 392 393 394 395 396 | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | - + |
char *z;
for(i=2; i<g.argc; i++){
char zHex[30];
v = (unsigned int)atoi(g.argv[i]);
sqlite3_snprintf(sizeof(zHex), zHex, "%x", v);
z = captcha_render(zHex);
|
| ︙ |
Changes to src/cgi.c.
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | - + | /* ** Copyright (c) 2006 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) |
| ︙ | |||
1114 1115 1116 1117 1118 1119 1120 | 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 | - + |
fossil_fatal("unable to open listening socket on any"
" port in the range %d..%d", mnPort, mxPort);
}
}
if( iPort>mxPort ) return 1;
listen(listener,10);
if( iPort>mnPort ){
|
| ︙ |
Changes to src/checkin.c.
| ︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - + |
int isNew = db_column_int(&q,3)==0;
int isRenamed = db_column_int(&q,4);
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
blob_append(report, zPrefix, nPrefix);
if( isDeleted ){
blob_appendf(report, "DELETED %s\n", zPathname);
}else if( !file_isfile(zFullName) ){
|
| ︙ | |||
134 135 136 137 138 139 140 | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - - - + + + |
** --sha1sum Verify file status using SHA1 hashing rather
** than relying on file mtimes.
*/
void status_cmd(void){
int vid;
db_must_be_within_tree();
/* 012345678901234 */
|
| ︙ | |||
174 175 176 177 178 179 180 | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - + - + - + - - + + - + - + - + - + |
const char *zPathname = db_column_text(&q,0);
int isDeleted = db_column_int(&q, 1);
int isNew = db_column_int(&q,2)==0;
int chnged = db_column_int(&q,3);
int renamed = db_column_int(&q,4);
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
if( isBrief ){
|
| ︙ | |||
242 243 244 245 246 247 248 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | - + |
" ORDER BY 1",
fossil_all_reserved_names()
);
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
}
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | |||
300 301 302 303 304 305 306 | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | - + - + |
g.zLocalRoot, fossil_all_reserved_names()
);
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
}
while( db_step(&q)==SQLITE_ROW ){
if( allFlag ){
|
| ︙ | |||
393 394 395 396 397 398 399 | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | - + - + |
}
#if defined(_WIN32)
blob_add_cr(&text);
#endif
blob_write_to_file(&text, zFile);
if( zEditor ){
zCmd = mprintf("%s \"%s\"", zEditor, zFile);
|
| ︙ | |||
1082 1083 1084 1085 1086 1087 1088 | 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | - + |
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
manifest_crosslink(nvid, &manifest);
assert( blob_is_reset(&manifest) );
content_deltify(vid, nvid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid);
|
| ︙ | |||
1151 1152 1153 1154 1155 1156 1157 | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 | - + |
}
db_end_transaction(0);
if( !g.markPrivate ){
autosync(AUTOSYNC_PUSH);
}
if( count_nonbranch_children(vid)>1 ){
|
Changes to src/checkout.c.
| ︙ | |||
155 156 157 158 159 160 161 | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | - + - + |
blob_append(&hash, "\n", 1);
blob_write_to_file(&hash, zManFile);
free(zManFile);
blob_reset(&hash);
}else{
if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){
zManFile = mprintf("%smanifest", g.zLocalRoot);
|
| ︙ | |||
247 248 249 250 251 252 253 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + - + - + |
db_lset_int("checkout", vid);
undo_reset();
db_multi_exec("DELETE FROM vmerge");
if( !keepFlag && db_get_boolean("repo-cksum",1) ){
vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
vfile_aggregate_checksum_disk(vid, &cksum2);
if( blob_compare(&cksum1, &cksum2) ){
|
| ︙ |
Changes to src/clearsign.c.
| ︙ | |||
50 51 52 53 54 55 56 | 50 51 52 53 54 55 56 57 58 59 60 61 62 | - - + + |
blob_zero(pOut);
blob_read_from_file(pOut, zIn);
}else{
if( pOut!=pIn ){
blob_copy(pOut, pIn);
}
}
|
Changes to src/clone.c.
| ︙ | |||
78 79 80 81 82 83 84 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | - + |
"DELETE FROM private;"
);
shun_artifacts();
g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'");
if( g.zLogin==0 ){
db_create_default_users(1,zDefaultUser);
}
|
| ︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | - + - + - - + + - + |
g.xlinkClusterOnly = 1;
nErr = client_sync(0,0,1,bPrivate,CONFIGSET_ALL,0);
g.xlinkClusterOnly = 0;
verify_cancel();
db_end_transaction(0);
db_close(1);
if( nErr ){
|
Changes to src/comformat.c.
| ︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - + |
char zBuf[400];
int lineCnt = 0;
for(;;){
while( fossil_isspace(zText[0]) ){ zText++; }
if( zText[0]==0 ){
if( doIndent==0 ){
|
| ︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - + - + - + - - + + |
si = i+1;
sk = k+1;
}
k++;
}
}
if( doIndent ){
|
Changes to src/configure.c.
| ︙ | |||
686 687 688 689 690 691 692 | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | - + - + |
int n = strlen(z);
for(i=0; i<count(aGroupName); i++){
if( strncmp(z, &aGroupName[i].zName[1], n)==0 ){
return aGroupName[i].groupMask;
}
}
if( notFoundIsFatal ){
|
| ︙ | |||
881 882 883 884 885 886 887 | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | - - + + |
}else if( fossil_strcmp(zName,"@shun")==0 ){
db_multi_exec("DELETE FROM shun");
}else if( fossil_strcmp(zName,"@reportfmt")==0 ){
db_multi_exec("DELETE FROM reportfmt");
}
}
db_end_transaction(0);
|
Changes to src/content.c.
| ︙ | |||
664 665 666 667 668 669 670 | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | - + |
int rid;
Blob content;
if( g.argc!=3 ) usage("FILENAME");
db_must_be_within_tree();
user_select();
blob_read_from_file(&content, g.argv[2]);
rid = content_put(&content);
|
| ︙ | |||
832 833 834 835 836 837 838 | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | - + - + - + |
db_prepare(&q, "SELECT rid, uuid, size FROM blob ORDER BY rid");
total = db_int(0, "SELECT max(rid) FROM blob");
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q, 0);
const char *zUuid = db_column_text(&q, 1);
int size = db_column_int(&q, 2);
n1++;
|
Changes to src/db.c.
| ︙ | |||
164 165 166 167 168 169 170 | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | - + |
if( nBegin ){
sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
nBegin = 0;
}
busy = 0;
db_close(0);
for(i=0; i<nDeleteOnFail; i++){
|
| ︙ | |||
690 691 692 693 694 695 696 697 698 699 700 701 702 703 | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | + |
zHome = getenv("HOMEPATH");
}
}
if( zHome==0 ){
fossil_fatal("cannot locate home directory - "
"please set the HOMEPATH environment variable");
}
zHome = fossil_mbcs_to_utf8(zHome);
#else
zHome = getenv("HOME");
if( zHome==0 ){
fossil_fatal("cannot locate home directory - "
"please set the HOME environment variable");
}
#endif
|
| ︙ | |||
735 736 737 738 739 740 741 | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | - + |
** true. If it is not a valid local database file, return 0.
*/
static int isValidLocalDb(const char *zDbName){
i64 lsize;
int rc;
sqlite3_stmt *pStmt;
|
| ︙ | |||
810 811 812 813 814 815 816 | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | - + |
db_err("pwd too big: max %d", sizeof(zPwd)-20);
}
n = strlen(zPwd);
zPwdConv = mprintf("%/", zPwd);
strncpy(zPwd, zPwdConv, 2000-20);
free(zPwdConv);
while( n>0 ){
|
| ︙ | |||
848 849 850 851 852 853 854 | 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | - - + + - + |
if( g.localOpen ){
zDbName = db_lget("repository", 0);
}
if( zDbName==0 ){
db_err("unable to find the name of a repository database");
}
}
|
| ︙ | |||
959 960 961 962 963 964 965 | 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | - + |
}
if( db_open_local()==0 ){
fossil_fatal("not in a local checkout");
return;
}
file_canonical_name(g.argv[2], &repo);
zRepo = blob_str(&repo);
|
| ︙ |
Changes to src/deltacmd.c.
| ︙ | |||
50 51 52 53 54 55 56 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - + - - + - - + - |
*/
void delta_create_cmd(void){
Blob orig, target, delta;
if( g.argc!=5 ){
usage("ORIGIN TARGET DELTA");
}
if( blob_read_from_file(&orig, g.argv[2])<0 ){
|
| ︙ | |||
112 113 114 115 116 117 118 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + - - + - - + - |
*/
void delta_apply_cmd(void){
Blob orig, target, delta;
if( g.argc!=5 ){
usage("ORIGIN DELTA TARGET");
}
if( blob_read_from_file(&orig, g.argv[2])<0 ){
|
| ︙ | |||
150 151 152 153 154 155 156 | 144 145 146 147 148 149 150 151 152 | - + |
blob_delta_create(&f1, &f2, &d12);
blob_delta_create(&f2, &f1, &d21);
blob_delta_apply(&f1, &d12, &a2);
blob_delta_apply(&f2, &d21, &a1);
if( blob_compare(&f1,&a1) || blob_compare(&f2, &a2) ){
fossil_panic("delta test failed");
}
|
Changes to src/diff.c.
| ︙ | |||
588 589 590 591 592 593 594 | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | - + - + |
Blob a, b;
int r;
int i;
int *R;
if( g.argc<4 ) usage("FILE1 FILE2 ...");
blob_read_from_file(&a, g.argv[2]);
for(i=3; i<g.argc; i++){
|
| ︙ | |||
741 742 743 744 745 746 747 | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | - + |
if( annotation_step(&x, &b, g.argv[i-1]) ){
fossil_fatal("binary file");
}
}
for(i=0; i<x.nOrig; i++){
const char *zSrc = x.aOrig[i].zSrc;
if( zSrc==0 ) zSrc = g.argv[g.argc-1];
|
| ︙ | |||
911 912 913 914 915 916 917 | 911 912 913 914 915 916 917 918 919 920 921 | + - + |
if( showLog ){
for(i=0; i<ann.nVers; i++){
printf("version %3d: %s\n", i+1, ann.azVers[i]);
}
printf("---------------------------------------------------\n");
}
for(i=0; i<ann.nOrig; i++){
fossil_print("%s: %.*s\n",
|
Changes to src/diffcmd.c.
| ︙ | |||
98 99 100 101 102 103 104 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - + - + |
/* Construct a temporary file to hold pFile1 based on the name of
** zFile2 */
blob_zero(&nameFile1);
do{
blob_reset(&nameFile1);
blob_appendf(&nameFile1, "%s~%d", zFile2, cnt++);
|
| ︙ | |||
166 167 168 169 170 171 172 | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | - - + + |
blob_append(&cmd, " ", 1);
shell_escape(&cmd, zTemp2);
/* Run the external diff command */
fossil_system(blob_str(&cmd));
/* Delete the temporary file and clean up memory used */
|
| ︙ | |||
261 262 263 264 265 266 267 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | - + |
int srcid = db_column_int(&q, 4);
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
char *zToFree = zFullName;
int showDiff = 1;
if( isDeleted ){
diff_printf("DELETED %s\n", zPathname);
if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; }
|
| ︙ |
Changes to src/encode.c.
| ︙ | |||
338 339 340 341 342 343 344 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + |
** Usage: %fossil test-encode64 STRING
*/
void test_encode64_cmd(void){
char *z;
int i;
for(i=2; i<g.argc; i++){
z = encode64(g.argv[i], -1);
|
| ︙ | |||
403 404 405 406 407 408 409 | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | - + |
** Usage: %fossil test-decode64 STRING
*/
void test_decode64_cmd(void){
char *z;
int i, n;
for(i=2; i<g.argc; i++){
z = decode64(g.argv[i], &n);
|
| ︙ | |||
577 578 579 580 581 582 583 | 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | - + - + |
*/
void test_obscure_cmd(void){
int i;
char *z, *z2;
for(i=2; i<g.argc; i++){
z = obscure(g.argv[i]);
z2 = unobscure(z);
|
Changes to src/file.c.
| ︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | + - + + |
** Return the number of errors. No error messages are generated.
*/
static int getStat(const char *zFilename){
int rc = 0;
if( zFilename==0 ){
if( fileStatValid==0 ) rc = 1;
}else{
char *zMbcs = fossil_utf8_to_mbcs(zFilename);
|
| ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | + + + + + + + + + + |
rc = getStat(zFN);
free(zFN);
}else{
rc = getStat(0);
}
return rc ? 0 : (S_ISDIR(fileStat.st_mode) ? 1 : 2);
}
/*
** Wrapper around the access() system call.
*/
int file_access(const char *zFilename, int flags){
char *zMbcs = fossil_utf8_to_mbcs(zFilename);
int rc = access(zMbcs, flags);
fossil_mbcs_free(zMbcs);
return rc;
}
/*
** Find an unused filename similar to zBase with zSuffix appended.
**
** Make the name relative to the working directory if relFlag is true.
**
** Space to hold the new filename is obtained form mprintf() and should
|
| ︙ | |||
164 165 166 167 168 169 170 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | - + - + |
/*
** Copy the content of a file from one place to another.
*/
void file_copy(const char *zFrom, const char *zTo){
FILE *in, *out;
int got;
char zBuf[8192];
|
| ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | + + + + + + + + + - + + + + + - + |
chmod(zFilename, buf.st_mode & ~0111);
rc = 1;
}
}
#endif /* _WIN32 */
return rc;
}
/*
** Delete a file.
*/
void file_delete(const char *zFilename){
char *z = fossil_utf8_to_mbcs(zFilename);
unlink(z);
fossil_mbcs_free(z);
}
/*
** Create the directory named in the argument, if it does not already
** exist. If forceFlag is 1, delete any prior non-directory object
** with the same name.
**
** Return the number of errors.
*/
int file_mkdir(const char *zName, int forceFlag){
int rc = file_isdir(zName);
if( rc==2 ){
if( !forceFlag ) return 1;
|
| ︙ | |||
348 349 350 351 352 353 354 | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | - + - + |
** Print the simplified versions of each FILENAME.
*/
void cmd_test_simplify_name(void){
int i;
char *z;
for(i=2; i<g.argc; i++){
z = mprintf("%s", g.argv[i]);
|
| ︙ | |||
375 376 377 378 379 380 381 | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | - + - |
#endif
){
blob_set(pOut, zOrigName);
blob_materialize(pOut);
}else{
char zPwd[2000];
if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){
|
| ︙ | |||
399 400 401 402 403 404 405 | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | - + - + - - - - + + + + |
int i;
Blob x;
blob_zero(&x);
for(i=2; i<g.argc; i++){
char zBuf[100];
const char *zName = g.argv[i];
file_canonical_name(zName, &x);
|
| ︙ | |||
451 452 453 454 455 456 457 | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | - + - |
blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut)));
zPath = blob_buffer(pOut);
if( zPath[0]=='/' ){
int i, j;
Blob tmp;
char zPwd[2000];
if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){
|
| ︙ | |||
500 501 502 503 504 505 506 | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | - + |
*/
void cmd_test_relative_name(void){
int i;
Blob x;
blob_zero(&x);
for(i=2; i<g.argc; i++){
file_relative_name(g.argv[i], &x);
|
| ︙ | |||
555 556 557 558 559 560 561 | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | - + |
*/
void cmd_test_tree_name(void){
int i;
Blob x;
blob_zero(&x);
for(i=2; i<g.argc; i++){
if( file_tree_name(g.argv[i], &x, 1) ){
|
| ︙ | |||
618 619 620 621 622 623 624 | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | - - + - - - + |
".",
};
static const unsigned char zChars[] =
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789";
unsigned int i, j;
|
| ︙ | |||
666 667 668 669 670 671 672 | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
if( iSize<0 ) return 0;
if( iSize!=blob_size(pContent) ) return 0;
blob_read_from_file(&onDisk, zName);
rc = blob_compare(&onDisk, pContent);
blob_reset(&onDisk);
return rc==0;
}
/**************************************************************************
** The following routines translate between MBCS and UTF8 on windows.
** Since everything is always UTF8 on unix, these routines are no-ops
** there.
*/
/*
** Translate MBCS to UTF8. Return a pointer. Call fossil_mbcs_free()
** to deallocate any memory used to store the returned pointer when done.
*/
char *fossil_mbcs_to_utf8(const char *zMbcs){
#ifdef _WIN32
extern char *sqlite3_win32_mbcs_to_utf8(const char*);
return sqlite3_win32_mbcs_to_utf8(zMbcs);
#else
return (char*)zMbcs; /* No-op on unix */
#endif
}
/*
** Translate UTF8 to MBCS. Return a pointer. Call fossil_mbcs_free()
** to deallocate any memory used to store the returned pointer when done.
*/
char *fossil_utf8_to_mbcs(const char *zUtf8){
#ifdef _WIN32
extern char *sqlite3_win32_utf8_to_mbcs(const char*);
return sqlite3_win32_utf8_to_mbcs(zUtf8);
#else
return (char*)zUtf8; /* No-op on unix */
#endif
}
/*
** Translate MBCS to UTF8. Return a pointer. Call fossil_mbcs_free()
** to deallocate any memory used to store the returned pointer when done.
*/
void fossil_mbcs_free(char *zOld){
#ifdef _WIN32
free(zOld);
#else
/* No-op on unix */
#endif
}
/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){
char *zMbcs = fossil_utf8_to_mbcs(zName);
FILE *f = fopen(zMbcs, zMode);
fossil_mbcs_free(zMbcs);
return f;
}
|
Changes to src/finfo.c.
| ︙ | |||
87 88 89 90 91 92 93 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | - + |
blob_appendf(&line, " ");
blob_appendf(&line, " %10.10s", blob_str(&uuid));
blob_reset(&uuid);
}else{
blob_appendf(&line, "unknown 0000000000");
}
db_finalize(&q);
|
| ︙ | |||
150 151 152 153 154 155 156 | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | - + - + |
" AND event.objid=mlink.mid"
" AND event.objid=ci.rid"
" ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
zFilename, iLimit, iOffset
);
blob_zero(&line);
if( iBrief ){
|
| ︙ |
Changes to src/glob.c.
| ︙ | |||
248 249 250 251 252 253 254 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | - + - + - + |
** PATTERN is a comma-separated list of glob patterns. Show which of
** the STRINGs that follow match the PATTERN.
*/
void glob_test_cmd(void){
Glob *pGlob;
int i;
if( g.argc<4 ) usage("PATTERN STRING ...");
|
Changes to src/http_transport.c.
| ︙ | |||
118 119 120 121 122 123 124 | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | - + - + - + |
if( g.urlPort!=g.urlDfltPort ){
#ifdef __MINGW32__
blob_appendf(&zCmd, " -P %d", g.urlPort);
#else
blob_appendf(&zCmd, " -p %d", g.urlPort);
#endif
}
|
| ︙ | |||
244 245 246 247 248 249 250 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | - - + + |
ssl_close();
#endif
}else if( g.urlIsFile ){
if( transport.pFile ){
fclose(transport.pFile);
transport.pFile = 0;
}
|
| ︙ |
Changes to src/import.c.
| ︙ | |||
495 496 497 498 499 500 501 | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | - + |
}else
if( memcmp(zLine, "option", 6)==0 ){
gg.xFinish();
}else
if( memcmp(zLine, "progress ", 9)==0 ){
gg.xFinish();
trim_newline(&zLine[9]);
|
| ︙ | |||
695 696 697 698 699 700 701 | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | - + |
if( g.argc==4 ){
pIn = fopen(g.argv[3], "rb");
}else{
pIn = stdin;
fossil_binary_mode(pIn);
}
if( !incrFlag ){
|
| ︙ | |||
740 741 742 743 744 745 746 | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | - + - + - + - - + + - + |
db_ephemeral_blob(&q, 0, &record);
fast_insert_content(&record, 0, 0);
import_reset(0);
}
db_finalize(&q);
db_end_transaction(0);
db_begin_transaction();
|
Changes to src/info.c.
| ︙ | |||
65 66 67 68 69 70 71 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - + - + - + - + - + |
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
if( zUuid ){
zDate = db_text(0,
"SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
rid
);
/* 01234567890123 */
|
| ︙ | |||
139 140 141 142 143 144 145 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | - - - + + + - - - + + + - + - - + + - + |
if( g.argc!=2 && g.argc!=3 ){
usage("?FILENAME|ARTIFACT-ID?");
}
if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
db_open_config(0);
db_record_repository_filename(g.argv[2]);
db_open_repository(g.argv[2]);
|
| ︙ |
Changes to src/main.c.
| ︙ | |||
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | + + - - - - + + + + - |
/*
** This procedure runs first.
*/
int main(int argc, char **argv){
const char *zCmdName = "unknown";
int idx;
int rc;
int i;
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
g.now = time(0);
g.argc = argc;
g.argv = argv;
for(i=0; i<argc; i++) g.argv[i] = fossil_mbcs_to_utf8(argv[i]);
if( getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){
zCmdName = "cgi";
}else if( argc<2 ){
|
| ︙ | |||
262 263 264 265 266 267 268 | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | - - + + - - - - - + + + + - |
g.argc++;
g.argv = zNewArgv;
}
zCmdName = g.argv[1];
}
rc = name_search(zCmdName, aCommand, count(aCommand), &idx);
if( rc==1 ){
|
| ︙ | |||
331 332 333 334 335 336 337 | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | - + + - + + |
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput && once ){
once = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
|
| ︙ | |||
376 377 378 379 380 381 382 | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | - + + - + + + |
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
|
| ︙ | |||
424 425 426 427 428 429 430 | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | + - + + |
int fossil_system(const char *zOrigCmd){
int rc;
#if defined(_WIN32)
/* On windows, we have to put double-quotes around the entire command.
** Who knows why - this is just the way windows works.
*/
char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
char *zMbcs = fossil_utf8_to_mbcs(zNewCmd);
|
| ︙ | |||
505 506 507 508 509 510 511 | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | - + - |
fossil_warning("%s: %s", sqlite_error_code_name(iCode), zErrmsg);
}
/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
|
| ︙ | |||
599 600 601 602 603 604 605 | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | - + - + |
}
nCol = 80/(mxLen+2);
if( nCol==0 ) nCol = 1;
nRow = (nWord + nCol - 1)/nCol;
for(i=0; i<nRow; i++){
const char *zSpacer = "";
for(j=i; j<nWord; j+=nRow){
|
| ︙ | |||
648 649 650 651 652 653 654 | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | + - + - - + + |
** COMMAND: version
**
** Usage: %fossil version
**
** Print the source code version number for the fossil executable.
*/
void version_cmd(void){
fossil_print("This is fossil version "
|
| ︙ | |||
687 688 689 690 691 692 693 | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | - + |
z = aCmdHelp[idx];
if( z==0 ){
fossil_fatal("no help available for the %s command",
aCommand[idx].zName);
}
while( *z ){
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
|
| ︙ | |||
1324 1325 1326 1327 1328 1329 1330 | 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 | - + |
char *zFull;
int i;
int bExists;
while( zPath && zPath[0] ){
while( zPath[0]==':' ) zPath++;
for(i=0; zPath[i] && zPath[i]!=':'; i++){}
zFull = mprintf("%.*s/%s", i, zPath, zBinary);
|
| ︙ | |||
1452 1453 1454 1455 1456 1457 1458 | 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 | - + |
**
** Echo all command-line arguments (enclosed in [...]) to the screen so that
** wildcard expansion behavior of the host shell can be investigated.
*/
void test_echo_cmd(void){
int i;
for(i=0; i<g.argc; i++){
|
Changes to src/md5.c.
| ︙ | |||
436 437 438 439 440 441 442 | 436 437 438 439 440 441 442 443 444 445 446 | - + |
for(i=2; i<g.argc; i++){
if( g.argv[i][0]=='-' && g.argv[i][1]==0 ){
blob_read_from_channel(&in, stdin, -1);
md5sum_blob(&in, &cksum);
}else{
md5sum_file(g.argv[i], &cksum);
}
|
Changes to src/merge.c.
| ︙ | |||
247 248 249 250 251 252 253 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | - + - - - + + + - + |
);
if( debugFlag ){
db_prepare(&q,
"SELECT rowid, fn, fnp, fnm, chnged, ridv, ridp, ridm, isexe FROM fv"
);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | |||
298 299 300 301 302 303 304 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | - + |
"INSERT INTO vfile(vid,chnged,deleted,rid,mrid,isexe,pathname)"
" SELECT %d,3,0,rid,mrid,isexe,pathname FROM vfile WHERE id=%d",
vid, idm
);
idv = db_last_insert_rowid();
db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid);
zName = db_column_text(&q, 2);
|
| ︙ | |||
320 321 322 323 324 325 326 | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | - + |
" AND ridm!=ridp AND ridv=ridp AND NOT chnged"
);
while( db_step(&q)==SQLITE_ROW ){
int idv = db_column_int(&q, 0);
int ridm = db_column_int(&q, 1);
const char *zName = db_column_text(&q, 2);
/* Copy content from idm over into idv. Overwrite idv. */
|
| ︙ | |||
353 354 355 356 357 358 359 | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | - + + - + - + - + |
const char *zName = db_column_text(&q, 5);
int isExe = db_column_int(&q, 6);
int rc;
char *zFullPath;
Blob m, p, r;
/* Do a 3-way merge of idp->idm into idp->idv. The results go into idv. */
if( detailFlag ){
|
| ︙ | |||
401 402 403 404 405 406 407 | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | - + - + - + - + - + + - + |
" WHERE idp>0 AND idv>0 AND idm=0"
);
while( db_step(&q)==SQLITE_ROW ){
int idv = db_column_int(&q, 0);
const char *zName = db_column_text(&q, 1);
int chnged = db_column_int(&q, 2);
/* Delete the file idv */
|
Changes to src/merge3.c.
| ︙ | |||
312 313 314 315 316 317 318 | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | - + - - + - - + - - + - |
*/
void delta_3waymerge_cmd(void){
Blob pivot, v1, v2, merged;
if( g.argc!=6 ){
usage("PIVOT V1 V2 MERGED");
}
if( blob_read_from_file(&pivot, g.argv[2])<0 ){
|
| ︙ | |||
426 427 428 429 430 431 432 | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | - - - - + + + + |
azSubst[4] = "%merge"; azSubst[5] = zOther;
azSubst[6] = "%output"; azSubst[7] = zOut;
zCmd = string_subst(zGMerge, 8, azSubst);
printf("%s\n", zCmd); fflush(stdout);
fossil_system(zCmd);
if( file_size(zOut)>=0 ){
blob_read_from_file(pOut, zOut);
|
Changes to src/name.c.
| ︙ | |||
265 266 267 268 269 270 271 | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | - + - + - + |
*/
void test_name_to_id(void){
int i;
Blob name;
db_must_be_within_tree();
for(i=2; i<g.argc; i++){
blob_init(&name, g.argv[i], -1);
|
| ︙ |
Changes to src/path.c.
| ︙ | |||
211 212 213 214 215 216 217 | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | - + + - + - + |
for(n=1, p=path.pStart; p; p=p->u.pTo, n++){
char *z;
z = db_text(0,
"SELECT substr(uuid,1,12) || ' ' || datetime(mtime)"
" FROM blob, event"
" WHERE blob.rid=%d AND event.objid=%d AND event.type='ci'",
p->rid, p->rid);
|
| ︙ | |||
310 311 312 313 314 315 316 | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | - + - - - - + + + + |
for(n=1, p=path.pStart; p; p=p->u.pTo, n++){
char *z;
z = db_text(0,
"SELECT substr(uuid,1,12) || ' ' || datetime(mtime)"
" FROM blob, event"
" WHERE blob.rid=%d AND event.objid=%d AND event.type='ci'",
p->rid, p->rid);
|
| ︙ | |||
443 444 445 446 447 448 449 | 444 445 446 447 448 449 450 451 452 453 454 455 456 | - + |
iTo = name_to_rid(g.argv[3]);
find_filename_changes(iFrom, iTo, &nChng, &aChng);
for(i=0; i<nChng; i++){
char *zFrom, *zTo;
zFrom = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2]);
zTo = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2+1]);
|
Changes to src/printf.c.
| ︙ | |||
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | + + + + + + + + + + + + + + + + + + + + + + + + + + + - + |
g.iErrPriority = iPriority;
}
void fossil_error_reset(void){
free(g.zErrMsg);
g.zErrMsg = 0;
g.iErrPriority = 0;
}
/*
** Write to standard output or standard error.
**
** On windows, transform the output into the current terminal encoding
** if the output is going to the screen. If output is redirected into
** a file, no translation occurs. No translation ever occurs on unix.
*/
void fossil_puts(const char *z, int toStdErr){
#if defined(_WIN32)
extern char *sqlite3_win32_utf8_to_mbcs(const char*);
static int once = 1;
static int istty[2];
char *zToFree = 0;
if( once ){
istty[0] = _isatty(fileno(stdout));
istty[1] = _isatty(fileno(stderr));
once = 0;
}
assert( toStdErr==0 || toStdErr==1 );
if( istty[toStdErr] ) z = zToFree = sqlite3_win32_utf8_to_mbcs(z);
fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout);
free(zToFree);
#else
fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout);
#endif
}
/*
** Write output for user consumption. If g.cgiOutput is enabled, then
** send the output as part of the CGI reply. If g.cgiOutput is false,
** then write on standard output.
*/
void fossil_print(const char *zFormat, ...){
va_list ap;
va_start(ap, zFormat);
if( g.cgiOutput ){
cgi_vprintf(zFormat, ap);
}else{
Blob b = empty_blob;
vxprintf(&b, zFormat, ap);
|
| ︙ |
Changes to src/rebuild.c.
| ︙ | |||
174 175 176 177 178 179 180 | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | - + |
/*
** Draw the percent-complete message.
** The input is actually the permill complete.
*/
static void percent_complete(int permill){
static int lastOutput = -1;
if( permill>lastOutput ){
|
| ︙ | |||
418 419 420 421 422 423 424 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | - + |
}
if( doClustering ) create_cluster();
if( !g.fQuiet && totalSize>0 ){
processCnt += incrSize;
percent_complete((processCnt*1000)/totalSize);
}
if(!g.fQuiet && ttyOutput ){
|
| ︙ | |||
547 548 549 550 551 552 553 | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | + - - + + + - + - + - + - + |
errCnt = rebuild_db(randomizeFlag, 1, doClustering);
db_multi_exec(
"REPLACE INTO config(name,value,mtime) VALUES('content-schema','%s',now());"
"REPLACE INTO config(name,value,mtime) VALUES('aux-schema','%s',now());",
CONTENT_SCHEMA, AUX_SCHEMA
);
if( errCnt && !forceFlag ){
fossil_print(
|
| ︙ | |||
676 677 678 679 680 681 682 | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | - + - + - + |
}
}
manifest_destroy(p);
}
n = db_int(0, "SELECT count(*) FROM /*scan*/"
" (SELECT rid FROM blob EXCEPT SELECT x FROM xdone)");
if( n==0 ){
|
| ︙ | |||
795 796 797 798 799 800 801 | 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | - + |
fossil_panic("some unknown error occurred while reading \"%s\"",
blob_str(&path));
}
content_put(&aContent);
blob_reset(&path);
blob_reset(&aContent);
free(zSubpath);
|
| ︙ | |||
822 823 824 825 826 827 828 | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | - + - + - + |
*/
void reconstruct_cmd(void) {
char *zPassword;
if( g.argc!=4 ){
usage("FILENAME DIRECTORY");
}
if( file_isdir(g.argv[3])!=1 ){
|
| ︙ | |||
859 860 861 862 863 864 865 | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | - - + + - + | /* Skip the verify_before_commit() step on a reconstruct. Most artifacts ** will have been changed and verification therefore takes a really, really ** long time. */ verify_cancel(); db_end_transaction(0); |
| ︙ | |||
907 908 909 910 911 912 913 | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | - + - + |
if( zPrefixOpt[0]>='0' && zPrefixOpt[0]<='9' && !zPrefixOpt[1] ){
prefixLength = (int)(*zPrefixOpt-'0');
}else{
fossil_fatal("N(%s) is not a a valid prefix length!",zPrefixOpt);
}
}
#ifndef _WIN32
|
| ︙ | |||
962 963 964 965 966 967 968 | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 | - + |
content_get(rid, &content);
rebuild_step(rid, size, &content);
}
}
}
db_finalize(&s);
if(!g.fQuiet && ttyOutput ){
|
Changes to src/report.c.
| ︙ | |||
998 999 1000 1001 1002 1003 1004 | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | - - - + + + - + |
** show all reports, which can be used for ticket show.
** Output is written to stdout as tab delimited table
*/
void rpt_list_reports(void){
Stmt q;
char const aRptOutFrmt[] = "%s\t%s\n";
|
| ︙ | |||
1035 1036 1037 1038 1039 1040 1041 | 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | - + - + - + |
static void output_no_tabs_file(const char *z){
switch( tktEncode ){
case tktFossilize:
{ char *zFosZ;
if( z && *z ){
zFosZ = fossilize(z,-1);
|
| ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 | - + - + |
){
int *pCount = (int*)pUser;
int i;
if( *pCount==0 ){
for(i=0; i<nArg; i++){
output_no_tabs_file(azName[i]);
|
| ︙ |
Changes to src/sha1.c.
| ︙ | |||
428 429 430 431 432 433 434 | 428 429 430 431 432 433 434 435 436 437 438 | - + |
blob_init(&cksum, "************** not found ***************", -1);
if( g.argv[i][0]=='-' && g.argv[i][1]==0 ){
blob_read_from_channel(&in, stdin, -1);
sha1sum_blob(&in, &cksum);
}else{
sha1sum_file(g.argv[i], &cksum);
}
|
Changes to src/stash.c.
| ︙ | |||
183 184 185 186 187 188 189 | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - + - - + + - + - + - + - + - + |
Blob delta;
undo_save(zNew);
blob_zero(&delta);
if( rid==0 ){
db_ephemeral_blob(&q, 5, &delta);
blob_write_to_file(&delta, zNPath);
file_setexe(zNPath, isExec);
|
| ︙ | |||
246 247 248 249 250 251 252 | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - + - + - + |
int isRemoved = db_column_int(&q, 1);
const char *zOrig = db_column_text(&q, 3);
const char *zNew = db_column_text(&q, 4);
char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
Blob delta;
if( rid==0 ){
db_ephemeral_blob(&q, 5, &delta);
|
| ︙ | |||
411 412 413 414 415 416 417 | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | - + - + - + |
"SELECT stashid, (SELECT uuid FROM blob WHERE rid=vid),"
" comment, datetime(ctime) FROM stash"
" ORDER BY ctime DESC"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zCom;
n++;
|
| ︙ |
Changes to src/sync.c.
| ︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - + |
** TODO: What happens if the shun list gets really big?
** Maybe the shunning list should only be pulled on every 10th
** autosync, or something?
*/
configSync = CONFIGSET_SHUN;
}
#endif
|
| ︙ | |||
122 123 124 125 126 127 128 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - + |
}
if( !g.dontKeepUrl ){
db_set("last-sync-url", g.urlCanonical, 0);
if( g.urlPasswd ) db_set("last-sync-pw", obscure(g.urlPasswd), 0);
}
user_select();
if( g.argc==2 ){
|
| ︙ | |||
261 262 263 264 265 266 267 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - + - + |
}else{
db_unset("last-sync-pw", 0);
}
}
}
zUrl = db_get("last-sync-url", 0);
if( zUrl==0 ){
|
Changes to src/tag.c.
| ︙ | |||
436 437 438 439 440 441 442 | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | - + |
"SELECT blob.uuid FROM tagxref, blob"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" AND tagxref.tagtype>0"
" AND blob.rid=tagxref.rid",
g.argv[3]
);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | |||
471 472 473 474 475 476 477 | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | - + - + |
" WHERE tagid=tag.tagid"
" AND tagtype>0)"
" ORDER BY tagname"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
if( fRaw ){
|
| ︙ | |||
495 496 497 498 499 500 501 | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | - + - + |
const char *zName = db_column_text(&q, 0);
const char *zValue = db_column_text(&q, 1);
if( fRaw==0 ){
if( strncmp(zName, "sym-", 4)!=0 ) continue;
zName += 4;
}
if( zValue && zValue[0] ){
|
| ︙ |
Changes to src/timeline.c.
| ︙ | |||
1201 1202 1203 1204 1205 1206 1207 | 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | - + - + |
char *zFree = 0;
int n = 0;
char zPrefix[80];
char zUuid[UUID_SIZE+1];
sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
if( memcmp(zDate, zPrevDate, 10) ){
|
| ︙ | |||
1451 1452 1453 1454 1455 1456 1457 | 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 | - + - + |
" (SELECT uuid FROM blob WHERE rid=c.cid),"
" datetime(p.mtime), datetime(c.mtime)"
" FROM plink p, plink c"
" WHERE p.cid=c.pid AND p.mtime>c.mtime"
);
while( db_step(&q)==SQLITE_ROW ){
if( !showDetail ){
|
| ︙ |
Changes to src/undo.c.
| ︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | - + - + - - + + |
old_exists = db_column_int(&q, 1);
old_exe = db_column_int(&q, 2);
if( old_exists ){
db_ephemeral_blob(&q, 0, &new);
}
if( old_exists ){
if( new_exists ){
|
| ︙ | |||
295 296 297 298 299 300 301 | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | - + |
/*
** Complete the undo process is one is currently in process.
*/
void undo_finish(void){
if( undoActive ){
if( undoNeedRollback ){
|
| ︙ | |||
317 318 319 320 321 322 323 | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | - + |
** was locked or had permissions turned off.
*/
void undo_rollback(void){
if( !undoNeedRollback ) return;
assert( undoActive );
undoNeedRollback = 0;
undoActive = 0;
|
| ︙ | |||
358 359 360 361 362 363 364 | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | - + - - + + + - - + + - + - + |
const char *zCmd = isRedo ? "redo" : "undo";
db_must_be_within_tree();
verify_all_options();
db_begin_transaction();
undo_available = db_lget_int("undo_available", 0);
if( explainFlag ){
if( undo_available==0 ){
|
| ︙ | |||
408 409 410 411 412 413 414 | 409 410 411 412 413 414 415 416 417 418 419 420 421 | - + |
file_tree_name(zFile, &path, 1);
undo_one(blob_str(&path), isRedo);
blob_reset(&path);
}
}
vid2 = db_lget_int("checkout", 0);
if( vid1!=vid2 ){
|
Changes to src/update.c.
| ︙ | |||
251 252 253 254 255 256 257 | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | - + - - + + |
);
if( debugFlag ){
db_prepare(&q,
"SELECT rowid, fn, fnt, chnged, ridv, ridt, isexe FROM fv"
);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | |||
329 330 331 332 333 334 335 | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | - + - + - + - + - + + - + - + - + - + - + - + - + - + - + - + - + |
zFullPath = mprintf("%s%s", g.zLocalRoot, zName);
zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName);
nameChng = fossil_strcmp(zName, zNewName);
if( idv>0 && ridv==0 && idt>0 && ridt>0 ){
/* Conflict. This file has been added to the current checkout
** but also exists in the target checkout. Use the current version.
*/
|
| ︙ | |||
568 569 570 571 572 573 574 | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | - + - - + + - + |
int isExe = 0;
char *zFull;
zFile = db_column_text(&q, 0);
zFull = mprintf("%/%/", g.zLocalRoot, zFile);
errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2);
if( errCode==2 ){
if( db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFile)==0 ){
|
| ︙ |
Changes to src/url.c.
| ︙ | |||
206 207 208 209 210 211 212 | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - - - - - - - - - - - - - + + + + + + + + + + + + + - + |
int i;
url_proxy_options();
if( g.argc!=3 && g.argc!=4 ){
usage("URL");
}
url_parse(g.argv[2]);
for(i=0; i<2; i++){
|
| ︙ | |||
274 275 276 277 278 279 280 | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | - + |
char *zOriginalUrl = g.urlCanonical;
char *zOriginalHost = g.urlHostname;
char *zOriginalUser = g.urlUser;
char *zOriginalPasswd = g.urlPasswd;
g.urlUser = 0;
g.urlPasswd = "";
url_parse(zProxy);
|
| ︙ |
Changes to src/user.c.
| ︙ | |||
115 116 117 118 119 120 121 | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - + - + |
blob_zero(&secondTry);
while(1){
prompt_for_passphrase(zPrompt, pPassphrase);
if( verify==0 ) break;
if( verify==1 && blob_size(pPassphrase)==0 ) break;
prompt_for_passphrase("Retype new password: ", &secondTry);
if( blob_compare(pPassphrase, &secondTry) ){
|
| ︙ | |||
210 211 212 213 214 215 216 | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | - + - + - + |
"VALUES(%B,%Q,%B,%B,now())",
&login, zPw, &caps, &contact
);
free(zPw);
}else if( n>=2 && strncmp(g.argv[2],"default",n)==0 ){
user_select();
if( g.argc==3 ){
|
| ︙ | |||
266 267 268 269 270 271 272 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + |
}
if( g.argc==5 ){
db_multi_exec(
"UPDATE user SET cap=%Q, mtime=now() WHERE uid=%d",
g.argv[4], uid
);
}
|
| ︙ |
Changes to src/vfile.c.
| ︙ | |||
262 263 264 265 266 267 268 | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | - + |
cReply = 'y';
}
if( cReply=='n' || cReply=='N' ){
blob_reset(&content);
continue;
}
}
|
| ︙ | |||
284 285 286 287 288 289 290 | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | - + |
Stmt q;
db_prepare(&q, "SELECT %Q || pathname FROM vfile"
" WHERE vid=%d AND mrid>0", g.zLocalRoot, vid);
while( db_step(&q)==SQLITE_ROW ){
const char *zName;
zName = db_column_text(&q, 0);
|
| ︙ | |||
426 427 428 429 430 431 432 | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | - + |
while( db_step(&q)==SQLITE_ROW ){
const char *zFullpath = db_column_text(&q, 0);
const char *zName = db_column_text(&q, 1);
int isSelected = db_column_int(&q, 3);
if( isSelected ){
md5sum_step_text(zName, -1);
|
| ︙ | |||
489 490 491 492 493 494 495 | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | - + - + + - - + + |
const char *zFullpath = db_column_text(&q, 0);
const char *zName = db_column_text(&q, 1);
int rid = db_column_int(&q, 2);
blob_zero(&disk);
rc = blob_read_from_file(&disk, zFullpath);
if( rc<0 ){
|
| ︙ |
Changes to src/wiki.c.
| ︙ | |||
914 915 916 917 918 919 920 | 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | - + - + - + - + - + |
zFile = (g.argc==4) ? 0 : g.argv[4];
if( zFile ){
FILE * zF;
short doClose = 0;
if( (1 == strlen(zFile)) && ('-'==zFile[0]) ){
zF = stdout;
}else{
|
Changes to src/winhttp.c.
| ︙ | |||
90 91 92 93 94 95 96 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - + - + - - + + |
z = strstr(zHdr, "\r\n\r\n");
if( z ){
wanted = find_content_length(zHdr) + (&z[4]-zHdr) - amt;
break;
}
}
if( amt>=sizeof(zHdr) ) goto end_request;
|
| ︙ | |||
144 145 146 147 148 149 150 | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | - + | WSADATA wd; SOCKET s = INVALID_SOCKET; SOCKADDR_IN addr; int idCnt = 0; int iPort = mnPort; Blob options; |
| ︙ | |||
188 189 190 191 192 193 194 | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | - + - + - + |
fossil_fatal("unable to open listening socket on ports %d", mnPort);
}else{
fossil_fatal("unable to open listening socket on any"
" port in the range %d..%d", mnPort, mxPort);
}
}
zTempPrefix = mprintf("fossil_server_P%d_", iPort);
|
| ︙ |
Changes to src/xfer.c.
| ︙ | |||
1204 1205 1206 1207 1208 1209 1210 | 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 | - + |
if( g.argc!=2 && g.argc!=3 ){
usage("?MESSAGEFILE?");
}
blob_zero(&g.cgiIn);
blob_read_from_file(&g.cgiIn, g.argc==2 ? "-" : g.argv[2]);
disableLogin = 1;
page_xfer();
|
| ︙ | |||
1388 1389 1390 1391 1392 1393 1394 | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | - + |
nCardSent = 0;
nCardRcvd = 0;
xfer.nFileSent = 0;
xfer.nDeltaSent = 0;
xfer.nGimmeSent = 0;
xfer.nIGotSent = 0;
if( !g.cgiOutput && !g.fQuiet ){
|
| ︙ | |||
1444 1445 1446 1447 1448 1449 1450 | 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 | - + |
continue;
}
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
nCardRcvd++;
if( !g.cgiOutput && !g.fQuiet && recv.nUsed>0 ){
pctDone = (recv.iCursor*100)/recv.nUsed;
if( pctDone!=lastPctDone ){
|
| ︙ |