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.
Commit
b3ccc4bf34a525a4d8563ab3119a08bd6f4d44b988471ffa7ed12e60c7df3905
Parent
4180dc6b5a6c226…
1 file changed
+10
-3
+10
-3
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -125,11 +125,13 @@ | ||
| 125 | 125 | static struct { |
| 126 | 126 | const char *zAllowed; /* Allowed cards. Human-readable */ |
| 127 | 127 | const char *zRequired; /* Required cards. Human-readable */ |
| 128 | 128 | } manifestCardTypes[] = { |
| 129 | 129 | /* 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 */ | |
| 131 | 133 | /* CFTYPE_CLUSTER 2 */ { "MZ", "MZ" }, |
| 132 | 134 | /* CFTYPE_CONTROL 3 */ { "DTUZ", "DTUZ" }, |
| 133 | 135 | /* CFTYPE_WIKI 4 */ { "DLNPUWZ", "DLUWZ" }, |
| 134 | 136 | /* CFTYPE_TICKET 5 */ { "DJKUZ", "DJKUZ" }, |
| 135 | 137 | /* CFTYPE_ATTACHMENT 6 */ { "ACDNUZ", "ADZ" }, |
| @@ -992,11 +994,15 @@ | ||
| 992 | 994 | if( x.z<x.zEnd ) SYNTAX("extra characters at end of card"); |
| 993 | 995 | |
| 994 | 996 | /* If the artifact type has not yet been determined, then compute |
| 995 | 997 | ** it now. */ |
| 996 | 998 | 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 | + } | |
| 998 | 1004 | } |
| 999 | 1005 | |
| 1000 | 1006 | /* Verify that no disallowed cards are present for this artifact type */ |
| 1001 | 1007 | m = manifest_card_mask(manifestCardTypes[p->type-1].zAllowed); |
| 1002 | 1008 | if( seenCard & ~m ){ |
| @@ -1119,11 +1125,12 @@ | ||
| 1119 | 1125 | void manifest_test_parse_cmd(void){ |
| 1120 | 1126 | Manifest *p; |
| 1121 | 1127 | Blob b; |
| 1122 | 1128 | int i; |
| 1123 | 1129 | int n = 1; |
| 1124 | - sqlite3_open(":memory:", &g.db); | |
| 1130 | + db_find_and_open_repository(0,0); | |
| 1131 | + verify_all_options(); | |
| 1125 | 1132 | if( g.argc!=3 && g.argc!=4 ){ |
| 1126 | 1133 | usage("FILENAME"); |
| 1127 | 1134 | } |
| 1128 | 1135 | blob_read_from_file(&b, g.argv[2], ExtFILE); |
| 1129 | 1136 | if( g.argc>3 ) n = atoi(g.argv[3]); |
| 1130 | 1137 |
| --- 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 |