Fossil SCM

Allow manifest artifacts to omit the C and U cards, because otherwise there are some historical manifest artifacts in Fossil itself that will not parse, and there may be similar artifacts in other repositories.

drh 2018-08-07 18:53 trunk
Commit b3ccc4bf34a525a4d8563ab3119a08bd6f4d44b988471ffa7ed12e60c7df3905
1 file changed +10 -3
+10 -3
--- src/manifest.c
+++ src/manifest.c
@@ -125,11 +125,13 @@
125125
static struct {
126126
const char *zAllowed; /* Allowed cards. Human-readable */
127127
const char *zRequired; /* Required cards. Human-readable */
128128
} manifestCardTypes[] = {
129129
/* Allowed Required */
130
- /* CFTYPE_MANIFEST 1 */ { "BCDFNPQRTUZ", "CDUZ" },
130
+ /* CFTYPE_MANIFEST 1 */ { "BCDFNPQRTUZ", "DZ" },
131
+ /* Wants to be "CDUZ" ----^^^^
132
+ ** but we must limit for historical compatibility */
131133
/* CFTYPE_CLUSTER 2 */ { "MZ", "MZ" },
132134
/* CFTYPE_CONTROL 3 */ { "DTUZ", "DTUZ" },
133135
/* CFTYPE_WIKI 4 */ { "DLNPUWZ", "DLUWZ" },
134136
/* CFTYPE_TICKET 5 */ { "DJKUZ", "DJKUZ" },
135137
/* CFTYPE_ATTACHMENT 6 */ { "ACDNUZ", "ADZ" },
@@ -992,11 +994,15 @@
992994
if( x.z<x.zEnd ) SYNTAX("extra characters at end of card");
993995
994996
/* If the artifact type has not yet been determined, then compute
995997
** it now. */
996998
if( p->type==0 ){
997
- p->type = p->zComment!=0 ? CFTYPE_MANIFEST : CFTYPE_CONTROL;
999
+ if( p->zComment!=0 || p->nFile>0 || p->nParent>0 ){
1000
+ p->type = CFTYPE_MANIFEST;
1001
+ }else{
1002
+ p->type = CFTYPE_CONTROL;
1003
+ }
9981004
}
9991005
10001006
/* Verify that no disallowed cards are present for this artifact type */
10011007
m = manifest_card_mask(manifestCardTypes[p->type-1].zAllowed);
10021008
if( seenCard & ~m ){
@@ -1119,11 +1125,12 @@
11191125
void manifest_test_parse_cmd(void){
11201126
Manifest *p;
11211127
Blob b;
11221128
int i;
11231129
int n = 1;
1124
- sqlite3_open(":memory:", &g.db);
1130
+ db_find_and_open_repository(0,0);
1131
+ verify_all_options();
11251132
if( g.argc!=3 && g.argc!=4 ){
11261133
usage("FILENAME");
11271134
}
11281135
blob_read_from_file(&b, g.argv[2], ExtFILE);
11291136
if( g.argc>3 ) n = atoi(g.argv[3]);
11301137
--- src/manifest.c
+++ src/manifest.c
@@ -125,11 +125,13 @@
125 static struct {
126 const char *zAllowed; /* Allowed cards. Human-readable */
127 const char *zRequired; /* Required cards. Human-readable */
128 } manifestCardTypes[] = {
129 /* Allowed Required */
130 /* CFTYPE_MANIFEST 1 */ { "BCDFNPQRTUZ", "CDUZ" },
 
 
131 /* CFTYPE_CLUSTER 2 */ { "MZ", "MZ" },
132 /* CFTYPE_CONTROL 3 */ { "DTUZ", "DTUZ" },
133 /* CFTYPE_WIKI 4 */ { "DLNPUWZ", "DLUWZ" },
134 /* CFTYPE_TICKET 5 */ { "DJKUZ", "DJKUZ" },
135 /* CFTYPE_ATTACHMENT 6 */ { "ACDNUZ", "ADZ" },
@@ -992,11 +994,15 @@
992 if( x.z<x.zEnd ) SYNTAX("extra characters at end of card");
993
994 /* If the artifact type has not yet been determined, then compute
995 ** it now. */
996 if( p->type==0 ){
997 p->type = p->zComment!=0 ? CFTYPE_MANIFEST : CFTYPE_CONTROL;
 
 
 
 
998 }
999
1000 /* Verify that no disallowed cards are present for this artifact type */
1001 m = manifest_card_mask(manifestCardTypes[p->type-1].zAllowed);
1002 if( seenCard & ~m ){
@@ -1119,11 +1125,12 @@
1119 void manifest_test_parse_cmd(void){
1120 Manifest *p;
1121 Blob b;
1122 int i;
1123 int n = 1;
1124 sqlite3_open(":memory:", &g.db);
 
1125 if( g.argc!=3 && g.argc!=4 ){
1126 usage("FILENAME");
1127 }
1128 blob_read_from_file(&b, g.argv[2], ExtFILE);
1129 if( g.argc>3 ) n = atoi(g.argv[3]);
1130
--- src/manifest.c
+++ src/manifest.c
@@ -125,11 +125,13 @@
125 static struct {
126 const char *zAllowed; /* Allowed cards. Human-readable */
127 const char *zRequired; /* Required cards. Human-readable */
128 } manifestCardTypes[] = {
129 /* Allowed Required */
130 /* CFTYPE_MANIFEST 1 */ { "BCDFNPQRTUZ", "DZ" },
131 /* Wants to be "CDUZ" ----^^^^
132 ** but we must limit for historical compatibility */
133 /* CFTYPE_CLUSTER 2 */ { "MZ", "MZ" },
134 /* CFTYPE_CONTROL 3 */ { "DTUZ", "DTUZ" },
135 /* CFTYPE_WIKI 4 */ { "DLNPUWZ", "DLUWZ" },
136 /* CFTYPE_TICKET 5 */ { "DJKUZ", "DJKUZ" },
137 /* CFTYPE_ATTACHMENT 6 */ { "ACDNUZ", "ADZ" },
@@ -992,11 +994,15 @@
994 if( x.z<x.zEnd ) SYNTAX("extra characters at end of card");
995
996 /* If the artifact type has not yet been determined, then compute
997 ** it now. */
998 if( p->type==0 ){
999 if( p->zComment!=0 || p->nFile>0 || p->nParent>0 ){
1000 p->type = CFTYPE_MANIFEST;
1001 }else{
1002 p->type = CFTYPE_CONTROL;
1003 }
1004 }
1005
1006 /* Verify that no disallowed cards are present for this artifact type */
1007 m = manifest_card_mask(manifestCardTypes[p->type-1].zAllowed);
1008 if( seenCard & ~m ){
@@ -1119,11 +1125,12 @@
1125 void manifest_test_parse_cmd(void){
1126 Manifest *p;
1127 Blob b;
1128 int i;
1129 int n = 1;
1130 db_find_and_open_repository(0,0);
1131 verify_all_options();
1132 if( g.argc!=3 && g.argc!=4 ){
1133 usage("FILENAME");
1134 }
1135 blob_read_from_file(&b, g.argv[2], ExtFILE);
1136 if( g.argc>3 ) n = atoi(g.argv[3]);
1137

Keyboard Shortcuts

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