Fossil SCM

Better error message in case of "manifest file (12892) is malformed". It will now give an additional line: "line ???: wrong size UUID on P-card" (or whatever other parsing error happens), and using the "-n" option it will print out the complete manifest as well. This would have made it much easier to investigate Ron Aaron's commit problem (many thanks for reporting this!), without adding special debugging code to fossil.

jan.nijtmans 2013-10-07 07:41 trunk merge
Commit ec81aee9156f43f45021592062d70d2829f43703
+1 -1
--- src/attach.c
+++ src/attach.c
@@ -384,11 +384,11 @@
384384
style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
385385
g.zTop, zUuid);
386386
}
387387
}
388388
#endif
389
- pAttach = manifest_get(rid, CFTYPE_ATTACHMENT);
389
+ pAttach = manifest_get(rid, CFTYPE_ATTACHMENT, 0);
390390
if( pAttach==0 ) fossil_redirect_home();
391391
zTarget = pAttach->zAttachTarget;
392392
zSrc = pAttach->zAttachSrc;
393393
ridSrc = db_int(0,"SELECT rid FROM blob WHERE uuid='%s'", zSrc);
394394
zName = pAttach->zAttachName;
395395
--- src/attach.c
+++ src/attach.c
@@ -384,11 +384,11 @@
384 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
385 g.zTop, zUuid);
386 }
387 }
388 #endif
389 pAttach = manifest_get(rid, CFTYPE_ATTACHMENT);
390 if( pAttach==0 ) fossil_redirect_home();
391 zTarget = pAttach->zAttachTarget;
392 zSrc = pAttach->zAttachSrc;
393 ridSrc = db_int(0,"SELECT rid FROM blob WHERE uuid='%s'", zSrc);
394 zName = pAttach->zAttachName;
395
--- src/attach.c
+++ src/attach.c
@@ -384,11 +384,11 @@
384 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
385 g.zTop, zUuid);
386 }
387 }
388 #endif
389 pAttach = manifest_get(rid, CFTYPE_ATTACHMENT, 0);
390 if( pAttach==0 ) fossil_redirect_home();
391 zTarget = pAttach->zAttachTarget;
392 zSrc = pAttach->zAttachSrc;
393 ridSrc = db_int(0,"SELECT rid FROM blob WHERE uuid='%s'", zSrc);
394 zName = pAttach->zAttachName;
395
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -73,11 +73,11 @@
7373
rootid = name_to_typed_rid(g.argv[4], "ci");
7474
if( rootid==0 ){
7575
fossil_fatal("unable to locate check-in off of which to branch");
7676
}
7777
78
- pParent = manifest_get(rootid, CFTYPE_MANIFEST);
78
+ pParent = manifest_get(rootid, CFTYPE_MANIFEST, 0);
7979
if( pParent==0 ){
8080
fossil_fatal("%s is not a valid check-in", g.argv[4]);
8181
}
8282
8383
/* Create a manifest for the new branch */
8484
--- src/branch.c
+++ src/branch.c
@@ -73,11 +73,11 @@
73 rootid = name_to_typed_rid(g.argv[4], "ci");
74 if( rootid==0 ){
75 fossil_fatal("unable to locate check-in off of which to branch");
76 }
77
78 pParent = manifest_get(rootid, CFTYPE_MANIFEST);
79 if( pParent==0 ){
80 fossil_fatal("%s is not a valid check-in", g.argv[4]);
81 }
82
83 /* Create a manifest for the new branch */
84
--- src/branch.c
+++ src/branch.c
@@ -73,11 +73,11 @@
73 rootid = name_to_typed_rid(g.argv[4], "ci");
74 if( rootid==0 ){
75 fossil_fatal("unable to locate check-in off of which to branch");
76 }
77
78 pParent = manifest_get(rootid, CFTYPE_MANIFEST, 0);
79 if( pParent==0 ){
80 fossil_fatal("%s is not a valid check-in", g.argv[4]);
81 }
82
83 /* Create a manifest for the new branch */
84
+1 -1
--- src/browse.c
+++ src/browse.c
@@ -331,11 +331,11 @@
331331
" mtime DATETIME,"
332332
" pathname TEXT"
333333
");"
334334
"CREATE INDEX fileage_fid ON fileage(fid);"
335335
);
336
- pManifest = manifest_get(vid, CFTYPE_MANIFEST);
336
+ pManifest = manifest_get(vid, CFTYPE_MANIFEST, 0);
337337
if( pManifest==0 ) return 1;
338338
manifest_file_rewind(pManifest);
339339
db_prepare(&ins,
340340
"INSERT INTO temp.fileage(fid, pathname)"
341341
" SELECT rid, :path FROM blob WHERE uuid=:uuid"
342342
--- src/browse.c
+++ src/browse.c
@@ -331,11 +331,11 @@
331 " mtime DATETIME,"
332 " pathname TEXT"
333 ");"
334 "CREATE INDEX fileage_fid ON fileage(fid);"
335 );
336 pManifest = manifest_get(vid, CFTYPE_MANIFEST);
337 if( pManifest==0 ) return 1;
338 manifest_file_rewind(pManifest);
339 db_prepare(&ins,
340 "INSERT INTO temp.fileage(fid, pathname)"
341 " SELECT rid, :path FROM blob WHERE uuid=:uuid"
342
--- src/browse.c
+++ src/browse.c
@@ -331,11 +331,11 @@
331 " mtime DATETIME,"
332 " pathname TEXT"
333 ");"
334 "CREATE INDEX fileage_fid ON fileage(fid);"
335 );
336 pManifest = manifest_get(vid, CFTYPE_MANIFEST, 0);
337 if( pManifest==0 ) return 1;
338 manifest_file_rewind(pManifest);
339 db_prepare(&ins,
340 "INSERT INTO temp.fileage(fid, pathname)"
341 " SELECT rid, :path FROM blob WHERE uuid=:uuid"
342
+1 -1
--- src/checkin.c
+++ src/checkin.c
@@ -1730,11 +1730,11 @@
17301730
/* See if a delta-manifest would be more appropriate */
17311731
if( !forceBaseline ){
17321732
const char *zBaselineUuid;
17331733
Manifest *pParent;
17341734
Manifest *pBaseline;
1735
- pParent = manifest_get(vid, CFTYPE_MANIFEST);
1735
+ pParent = manifest_get(vid, CFTYPE_MANIFEST, 0);
17361736
if( pParent && pParent->zBaseline ){
17371737
zBaselineUuid = pParent->zBaseline;
17381738
pBaseline = manifest_get_by_name(zBaselineUuid, 0);
17391739
}else{
17401740
zBaselineUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
17411741
--- src/checkin.c
+++ src/checkin.c
@@ -1730,11 +1730,11 @@
1730 /* See if a delta-manifest would be more appropriate */
1731 if( !forceBaseline ){
1732 const char *zBaselineUuid;
1733 Manifest *pParent;
1734 Manifest *pBaseline;
1735 pParent = manifest_get(vid, CFTYPE_MANIFEST);
1736 if( pParent && pParent->zBaseline ){
1737 zBaselineUuid = pParent->zBaseline;
1738 pBaseline = manifest_get_by_name(zBaselineUuid, 0);
1739 }else{
1740 zBaselineUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
1741
--- src/checkin.c
+++ src/checkin.c
@@ -1730,11 +1730,11 @@
1730 /* See if a delta-manifest would be more appropriate */
1731 if( !forceBaseline ){
1732 const char *zBaselineUuid;
1733 Manifest *pParent;
1734 Manifest *pBaseline;
1735 pParent = manifest_get(vid, CFTYPE_MANIFEST, 0);
1736 if( pParent && pParent->zBaseline ){
1737 zBaselineUuid = pParent->zBaseline;
1738 pBaseline = manifest_get_by_name(zBaselineUuid, 0);
1739 }else{
1740 zBaselineUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
1741
+1 -1
--- src/checkout.c
+++ src/checkout.c
@@ -103,11 +103,11 @@
103103
Manifest *pManifest;
104104
ManifestFile *pFile;
105105
106106
/* Check the EXE permission status of all files
107107
*/
108
- pManifest = manifest_get(vid, CFTYPE_MANIFEST);
108
+ pManifest = manifest_get(vid, CFTYPE_MANIFEST, 0);
109109
if( pManifest==0 ) return;
110110
blob_zero(&filename);
111111
blob_appendf(&filename, "%s", g.zLocalRoot);
112112
baseLen = blob_size(&filename);
113113
manifest_file_rewind(pManifest);
114114
--- src/checkout.c
+++ src/checkout.c
@@ -103,11 +103,11 @@
103 Manifest *pManifest;
104 ManifestFile *pFile;
105
106 /* Check the EXE permission status of all files
107 */
108 pManifest = manifest_get(vid, CFTYPE_MANIFEST);
109 if( pManifest==0 ) return;
110 blob_zero(&filename);
111 blob_appendf(&filename, "%s", g.zLocalRoot);
112 baseLen = blob_size(&filename);
113 manifest_file_rewind(pManifest);
114
--- src/checkout.c
+++ src/checkout.c
@@ -103,11 +103,11 @@
103 Manifest *pManifest;
104 ManifestFile *pFile;
105
106 /* Check the EXE permission status of all files
107 */
108 pManifest = manifest_get(vid, CFTYPE_MANIFEST, 0);
109 if( pManifest==0 ) return;
110 blob_zero(&filename);
111 blob_appendf(&filename, "%s", g.zLocalRoot);
112 baseLen = blob_size(&filename);
113 manifest_file_rewind(pManifest);
114
+1 -1
--- src/doc.c
+++ src/doc.c
@@ -449,11 +449,11 @@
449449
450450
/* Add the vid baseline to the cache */
451451
if( db_int(0, "SELECT count(*) FROM vcache")>10000 ){
452452
db_multi_exec("DELETE FROM vcache");
453453
}
454
- pM = manifest_get(vid, CFTYPE_MANIFEST);
454
+ pM = manifest_get(vid, CFTYPE_MANIFEST, 0);
455455
if( pM==0 ){
456456
goto doc_not_found;
457457
}
458458
db_prepare(&s,
459459
"INSERT INTO vcache(vid,fname,rid)"
460460
--- src/doc.c
+++ src/doc.c
@@ -449,11 +449,11 @@
449
450 /* Add the vid baseline to the cache */
451 if( db_int(0, "SELECT count(*) FROM vcache")>10000 ){
452 db_multi_exec("DELETE FROM vcache");
453 }
454 pM = manifest_get(vid, CFTYPE_MANIFEST);
455 if( pM==0 ){
456 goto doc_not_found;
457 }
458 db_prepare(&s,
459 "INSERT INTO vcache(vid,fname,rid)"
460
--- src/doc.c
+++ src/doc.c
@@ -449,11 +449,11 @@
449
450 /* Add the vid baseline to the cache */
451 if( db_int(0, "SELECT count(*) FROM vcache")>10000 ){
452 db_multi_exec("DELETE FROM vcache");
453 }
454 pM = manifest_get(vid, CFTYPE_MANIFEST, 0);
455 if( pM==0 ){
456 goto doc_not_found;
457 }
458 db_prepare(&s,
459 "INSERT INTO vcache(vid,fname,rid)"
460
+2 -2
--- src/event.c
+++ src/event.c
@@ -113,11 +113,11 @@
113113
}
114114
verboseFlag = (zVerbose!=0) && !is_false(zVerbose);
115115
116116
/* Extract the event content.
117117
*/
118
- pEvent = manifest_get(rid, CFTYPE_EVENT);
118
+ pEvent = manifest_get(rid, CFTYPE_EVENT, 0);
119119
if( pEvent==0 ){
120120
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) ){
@@ -257,11 +257,11 @@
257257
/* If editing an existing event, extract the key fields to use as
258258
** a starting point for the edit.
259259
*/
260260
if( rid && (zBody==0 || zETime==0 || zComment==0 || zTags==0) ){
261261
Manifest *pEvent;
262
- pEvent = manifest_get(rid, CFTYPE_EVENT);
262
+ pEvent = manifest_get(rid, CFTYPE_EVENT, 0);
263263
if( pEvent && pEvent->type==CFTYPE_EVENT ){
264264
if( zBody==0 ) zBody = pEvent->zWiki;
265265
if( zETime==0 ){
266266
zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
267267
}
268268
--- src/event.c
+++ src/event.c
@@ -113,11 +113,11 @@
113 }
114 verboseFlag = (zVerbose!=0) && !is_false(zVerbose);
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) ){
@@ -257,11 +257,11 @@
257 /* If editing an existing event, extract the key fields to use as
258 ** a starting point for the edit.
259 */
260 if( rid && (zBody==0 || zETime==0 || zComment==0 || zTags==0) ){
261 Manifest *pEvent;
262 pEvent = manifest_get(rid, CFTYPE_EVENT);
263 if( pEvent && pEvent->type==CFTYPE_EVENT ){
264 if( zBody==0 ) zBody = pEvent->zWiki;
265 if( zETime==0 ){
266 zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
267 }
268
--- src/event.c
+++ src/event.c
@@ -113,11 +113,11 @@
113 }
114 verboseFlag = (zVerbose!=0) && !is_false(zVerbose);
115
116 /* Extract the event content.
117 */
118 pEvent = manifest_get(rid, CFTYPE_EVENT, 0);
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) ){
@@ -257,11 +257,11 @@
257 /* If editing an existing event, extract the key fields to use as
258 ** a starting point for the edit.
259 */
260 if( rid && (zBody==0 || zETime==0 || zComment==0 || zTags==0) ){
261 Manifest *pEvent;
262 pEvent = manifest_get(rid, CFTYPE_EVENT, 0);
263 if( pEvent && pEvent->type==CFTYPE_EVENT ){
264 if( zBody==0 ) zBody = pEvent->zWiki;
265 if( zETime==0 ){
266 zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
267 }
268
+1 -1
--- src/import.c
+++ src/import.c
@@ -419,11 +419,11 @@
419419
gg.zPrevCheckin = 0;
420420
}
421421
if( gg.zFrom==0 ) return;
422422
rid = fast_uuid_to_rid(gg.zFrom);
423423
if( rid==0 ) return;
424
- p = manifest_get(rid, CFTYPE_MANIFEST);
424
+ p = manifest_get(rid, CFTYPE_MANIFEST, 0);
425425
if( p==0 ) return;
426426
manifest_file_rewind(p);
427427
while( (pOld = manifest_file_next(p, 0))!=0 ){
428428
pNew = import_add_file();
429429
pNew->zName = fossil_strdup(pOld->zName);
430430
--- src/import.c
+++ src/import.c
@@ -419,11 +419,11 @@
419 gg.zPrevCheckin = 0;
420 }
421 if( gg.zFrom==0 ) return;
422 rid = fast_uuid_to_rid(gg.zFrom);
423 if( rid==0 ) return;
424 p = manifest_get(rid, CFTYPE_MANIFEST);
425 if( p==0 ) return;
426 manifest_file_rewind(p);
427 while( (pOld = manifest_file_next(p, 0))!=0 ){
428 pNew = import_add_file();
429 pNew->zName = fossil_strdup(pOld->zName);
430
--- src/import.c
+++ src/import.c
@@ -419,11 +419,11 @@
419 gg.zPrevCheckin = 0;
420 }
421 if( gg.zFrom==0 ) return;
422 rid = fast_uuid_to_rid(gg.zFrom);
423 if( rid==0 ) return;
424 p = manifest_get(rid, CFTYPE_MANIFEST, 0);
425 if( p==0 ) return;
426 manifest_file_rewind(p);
427 while( (pOld = manifest_file_next(p, 0))!=0 ){
428 pNew = import_add_file();
429 pNew->zName = fossil_strdup(pOld->zName);
430
+4 -4
--- src/info.c
+++ src/info.c
@@ -723,11 +723,11 @@
723723
const char *zModAction;
724724
725725
login_check_credentials();
726726
if( !g.perm.RdWiki ){ login_needed(); return; }
727727
rid = name_to_rid_www("name");
728
- if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI))==0 ){
728
+ if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){
729729
style_header("Wiki Page Information Error");
730730
@ No such object: %h(P("name"))
731731
style_footer();
732732
return;
733733
}
@@ -834,11 +834,11 @@
834834
}
835835
if( !is_a_version(rid) ){
836836
webpage_error("Artifact %s is not a checkin.", P(zParam));
837837
return 0;
838838
}
839
- return manifest_get(rid, CFTYPE_MANIFEST);
839
+ return manifest_get(rid, CFTYPE_MANIFEST, 0);
840840
}
841841
842842
/*
843843
** Output a description of a check-in
844844
*/
@@ -1485,11 +1485,11 @@
14851485
zCI = P("ci");
14861486
if( zCI==0 ) return 0;
14871487
zFilename = P("filename");
14881488
if( zFilename==0 ) return 0;
14891489
cirid = name_to_rid_www("ci");
1490
- pManifest = manifest_get(cirid, CFTYPE_MANIFEST);
1490
+ pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0);
14911491
if( pManifest==0 ) return 0;
14921492
manifest_file_rewind(pManifest);
14931493
while( (pFile = manifest_file_next(pManifest,0))!=0 ){
14941494
if( fossil_strcmp(zFilename, pFile->zName)==0 ){
14951495
int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid);
@@ -1708,11 +1708,11 @@
17081708
}else{
17091709
style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
17101710
g.zTop, zUuid);
17111711
}
17121712
}
1713
- pTktChng = manifest_get(rid, CFTYPE_TICKET);
1713
+ pTktChng = manifest_get(rid, CFTYPE_TICKET, 0);
17141714
if( pTktChng==0 ) fossil_redirect_home();
17151715
zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
17161716
memcpy(zTktName, pTktChng->zTicketUuid, UUID_SIZE+1);
17171717
if( g.perm.ModTkt && (zModAction = P("modaction"))!=0 ){
17181718
if( strcmp(zModAction,"delete")==0 ){
17191719
--- src/info.c
+++ src/info.c
@@ -723,11 +723,11 @@
723 const char *zModAction;
724
725 login_check_credentials();
726 if( !g.perm.RdWiki ){ login_needed(); return; }
727 rid = name_to_rid_www("name");
728 if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI))==0 ){
729 style_header("Wiki Page Information Error");
730 @ No such object: %h(P("name"))
731 style_footer();
732 return;
733 }
@@ -834,11 +834,11 @@
834 }
835 if( !is_a_version(rid) ){
836 webpage_error("Artifact %s is not a checkin.", P(zParam));
837 return 0;
838 }
839 return manifest_get(rid, CFTYPE_MANIFEST);
840 }
841
842 /*
843 ** Output a description of a check-in
844 */
@@ -1485,11 +1485,11 @@
1485 zCI = P("ci");
1486 if( zCI==0 ) return 0;
1487 zFilename = P("filename");
1488 if( zFilename==0 ) return 0;
1489 cirid = name_to_rid_www("ci");
1490 pManifest = manifest_get(cirid, CFTYPE_MANIFEST);
1491 if( pManifest==0 ) return 0;
1492 manifest_file_rewind(pManifest);
1493 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
1494 if( fossil_strcmp(zFilename, pFile->zName)==0 ){
1495 int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid);
@@ -1708,11 +1708,11 @@
1708 }else{
1709 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
1710 g.zTop, zUuid);
1711 }
1712 }
1713 pTktChng = manifest_get(rid, CFTYPE_TICKET);
1714 if( pTktChng==0 ) fossil_redirect_home();
1715 zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
1716 memcpy(zTktName, pTktChng->zTicketUuid, UUID_SIZE+1);
1717 if( g.perm.ModTkt && (zModAction = P("modaction"))!=0 ){
1718 if( strcmp(zModAction,"delete")==0 ){
1719
--- src/info.c
+++ src/info.c
@@ -723,11 +723,11 @@
723 const char *zModAction;
724
725 login_check_credentials();
726 if( !g.perm.RdWiki ){ login_needed(); return; }
727 rid = name_to_rid_www("name");
728 if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){
729 style_header("Wiki Page Information Error");
730 @ No such object: %h(P("name"))
731 style_footer();
732 return;
733 }
@@ -834,11 +834,11 @@
834 }
835 if( !is_a_version(rid) ){
836 webpage_error("Artifact %s is not a checkin.", P(zParam));
837 return 0;
838 }
839 return manifest_get(rid, CFTYPE_MANIFEST, 0);
840 }
841
842 /*
843 ** Output a description of a check-in
844 */
@@ -1485,11 +1485,11 @@
1485 zCI = P("ci");
1486 if( zCI==0 ) return 0;
1487 zFilename = P("filename");
1488 if( zFilename==0 ) return 0;
1489 cirid = name_to_rid_www("ci");
1490 pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0);
1491 if( pManifest==0 ) return 0;
1492 manifest_file_rewind(pManifest);
1493 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
1494 if( fossil_strcmp(zFilename, pFile->zName)==0 ){
1495 int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid);
@@ -1708,11 +1708,11 @@
1708 }else{
1709 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
1710 g.zTop, zUuid);
1711 }
1712 }
1713 pTktChng = manifest_get(rid, CFTYPE_TICKET, 0);
1714 if( pTktChng==0 ) fossil_redirect_home();
1715 zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
1716 memcpy(zTktName, pTktChng->zTicketUuid, UUID_SIZE+1);
1717 if( g.perm.ModTkt && (zModAction = P("modaction"))!=0 ){
1718 if( strcmp(zModAction,"delete")==0 ){
1719
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -192,11 +192,11 @@
192192
if(!eventTypeLabel){
193193
eventTypeLabel = json_new_string("ticket");
194194
json_gc_add("$EVENT_TYPE_LABEL(ticket)", eventTypeLabel);
195195
}
196196
197
- pTktChng = manifest_get(rid, CFTYPE_TICKET);
197
+ pTktChng = manifest_get(rid, CFTYPE_TICKET, 0);
198198
if( pTktChng==0 ){
199199
g.json.resultCode = FSL_JSON_E_MANIFEST_READ_FAILED;
200200
return NULL;
201201
}
202202
pay = cson_new_object();
203203
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -192,11 +192,11 @@
192 if(!eventTypeLabel){
193 eventTypeLabel = json_new_string("ticket");
194 json_gc_add("$EVENT_TYPE_LABEL(ticket)", eventTypeLabel);
195 }
196
197 pTktChng = manifest_get(rid, CFTYPE_TICKET);
198 if( pTktChng==0 ){
199 g.json.resultCode = FSL_JSON_E_MANIFEST_READ_FAILED;
200 return NULL;
201 }
202 pay = cson_new_object();
203
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -192,11 +192,11 @@
192 if(!eventTypeLabel){
193 eventTypeLabel = json_new_string("ticket");
194 json_gc_add("$EVENT_TYPE_LABEL(ticket)", eventTypeLabel);
195 }
196
197 pTktChng = manifest_get(rid, CFTYPE_TICKET, 0);
198 if( pTktChng==0 ){
199 g.json.resultCode = FSL_JSON_E_MANIFEST_READ_FAILED;
200 return NULL;
201 }
202 pay = cson_new_object();
203
--- src/json_branch.c
+++ src/json_branch.c
@@ -218,11 +218,11 @@
218218
if( rootid==0 ){
219219
zOpt->rcErrMsg = "Basis branch not found.";
220220
return FSL_JSON_E_RESOURCE_NOT_FOUND;
221221
}
222222
223
- pParent = manifest_get(rootid, CFTYPE_MANIFEST);
223
+ pParent = manifest_get(rootid, CFTYPE_MANIFEST, 0);
224224
if( pParent==0 ){
225225
zOpt->rcErrMsg = "Could not read parent manifest.";
226226
return FSL_JSON_E_UNKNOWN;
227227
}
228228
229229
--- src/json_branch.c
+++ src/json_branch.c
@@ -218,11 +218,11 @@
218 if( rootid==0 ){
219 zOpt->rcErrMsg = "Basis branch not found.";
220 return FSL_JSON_E_RESOURCE_NOT_FOUND;
221 }
222
223 pParent = manifest_get(rootid, CFTYPE_MANIFEST);
224 if( pParent==0 ){
225 zOpt->rcErrMsg = "Could not read parent manifest.";
226 return FSL_JSON_E_UNKNOWN;
227 }
228
229
--- src/json_branch.c
+++ src/json_branch.c
@@ -218,11 +218,11 @@
218 if( rootid==0 ){
219 zOpt->rcErrMsg = "Basis branch not found.";
220 return FSL_JSON_E_RESOURCE_NOT_FOUND;
221 }
222
223 pParent = manifest_get(rootid, CFTYPE_MANIFEST, 0);
224 if( pParent==0 ){
225 zOpt->rcErrMsg = "Could not read parent manifest.";
226 return FSL_JSON_E_UNKNOWN;
227 }
228
229
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -632,11 +632,11 @@
632632
int const rid = db_column_int(&q,0);
633633
Manifest * pMan = NULL;
634634
cson_value * rowV;
635635
cson_object * row;
636636
/*printf("rid=%d\n",rid);*/
637
- pMan = manifest_get(rid, CFTYPE_TICKET);
637
+ pMan = manifest_get(rid, CFTYPE_TICKET, 0);
638638
if(!pMan){
639639
/* this might be an attachment? I'm seeing this with
640640
rid 15380, uuid [1292fef05f2472108].
641641
642642
/json/artifact/1292fef05f2472108 returns not-found,
643643
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -632,11 +632,11 @@
632 int const rid = db_column_int(&q,0);
633 Manifest * pMan = NULL;
634 cson_value * rowV;
635 cson_object * row;
636 /*printf("rid=%d\n",rid);*/
637 pMan = manifest_get(rid, CFTYPE_TICKET);
638 if(!pMan){
639 /* this might be an attachment? I'm seeing this with
640 rid 15380, uuid [1292fef05f2472108].
641
642 /json/artifact/1292fef05f2472108 returns not-found,
643
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -632,11 +632,11 @@
632 int const rid = db_column_int(&q,0);
633 Manifest * pMan = NULL;
634 cson_value * rowV;
635 cson_object * row;
636 /*printf("rid=%d\n",rid);*/
637 pMan = manifest_get(rid, CFTYPE_TICKET, 0);
638 if(!pMan){
639 /* this might be an attachment? I'm seeing this with
640 rid 15380, uuid [1292fef05f2472108].
641
642 /json/artifact/1292fef05f2472108 returns not-found,
643
+3 -3
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -82,11 +82,11 @@
8282
** The returned value, if not NULL, is-a JSON Object owned by the
8383
** caller. If it returns NULL then it may set g.json's error state.
8484
*/
8585
cson_value * json_get_wiki_page_by_rid(int rid, char contentFormat){
8686
Manifest * pWiki = NULL;
87
- if( NULL == (pWiki = manifest_get(rid, CFTYPE_WIKI)) ){
87
+ if( NULL == (pWiki = manifest_get(rid, CFTYPE_WIKI, 0)) ){
8888
json_set_err( FSL_JSON_E_UNKNOWN,
8989
"Error reading wiki page from manifest (rid=%d).",
9090
rid );
9191
return NULL;
9292
}else{
@@ -528,16 +528,16 @@
528528
}else if(0==r2){
529529
goto invalid;
530530
}
531531
532532
zErrTag = zV1;
533
- pW1 = manifest_get(r1, CFTYPE_WIKI);
533
+ pW1 = manifest_get(r1, CFTYPE_WIKI, 0);
534534
if( pW1==0 ) {
535535
goto manifest;
536536
}
537537
zErrTag = zV2;
538
- pW2 = manifest_get(r2, CFTYPE_WIKI);
538
+ pW2 = manifest_get(r2, CFTYPE_WIKI, 0);
539539
if( pW2==0 ) {
540540
goto manifest;
541541
}
542542
543543
blob_init(&w1, pW1->zWiki, -1);
544544
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -82,11 +82,11 @@
82 ** The returned value, if not NULL, is-a JSON Object owned by the
83 ** caller. If it returns NULL then it may set g.json's error state.
84 */
85 cson_value * json_get_wiki_page_by_rid(int rid, char contentFormat){
86 Manifest * pWiki = NULL;
87 if( NULL == (pWiki = manifest_get(rid, CFTYPE_WIKI)) ){
88 json_set_err( FSL_JSON_E_UNKNOWN,
89 "Error reading wiki page from manifest (rid=%d).",
90 rid );
91 return NULL;
92 }else{
@@ -528,16 +528,16 @@
528 }else if(0==r2){
529 goto invalid;
530 }
531
532 zErrTag = zV1;
533 pW1 = manifest_get(r1, CFTYPE_WIKI);
534 if( pW1==0 ) {
535 goto manifest;
536 }
537 zErrTag = zV2;
538 pW2 = manifest_get(r2, CFTYPE_WIKI);
539 if( pW2==0 ) {
540 goto manifest;
541 }
542
543 blob_init(&w1, pW1->zWiki, -1);
544
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -82,11 +82,11 @@
82 ** The returned value, if not NULL, is-a JSON Object owned by the
83 ** caller. If it returns NULL then it may set g.json's error state.
84 */
85 cson_value * json_get_wiki_page_by_rid(int rid, char contentFormat){
86 Manifest * pWiki = NULL;
87 if( NULL == (pWiki = manifest_get(rid, CFTYPE_WIKI, 0)) ){
88 json_set_err( FSL_JSON_E_UNKNOWN,
89 "Error reading wiki page from manifest (rid=%d).",
90 rid );
91 return NULL;
92 }else{
@@ -528,16 +528,16 @@
528 }else if(0==r2){
529 goto invalid;
530 }
531
532 zErrTag = zV1;
533 pW1 = manifest_get(r1, CFTYPE_WIKI, 0);
534 if( pW1==0 ) {
535 goto manifest;
536 }
537 zErrTag = zV2;
538 pW2 = manifest_get(r2, CFTYPE_WIKI, 0);
539 if( pW2==0 ) {
540 goto manifest;
541 }
542
543 blob_init(&w1, pW1->zWiki, -1);
544
+4 -4
--- src/manifest.c
+++ src/manifest.c
@@ -955,11 +955,11 @@
955955
956956
/*
957957
** Get a manifest given the rid for the control artifact. Return
958958
** a pointer to the manifest on success or NULL if there is a failure.
959959
*/
960
-Manifest *manifest_get(int rid, int cfType){
960
+Manifest *manifest_get(int rid, int cfType, Blob *pErr){
961961
Blob content;
962962
Manifest *p;
963963
if( !rid ) return 0;
964964
p = manifest_cache_find(rid);
965965
if( p ){
@@ -968,11 +968,11 @@
968968
p = 0;
969969
}
970970
return p;
971971
}
972972
content_get(rid, &content);
973
- p = manifest_parse(&content, rid, 0);
973
+ p = manifest_parse(&content, rid, pErr);
974974
if( p && cfType!=CFTYPE_ANY && cfType!=p->type ){
975975
manifest_destroy(p);
976976
p = 0;
977977
}
978978
return p;
@@ -989,11 +989,11 @@
989989
rid = name_to_typed_rid(zName, "ci");
990990
if( !is_a_version(rid) ){
991991
fossil_fatal("no such checkin: %s", zName);
992992
}
993993
if( pRid ) *pRid = rid;
994
- p = manifest_get(rid, CFTYPE_MANIFEST);
994
+ p = manifest_get(rid, CFTYPE_MANIFEST, 0);
995995
if( p==0 ){
996996
fossil_fatal("cannot parse manifest for checkin: %s", zName);
997997
}
998998
return p;
999999
}
@@ -1036,11 +1036,11 @@
10361036
** and return 1 if throwError is false.
10371037
*/
10381038
static int fetch_baseline(Manifest *p, int throwError){
10391039
if( p->zBaseline!=0 && p->pBaseline==0 ){
10401040
int rid = uuid_to_rid(p->zBaseline, 1);
1041
- p->pBaseline = manifest_get(rid, CFTYPE_MANIFEST);
1041
+ p->pBaseline = manifest_get(rid, CFTYPE_MANIFEST, 0);
10421042
if( p->pBaseline==0 ){
10431043
if( !throwError ){
10441044
db_multi_exec(
10451045
"INSERT OR IGNORE INTO orphan(rid, baseline) VALUES(%d,%d)",
10461046
p->rid, rid
10471047
--- src/manifest.c
+++ src/manifest.c
@@ -955,11 +955,11 @@
955
956 /*
957 ** Get a manifest given the rid for the control artifact. Return
958 ** a pointer to the manifest on success or NULL if there is a failure.
959 */
960 Manifest *manifest_get(int rid, int cfType){
961 Blob content;
962 Manifest *p;
963 if( !rid ) return 0;
964 p = manifest_cache_find(rid);
965 if( p ){
@@ -968,11 +968,11 @@
968 p = 0;
969 }
970 return p;
971 }
972 content_get(rid, &content);
973 p = manifest_parse(&content, rid, 0);
974 if( p && cfType!=CFTYPE_ANY && cfType!=p->type ){
975 manifest_destroy(p);
976 p = 0;
977 }
978 return p;
@@ -989,11 +989,11 @@
989 rid = name_to_typed_rid(zName, "ci");
990 if( !is_a_version(rid) ){
991 fossil_fatal("no such checkin: %s", zName);
992 }
993 if( pRid ) *pRid = rid;
994 p = manifest_get(rid, CFTYPE_MANIFEST);
995 if( p==0 ){
996 fossil_fatal("cannot parse manifest for checkin: %s", zName);
997 }
998 return p;
999 }
@@ -1036,11 +1036,11 @@
1036 ** and return 1 if throwError is false.
1037 */
1038 static int fetch_baseline(Manifest *p, int throwError){
1039 if( p->zBaseline!=0 && p->pBaseline==0 ){
1040 int rid = uuid_to_rid(p->zBaseline, 1);
1041 p->pBaseline = manifest_get(rid, CFTYPE_MANIFEST);
1042 if( p->pBaseline==0 ){
1043 if( !throwError ){
1044 db_multi_exec(
1045 "INSERT OR IGNORE INTO orphan(rid, baseline) VALUES(%d,%d)",
1046 p->rid, rid
1047
--- src/manifest.c
+++ src/manifest.c
@@ -955,11 +955,11 @@
955
956 /*
957 ** Get a manifest given the rid for the control artifact. Return
958 ** a pointer to the manifest on success or NULL if there is a failure.
959 */
960 Manifest *manifest_get(int rid, int cfType, Blob *pErr){
961 Blob content;
962 Manifest *p;
963 if( !rid ) return 0;
964 p = manifest_cache_find(rid);
965 if( p ){
@@ -968,11 +968,11 @@
968 p = 0;
969 }
970 return p;
971 }
972 content_get(rid, &content);
973 p = manifest_parse(&content, rid, pErr);
974 if( p && cfType!=CFTYPE_ANY && cfType!=p->type ){
975 manifest_destroy(p);
976 p = 0;
977 }
978 return p;
@@ -989,11 +989,11 @@
989 rid = name_to_typed_rid(zName, "ci");
990 if( !is_a_version(rid) ){
991 fossil_fatal("no such checkin: %s", zName);
992 }
993 if( pRid ) *pRid = rid;
994 p = manifest_get(rid, CFTYPE_MANIFEST, 0);
995 if( p==0 ){
996 fossil_fatal("cannot parse manifest for checkin: %s", zName);
997 }
998 return p;
999 }
@@ -1036,11 +1036,11 @@
1036 ** and return 1 if throwError is false.
1037 */
1038 static int fetch_baseline(Manifest *p, int throwError){
1039 if( p->zBaseline!=0 && p->pBaseline==0 ){
1040 int rid = uuid_to_rid(p->zBaseline, 1);
1041 p->pBaseline = manifest_get(rid, CFTYPE_MANIFEST, 0);
1042 if( p->pBaseline==0 ){
1043 if( !throwError ){
1044 db_multi_exec(
1045 "INSERT OR IGNORE INTO orphan(rid, baseline) VALUES(%d,%d)",
1046 p->rid, rid
1047
+1 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -721,11 +721,11 @@
721721
Manifest *p;
722722
int rid = bag_first(&pending);
723723
int i;
724724
725725
bag_remove(&pending, rid);
726
- p = manifest_get(rid, CFTYPE_CLUSTER);
726
+ p = manifest_get(rid, CFTYPE_CLUSTER, 0);
727727
if( p==0 ){
728728
fossil_fatal("bad cluster: rid=%d", rid);
729729
}
730730
for(i=0; i<p->nCChild; i++){
731731
const char *zUuid = p->azCChild[i];
732732
--- src/rebuild.c
+++ src/rebuild.c
@@ -721,11 +721,11 @@
721 Manifest *p;
722 int rid = bag_first(&pending);
723 int i;
724
725 bag_remove(&pending, rid);
726 p = manifest_get(rid, CFTYPE_CLUSTER);
727 if( p==0 ){
728 fossil_fatal("bad cluster: rid=%d", rid);
729 }
730 for(i=0; i<p->nCChild; i++){
731 const char *zUuid = p->azCChild[i];
732
--- src/rebuild.c
+++ src/rebuild.c
@@ -721,11 +721,11 @@
721 Manifest *p;
722 int rid = bag_first(&pending);
723 int i;
724
725 bag_remove(&pending, rid);
726 p = manifest_get(rid, CFTYPE_CLUSTER, 0);
727 if( p==0 ){
728 fossil_fatal("bad cluster: rid=%d", rid);
729 }
730 for(i=0; i<p->nCChild; i++){
731 const char *zUuid = p->azCChild[i];
732
+1 -1
--- src/tar.c
+++ src/tar.c
@@ -479,11 +479,11 @@
479479
if( zDir && zDir[0] ){
480480
blob_appendf(&filename, "%s/", zDir);
481481
}
482482
nPrefix = blob_size(&filename);
483483
484
- pManifest = manifest_get(rid, CFTYPE_MANIFEST);
484
+ pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
485485
if( pManifest ){
486486
mTime = (pManifest->rDate - 2440587.5)*86400.0;
487487
tar_begin(mTime);
488488
if( db_get_boolean("manifest", 0) ){
489489
blob_append(&filename, "manifest", -1);
490490
--- src/tar.c
+++ src/tar.c
@@ -479,11 +479,11 @@
479 if( zDir && zDir[0] ){
480 blob_appendf(&filename, "%s/", zDir);
481 }
482 nPrefix = blob_size(&filename);
483
484 pManifest = manifest_get(rid, CFTYPE_MANIFEST);
485 if( pManifest ){
486 mTime = (pManifest->rDate - 2440587.5)*86400.0;
487 tar_begin(mTime);
488 if( db_get_boolean("manifest", 0) ){
489 blob_append(&filename, "manifest", -1);
490
--- src/tar.c
+++ src/tar.c
@@ -479,11 +479,11 @@
479 if( zDir && zDir[0] ){
480 blob_appendf(&filename, "%s/", zDir);
481 }
482 nPrefix = blob_size(&filename);
483
484 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
485 if( pManifest ){
486 mTime = (pManifest->rDate - 2440587.5)*86400.0;
487 tar_begin(mTime);
488 if( db_get_boolean("manifest", 0) ){
489 blob_append(&filename, "manifest", -1);
490
+3 -3
--- src/tkt.c
+++ src/tkt.c
@@ -296,11 +296,11 @@
296296
db_multi_exec("DELETE FROM ticket WHERE tkt_id=%d", tktid);
297297
tktid = 0;
298298
db_prepare(&q, "SELECT rid FROM tagxref WHERE tagid=%d ORDER BY mtime",tagid);
299299
while( db_step(&q)==SQLITE_ROW ){
300300
int rid = db_column_int(&q, 0);
301
- pTicket = manifest_get(rid, CFTYPE_TICKET);
301
+ pTicket = manifest_get(rid, CFTYPE_TICKET, 0);
302302
if( pTicket ){
303303
tktid = ticket_insert(pTicket, rid, tktid);
304304
manifest_ticket_event(rid, pTicket, createFlag, tagid);
305305
manifest_destroy(pTicket);
306306
}
@@ -943,11 +943,11 @@
943943
@ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
944944
@ (rid %d(rid)) by
945945
hyperlink_to_user(zUser,zDate," on");
946946
hyperlink_to_date(zDate, ".</p>");
947947
}else{
948
- pTicket = manifest_get(rid, CFTYPE_TICKET);
948
+ pTicket = manifest_get(rid, CFTYPE_TICKET, 0);
949949
if( pTicket ){
950950
@
951951
@ <li><p>Ticket change
952952
@ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
953953
@ (rid %d(rid)) by
@@ -1243,11 +1243,11 @@
12431243
}else{
12441244
fossil_print("Add attachment %s\n", zFile);
12451245
}
12461246
fossil_print(" by %s on %s\n", zUser, zDate);
12471247
}else{
1248
- pTicket = manifest_get(rid, CFTYPE_TICKET);
1248
+ pTicket = manifest_get(rid, CFTYPE_TICKET, 0);
12491249
if( pTicket ){
12501250
int i;
12511251
12521252
fossil_print("Ticket Change by %s on %s:\n",
12531253
pTicket->zUser, zDate);
12541254
--- src/tkt.c
+++ src/tkt.c
@@ -296,11 +296,11 @@
296 db_multi_exec("DELETE FROM ticket WHERE tkt_id=%d", tktid);
297 tktid = 0;
298 db_prepare(&q, "SELECT rid FROM tagxref WHERE tagid=%d ORDER BY mtime",tagid);
299 while( db_step(&q)==SQLITE_ROW ){
300 int rid = db_column_int(&q, 0);
301 pTicket = manifest_get(rid, CFTYPE_TICKET);
302 if( pTicket ){
303 tktid = ticket_insert(pTicket, rid, tktid);
304 manifest_ticket_event(rid, pTicket, createFlag, tagid);
305 manifest_destroy(pTicket);
306 }
@@ -943,11 +943,11 @@
943 @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
944 @ (rid %d(rid)) by
945 hyperlink_to_user(zUser,zDate," on");
946 hyperlink_to_date(zDate, ".</p>");
947 }else{
948 pTicket = manifest_get(rid, CFTYPE_TICKET);
949 if( pTicket ){
950 @
951 @ <li><p>Ticket change
952 @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
953 @ (rid %d(rid)) by
@@ -1243,11 +1243,11 @@
1243 }else{
1244 fossil_print("Add attachment %s\n", zFile);
1245 }
1246 fossil_print(" by %s on %s\n", zUser, zDate);
1247 }else{
1248 pTicket = manifest_get(rid, CFTYPE_TICKET);
1249 if( pTicket ){
1250 int i;
1251
1252 fossil_print("Ticket Change by %s on %s:\n",
1253 pTicket->zUser, zDate);
1254
--- src/tkt.c
+++ src/tkt.c
@@ -296,11 +296,11 @@
296 db_multi_exec("DELETE FROM ticket WHERE tkt_id=%d", tktid);
297 tktid = 0;
298 db_prepare(&q, "SELECT rid FROM tagxref WHERE tagid=%d ORDER BY mtime",tagid);
299 while( db_step(&q)==SQLITE_ROW ){
300 int rid = db_column_int(&q, 0);
301 pTicket = manifest_get(rid, CFTYPE_TICKET, 0);
302 if( pTicket ){
303 tktid = ticket_insert(pTicket, rid, tktid);
304 manifest_ticket_event(rid, pTicket, createFlag, tagid);
305 manifest_destroy(pTicket);
306 }
@@ -943,11 +943,11 @@
943 @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
944 @ (rid %d(rid)) by
945 hyperlink_to_user(zUser,zDate," on");
946 hyperlink_to_date(zDate, ".</p>");
947 }else{
948 pTicket = manifest_get(rid, CFTYPE_TICKET, 0);
949 if( pTicket ){
950 @
951 @ <li><p>Ticket change
952 @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
953 @ (rid %d(rid)) by
@@ -1243,11 +1243,11 @@
1243 }else{
1244 fossil_print("Add attachment %s\n", zFile);
1245 }
1246 fossil_print(" by %s on %s\n", zUser, zDate);
1247 }else{
1248 pTicket = manifest_get(rid, CFTYPE_TICKET, 0);
1249 if( pTicket ){
1250 int i;
1251
1252 fossil_print("Ticket Change by %s on %s:\n",
1253 pTicket->zUser, zDate);
1254
+1 -1
--- src/update.c
+++ src/update.c
@@ -635,11 +635,11 @@
635635
}
636636
if( !is_a_version(rid) ){
637637
if( errCode>0 ) return errCode;
638638
fossil_fatal("no such checkin: %s", revision);
639639
}
640
- pManifest = manifest_get(rid, CFTYPE_MANIFEST);
640
+ pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
641641
642642
if( pManifest ){
643643
pFile = manifest_file_find(pManifest, file);
644644
if( pFile ){
645645
int rc;
646646
--- src/update.c
+++ src/update.c
@@ -635,11 +635,11 @@
635 }
636 if( !is_a_version(rid) ){
637 if( errCode>0 ) return errCode;
638 fossil_fatal("no such checkin: %s", revision);
639 }
640 pManifest = manifest_get(rid, CFTYPE_MANIFEST);
641
642 if( pManifest ){
643 pFile = manifest_file_find(pManifest, file);
644 if( pFile ){
645 int rc;
646
--- src/update.c
+++ src/update.c
@@ -635,11 +635,11 @@
635 }
636 if( !is_a_version(rid) ){
637 if( errCode>0 ) return errCode;
638 fossil_fatal("no such checkin: %s", revision);
639 }
640 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
641
642 if( pManifest ){
643 pFile = manifest_file_find(pManifest, file);
644 if( pFile ){
645 int rc;
646
+6 -3
--- src/vfile.c
+++ src/vfile.c
@@ -81,11 +81,11 @@
8181
if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
8282
return;
8383
}
8484
8585
db_begin_transaction();
86
- p = manifest_get(vid, CFTYPE_MANIFEST);
86
+ p = manifest_get(vid, CFTYPE_MANIFEST, 0);
8787
if( p==0 ) {
8888
db_end_transaction(1);
8989
return;
9090
}
9191
db_prepare(&ins,
@@ -852,22 +852,25 @@
852852
** pManOut, should be identical.
853853
*/
854854
void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){
855855
int fid;
856856
Blob file;
857
+ Blob err;
857858
Manifest *pManifest;
858859
ManifestFile *pFile;
859860
char zBuf[100];
860861
861862
blob_zero(pOut);
863
+ blob_zero(&err);
862864
if( pManOut ){
863865
blob_zero(pManOut);
864866
}
865867
db_must_be_within_tree();
866
- pManifest = manifest_get(vid, CFTYPE_MANIFEST);
868
+ pManifest = manifest_get(vid, CFTYPE_MANIFEST, &err);
867869
if( pManifest==0 ){
868
- fossil_fatal("manifest file (%d) is malformed", vid);
870
+ fossil_fatal("manifest file (%d) is malformed:\n%s\n",
871
+ vid, blob_str(&err));
869872
}
870873
manifest_file_rewind(pManifest);
871874
while( (pFile = manifest_file_next(pManifest,0))!=0 ){
872875
if( pFile->zUuid==0 ) continue;
873876
fid = uuid_to_rid(pFile->zUuid, 0);
874877
--- src/vfile.c
+++ src/vfile.c
@@ -81,11 +81,11 @@
81 if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
82 return;
83 }
84
85 db_begin_transaction();
86 p = manifest_get(vid, CFTYPE_MANIFEST);
87 if( p==0 ) {
88 db_end_transaction(1);
89 return;
90 }
91 db_prepare(&ins,
@@ -852,22 +852,25 @@
852 ** pManOut, should be identical.
853 */
854 void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){
855 int fid;
856 Blob file;
 
857 Manifest *pManifest;
858 ManifestFile *pFile;
859 char zBuf[100];
860
861 blob_zero(pOut);
 
862 if( pManOut ){
863 blob_zero(pManOut);
864 }
865 db_must_be_within_tree();
866 pManifest = manifest_get(vid, CFTYPE_MANIFEST);
867 if( pManifest==0 ){
868 fossil_fatal("manifest file (%d) is malformed", vid);
 
869 }
870 manifest_file_rewind(pManifest);
871 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
872 if( pFile->zUuid==0 ) continue;
873 fid = uuid_to_rid(pFile->zUuid, 0);
874
--- src/vfile.c
+++ src/vfile.c
@@ -81,11 +81,11 @@
81 if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
82 return;
83 }
84
85 db_begin_transaction();
86 p = manifest_get(vid, CFTYPE_MANIFEST, 0);
87 if( p==0 ) {
88 db_end_transaction(1);
89 return;
90 }
91 db_prepare(&ins,
@@ -852,22 +852,25 @@
852 ** pManOut, should be identical.
853 */
854 void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){
855 int fid;
856 Blob file;
857 Blob err;
858 Manifest *pManifest;
859 ManifestFile *pFile;
860 char zBuf[100];
861
862 blob_zero(pOut);
863 blob_zero(&err);
864 if( pManOut ){
865 blob_zero(pManOut);
866 }
867 db_must_be_within_tree();
868 pManifest = manifest_get(vid, CFTYPE_MANIFEST, &err);
869 if( pManifest==0 ){
870 fossil_fatal("manifest file (%d) is malformed:\n%s\n",
871 vid, blob_str(&err));
872 }
873 manifest_file_rewind(pManifest);
874 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
875 if( pFile->zUuid==0 ) continue;
876 fid = uuid_to_rid(pFile->zUuid, 0);
877
+6 -3
--- src/vfile.c
+++ src/vfile.c
@@ -81,11 +81,11 @@
8181
if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
8282
return;
8383
}
8484
8585
db_begin_transaction();
86
- p = manifest_get(vid, CFTYPE_MANIFEST);
86
+ p = manifest_get(vid, CFTYPE_MANIFEST, 0);
8787
if( p==0 ) {
8888
db_end_transaction(1);
8989
return;
9090
}
9191
db_prepare(&ins,
@@ -852,22 +852,25 @@
852852
** pManOut, should be identical.
853853
*/
854854
void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){
855855
int fid;
856856
Blob file;
857
+ Blob err;
857858
Manifest *pManifest;
858859
ManifestFile *pFile;
859860
char zBuf[100];
860861
861862
blob_zero(pOut);
863
+ blob_zero(&err);
862864
if( pManOut ){
863865
blob_zero(pManOut);
864866
}
865867
db_must_be_within_tree();
866
- pManifest = manifest_get(vid, CFTYPE_MANIFEST);
868
+ pManifest = manifest_get(vid, CFTYPE_MANIFEST, &err);
867869
if( pManifest==0 ){
868
- fossil_fatal("manifest file (%d) is malformed", vid);
870
+ fossil_fatal("manifest file (%d) is malformed:\n%s\n",
871
+ vid, blob_str(&err));
869872
}
870873
manifest_file_rewind(pManifest);
871874
while( (pFile = manifest_file_next(pManifest,0))!=0 ){
872875
if( pFile->zUuid==0 ) continue;
873876
fid = uuid_to_rid(pFile->zUuid, 0);
874877
--- src/vfile.c
+++ src/vfile.c
@@ -81,11 +81,11 @@
81 if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
82 return;
83 }
84
85 db_begin_transaction();
86 p = manifest_get(vid, CFTYPE_MANIFEST);
87 if( p==0 ) {
88 db_end_transaction(1);
89 return;
90 }
91 db_prepare(&ins,
@@ -852,22 +852,25 @@
852 ** pManOut, should be identical.
853 */
854 void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){
855 int fid;
856 Blob file;
 
857 Manifest *pManifest;
858 ManifestFile *pFile;
859 char zBuf[100];
860
861 blob_zero(pOut);
 
862 if( pManOut ){
863 blob_zero(pManOut);
864 }
865 db_must_be_within_tree();
866 pManifest = manifest_get(vid, CFTYPE_MANIFEST);
867 if( pManifest==0 ){
868 fossil_fatal("manifest file (%d) is malformed", vid);
 
869 }
870 manifest_file_rewind(pManifest);
871 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
872 if( pFile->zUuid==0 ) continue;
873 fid = uuid_to_rid(pFile->zUuid, 0);
874
--- src/vfile.c
+++ src/vfile.c
@@ -81,11 +81,11 @@
81 if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
82 return;
83 }
84
85 db_begin_transaction();
86 p = manifest_get(vid, CFTYPE_MANIFEST, 0);
87 if( p==0 ) {
88 db_end_transaction(1);
89 return;
90 }
91 db_prepare(&ins,
@@ -852,22 +852,25 @@
852 ** pManOut, should be identical.
853 */
854 void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){
855 int fid;
856 Blob file;
857 Blob err;
858 Manifest *pManifest;
859 ManifestFile *pFile;
860 char zBuf[100];
861
862 blob_zero(pOut);
863 blob_zero(&err);
864 if( pManOut ){
865 blob_zero(pManOut);
866 }
867 db_must_be_within_tree();
868 pManifest = manifest_get(vid, CFTYPE_MANIFEST, &err);
869 if( pManifest==0 ){
870 fossil_fatal("manifest file (%d) is malformed:\n%s\n",
871 vid, blob_str(&err));
872 }
873 manifest_file_rewind(pManifest);
874 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
875 if( pFile->zUuid==0 ) continue;
876 fid = uuid_to_rid(pFile->zUuid, 0);
877
+6 -6
--- src/wiki.c
+++ src/wiki.c
@@ -228,11 +228,11 @@
228228
"SELECT rid FROM tagxref"
229229
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
230230
" ORDER BY mtime DESC", zTag
231231
);
232232
free(zTag);
233
- pWiki = manifest_get(rid, CFTYPE_WIKI);
233
+ pWiki = manifest_get(rid, CFTYPE_WIKI, 0);
234234
if( pWiki ){
235235
zBody = pWiki->zWiki;
236236
zMimetype = pWiki->zMimetype;
237237
}
238238
}
@@ -391,11 +391,11 @@
391391
free(zTag);
392392
if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
393393
login_needed();
394394
return;
395395
}
396
- if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
396
+ if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){
397397
zBody = pWiki->zWiki;
398398
zMimetype = pWiki->zMimetype;
399399
}
400400
}
401401
if( P("submit")!=0 && zBody!=0
@@ -632,11 +632,11 @@
632632
blob_appendf(&body, db_get("sandbox",""));
633633
appendRemark(&body, zMimetype);
634634
db_set("sandbox", blob_str(&body), 0);
635635
}else{
636636
login_verify_csrf_secret();
637
- pWiki = manifest_get(rid, CFTYPE_WIKI);
637
+ pWiki = manifest_get(rid, CFTYPE_WIKI, 0);
638638
if( pWiki ){
639639
blob_append(&body, pWiki->zWiki, -1);
640640
manifest_destroy(pWiki);
641641
}
642642
blob_zero(&wiki);
@@ -782,15 +782,15 @@
782782
" WHERE event.mtime<(SELECT mtime FROM event WHERE objid=%d)"
783783
" ORDER BY event.mtime DESC LIMIT 1",
784784
zPageName, rid1
785785
);
786786
}
787
- pW1 = manifest_get(rid1, CFTYPE_WIKI);
787
+ pW1 = manifest_get(rid1, CFTYPE_WIKI, 0);
788788
if( pW1==0 ) fossil_redirect_home();
789789
blob_init(&w1, pW1->zWiki, -1);
790790
blob_zero(&w2);
791
- if( rid2 && (pW2 = manifest_get(rid2, CFTYPE_WIKI))!=0 ){
791
+ if( rid2 && (pW2 = manifest_get(rid2, CFTYPE_WIKI, 0))!=0 ){
792792
blob_init(&w2, pW2->zWiki, -1);
793793
}
794794
blob_zero(&d);
795795
diffFlags = construct_diff_flags(1,0);
796796
text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
@@ -1064,11 +1064,11 @@
10641064
rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x"
10651065
" WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'"
10661066
" ORDER BY x.mtime DESC LIMIT 1",
10671067
zPageName
10681068
);
1069
- if( (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
1069
+ if( (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){
10701070
zBody = pWiki->zWiki;
10711071
}
10721072
if( zBody==0 ){
10731073
fossil_fatal("wiki page [%s] not found",zPageName);
10741074
}
10751075
--- src/wiki.c
+++ src/wiki.c
@@ -228,11 +228,11 @@
228 "SELECT rid FROM tagxref"
229 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
230 " ORDER BY mtime DESC", zTag
231 );
232 free(zTag);
233 pWiki = manifest_get(rid, CFTYPE_WIKI);
234 if( pWiki ){
235 zBody = pWiki->zWiki;
236 zMimetype = pWiki->zMimetype;
237 }
238 }
@@ -391,11 +391,11 @@
391 free(zTag);
392 if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
393 login_needed();
394 return;
395 }
396 if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
397 zBody = pWiki->zWiki;
398 zMimetype = pWiki->zMimetype;
399 }
400 }
401 if( P("submit")!=0 && zBody!=0
@@ -632,11 +632,11 @@
632 blob_appendf(&body, db_get("sandbox",""));
633 appendRemark(&body, zMimetype);
634 db_set("sandbox", blob_str(&body), 0);
635 }else{
636 login_verify_csrf_secret();
637 pWiki = manifest_get(rid, CFTYPE_WIKI);
638 if( pWiki ){
639 blob_append(&body, pWiki->zWiki, -1);
640 manifest_destroy(pWiki);
641 }
642 blob_zero(&wiki);
@@ -782,15 +782,15 @@
782 " WHERE event.mtime<(SELECT mtime FROM event WHERE objid=%d)"
783 " ORDER BY event.mtime DESC LIMIT 1",
784 zPageName, rid1
785 );
786 }
787 pW1 = manifest_get(rid1, CFTYPE_WIKI);
788 if( pW1==0 ) fossil_redirect_home();
789 blob_init(&w1, pW1->zWiki, -1);
790 blob_zero(&w2);
791 if( rid2 && (pW2 = manifest_get(rid2, CFTYPE_WIKI))!=0 ){
792 blob_init(&w2, pW2->zWiki, -1);
793 }
794 blob_zero(&d);
795 diffFlags = construct_diff_flags(1,0);
796 text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
@@ -1064,11 +1064,11 @@
1064 rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x"
1065 " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'"
1066 " ORDER BY x.mtime DESC LIMIT 1",
1067 zPageName
1068 );
1069 if( (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
1070 zBody = pWiki->zWiki;
1071 }
1072 if( zBody==0 ){
1073 fossil_fatal("wiki page [%s] not found",zPageName);
1074 }
1075
--- src/wiki.c
+++ src/wiki.c
@@ -228,11 +228,11 @@
228 "SELECT rid FROM tagxref"
229 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
230 " ORDER BY mtime DESC", zTag
231 );
232 free(zTag);
233 pWiki = manifest_get(rid, CFTYPE_WIKI, 0);
234 if( pWiki ){
235 zBody = pWiki->zWiki;
236 zMimetype = pWiki->zMimetype;
237 }
238 }
@@ -391,11 +391,11 @@
391 free(zTag);
392 if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
393 login_needed();
394 return;
395 }
396 if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){
397 zBody = pWiki->zWiki;
398 zMimetype = pWiki->zMimetype;
399 }
400 }
401 if( P("submit")!=0 && zBody!=0
@@ -632,11 +632,11 @@
632 blob_appendf(&body, db_get("sandbox",""));
633 appendRemark(&body, zMimetype);
634 db_set("sandbox", blob_str(&body), 0);
635 }else{
636 login_verify_csrf_secret();
637 pWiki = manifest_get(rid, CFTYPE_WIKI, 0);
638 if( pWiki ){
639 blob_append(&body, pWiki->zWiki, -1);
640 manifest_destroy(pWiki);
641 }
642 blob_zero(&wiki);
@@ -782,15 +782,15 @@
782 " WHERE event.mtime<(SELECT mtime FROM event WHERE objid=%d)"
783 " ORDER BY event.mtime DESC LIMIT 1",
784 zPageName, rid1
785 );
786 }
787 pW1 = manifest_get(rid1, CFTYPE_WIKI, 0);
788 if( pW1==0 ) fossil_redirect_home();
789 blob_init(&w1, pW1->zWiki, -1);
790 blob_zero(&w2);
791 if( rid2 && (pW2 = manifest_get(rid2, CFTYPE_WIKI, 0))!=0 ){
792 blob_init(&w2, pW2->zWiki, -1);
793 }
794 blob_zero(&d);
795 diffFlags = construct_diff_flags(1,0);
796 text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO);
@@ -1064,11 +1064,11 @@
1064 rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x"
1065 " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'"
1066 " ORDER BY x.mtime DESC LIMIT 1",
1067 zPageName
1068 );
1069 if( (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){
1070 zBody = pWiki->zWiki;
1071 }
1072 if( zBody==0 ){
1073 fossil_fatal("wiki page [%s] not found",zPageName);
1074 }
1075
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -337,11 +337,11 @@
337337
if( zDir && zDir[0] ){
338338
blob_appendf(&filename, "%s/", zDir);
339339
}
340340
nPrefix = blob_size(&filename);
341341
342
- pManifest = manifest_get(rid, CFTYPE_MANIFEST);
342
+ pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
343343
if( pManifest ){
344344
char *zName;
345345
zip_set_timedate(pManifest->rDate);
346346
if( db_get_boolean("manifest", 0) ){
347347
blob_append(&filename, "manifest", -1);
348348
--- src/zip.c
+++ src/zip.c
@@ -337,11 +337,11 @@
337 if( zDir && zDir[0] ){
338 blob_appendf(&filename, "%s/", zDir);
339 }
340 nPrefix = blob_size(&filename);
341
342 pManifest = manifest_get(rid, CFTYPE_MANIFEST);
343 if( pManifest ){
344 char *zName;
345 zip_set_timedate(pManifest->rDate);
346 if( db_get_boolean("manifest", 0) ){
347 blob_append(&filename, "manifest", -1);
348
--- src/zip.c
+++ src/zip.c
@@ -337,11 +337,11 @@
337 if( zDir && zDir[0] ){
338 blob_appendf(&filename, "%s/", zDir);
339 }
340 nPrefix = blob_size(&filename);
341
342 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
343 if( pManifest ){
344 char *zName;
345 zip_set_timedate(pManifest->rDate);
346 if( db_get_boolean("manifest", 0) ){
347 blob_append(&filename, "manifest", -1);
348

Keyboard Shortcuts

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