Fossil SCM
Automatically shun Clusters which contain M-cards pointing to other shunned artifacts
Commit
abda198efa6eba887339b82ea7be50760c6656d2
Parent
669f22fb7cc2556…
1 file changed
+13
-1
+13
-1
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -353,11 +353,11 @@ | ||
| 353 | 353 | char cType; |
| 354 | 354 | char *z; |
| 355 | 355 | int n; |
| 356 | 356 | char *zUuid; |
| 357 | 357 | int sz = 0; |
| 358 | - int isRepeat, hasSelfRefTag = 0; | |
| 358 | + int isRepeat, hasSelfRefTag = 0, hasShunnedMCard = 0; | |
| 359 | 359 | static Bag seen; |
| 360 | 360 | const char *zErr = 0; |
| 361 | 361 | |
| 362 | 362 | if( rid==0 ){ |
| 363 | 363 | isRepeat = 1; |
| @@ -642,10 +642,13 @@ | ||
| 642 | 642 | i = p->nCChild++; |
| 643 | 643 | p->azCChild[i] = zUuid; |
| 644 | 644 | if( i>0 && fossil_strcmp(p->azCChild[i-1], zUuid)>=0 ){ |
| 645 | 645 | SYNTAX("M-card in the wrong order"); |
| 646 | 646 | } |
| 647 | + if( !hasShunnedMCard ){ | |
| 648 | + hasShunnedMCard = uuid_is_shunned(zUuid); | |
| 649 | + } | |
| 647 | 650 | break; |
| 648 | 651 | } |
| 649 | 652 | |
| 650 | 653 | /* |
| 651 | 654 | ** N <uuid> |
| @@ -879,10 +882,19 @@ | ||
| 879 | 882 | || p->zWiki |
| 880 | 883 | ){ |
| 881 | 884 | SYNTAX("cluster contains a card other than M- or Z-"); |
| 882 | 885 | } |
| 883 | 886 | if( !seenZ ) SYNTAX("missing Z-card on cluster"); |
| 887 | + if( hasShunnedMCard) { | |
| 888 | + zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); | |
| 889 | + db_begin_transaction(); | |
| 890 | + db_multi_exec( | |
| 891 | + "INSERT OR IGNORE INTO shun(uuid,mtime)" | |
| 892 | + " VALUES('%s', now())", zUuid); | |
| 893 | + db_end_transaction(0); | |
| 894 | + SYNTAX("shunned M-card on cluster"); | |
| 895 | + } | |
| 884 | 896 | p->type = CFTYPE_CLUSTER; |
| 885 | 897 | }else if( p->zEventId ){ |
| 886 | 898 | if( p->rDate<=0.0 ) SYNTAX("missing date on event"); |
| 887 | 899 | if( p->nFile>0 ) SYNTAX("F-card in event"); |
| 888 | 900 | if( p->zRepoCksum ) SYNTAX("R-card in event"); |
| 889 | 901 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -353,11 +353,11 @@ | |
| 353 | char cType; |
| 354 | char *z; |
| 355 | int n; |
| 356 | char *zUuid; |
| 357 | int sz = 0; |
| 358 | int isRepeat, hasSelfRefTag = 0; |
| 359 | static Bag seen; |
| 360 | const char *zErr = 0; |
| 361 | |
| 362 | if( rid==0 ){ |
| 363 | isRepeat = 1; |
| @@ -642,10 +642,13 @@ | |
| 642 | i = p->nCChild++; |
| 643 | p->azCChild[i] = zUuid; |
| 644 | if( i>0 && fossil_strcmp(p->azCChild[i-1], zUuid)>=0 ){ |
| 645 | SYNTAX("M-card in the wrong order"); |
| 646 | } |
| 647 | break; |
| 648 | } |
| 649 | |
| 650 | /* |
| 651 | ** N <uuid> |
| @@ -879,10 +882,19 @@ | |
| 879 | || p->zWiki |
| 880 | ){ |
| 881 | SYNTAX("cluster contains a card other than M- or Z-"); |
| 882 | } |
| 883 | if( !seenZ ) SYNTAX("missing Z-card on cluster"); |
| 884 | p->type = CFTYPE_CLUSTER; |
| 885 | }else if( p->zEventId ){ |
| 886 | if( p->rDate<=0.0 ) SYNTAX("missing date on event"); |
| 887 | if( p->nFile>0 ) SYNTAX("F-card in event"); |
| 888 | if( p->zRepoCksum ) SYNTAX("R-card in event"); |
| 889 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -353,11 +353,11 @@ | |
| 353 | char cType; |
| 354 | char *z; |
| 355 | int n; |
| 356 | char *zUuid; |
| 357 | int sz = 0; |
| 358 | int isRepeat, hasSelfRefTag = 0, hasShunnedMCard = 0; |
| 359 | static Bag seen; |
| 360 | const char *zErr = 0; |
| 361 | |
| 362 | if( rid==0 ){ |
| 363 | isRepeat = 1; |
| @@ -642,10 +642,13 @@ | |
| 642 | i = p->nCChild++; |
| 643 | p->azCChild[i] = zUuid; |
| 644 | if( i>0 && fossil_strcmp(p->azCChild[i-1], zUuid)>=0 ){ |
| 645 | SYNTAX("M-card in the wrong order"); |
| 646 | } |
| 647 | if( !hasShunnedMCard ){ |
| 648 | hasShunnedMCard = uuid_is_shunned(zUuid); |
| 649 | } |
| 650 | break; |
| 651 | } |
| 652 | |
| 653 | /* |
| 654 | ** N <uuid> |
| @@ -879,10 +882,19 @@ | |
| 882 | || p->zWiki |
| 883 | ){ |
| 884 | SYNTAX("cluster contains a card other than M- or Z-"); |
| 885 | } |
| 886 | if( !seenZ ) SYNTAX("missing Z-card on cluster"); |
| 887 | if( hasShunnedMCard) { |
| 888 | zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 889 | db_begin_transaction(); |
| 890 | db_multi_exec( |
| 891 | "INSERT OR IGNORE INTO shun(uuid,mtime)" |
| 892 | " VALUES('%s', now())", zUuid); |
| 893 | db_end_transaction(0); |
| 894 | SYNTAX("shunned M-card on cluster"); |
| 895 | } |
| 896 | p->type = CFTYPE_CLUSTER; |
| 897 | }else if( p->zEventId ){ |
| 898 | if( p->rDate<=0.0 ) SYNTAX("missing date on event"); |
| 899 | if( p->nFile>0 ) SYNTAX("F-card in event"); |
| 900 | if( p->zRepoCksum ) SYNTAX("R-card in event"); |
| 901 |