Fossil SCM

Change most uses of fossil_panic() to fossil_fatal(). Modify fossil_panic() to avoid allocating heap memory and to close the database connection before doing anything else.

drh 2013-08-30 03:06 trunk
Commit 320f14363e1a37dc96e30e0a47cec07c6be398c4
+4 -4
--- src/add.c
+++ src/add.c
@@ -264,11 +264,11 @@
264264
if( zIgnoreFlag==0 ){
265265
zIgnoreFlag = db_get("ignore-glob", 0);
266266
}
267267
vid = db_lget_int("checkout",0);
268268
if( vid==0 ){
269
- fossil_panic("no checkout to add to");
269
+ fossil_fatal("no checkout to add to");
270270
}
271271
db_begin_transaction();
272272
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
273273
filename_collation());
274274
pClean = glob_create(zCleanFlag);
@@ -331,11 +331,11 @@
331331
332332
capture_case_sensitive_option();
333333
db_must_be_within_tree();
334334
vid = db_lget_int("checkout", 0);
335335
if( vid==0 ){
336
- fossil_panic("no checkout to remove from");
336
+ fossil_fatal("no checkout to remove from");
337337
}
338338
db_begin_transaction();
339339
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
340340
filename_collation());
341341
for(i=2; i<g.argc; i++){
@@ -506,11 +506,11 @@
506506
if( zIgnoreFlag==0 ){
507507
zIgnoreFlag = db_get("ignore-glob", 0);
508508
}
509509
vid = db_lget_int("checkout",0);
510510
if( vid==0 ){
511
- fossil_panic("no checkout to add to");
511
+ fossil_fatal("no checkout to add to");
512512
}
513513
db_begin_transaction();
514514
515515
/* step 1:
516516
** Populate the temp table "sfile" with the names of all unmanaged
@@ -611,11 +611,11 @@
611611
612612
capture_case_sensitive_option();
613613
db_must_be_within_tree();
614614
vid = db_lget_int("checkout", 0);
615615
if( vid==0 ){
616
- fossil_panic("no checkout rename files in");
616
+ fossil_fatal("no checkout rename files in");
617617
}
618618
if( g.argc<4 ){
619619
usage("OLDNAME NEWNAME");
620620
}
621621
zDest = g.argv[g.argc-1];
622622
--- src/add.c
+++ src/add.c
@@ -264,11 +264,11 @@
264 if( zIgnoreFlag==0 ){
265 zIgnoreFlag = db_get("ignore-glob", 0);
266 }
267 vid = db_lget_int("checkout",0);
268 if( vid==0 ){
269 fossil_panic("no checkout to add to");
270 }
271 db_begin_transaction();
272 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
273 filename_collation());
274 pClean = glob_create(zCleanFlag);
@@ -331,11 +331,11 @@
331
332 capture_case_sensitive_option();
333 db_must_be_within_tree();
334 vid = db_lget_int("checkout", 0);
335 if( vid==0 ){
336 fossil_panic("no checkout to remove from");
337 }
338 db_begin_transaction();
339 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
340 filename_collation());
341 for(i=2; i<g.argc; i++){
@@ -506,11 +506,11 @@
506 if( zIgnoreFlag==0 ){
507 zIgnoreFlag = db_get("ignore-glob", 0);
508 }
509 vid = db_lget_int("checkout",0);
510 if( vid==0 ){
511 fossil_panic("no checkout to add to");
512 }
513 db_begin_transaction();
514
515 /* step 1:
516 ** Populate the temp table "sfile" with the names of all unmanaged
@@ -611,11 +611,11 @@
611
612 capture_case_sensitive_option();
613 db_must_be_within_tree();
614 vid = db_lget_int("checkout", 0);
615 if( vid==0 ){
616 fossil_panic("no checkout rename files in");
617 }
618 if( g.argc<4 ){
619 usage("OLDNAME NEWNAME");
620 }
621 zDest = g.argv[g.argc-1];
622
--- src/add.c
+++ src/add.c
@@ -264,11 +264,11 @@
264 if( zIgnoreFlag==0 ){
265 zIgnoreFlag = db_get("ignore-glob", 0);
266 }
267 vid = db_lget_int("checkout",0);
268 if( vid==0 ){
269 fossil_fatal("no checkout to add to");
270 }
271 db_begin_transaction();
272 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
273 filename_collation());
274 pClean = glob_create(zCleanFlag);
@@ -331,11 +331,11 @@
331
332 capture_case_sensitive_option();
333 db_must_be_within_tree();
334 vid = db_lget_int("checkout", 0);
335 if( vid==0 ){
336 fossil_fatal("no checkout to remove from");
337 }
338 db_begin_transaction();
339 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
340 filename_collation());
341 for(i=2; i<g.argc; i++){
@@ -506,11 +506,11 @@
506 if( zIgnoreFlag==0 ){
507 zIgnoreFlag = db_get("ignore-glob", 0);
508 }
509 vid = db_lget_int("checkout",0);
510 if( vid==0 ){
511 fossil_fatal("no checkout to add to");
512 }
513 db_begin_transaction();
514
515 /* step 1:
516 ** Populate the temp table "sfile" with the names of all unmanaged
@@ -611,11 +611,11 @@
611
612 capture_case_sensitive_option();
613 db_must_be_within_tree();
614 vid = db_lget_int("checkout", 0);
615 if( vid==0 ){
616 fossil_fatal("no checkout rename files in");
617 }
618 if( g.argc<4 ){
619 usage("OLDNAME NEWNAME");
620 }
621 zDest = g.argv[g.argc-1];
622
+4 -4
--- src/blob.c
+++ src/blob.c
@@ -700,11 +700,11 @@
700700
** Initialize a blob to be the content of a file. If the filename
701701
** is blank or "-" then read from standard input.
702702
**
703703
** Any prior content of the blob is discarded, not freed.
704704
**
705
-** Return the number of bytes read. Calls fossil_panic() error (i.e.
705
+** Return the number of bytes read. Calls fossil_fatal() error (i.e.
706706
** it exit()s and does not return).
707707
*/
708708
int blob_read_from_file(Blob *pBlob, const char *zFilename){
709709
int size, got;
710710
FILE *in;
@@ -721,11 +721,11 @@
721721
return 0;
722722
}
723723
blob_resize(pBlob, size);
724724
in = fossil_fopen(zFilename, "rb");
725725
if( in==0 ){
726
- fossil_panic("cannot open %s for reading", zFilename);
726
+ fossil_fatal("cannot open %s for reading", zFilename);
727727
}
728728
got = fread(blob_buffer(pBlob), 1, size, in);
729729
fclose(in);
730730
if( got<size ){
731731
blob_resize(pBlob, got);
@@ -744,11 +744,11 @@
744744
int blob_read_link(Blob *pBlob, const char *zFilename){
745745
#if !defined(_WIN32)
746746
char zBuf[1024];
747747
ssize_t len = readlink(zFilename, zBuf, 1023);
748748
if( len < 0 ){
749
- fossil_panic("cannot read symbolic link %s", zFilename);
749
+ fossil_fatal("cannot read symbolic link %s", zFilename);
750750
}
751751
zBuf[len] = 0; /* null-terminate */
752752
blob_zero(pBlob);
753753
blob_appendf(pBlob, "%s", zBuf);
754754
return len;
@@ -978,11 +978,11 @@
978978
for(i=2; i<g.argc; i++){
979979
blob_read_from_file(&b1, g.argv[i]);
980980
blob_compress(&b1, &b2);
981981
blob_uncompress(&b2, &b3);
982982
if( blob_compare(&b1, &b3) ){
983
- fossil_panic("compress/uncompress cycle failed for %s", g.argv[i]);
983
+ fossil_fatal("compress/uncompress cycle failed for %s", g.argv[i]);
984984
}
985985
blob_reset(&b1);
986986
blob_reset(&b2);
987987
blob_reset(&b3);
988988
}
989989
--- src/blob.c
+++ src/blob.c
@@ -700,11 +700,11 @@
700 ** Initialize a blob to be the content of a file. If the filename
701 ** is blank or "-" then read from standard input.
702 **
703 ** Any prior content of the blob is discarded, not freed.
704 **
705 ** Return the number of bytes read. Calls fossil_panic() error (i.e.
706 ** it exit()s and does not return).
707 */
708 int blob_read_from_file(Blob *pBlob, const char *zFilename){
709 int size, got;
710 FILE *in;
@@ -721,11 +721,11 @@
721 return 0;
722 }
723 blob_resize(pBlob, size);
724 in = fossil_fopen(zFilename, "rb");
725 if( in==0 ){
726 fossil_panic("cannot open %s for reading", zFilename);
727 }
728 got = fread(blob_buffer(pBlob), 1, size, in);
729 fclose(in);
730 if( got<size ){
731 blob_resize(pBlob, got);
@@ -744,11 +744,11 @@
744 int blob_read_link(Blob *pBlob, const char *zFilename){
745 #if !defined(_WIN32)
746 char zBuf[1024];
747 ssize_t len = readlink(zFilename, zBuf, 1023);
748 if( len < 0 ){
749 fossil_panic("cannot read symbolic link %s", zFilename);
750 }
751 zBuf[len] = 0; /* null-terminate */
752 blob_zero(pBlob);
753 blob_appendf(pBlob, "%s", zBuf);
754 return len;
@@ -978,11 +978,11 @@
978 for(i=2; i<g.argc; i++){
979 blob_read_from_file(&b1, g.argv[i]);
980 blob_compress(&b1, &b2);
981 blob_uncompress(&b2, &b3);
982 if( blob_compare(&b1, &b3) ){
983 fossil_panic("compress/uncompress cycle failed for %s", g.argv[i]);
984 }
985 blob_reset(&b1);
986 blob_reset(&b2);
987 blob_reset(&b3);
988 }
989
--- src/blob.c
+++ src/blob.c
@@ -700,11 +700,11 @@
700 ** Initialize a blob to be the content of a file. If the filename
701 ** is blank or "-" then read from standard input.
702 **
703 ** Any prior content of the blob is discarded, not freed.
704 **
705 ** Return the number of bytes read. Calls fossil_fatal() error (i.e.
706 ** it exit()s and does not return).
707 */
708 int blob_read_from_file(Blob *pBlob, const char *zFilename){
709 int size, got;
710 FILE *in;
@@ -721,11 +721,11 @@
721 return 0;
722 }
723 blob_resize(pBlob, size);
724 in = fossil_fopen(zFilename, "rb");
725 if( in==0 ){
726 fossil_fatal("cannot open %s for reading", zFilename);
727 }
728 got = fread(blob_buffer(pBlob), 1, size, in);
729 fclose(in);
730 if( got<size ){
731 blob_resize(pBlob, got);
@@ -744,11 +744,11 @@
744 int blob_read_link(Blob *pBlob, const char *zFilename){
745 #if !defined(_WIN32)
746 char zBuf[1024];
747 ssize_t len = readlink(zFilename, zBuf, 1023);
748 if( len < 0 ){
749 fossil_fatal("cannot read symbolic link %s", zFilename);
750 }
751 zBuf[len] = 0; /* null-terminate */
752 blob_zero(pBlob);
753 blob_appendf(pBlob, "%s", zBuf);
754 return len;
@@ -978,11 +978,11 @@
978 for(i=2; i<g.argc; i++){
979 blob_read_from_file(&b1, g.argv[i]);
980 blob_compress(&b1, &b2);
981 blob_uncompress(&b2, &b3);
982 if( blob_compare(&b1, &b3) ){
983 fossil_fatal("compress/uncompress cycle failed for %s", g.argv[i]);
984 }
985 blob_reset(&b1);
986 blob_reset(&b2);
987 blob_reset(&b3);
988 }
989
+4 -4
--- src/branch.c
+++ src/branch.c
@@ -56,11 +56,11 @@
5656
noSign = db_get_int("omitsign", 0)|noSign;
5757
5858
/* fossil branch new name */
5959
zBranch = g.argv[3];
6060
if( zBranch==0 || zBranch[0]==0 ){
61
- fossil_panic("branch name cannot be empty");
61
+ fossil_fatal("branch name cannot be empty");
6262
}
6363
if( db_exists(
6464
"SELECT 1 FROM tagxref"
6565
" WHERE tagtype>0"
6666
" AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%q')",
@@ -150,15 +150,15 @@
150150
}
151151
}
152152
153153
brid = content_put_ex(&branch, 0, 0, 0, isPrivate);
154154
if( brid==0 ){
155
- fossil_panic("trouble committing manifest: %s", g.zErrMsg);
155
+ fossil_fatal("trouble committing manifest: %s", g.zErrMsg);
156156
}
157157
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
158158
if( manifest_crosslink(brid, &branch)==0 ){
159
- fossil_panic("unable to install new manifest");
159
+ fossil_fatal("unable to install new manifest");
160160
}
161161
assert( blob_is_reset(&branch) );
162162
content_deltify(rootid, brid, 0);
163163
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
164164
fossil_print("New branch: %s\n", zUuid);
@@ -279,11 +279,11 @@
279279
int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
280280
fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
281281
}
282282
db_finalize(&q);
283283
}else{
284
- fossil_panic("branch subcommand should be one of: "
284
+ fossil_fatal("branch subcommand should be one of: "
285285
"new list ls");
286286
}
287287
}
288288
289289
/*
290290
--- src/branch.c
+++ src/branch.c
@@ -56,11 +56,11 @@
56 noSign = db_get_int("omitsign", 0)|noSign;
57
58 /* fossil branch new name */
59 zBranch = g.argv[3];
60 if( zBranch==0 || zBranch[0]==0 ){
61 fossil_panic("branch name cannot be empty");
62 }
63 if( db_exists(
64 "SELECT 1 FROM tagxref"
65 " WHERE tagtype>0"
66 " AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%q')",
@@ -150,15 +150,15 @@
150 }
151 }
152
153 brid = content_put_ex(&branch, 0, 0, 0, isPrivate);
154 if( brid==0 ){
155 fossil_panic("trouble committing manifest: %s", g.zErrMsg);
156 }
157 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
158 if( manifest_crosslink(brid, &branch)==0 ){
159 fossil_panic("unable to install new manifest");
160 }
161 assert( blob_is_reset(&branch) );
162 content_deltify(rootid, brid, 0);
163 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
164 fossil_print("New branch: %s\n", zUuid);
@@ -279,11 +279,11 @@
279 int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
280 fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
281 }
282 db_finalize(&q);
283 }else{
284 fossil_panic("branch subcommand should be one of: "
285 "new list ls");
286 }
287 }
288
289 /*
290
--- src/branch.c
+++ src/branch.c
@@ -56,11 +56,11 @@
56 noSign = db_get_int("omitsign", 0)|noSign;
57
58 /* fossil branch new name */
59 zBranch = g.argv[3];
60 if( zBranch==0 || zBranch[0]==0 ){
61 fossil_fatal("branch name cannot be empty");
62 }
63 if( db_exists(
64 "SELECT 1 FROM tagxref"
65 " WHERE tagtype>0"
66 " AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%q')",
@@ -150,15 +150,15 @@
150 }
151 }
152
153 brid = content_put_ex(&branch, 0, 0, 0, isPrivate);
154 if( brid==0 ){
155 fossil_fatal("trouble committing manifest: %s", g.zErrMsg);
156 }
157 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
158 if( manifest_crosslink(brid, &branch)==0 ){
159 fossil_fatal("unable to install new manifest");
160 }
161 assert( blob_is_reset(&branch) );
162 content_deltify(rootid, brid, 0);
163 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
164 fossil_print("New branch: %s\n", zUuid);
@@ -279,11 +279,11 @@
279 int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
280 fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
281 }
282 db_finalize(&q);
283 }else{
284 fossil_fatal("branch subcommand should be one of: "
285 "new list ls");
286 }
287 }
288
289 /*
290
+2 -2
--- src/checkin.c
+++ src/checkin.c
@@ -1690,11 +1690,11 @@
16901690
manifest = delta;
16911691
}else{
16921692
blob_reset(&delta);
16931693
}
16941694
}else if( forceDelta ){
1695
- fossil_panic("unable to find a baseline-manifest for the delta");
1695
+ fossil_fatal("unable to find a baseline-manifest for the delta");
16961696
}
16971697
}
16981698
if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
16991699
blob_zero(&ans);
17001700
prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
@@ -1718,11 +1718,11 @@
17181718
free(zManifestFile);
17191719
}
17201720
17211721
nvid = content_put(&manifest);
17221722
if( nvid==0 ){
1723
- fossil_panic("trouble committing manifest: %s", g.zErrMsg);
1723
+ fossil_fatal("trouble committing manifest: %s", g.zErrMsg);
17241724
}
17251725
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
17261726
manifest_crosslink(nvid, &manifest);
17271727
assert( blob_is_reset(&manifest) );
17281728
content_deltify(vid, nvid, 0);
17291729
--- src/checkin.c
+++ src/checkin.c
@@ -1690,11 +1690,11 @@
1690 manifest = delta;
1691 }else{
1692 blob_reset(&delta);
1693 }
1694 }else if( forceDelta ){
1695 fossil_panic("unable to find a baseline-manifest for the delta");
1696 }
1697 }
1698 if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
1699 blob_zero(&ans);
1700 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
@@ -1718,11 +1718,11 @@
1718 free(zManifestFile);
1719 }
1720
1721 nvid = content_put(&manifest);
1722 if( nvid==0 ){
1723 fossil_panic("trouble committing manifest: %s", g.zErrMsg);
1724 }
1725 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
1726 manifest_crosslink(nvid, &manifest);
1727 assert( blob_is_reset(&manifest) );
1728 content_deltify(vid, nvid, 0);
1729
--- src/checkin.c
+++ src/checkin.c
@@ -1690,11 +1690,11 @@
1690 manifest = delta;
1691 }else{
1692 blob_reset(&delta);
1693 }
1694 }else if( forceDelta ){
1695 fossil_fatal("unable to find a baseline-manifest for the delta");
1696 }
1697 }
1698 if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
1699 blob_zero(&ans);
1700 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
@@ -1718,11 +1718,11 @@
1718 free(zManifestFile);
1719 }
1720
1721 nvid = content_put(&manifest);
1722 if( nvid==0 ){
1723 fossil_fatal("trouble committing manifest: %s", g.zErrMsg);
1724 }
1725 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
1726 manifest_crosslink(nvid, &manifest);
1727 assert( blob_is_reset(&manifest) );
1728 content_deltify(vid, nvid, 0);
1729
+1 -1
--- src/checkout.c
+++ src/checkout.c
@@ -61,11 +61,11 @@
6161
Blob uuid;
6262
int vid;
6363
6464
blob_init(&uuid, zName, -1);
6565
if( name_to_uuid(&uuid, 1, "ci") ){
66
- fossil_panic(g.zErrMsg);
66
+ fossil_fatal(g.zErrMsg);
6767
}
6868
vid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
6969
if( vid==0 ){
7070
fossil_fatal("no such check-in: %s", g.argv[2]);
7171
}
7272
--- src/checkout.c
+++ src/checkout.c
@@ -61,11 +61,11 @@
61 Blob uuid;
62 int vid;
63
64 blob_init(&uuid, zName, -1);
65 if( name_to_uuid(&uuid, 1, "ci") ){
66 fossil_panic(g.zErrMsg);
67 }
68 vid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
69 if( vid==0 ){
70 fossil_fatal("no such check-in: %s", g.argv[2]);
71 }
72
--- src/checkout.c
+++ src/checkout.c
@@ -61,11 +61,11 @@
61 Blob uuid;
62 int vid;
63
64 blob_init(&uuid, zName, -1);
65 if( name_to_uuid(&uuid, 1, "ci") ){
66 fossil_fatal(g.zErrMsg);
67 }
68 vid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
69 if( vid==0 ){
70 fossil_fatal("no such check-in: %s", g.argv[2]);
71 }
72
+1 -1
--- src/clone.c
+++ src/clone.c
@@ -123,11 +123,11 @@
123123
if( g.argc < 4 ){
124124
usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
125125
}
126126
db_open_config(0);
127127
if( file_size(g.argv[3])>0 ){
128
- fossil_panic("file already exists: %s", g.argv[3]);
128
+ fossil_fatal("file already exists: %s", g.argv[3]);
129129
}
130130
131131
zDefaultUser = find_option("admin-user","A",1);
132132
133133
url_parse(g.argv[2], URL_PROMPT_PW|URL_ASK_REMEMBER_PW);
134134
--- src/clone.c
+++ src/clone.c
@@ -123,11 +123,11 @@
123 if( g.argc < 4 ){
124 usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
125 }
126 db_open_config(0);
127 if( file_size(g.argv[3])>0 ){
128 fossil_panic("file already exists: %s", g.argv[3]);
129 }
130
131 zDefaultUser = find_option("admin-user","A",1);
132
133 url_parse(g.argv[2], URL_PROMPT_PW|URL_ASK_REMEMBER_PW);
134
--- src/clone.c
+++ src/clone.c
@@ -123,11 +123,11 @@
123 if( g.argc < 4 ){
124 usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
125 }
126 db_open_config(0);
127 if( file_size(g.argv[3])>0 ){
128 fossil_fatal("file already exists: %s", g.argv[3]);
129 }
130
131 zDefaultUser = find_option("admin-user","A",1);
132
133 url_parse(g.argv[2], URL_PROMPT_PW|URL_ASK_REMEMBER_PW);
134
+1 -1
--- src/db.c
+++ src/db.c
@@ -1994,11 +1994,11 @@
19941994
allowNested = find_option("nested",0,0)!=0;
19951995
if( g.argc!=3 && g.argc!=4 ){
19961996
usage("REPOSITORY-FILENAME ?VERSION?");
19971997
}
19981998
if( !allowNested && db_open_local(0) ){
1999
- fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
1999
+ fossil_fatal("already within an open tree rooted at %s", g.zLocalRoot);
20002000
}
20012001
db_open_repository(g.argv[2]);
20022002
#if defined(_WIN32) || defined(__CYGWIN__)
20032003
# define LOCALDB_NAME "./_FOSSIL_"
20042004
#else
20052005
--- src/db.c
+++ src/db.c
@@ -1994,11 +1994,11 @@
1994 allowNested = find_option("nested",0,0)!=0;
1995 if( g.argc!=3 && g.argc!=4 ){
1996 usage("REPOSITORY-FILENAME ?VERSION?");
1997 }
1998 if( !allowNested && db_open_local(0) ){
1999 fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
2000 }
2001 db_open_repository(g.argv[2]);
2002 #if defined(_WIN32) || defined(__CYGWIN__)
2003 # define LOCALDB_NAME "./_FOSSIL_"
2004 #else
2005
--- src/db.c
+++ src/db.c
@@ -1994,11 +1994,11 @@
1994 allowNested = find_option("nested",0,0)!=0;
1995 if( g.argc!=3 && g.argc!=4 ){
1996 usage("REPOSITORY-FILENAME ?VERSION?");
1997 }
1998 if( !allowNested && db_open_local(0) ){
1999 fossil_fatal("already within an open tree rooted at %s", g.zLocalRoot);
2000 }
2001 db_open_repository(g.argv[2]);
2002 #if defined(_WIN32) || defined(__CYGWIN__)
2003 # define LOCALDB_NAME "./_FOSSIL_"
2004 #else
2005
+1 -1
--- src/deltacmd.c
+++ src/deltacmd.c
@@ -144,9 +144,9 @@
144144
blob_delta_create(&f1, &f2, &d12);
145145
blob_delta_create(&f2, &f1, &d21);
146146
blob_delta_apply(&f1, &d12, &a2);
147147
blob_delta_apply(&f2, &d21, &a1);
148148
if( blob_compare(&f1,&a1) || blob_compare(&f2, &a2) ){
149
- fossil_panic("delta test failed");
149
+ fossil_fatal("delta test failed");
150150
}
151151
fossil_print("ok\n");
152152
}
153153
--- src/deltacmd.c
+++ src/deltacmd.c
@@ -144,9 +144,9 @@
144 blob_delta_create(&f1, &f2, &d12);
145 blob_delta_create(&f2, &f1, &d21);
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
--- src/deltacmd.c
+++ src/deltacmd.c
@@ -144,9 +144,9 @@
144 blob_delta_create(&f1, &f2, &d12);
145 blob_delta_create(&f2, &f1, &d21);
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_fatal("delta test failed");
150 }
151 fossil_print("ok\n");
152 }
153
+3 -3
--- src/diff.c
+++ src/diff.c
@@ -2046,14 +2046,14 @@
20462046
int cnt = 0; /* Number of versions examined */
20472047
20482048
/* Initialize the annotation */
20492049
rid = db_int(0, "SELECT fid FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid);
20502050
if( rid==0 ){
2051
- fossil_panic("file #%d is unchanged in manifest #%d", fnid, mid);
2051
+ fossil_fatal("file #%d is unchanged in manifest #%d", fnid, mid);
20522052
}
20532053
if( !content_get(rid, &toAnnotate) ){
2054
- fossil_panic("unable to retrieve content of artifact #%d", rid);
2054
+ fossil_fatal("unable to retrieve content of artifact #%d", rid);
20552055
}
20562056
if( iLimit<=0 ) iLimit = 1000000000;
20572057
annotation_start(p, &toAnnotate);
20582058
db_begin_transaction();
20592059
db_multi_exec(
@@ -2329,11 +2329,11 @@
23292329
mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
23302330
" WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
23312331
" ORDER BY ancestor.generation ASC LIMIT 1",
23322332
fid, fnid);
23332333
if( mid==0 ){
2334
- fossil_panic("unable to find manifest");
2334
+ fossil_fatal("unable to find manifest");
23352335
}
23362336
annFlags |= ANN_FILE_ANCEST;
23372337
annotate_file(&ann, fnid, mid, iLimit, annFlags);
23382338
if( showLog ){
23392339
struct AnnVers *p;
23402340
--- src/diff.c
+++ src/diff.c
@@ -2046,14 +2046,14 @@
2046 int cnt = 0; /* Number of versions examined */
2047
2048 /* Initialize the annotation */
2049 rid = db_int(0, "SELECT fid FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid);
2050 if( rid==0 ){
2051 fossil_panic("file #%d is unchanged in manifest #%d", fnid, mid);
2052 }
2053 if( !content_get(rid, &toAnnotate) ){
2054 fossil_panic("unable to retrieve content of artifact #%d", rid);
2055 }
2056 if( iLimit<=0 ) iLimit = 1000000000;
2057 annotation_start(p, &toAnnotate);
2058 db_begin_transaction();
2059 db_multi_exec(
@@ -2329,11 +2329,11 @@
2329 mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
2330 " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
2331 " ORDER BY ancestor.generation ASC LIMIT 1",
2332 fid, fnid);
2333 if( mid==0 ){
2334 fossil_panic("unable to find manifest");
2335 }
2336 annFlags |= ANN_FILE_ANCEST;
2337 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2338 if( showLog ){
2339 struct AnnVers *p;
2340
--- src/diff.c
+++ src/diff.c
@@ -2046,14 +2046,14 @@
2046 int cnt = 0; /* Number of versions examined */
2047
2048 /* Initialize the annotation */
2049 rid = db_int(0, "SELECT fid FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid);
2050 if( rid==0 ){
2051 fossil_fatal("file #%d is unchanged in manifest #%d", fnid, mid);
2052 }
2053 if( !content_get(rid, &toAnnotate) ){
2054 fossil_fatal("unable to retrieve content of artifact #%d", rid);
2055 }
2056 if( iLimit<=0 ) iLimit = 1000000000;
2057 annotation_start(p, &toAnnotate);
2058 db_begin_transaction();
2059 db_multi_exec(
@@ -2329,11 +2329,11 @@
2329 mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
2330 " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
2331 " ORDER BY ancestor.generation ASC LIMIT 1",
2332 fid, fnid);
2333 if( mid==0 ){
2334 fossil_fatal("unable to find manifest");
2335 }
2336 annFlags |= ANN_FILE_ANCEST;
2337 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2338 if( showLog ){
2339 struct AnnVers *p;
2340
+1 -1
--- src/event.c
+++ src/event.c
@@ -115,11 +115,11 @@
115115
116116
/* Extract the event content.
117117
*/
118118
pEvent = manifest_get(rid, CFTYPE_EVENT);
119119
if( pEvent==0 ){
120
- fossil_panic("Object #%d is not an event", rid);
120
+ fossil_fatal("Object #%d is not an event", rid);
121121
}
122122
blob_init(&fullbody, pEvent->zWiki, -1);
123123
if( wiki_find_title(&fullbody, &title, &tail) ){
124124
style_header(blob_str(&title));
125125
}else{
126126
--- src/event.c
+++ src/event.c
@@ -115,11 +115,11 @@
115
116 /* Extract the event content.
117 */
118 pEvent = manifest_get(rid, CFTYPE_EVENT);
119 if( pEvent==0 ){
120 fossil_panic("Object #%d is not an event", rid);
121 }
122 blob_init(&fullbody, pEvent->zWiki, -1);
123 if( wiki_find_title(&fullbody, &title, &tail) ){
124 style_header(blob_str(&title));
125 }else{
126
--- src/event.c
+++ src/event.c
@@ -115,11 +115,11 @@
115
116 /* Extract the event content.
117 */
118 pEvent = manifest_get(rid, CFTYPE_EVENT);
119 if( pEvent==0 ){
120 fossil_fatal("Object #%d is not an event", rid);
121 }
122 blob_init(&fullbody, pEvent->zWiki, -1);
123 if( wiki_find_title(&fullbody, &title, &tail) ){
124 style_header(blob_str(&title));
125 }else{
126
+4 -4
--- src/export.c
+++ src/export.c
@@ -138,11 +138,11 @@
138138
char line[100];
139139
FILE *f;
140140
141141
f = fossil_fopen(markfile_in, "r");
142142
if( f==0 ){
143
- fossil_panic("cannot open %s for reading", markfile_in);
143
+ fossil_fatal("cannot open %s for reading", markfile_in);
144144
}
145145
db_prepare(&qb, "INSERT OR IGNORE INTO oldblob VALUES (:rid)");
146146
db_prepare(&qc, "INSERT OR IGNORE INTO oldcommit VALUES (:rid)");
147147
while( fgets(line, sizeof(line), f)!=0 ){
148148
if( *line == 'b' ){
@@ -154,11 +154,11 @@
154154
db_bind_text(&qc, ":rid", line + 1);
155155
db_step(&qc);
156156
db_reset(&qc);
157157
bag_insert(&vers, atoi(line + 1));
158158
}else{
159
- fossil_panic("bad input from %s: %s", markfile_in, line);
159
+ fossil_fatal("bad input from %s: %s", markfile_in, line);
160160
}
161161
}
162162
db_finalize(&qb);
163163
db_finalize(&qc);
164164
fclose(f);
@@ -335,11 +335,11 @@
335335
336336
if( markfile_out!=0 ){
337337
FILE *f;
338338
f = fossil_fopen(markfile_out, "w");
339339
if( f == 0 ){
340
- fossil_panic("cannot open %s for writing", markfile_out);
340
+ fossil_fatal("cannot open %s for writing", markfile_out);
341341
}
342342
db_prepare(&q, "SELECT rid FROM oldblob");
343343
while( db_step(&q)==SQLITE_ROW ){
344344
fprintf(f, "b%d\n", db_column_int(&q, 0));
345345
}
@@ -348,9 +348,9 @@
348348
while( db_step(&q)==SQLITE_ROW ){
349349
fprintf(f, "c%d\n", db_column_int(&q, 0));
350350
}
351351
db_finalize(&q);
352352
if( ferror(f)!=0 || fclose(f)!=0 ) {
353
- fossil_panic("error while writing %s", markfile_out);
353
+ fossil_fatal("error while writing %s", markfile_out);
354354
}
355355
}
356356
}
357357
--- src/export.c
+++ src/export.c
@@ -138,11 +138,11 @@
138 char line[100];
139 FILE *f;
140
141 f = fossil_fopen(markfile_in, "r");
142 if( f==0 ){
143 fossil_panic("cannot open %s for reading", markfile_in);
144 }
145 db_prepare(&qb, "INSERT OR IGNORE INTO oldblob VALUES (:rid)");
146 db_prepare(&qc, "INSERT OR IGNORE INTO oldcommit VALUES (:rid)");
147 while( fgets(line, sizeof(line), f)!=0 ){
148 if( *line == 'b' ){
@@ -154,11 +154,11 @@
154 db_bind_text(&qc, ":rid", line + 1);
155 db_step(&qc);
156 db_reset(&qc);
157 bag_insert(&vers, atoi(line + 1));
158 }else{
159 fossil_panic("bad input from %s: %s", markfile_in, line);
160 }
161 }
162 db_finalize(&qb);
163 db_finalize(&qc);
164 fclose(f);
@@ -335,11 +335,11 @@
335
336 if( markfile_out!=0 ){
337 FILE *f;
338 f = fossil_fopen(markfile_out, "w");
339 if( f == 0 ){
340 fossil_panic("cannot open %s for writing", markfile_out);
341 }
342 db_prepare(&q, "SELECT rid FROM oldblob");
343 while( db_step(&q)==SQLITE_ROW ){
344 fprintf(f, "b%d\n", db_column_int(&q, 0));
345 }
@@ -348,9 +348,9 @@
348 while( db_step(&q)==SQLITE_ROW ){
349 fprintf(f, "c%d\n", db_column_int(&q, 0));
350 }
351 db_finalize(&q);
352 if( ferror(f)!=0 || fclose(f)!=0 ) {
353 fossil_panic("error while writing %s", markfile_out);
354 }
355 }
356 }
357
--- src/export.c
+++ src/export.c
@@ -138,11 +138,11 @@
138 char line[100];
139 FILE *f;
140
141 f = fossil_fopen(markfile_in, "r");
142 if( f==0 ){
143 fossil_fatal("cannot open %s for reading", markfile_in);
144 }
145 db_prepare(&qb, "INSERT OR IGNORE INTO oldblob VALUES (:rid)");
146 db_prepare(&qc, "INSERT OR IGNORE INTO oldcommit VALUES (:rid)");
147 while( fgets(line, sizeof(line), f)!=0 ){
148 if( *line == 'b' ){
@@ -154,11 +154,11 @@
154 db_bind_text(&qc, ":rid", line + 1);
155 db_step(&qc);
156 db_reset(&qc);
157 bag_insert(&vers, atoi(line + 1));
158 }else{
159 fossil_fatal("bad input from %s: %s", markfile_in, line);
160 }
161 }
162 db_finalize(&qb);
163 db_finalize(&qc);
164 fclose(f);
@@ -335,11 +335,11 @@
335
336 if( markfile_out!=0 ){
337 FILE *f;
338 f = fossil_fopen(markfile_out, "w");
339 if( f == 0 ){
340 fossil_fatal("cannot open %s for writing", markfile_out);
341 }
342 db_prepare(&q, "SELECT rid FROM oldblob");
343 while( db_step(&q)==SQLITE_ROW ){
344 fprintf(f, "b%d\n", db_column_int(&q, 0));
345 }
@@ -348,9 +348,9 @@
348 while( db_step(&q)==SQLITE_ROW ){
349 fprintf(f, "c%d\n", db_column_int(&q, 0));
350 }
351 db_finalize(&q);
352 if( ferror(f)!=0 || fclose(f)!=0 ) {
353 fossil_fatal("error while writing %s", markfile_out);
354 }
355 }
356 }
357
+1 -1
--- src/finfo.c
+++ src/finfo.c
@@ -64,11 +64,11 @@
6464
int vid;
6565
6666
if( g.argc!=3 ) usage("-s|--status FILENAME");
6767
vid = db_lget_int("checkout", 0);
6868
if( vid==0 ){
69
- fossil_panic("no checkout to finfo files in");
69
+ fossil_fatal("no checkout to finfo files in");
7070
}
7171
vfile_check_signature(vid, CKSIG_ENOTFILE);
7272
file_tree_name(g.argv[2], &fname, 1);
7373
db_prepare(&q,
7474
"SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
7575
--- src/finfo.c
+++ src/finfo.c
@@ -64,11 +64,11 @@
64 int vid;
65
66 if( g.argc!=3 ) usage("-s|--status FILENAME");
67 vid = db_lget_int("checkout", 0);
68 if( vid==0 ){
69 fossil_panic("no checkout to finfo files in");
70 }
71 vfile_check_signature(vid, CKSIG_ENOTFILE);
72 file_tree_name(g.argv[2], &fname, 1);
73 db_prepare(&q,
74 "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
75
--- src/finfo.c
+++ src/finfo.c
@@ -64,11 +64,11 @@
64 int vid;
65
66 if( g.argc!=3 ) usage("-s|--status FILENAME");
67 vid = db_lget_int("checkout", 0);
68 if( vid==0 ){
69 fossil_fatal("no checkout to finfo files in");
70 }
71 vfile_check_signature(vid, CKSIG_ENOTFILE);
72 file_tree_name(g.argv[2], &fname, 1);
73 db_prepare(&q,
74 "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
75
+1 -1
--- src/info.c
+++ src/info.c
@@ -215,11 +215,11 @@
215215
db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/"));
216216
}else{
217217
int rid;
218218
rid = name_to_rid(g.argv[2]);
219219
if( rid==0 ){
220
- fossil_panic("no such object: %s\n", g.argv[2]);
220
+ fossil_fatal("no such object: %s\n", g.argv[2]);
221221
}
222222
show_common_info(rid, "uuid:", 1, 1);
223223
}
224224
}
225225
226226
--- src/info.c
+++ src/info.c
@@ -215,11 +215,11 @@
215 db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/"));
216 }else{
217 int rid;
218 rid = name_to_rid(g.argv[2]);
219 if( rid==0 ){
220 fossil_panic("no such object: %s\n", g.argv[2]);
221 }
222 show_common_info(rid, "uuid:", 1, 1);
223 }
224 }
225
226
--- src/info.c
+++ src/info.c
@@ -215,11 +215,11 @@
215 db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/"));
216 }else{
217 int rid;
218 rid = name_to_rid(g.argv[2]);
219 if( rid==0 ){
220 fossil_fatal("no such object: %s\n", g.argv[2]);
221 }
222 show_common_info(rid, "uuid:", 1, 1);
223 }
224 }
225
226
--- src/json_branch.c
+++ src/json_branch.c
@@ -288,15 +288,15 @@
288288
md5sum_blob(&branch, &mcksum);
289289
blob_appendf(&branch, "Z %b\n", &mcksum);
290290
291291
brid = content_put(&branch);
292292
if( brid==0 ){
293
- fossil_panic("Problem committing manifest: %s", g.zErrMsg);
293
+ fossil_fatal("Problem committing manifest: %s", g.zErrMsg);
294294
}
295295
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
296296
if( manifest_crosslink(brid, &branch)==0 ){
297
- fossil_panic("unable to install new manifest");
297
+ fossil_fatal("unable to install new manifest");
298298
}
299299
assert( blob_is_reset(&branch) );
300300
content_deltify(rootid, brid, 0);
301301
if( zNewRid ){
302302
*zNewRid = brid;
303303
--- src/json_branch.c
+++ src/json_branch.c
@@ -288,15 +288,15 @@
288 md5sum_blob(&branch, &mcksum);
289 blob_appendf(&branch, "Z %b\n", &mcksum);
290
291 brid = content_put(&branch);
292 if( brid==0 ){
293 fossil_panic("Problem committing manifest: %s", g.zErrMsg);
294 }
295 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
296 if( manifest_crosslink(brid, &branch)==0 ){
297 fossil_panic("unable to install new manifest");
298 }
299 assert( blob_is_reset(&branch) );
300 content_deltify(rootid, brid, 0);
301 if( zNewRid ){
302 *zNewRid = brid;
303
--- src/json_branch.c
+++ src/json_branch.c
@@ -288,15 +288,15 @@
288 md5sum_blob(&branch, &mcksum);
289 blob_appendf(&branch, "Z %b\n", &mcksum);
290
291 brid = content_put(&branch);
292 if( brid==0 ){
293 fossil_fatal("Problem committing manifest: %s", g.zErrMsg);
294 }
295 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
296 if( manifest_crosslink(brid, &branch)==0 ){
297 fossil_fatal("unable to install new manifest");
298 }
299 assert( blob_is_reset(&branch) );
300 content_deltify(rootid, brid, 0);
301 if( zNewRid ){
302 *zNewRid = brid;
303
+2 -2
--- src/main.c
+++ src/main.c
@@ -406,11 +406,11 @@
406406
zFileName = g.argv[i+1];
407407
zInFile = (0==strcmp("-",zFileName))
408408
? stdin
409409
: fossil_fopen(zFileName,"rb");
410410
if(!zInFile){
411
- fossil_panic("Cannot open -args file [%s]", zFileName);
411
+ fossil_fatal("Cannot open -args file [%s]", zFileName);
412412
}else{
413413
blob_read_from_channel(&file, zInFile, -1);
414414
if(stdin != zInFile){
415415
fclose(zInFile);
416416
}
@@ -1114,11 +1114,11 @@
11141114
fossil_fatal("unable to chroot into %s", zDir);
11151115
}
11161116
zRepo = "/";
11171117
}else{
11181118
for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
1119
- if( zDir[i]!='/' ) fossil_panic("bad repository name: %s", zRepo);
1119
+ if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo);
11201120
if( i>0 ){
11211121
zDir[i] = 0;
11221122
if( file_chdir(zDir, 1) ){
11231123
fossil_fatal("unable to chroot into %s", zDir);
11241124
}
11251125
--- src/main.c
+++ src/main.c
@@ -406,11 +406,11 @@
406 zFileName = g.argv[i+1];
407 zInFile = (0==strcmp("-",zFileName))
408 ? stdin
409 : fossil_fopen(zFileName,"rb");
410 if(!zInFile){
411 fossil_panic("Cannot open -args file [%s]", zFileName);
412 }else{
413 blob_read_from_channel(&file, zInFile, -1);
414 if(stdin != zInFile){
415 fclose(zInFile);
416 }
@@ -1114,11 +1114,11 @@
1114 fossil_fatal("unable to chroot into %s", zDir);
1115 }
1116 zRepo = "/";
1117 }else{
1118 for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
1119 if( zDir[i]!='/' ) fossil_panic("bad repository name: %s", zRepo);
1120 if( i>0 ){
1121 zDir[i] = 0;
1122 if( file_chdir(zDir, 1) ){
1123 fossil_fatal("unable to chroot into %s", zDir);
1124 }
1125
--- src/main.c
+++ src/main.c
@@ -406,11 +406,11 @@
406 zFileName = g.argv[i+1];
407 zInFile = (0==strcmp("-",zFileName))
408 ? stdin
409 : fossil_fopen(zFileName,"rb");
410 if(!zInFile){
411 fossil_fatal("Cannot open -args file [%s]", zFileName);
412 }else{
413 blob_read_from_channel(&file, zInFile, -1);
414 if(stdin != zInFile){
415 fclose(zInFile);
416 }
@@ -1114,11 +1114,11 @@
1114 fossil_fatal("unable to chroot into %s", zDir);
1115 }
1116 zRepo = "/";
1117 }else{
1118 for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
1119 if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo);
1120 if( i>0 ){
1121 zDir[i] = 0;
1122 if( file_chdir(zDir, 1) ){
1123 fossil_fatal("unable to chroot into %s", zDir);
1124 }
1125
+1 -1
--- src/pivot.c
+++ src/pivot.c
@@ -82,11 +82,11 @@
8282
8383
/* aqueue must contain at least one primary and one other. Otherwise
8484
** we abort early
8585
*/
8686
if( db_int(0, "SELECT count(distinct src) FROM aqueue")<2 ){
87
- fossil_panic("lack both primary and secondary files");
87
+ fossil_fatal("lack both primary and secondary files");
8888
}
8989
9090
/* Prepare queries we will be needing
9191
**
9292
** The first query finds the oldest pending version on the aqueue. This
9393
--- src/pivot.c
+++ src/pivot.c
@@ -82,11 +82,11 @@
82
83 /* aqueue must contain at least one primary and one other. Otherwise
84 ** we abort early
85 */
86 if( db_int(0, "SELECT count(distinct src) FROM aqueue")<2 ){
87 fossil_panic("lack both primary and secondary files");
88 }
89
90 /* Prepare queries we will be needing
91 **
92 ** The first query finds the oldest pending version on the aqueue. This
93
--- src/pivot.c
+++ src/pivot.c
@@ -82,11 +82,11 @@
82
83 /* aqueue must contain at least one primary and one other. Otherwise
84 ** we abort early
85 */
86 if( db_int(0, "SELECT count(distinct src) FROM aqueue")<2 ){
87 fossil_fatal("lack both primary and secondary files");
88 }
89
90 /* Prepare queries we will be needing
91 **
92 ** The first query finds the oldest pending version on the aqueue. This
93
+10 -5
--- src/printf.c
+++ src/printf.c
@@ -919,17 +919,22 @@
919919
/*
920920
** Print an error message, rollback all databases, and quit. These
921921
** routines never return.
922922
*/
923923
NORETURN void fossil_panic(const char *zFormat, ...){
924
- char *z;
925924
va_list ap;
926925
int rc = 1;
926
+ char z[1000];
927927
static int once = 1;
928
+
929
+ if( g.db ){
930
+ sqlite3_close_v2(g.db);
931
+ g.db = 0;
932
+ }
928933
mainInFatalError = 1;
929934
va_start(ap, zFormat);
930
- z = vmprintf(zFormat, ap);
935
+ sqlite3_vsnprintf(sizeof(z),z,zFormat, ap);
931936
va_end(ap);
932937
#ifdef FOSSIL_ENABLE_JSON
933938
if( g.json.isJsonMode ){
934939
json_err( 0, z, 1 );
935940
if( g.isHTTP ){
@@ -943,15 +948,15 @@
943948
once = 0;
944949
cgi_printf("<p class=\"generalError\">%h</p>", z);
945950
cgi_reply();
946951
}else if( !g.fQuiet ){
947952
fossil_force_newline();
948
- fossil_trace("Fossil internal error: %s\n", z);
953
+ fossil_puts("Fossil internal error: ", 1);
954
+ fossil_puts(z, 1);
955
+ fossil_puts("\n", 1);
949956
}
950957
}
951
- free(z);
952
- db_force_rollback();
953958
fossil_exit(rc);
954959
}
955960
956961
NORETURN void fossil_fatal(const char *zFormat, ...){
957962
char *z;
958963
--- src/printf.c
+++ src/printf.c
@@ -919,17 +919,22 @@
919 /*
920 ** Print an error message, rollback all databases, and quit. These
921 ** routines never return.
922 */
923 NORETURN void fossil_panic(const char *zFormat, ...){
924 char *z;
925 va_list ap;
926 int rc = 1;
 
927 static int once = 1;
 
 
 
 
 
928 mainInFatalError = 1;
929 va_start(ap, zFormat);
930 z = vmprintf(zFormat, ap);
931 va_end(ap);
932 #ifdef FOSSIL_ENABLE_JSON
933 if( g.json.isJsonMode ){
934 json_err( 0, z, 1 );
935 if( g.isHTTP ){
@@ -943,15 +948,15 @@
943 once = 0;
944 cgi_printf("<p class=\"generalError\">%h</p>", z);
945 cgi_reply();
946 }else if( !g.fQuiet ){
947 fossil_force_newline();
948 fossil_trace("Fossil internal error: %s\n", z);
 
 
949 }
950 }
951 free(z);
952 db_force_rollback();
953 fossil_exit(rc);
954 }
955
956 NORETURN void fossil_fatal(const char *zFormat, ...){
957 char *z;
958
--- src/printf.c
+++ src/printf.c
@@ -919,17 +919,22 @@
919 /*
920 ** Print an error message, rollback all databases, and quit. These
921 ** routines never return.
922 */
923 NORETURN void fossil_panic(const char *zFormat, ...){
 
924 va_list ap;
925 int rc = 1;
926 char z[1000];
927 static int once = 1;
928
929 if( g.db ){
930 sqlite3_close_v2(g.db);
931 g.db = 0;
932 }
933 mainInFatalError = 1;
934 va_start(ap, zFormat);
935 sqlite3_vsnprintf(sizeof(z),z,zFormat, ap);
936 va_end(ap);
937 #ifdef FOSSIL_ENABLE_JSON
938 if( g.json.isJsonMode ){
939 json_err( 0, z, 1 );
940 if( g.isHTTP ){
@@ -943,15 +948,15 @@
948 once = 0;
949 cgi_printf("<p class=\"generalError\">%h</p>", z);
950 cgi_reply();
951 }else if( !g.fQuiet ){
952 fossil_force_newline();
953 fossil_puts("Fossil internal error: ", 1);
954 fossil_puts(z, 1);
955 fossil_puts("\n", 1);
956 }
957 }
 
 
958 fossil_exit(rc);
959 }
960
961 NORETURN void fossil_fatal(const char *zFormat, ...){
962 char *z;
963
+2 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -862,11 +862,11 @@
862862
recon_read_dir(zSubpath);
863863
}
864864
blob_init(&path, 0, 0);
865865
blob_appendf(&path, "%s", zSubpath);
866866
if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
867
- fossil_panic("some unknown error occurred while reading \"%s\"",
867
+ fossil_fatal("some unknown error occurred while reading \"%s\"",
868868
blob_str(&path));
869869
}
870870
content_put(&aContent);
871871
blob_reset(&path);
872872
blob_reset(&aContent);
@@ -874,11 +874,11 @@
874874
fossil_print("\r%d", ++nFileRead);
875875
fflush(stdout);
876876
}
877877
closedir(d);
878878
}else {
879
- fossil_panic("encountered error %d while trying to open \"%s\".",
879
+ fossil_fatal("encountered error %d while trying to open \"%s\".",
880880
errno, g.argv[3]);
881881
}
882882
fossil_filename_free(zUnicodePath);
883883
}
884884
885885
--- src/rebuild.c
+++ src/rebuild.c
@@ -862,11 +862,11 @@
862 recon_read_dir(zSubpath);
863 }
864 blob_init(&path, 0, 0);
865 blob_appendf(&path, "%s", zSubpath);
866 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
867 fossil_panic("some unknown error occurred while reading \"%s\"",
868 blob_str(&path));
869 }
870 content_put(&aContent);
871 blob_reset(&path);
872 blob_reset(&aContent);
@@ -874,11 +874,11 @@
874 fossil_print("\r%d", ++nFileRead);
875 fflush(stdout);
876 }
877 closedir(d);
878 }else {
879 fossil_panic("encountered error %d while trying to open \"%s\".",
880 errno, g.argv[3]);
881 }
882 fossil_filename_free(zUnicodePath);
883 }
884
885
--- src/rebuild.c
+++ src/rebuild.c
@@ -862,11 +862,11 @@
862 recon_read_dir(zSubpath);
863 }
864 blob_init(&path, 0, 0);
865 blob_appendf(&path, "%s", zSubpath);
866 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
867 fossil_fatal("some unknown error occurred while reading \"%s\"",
868 blob_str(&path));
869 }
870 content_put(&aContent);
871 blob_reset(&path);
872 blob_reset(&aContent);
@@ -874,11 +874,11 @@
874 fossil_print("\r%d", ++nFileRead);
875 fflush(stdout);
876 }
877 closedir(d);
878 }else {
879 fossil_fatal("encountered error %d while trying to open \"%s\".",
880 errno, g.argv[3]);
881 }
882 fossil_filename_free(zUnicodePath);
883 }
884
885
+1 -1
--- src/tkt.c
+++ src/tkt.c
@@ -520,11 +520,11 @@
520520
const char *zTktId, /* The ticket to which this change is applied */
521521
int needMod /* True if moderation is needed */
522522
){
523523
int rid = content_put_ex(pTicket, 0, 0, 0, needMod);
524524
if( rid==0 ){
525
- fossil_panic("trouble committing ticket: %s", g.zErrMsg);
525
+ fossil_fatal("trouble committing ticket: %s", g.zErrMsg);
526526
}
527527
if( needMod ){
528528
moderation_table_create();
529529
db_multi_exec(
530530
"INSERT INTO modreq(objid, tktid) VALUES(%d,'%s')",
531531
--- src/tkt.c
+++ src/tkt.c
@@ -520,11 +520,11 @@
520 const char *zTktId, /* The ticket to which this change is applied */
521 int needMod /* True if moderation is needed */
522 ){
523 int rid = content_put_ex(pTicket, 0, 0, 0, needMod);
524 if( rid==0 ){
525 fossil_panic("trouble committing ticket: %s", g.zErrMsg);
526 }
527 if( needMod ){
528 moderation_table_create();
529 db_multi_exec(
530 "INSERT INTO modreq(objid, tktid) VALUES(%d,'%s')",
531
--- src/tkt.c
+++ src/tkt.c
@@ -520,11 +520,11 @@
520 const char *zTktId, /* The ticket to which this change is applied */
521 int needMod /* True if moderation is needed */
522 ){
523 int rid = content_put_ex(pTicket, 0, 0, 0, needMod);
524 if( rid==0 ){
525 fossil_fatal("trouble committing ticket: %s", g.zErrMsg);
526 }
527 if( needMod ){
528 moderation_table_create();
529 db_multi_exec(
530 "INSERT INTO modreq(objid, tktid) VALUES(%d,'%s')",
531
+2 -2
--- src/update.c
+++ src/update.c
@@ -199,11 +199,11 @@
199199
" ORDER BY event.mtime DESC");
200200
if( tid==0 ) tid = vid;
201201
}
202202
203203
if( tid==0 ){
204
- fossil_panic("Internal Error: unable to find a version to update to.");
204
+ fossil_panic("unable to find a version to update to.");
205205
}
206206
207207
db_begin_transaction();
208208
vfile_check_signature(vid, CKSIG_ENOTFILE);
209209
if( !dryRunFlag && !internalUpdate ) undo_begin();
@@ -658,11 +658,11 @@
658658
}
659659
}else if( errCode<=0 ){
660660
if( revision==0 ){
661661
revision = db_text("current", "SELECT uuid FROM blob WHERE rid=%d", rid);
662662
}
663
- fossil_panic("could not parse manifest for checkin: %s", revision);
663
+ fossil_fatal("could not parse manifest for checkin: %s", revision);
664664
}
665665
return errCode;
666666
}
667667
668668
669669
--- src/update.c
+++ src/update.c
@@ -199,11 +199,11 @@
199 " ORDER BY event.mtime DESC");
200 if( tid==0 ) tid = vid;
201 }
202
203 if( tid==0 ){
204 fossil_panic("Internal Error: unable to find a version to update to.");
205 }
206
207 db_begin_transaction();
208 vfile_check_signature(vid, CKSIG_ENOTFILE);
209 if( !dryRunFlag && !internalUpdate ) undo_begin();
@@ -658,11 +658,11 @@
658 }
659 }else if( errCode<=0 ){
660 if( revision==0 ){
661 revision = db_text("current", "SELECT uuid FROM blob WHERE rid=%d", rid);
662 }
663 fossil_panic("could not parse manifest for checkin: %s", revision);
664 }
665 return errCode;
666 }
667
668
669
--- src/update.c
+++ src/update.c
@@ -199,11 +199,11 @@
199 " ORDER BY event.mtime DESC");
200 if( tid==0 ) tid = vid;
201 }
202
203 if( tid==0 ){
204 fossil_panic("unable to find a version to update to.");
205 }
206
207 db_begin_transaction();
208 vfile_check_signature(vid, CKSIG_ENOTFILE);
209 if( !dryRunFlag && !internalUpdate ) undo_begin();
@@ -658,11 +658,11 @@
658 }
659 }else if( errCode<=0 ){
660 if( revision==0 ){
661 revision = db_text("current", "SELECT uuid FROM blob WHERE rid=%d", rid);
662 }
663 fossil_fatal("could not parse manifest for checkin: %s", revision);
664 }
665 return errCode;
666 }
667
668
669
+1 -1
--- src/user.c
+++ src/user.c
@@ -277,11 +277,11 @@
277277
g.argv[4], uid
278278
);
279279
}
280280
fossil_print("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid));
281281
}else{
282
- fossil_panic("user subcommand should be one of: "
282
+ fossil_fatal("user subcommand should be one of: "
283283
"capabilities default list new password");
284284
}
285285
}
286286
287287
/*
288288
--- src/user.c
+++ src/user.c
@@ -277,11 +277,11 @@
277 g.argv[4], uid
278 );
279 }
280 fossil_print("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid));
281 }else{
282 fossil_panic("user subcommand should be one of: "
283 "capabilities default list new password");
284 }
285 }
286
287 /*
288
--- src/user.c
+++ src/user.c
@@ -277,11 +277,11 @@
277 g.argv[4], uid
278 );
279 }
280 fossil_print("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid));
281 }else{
282 fossil_fatal("user subcommand should be one of: "
283 "capabilities default list new password");
284 }
285 }
286
287 /*
288
+1 -1
--- src/verify.c
+++ src/verify.c
@@ -41,11 +41,11 @@
4141
return; /* No way to verify phantoms */
4242
}
4343
blob_zero(&uuid);
4444
db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
4545
if( blob_size(&uuid)!=UUID_SIZE ){
46
- fossil_panic("not a valid rid: %d", rid);
46
+ fossil_fatal("not a valid rid: %d", rid);
4747
}
4848
if( content_get(rid, &content) ){
4949
sha1sum_blob(&content, &hash);
5050
blob_reset(&content);
5151
if( blob_compare(&uuid, &hash) ){
5252
--- src/verify.c
+++ src/verify.c
@@ -41,11 +41,11 @@
41 return; /* No way to verify phantoms */
42 }
43 blob_zero(&uuid);
44 db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
45 if( blob_size(&uuid)!=UUID_SIZE ){
46 fossil_panic("not a valid rid: %d", rid);
47 }
48 if( content_get(rid, &content) ){
49 sha1sum_blob(&content, &hash);
50 blob_reset(&content);
51 if( blob_compare(&uuid, &hash) ){
52
--- src/verify.c
+++ src/verify.c
@@ -41,11 +41,11 @@
41 return; /* No way to verify phantoms */
42 }
43 blob_zero(&uuid);
44 db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
45 if( blob_size(&uuid)!=UUID_SIZE ){
46 fossil_fatal("not a valid rid: %d", rid);
47 }
48 if( content_get(rid, &content) ){
49 sha1sum_blob(&content, &hash);
50 blob_reset(&content);
51 if( blob_compare(&uuid, &hash) ){
52
+1 -1
--- src/vfile.c
+++ src/vfile.c
@@ -744,11 +744,11 @@
744744
blob_zero(pManOut);
745745
}
746746
db_must_be_within_tree();
747747
pManifest = manifest_get(vid, CFTYPE_MANIFEST);
748748
if( pManifest==0 ){
749
- fossil_panic("manifest file (%d) is malformed", vid);
749
+ fossil_fatal("manifest file (%d) is malformed", vid);
750750
}
751751
manifest_file_rewind(pManifest);
752752
while( (pFile = manifest_file_next(pManifest,0))!=0 ){
753753
if( pFile->zUuid==0 ) continue;
754754
fid = uuid_to_rid(pFile->zUuid, 0);
755755
--- src/vfile.c
+++ src/vfile.c
@@ -744,11 +744,11 @@
744 blob_zero(pManOut);
745 }
746 db_must_be_within_tree();
747 pManifest = manifest_get(vid, CFTYPE_MANIFEST);
748 if( pManifest==0 ){
749 fossil_panic("manifest file (%d) is malformed", vid);
750 }
751 manifest_file_rewind(pManifest);
752 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
753 if( pFile->zUuid==0 ) continue;
754 fid = uuid_to_rid(pFile->zUuid, 0);
755
--- src/vfile.c
+++ src/vfile.c
@@ -744,11 +744,11 @@
744 blob_zero(pManOut);
745 }
746 db_must_be_within_tree();
747 pManifest = manifest_get(vid, CFTYPE_MANIFEST);
748 if( pManifest==0 ){
749 fossil_fatal("manifest file (%d) is malformed", vid);
750 }
751 manifest_file_rewind(pManifest);
752 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
753 if( pFile->zUuid==0 ) continue;
754 fid = uuid_to_rid(pFile->zUuid, 0);
755

Keyboard Shortcuts

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