Fossil SCM

Back out the change to the cluster artifact M-card that added an alias name. The plan is to transmit alias information by new cards in the sync protocol.

drh 2017-02-27 22:33 fossil-2.0
Commit a6ee563c70655245c0b164a5f8607b7f64fa4140
+1 -1
--- src/content.c
+++ src/content.c
@@ -1128,11 +1128,11 @@
11281128
"cherry-pick target of", 0);
11291129
nErr += check_exists(p->aCherrypick[i].zCPBase, flags, p,
11301130
"cherry-pick baseline of", 0);
11311131
}
11321132
for(i=0; i<p->nCChild; i++){
1133
- nErr += check_exists(p->aCChild[i].zUuid, flags, p, "in", 0);
1133
+ nErr += check_exists(p->azCChild[i], flags, p, "in", 0);
11341134
}
11351135
for(i=0; i<p->nTag; i++){
11361136
nErr += check_exists(p->aTag[i].zUuid, flags, p, "target of", 0);
11371137
}
11381138
manifest_destroy(p);
11391139
--- src/content.c
+++ src/content.c
@@ -1128,11 +1128,11 @@
1128 "cherry-pick target of", 0);
1129 nErr += check_exists(p->aCherrypick[i].zCPBase, flags, p,
1130 "cherry-pick baseline of", 0);
1131 }
1132 for(i=0; i<p->nCChild; i++){
1133 nErr += check_exists(p->aCChild[i].zUuid, flags, p, "in", 0);
1134 }
1135 for(i=0; i<p->nTag; i++){
1136 nErr += check_exists(p->aTag[i].zUuid, flags, p, "target of", 0);
1137 }
1138 manifest_destroy(p);
1139
--- src/content.c
+++ src/content.c
@@ -1128,11 +1128,11 @@
1128 "cherry-pick target of", 0);
1129 nErr += check_exists(p->aCherrypick[i].zCPBase, flags, p,
1130 "cherry-pick baseline of", 0);
1131 }
1132 for(i=0; i<p->nCChild; i++){
1133 nErr += check_exists(p->azCChild[i], flags, p, "in", 0);
1134 }
1135 for(i=0; i<p->nTag; i++){
1136 nErr += check_exists(p->aTag[i].zUuid, flags, p, "target of", 0);
1137 }
1138 manifest_destroy(p);
1139
+8 -17
--- src/manifest.c
+++ src/manifest.c
@@ -95,15 +95,12 @@
9595
struct {
9696
char *zCPTarget; /* Hash for cherry-picked version w/ +|- prefix */
9797
char *zCPBase; /* Hash for cherry-pick baseline. NULL for singletons */
9898
} *aCherrypick;
9999
int nCChild; /* Number of cluster children */
100
- int nCChildAlloc; /* Number of cluster allocated in aCChild[] */
101
- struct {
102
- char *zUuid; /* Hashes of referenced objects in cluster. M cards */
103
- char *zAlias; /* Alias arguments on a cluster */
104
- } *aCChild;
100
+ int nCChildAlloc; /* Number of closts allocated in azCChild[] */
101
+ char **azCChild; /* Hashes of referenced objects in a cluster. M cards */
105102
int nTag; /* Number of T Cards */
106103
int nTagAlloc; /* Slots allocated in aTag[] */
107104
struct TagType {
108105
char *zName; /* Name of the tag */
109106
char *zUuid; /* Hash of artifact that the tag is applied to */
@@ -141,11 +138,11 @@
141138
void manifest_destroy(Manifest *p){
142139
if( p ){
143140
blob_reset(&p->content);
144141
fossil_free(p->aFile);
145142
fossil_free(p->azParent);
146
- fossil_free(p->aCChild);
143
+ fossil_free(p->azCChild);
147144
fossil_free(p->aTag);
148145
fossil_free(p->aField);
149146
fossil_free(p->aCherrypick);
150147
if( p->pBaseline ) manifest_destroy(p->pBaseline);
151148
memset(p, 0, sizeof(*p));
@@ -646,29 +643,23 @@
646643
**
647644
** An M-line identifies another artifact by its hash. M-lines
648645
** occur in clusters only.
649646
*/
650647
case 'M': {
651
- char *zAlias;
652648
zUuid = next_token(&x, &sz);
653649
if( zUuid==0 ) SYNTAX("missing hash on M-card");
654650
if( hname_validate(zUuid,sz)==HNAME_NONE ){
655651
SYNTAX("Invalid hash on M-card");
656652
}
657
- zAlias = next_token(&x, &sz);
658
- if( zAlias && hname_validate(zAlias,sz)==HNAME_NONE ){
659
- SYNTAX("Invalid alias hash on M-card");
660
- }
661653
if( p->nCChild>=p->nCChildAlloc ){
662654
p->nCChildAlloc = p->nCChildAlloc*2 + 10;
663
- p->aCChild = fossil_realloc(p->aCChild
664
- , p->nCChildAlloc*sizeof(p->aCChild[0]) );
655
+ p->azCChild = fossil_realloc(p->azCChild
656
+ , p->nCChildAlloc*sizeof(p->azCChild[0]) );
665657
}
666658
i = p->nCChild++;
667
- p->aCChild[i].zUuid = zUuid;
668
- p->aCChild[i].zAlias = zAlias;
669
- if( i>0 && fossil_strcmp(p->aCChild[i-1].zUuid, zUuid)>=0 ){
659
+ p->azCChild[i] = zUuid;
660
+ if( i>0 && fossil_strcmp(p->azCChild[i-1], zUuid)>=0 ){
670661
SYNTAX("M-card in the wrong order");
671662
}
672663
break;
673664
}
674665
@@ -2015,11 +2006,11 @@
20152006
static Stmt del1;
20162007
tag_insert("cluster", 1, 0, rid, p->rDate, rid);
20172008
db_static_prepare(&del1, "DELETE FROM unclustered WHERE rid=:rid");
20182009
for(i=0; i<p->nCChild; i++){
20192010
int mid;
2020
- mid = uuid_to_rid(p->aCChild[i].zUuid, 1);
2011
+ mid = uuid_to_rid(p->azCChild[i], 1);
20212012
if( mid>0 ){
20222013
db_bind_int(&del1, ":rid", mid);
20232014
db_step(&del1);
20242015
db_reset(&del1);
20252016
}
20262017
--- src/manifest.c
+++ src/manifest.c
@@ -95,15 +95,12 @@
95 struct {
96 char *zCPTarget; /* Hash for cherry-picked version w/ +|- prefix */
97 char *zCPBase; /* Hash for cherry-pick baseline. NULL for singletons */
98 } *aCherrypick;
99 int nCChild; /* Number of cluster children */
100 int nCChildAlloc; /* Number of cluster allocated in aCChild[] */
101 struct {
102 char *zUuid; /* Hashes of referenced objects in cluster. M cards */
103 char *zAlias; /* Alias arguments on a cluster */
104 } *aCChild;
105 int nTag; /* Number of T Cards */
106 int nTagAlloc; /* Slots allocated in aTag[] */
107 struct TagType {
108 char *zName; /* Name of the tag */
109 char *zUuid; /* Hash of artifact that the tag is applied to */
@@ -141,11 +138,11 @@
141 void manifest_destroy(Manifest *p){
142 if( p ){
143 blob_reset(&p->content);
144 fossil_free(p->aFile);
145 fossil_free(p->azParent);
146 fossil_free(p->aCChild);
147 fossil_free(p->aTag);
148 fossil_free(p->aField);
149 fossil_free(p->aCherrypick);
150 if( p->pBaseline ) manifest_destroy(p->pBaseline);
151 memset(p, 0, sizeof(*p));
@@ -646,29 +643,23 @@
646 **
647 ** An M-line identifies another artifact by its hash. M-lines
648 ** occur in clusters only.
649 */
650 case 'M': {
651 char *zAlias;
652 zUuid = next_token(&x, &sz);
653 if( zUuid==0 ) SYNTAX("missing hash on M-card");
654 if( hname_validate(zUuid,sz)==HNAME_NONE ){
655 SYNTAX("Invalid hash on M-card");
656 }
657 zAlias = next_token(&x, &sz);
658 if( zAlias && hname_validate(zAlias,sz)==HNAME_NONE ){
659 SYNTAX("Invalid alias hash on M-card");
660 }
661 if( p->nCChild>=p->nCChildAlloc ){
662 p->nCChildAlloc = p->nCChildAlloc*2 + 10;
663 p->aCChild = fossil_realloc(p->aCChild
664 , p->nCChildAlloc*sizeof(p->aCChild[0]) );
665 }
666 i = p->nCChild++;
667 p->aCChild[i].zUuid = zUuid;
668 p->aCChild[i].zAlias = zAlias;
669 if( i>0 && fossil_strcmp(p->aCChild[i-1].zUuid, zUuid)>=0 ){
670 SYNTAX("M-card in the wrong order");
671 }
672 break;
673 }
674
@@ -2015,11 +2006,11 @@
2015 static Stmt del1;
2016 tag_insert("cluster", 1, 0, rid, p->rDate, rid);
2017 db_static_prepare(&del1, "DELETE FROM unclustered WHERE rid=:rid");
2018 for(i=0; i<p->nCChild; i++){
2019 int mid;
2020 mid = uuid_to_rid(p->aCChild[i].zUuid, 1);
2021 if( mid>0 ){
2022 db_bind_int(&del1, ":rid", mid);
2023 db_step(&del1);
2024 db_reset(&del1);
2025 }
2026
--- src/manifest.c
+++ src/manifest.c
@@ -95,15 +95,12 @@
95 struct {
96 char *zCPTarget; /* Hash for cherry-picked version w/ +|- prefix */
97 char *zCPBase; /* Hash for cherry-pick baseline. NULL for singletons */
98 } *aCherrypick;
99 int nCChild; /* Number of cluster children */
100 int nCChildAlloc; /* Number of closts allocated in azCChild[] */
101 char **azCChild; /* Hashes of referenced objects in a cluster. M cards */
 
 
 
102 int nTag; /* Number of T Cards */
103 int nTagAlloc; /* Slots allocated in aTag[] */
104 struct TagType {
105 char *zName; /* Name of the tag */
106 char *zUuid; /* Hash of artifact that the tag is applied to */
@@ -141,11 +138,11 @@
138 void manifest_destroy(Manifest *p){
139 if( p ){
140 blob_reset(&p->content);
141 fossil_free(p->aFile);
142 fossil_free(p->azParent);
143 fossil_free(p->azCChild);
144 fossil_free(p->aTag);
145 fossil_free(p->aField);
146 fossil_free(p->aCherrypick);
147 if( p->pBaseline ) manifest_destroy(p->pBaseline);
148 memset(p, 0, sizeof(*p));
@@ -646,29 +643,23 @@
643 **
644 ** An M-line identifies another artifact by its hash. M-lines
645 ** occur in clusters only.
646 */
647 case 'M': {
 
648 zUuid = next_token(&x, &sz);
649 if( zUuid==0 ) SYNTAX("missing hash on M-card");
650 if( hname_validate(zUuid,sz)==HNAME_NONE ){
651 SYNTAX("Invalid hash on M-card");
652 }
 
 
 
 
653 if( p->nCChild>=p->nCChildAlloc ){
654 p->nCChildAlloc = p->nCChildAlloc*2 + 10;
655 p->azCChild = fossil_realloc(p->azCChild
656 , p->nCChildAlloc*sizeof(p->azCChild[0]) );
657 }
658 i = p->nCChild++;
659 p->azCChild[i] = zUuid;
660 if( i>0 && fossil_strcmp(p->azCChild[i-1], zUuid)>=0 ){
 
661 SYNTAX("M-card in the wrong order");
662 }
663 break;
664 }
665
@@ -2015,11 +2006,11 @@
2006 static Stmt del1;
2007 tag_insert("cluster", 1, 0, rid, p->rDate, rid);
2008 db_static_prepare(&del1, "DELETE FROM unclustered WHERE rid=:rid");
2009 for(i=0; i<p->nCChild; i++){
2010 int mid;
2011 mid = uuid_to_rid(p->azCChild[i], 1);
2012 if( mid>0 ){
2013 db_bind_int(&del1, ":rid", mid);
2014 db_step(&del1);
2015 db_reset(&del1);
2016 }
2017
+1 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -787,11 +787,11 @@
787787
p = manifest_get(rid, CFTYPE_CLUSTER, 0);
788788
if( p==0 ){
789789
fossil_fatal("bad cluster: rid=%d", rid);
790790
}
791791
for(i=0; i<p->nCChild; i++){
792
- const char *zUuid = p->aCChild[i].zUuid;
792
+ const char *zUuid = p->azCChild[i];
793793
int crid = name_to_rid(zUuid);
794794
if( crid==0 ){
795795
fossil_warning("cluster (rid=%d) references unknown artifact %s",
796796
rid, zUuid);
797797
continue;
798798
--- src/rebuild.c
+++ src/rebuild.c
@@ -787,11 +787,11 @@
787 p = manifest_get(rid, CFTYPE_CLUSTER, 0);
788 if( p==0 ){
789 fossil_fatal("bad cluster: rid=%d", rid);
790 }
791 for(i=0; i<p->nCChild; i++){
792 const char *zUuid = p->aCChild[i].zUuid;
793 int crid = name_to_rid(zUuid);
794 if( crid==0 ){
795 fossil_warning("cluster (rid=%d) references unknown artifact %s",
796 rid, zUuid);
797 continue;
798
--- src/rebuild.c
+++ src/rebuild.c
@@ -787,11 +787,11 @@
787 p = manifest_get(rid, CFTYPE_CLUSTER, 0);
788 if( p==0 ){
789 fossil_fatal("bad cluster: rid=%d", rid);
790 }
791 for(i=0; i<p->nCChild; i++){
792 const char *zUuid = p->azCChild[i];
793 int crid = name_to_rid(zUuid);
794 if( crid==0 ){
795 fossil_warning("cluster (rid=%d) references unknown artifact %s",
796 rid, zUuid);
797 continue;
798
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -251,13 +251,13 @@
251251
<a name="cluster"></a>
252252
<h2>2.0 Clusters</h2>
253253
254254
A cluster is an artifact that declares the existence of other artifacts.
255255
Clusters are used during repository synchronization to help
256
-reduce network traffic. Clusters are also used to record aliases
257
-for artifact names, so that if the artifact hash algorithm changes,
258
-artifacts can still be looked up using the older hash algorithm.
256
+reduce network traffic. As such, clusters are an optimization and
257
+may be removed from a repository without loss or damage to the
258
+underlying project code.
259259
260260
Clusters follow a syntax that is very similar to manifests.
261261
A cluster is a line-oriented text file. Newline characters
262262
(ASCII 0x0a) separate the artifact into cards. Each card begins with a single
263263
character "card type". Zero or more arguments may follow
@@ -273,19 +273,17 @@
273273
Unlike manifests, clusters are never PGP signed.
274274
275275
Allowed cards in the cluster are as follows:
276276
277277
<blockquote>
278
-<b>M</b> <i>artifact-id</i> ?<i>alias</i><br />
278
+<b>M</b> <i>artifact-id</i><br />
279279
<b>Z</b> <i>checksum</i>
280280
</blockquote>
281281
282282
A cluster contains one or more "M" cards followed by a single "Z"
283
-card. Each M card has at least on argument which is the artifact ID of
284
-another artifact in the repository. If the M card has a second argument,
285
-the second argument is an alias for the artifact name.
286
-The Z card works exactly like
283
+card. Each M card has a single argument which is the artifact ID of
284
+another artifact in the repository. The Z card works exactly like
287285
the Z card of a manifest. The argument to the Z card is the
288286
lower-case hexadecimal representation of the MD5 checksum of all
289287
prior cards in the cluster. The Z-card is required.
290288
291289
An example cluster from Fossil can be seen
@@ -659,11 +657,11 @@
659657
<td>&nbsp;</td>
660658
<td>&nbsp;</td>
661659
<td>&nbsp;</td>
662660
</tr>
663661
<tr>
664
-<td><b>M</b> <i>uuid</i> ?<i>alias</i>?</td>
662
+<td><b>M</b> <i>uuid</i></td>
665663
<td>&nbsp;</td>
666664
<td align=center><b>1+</b></td>
667665
<td>&nbsp;</td>
668666
<td>&nbsp;</td>
669667
<td>&nbsp;</td>
670668
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -251,13 +251,13 @@
251 <a name="cluster"></a>
252 <h2>2.0 Clusters</h2>
253
254 A cluster is an artifact that declares the existence of other artifacts.
255 Clusters are used during repository synchronization to help
256 reduce network traffic. Clusters are also used to record aliases
257 for artifact names, so that if the artifact hash algorithm changes,
258 artifacts can still be looked up using the older hash algorithm.
259
260 Clusters follow a syntax that is very similar to manifests.
261 A cluster is a line-oriented text file. Newline characters
262 (ASCII 0x0a) separate the artifact into cards. Each card begins with a single
263 character "card type". Zero or more arguments may follow
@@ -273,19 +273,17 @@
273 Unlike manifests, clusters are never PGP signed.
274
275 Allowed cards in the cluster are as follows:
276
277 <blockquote>
278 <b>M</b> <i>artifact-id</i> ?<i>alias</i><br />
279 <b>Z</b> <i>checksum</i>
280 </blockquote>
281
282 A cluster contains one or more "M" cards followed by a single "Z"
283 card. Each M card has at least on argument which is the artifact ID of
284 another artifact in the repository. If the M card has a second argument,
285 the second argument is an alias for the artifact name.
286 The Z card works exactly like
287 the Z card of a manifest. The argument to the Z card is the
288 lower-case hexadecimal representation of the MD5 checksum of all
289 prior cards in the cluster. The Z-card is required.
290
291 An example cluster from Fossil can be seen
@@ -659,11 +657,11 @@
659 <td>&nbsp;</td>
660 <td>&nbsp;</td>
661 <td>&nbsp;</td>
662 </tr>
663 <tr>
664 <td><b>M</b> <i>uuid</i> ?<i>alias</i>?</td>
665 <td>&nbsp;</td>
666 <td align=center><b>1+</b></td>
667 <td>&nbsp;</td>
668 <td>&nbsp;</td>
669 <td>&nbsp;</td>
670
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -251,13 +251,13 @@
251 <a name="cluster"></a>
252 <h2>2.0 Clusters</h2>
253
254 A cluster is an artifact that declares the existence of other artifacts.
255 Clusters are used during repository synchronization to help
256 reduce network traffic. As such, clusters are an optimization and
257 may be removed from a repository without loss or damage to the
258 underlying project code.
259
260 Clusters follow a syntax that is very similar to manifests.
261 A cluster is a line-oriented text file. Newline characters
262 (ASCII 0x0a) separate the artifact into cards. Each card begins with a single
263 character "card type". Zero or more arguments may follow
@@ -273,19 +273,17 @@
273 Unlike manifests, clusters are never PGP signed.
274
275 Allowed cards in the cluster are as follows:
276
277 <blockquote>
278 <b>M</b> <i>artifact-id</i><br />
279 <b>Z</b> <i>checksum</i>
280 </blockquote>
281
282 A cluster contains one or more "M" cards followed by a single "Z"
283 card. Each M card has a single argument which is the artifact ID of
284 another artifact in the repository. The Z card works exactly like
 
 
285 the Z card of a manifest. The argument to the Z card is the
286 lower-case hexadecimal representation of the MD5 checksum of all
287 prior cards in the cluster. The Z-card is required.
288
289 An example cluster from Fossil can be seen
@@ -659,11 +657,11 @@
657 <td>&nbsp;</td>
658 <td>&nbsp;</td>
659 <td>&nbsp;</td>
660 </tr>
661 <tr>
662 <td><b>M</b> <i>uuid</i></td>
663 <td>&nbsp;</td>
664 <td align=center><b>1+</b></td>
665 <td>&nbsp;</td>
666 <td>&nbsp;</td>
667 <td>&nbsp;</td>
668

Keyboard Shortcuts

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