Fossil SCM

Automatically shun Clusters which contain M-cards pointing to other shunned artifacts

jan.nijtmans 2013-08-28 21:32 UTC trunk
Commit abda198efa6eba887339b82ea7be50760c6656d2
1 file changed +13 -1
+13 -1
--- src/manifest.c
+++ src/manifest.c
@@ -353,11 +353,11 @@
353353
char cType;
354354
char *z;
355355
int n;
356356
char *zUuid;
357357
int sz = 0;
358
- int isRepeat, hasSelfRefTag = 0;
358
+ int isRepeat, hasSelfRefTag = 0, hasShunnedMCard = 0;
359359
static Bag seen;
360360
const char *zErr = 0;
361361
362362
if( rid==0 ){
363363
isRepeat = 1;
@@ -642,10 +642,13 @@
642642
i = p->nCChild++;
643643
p->azCChild[i] = zUuid;
644644
if( i>0 && fossil_strcmp(p->azCChild[i-1], zUuid)>=0 ){
645645
SYNTAX("M-card in the wrong order");
646646
}
647
+ if( !hasShunnedMCard ){
648
+ hasShunnedMCard = uuid_is_shunned(zUuid);
649
+ }
647650
break;
648651
}
649652
650653
/*
651654
** N <uuid>
@@ -879,10 +882,19 @@
879882
|| p->zWiki
880883
){
881884
SYNTAX("cluster contains a card other than M- or Z-");
882885
}
883886
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
+ }
884896
p->type = CFTYPE_CLUSTER;
885897
}else if( p->zEventId ){
886898
if( p->rDate<=0.0 ) SYNTAX("missing date on event");
887899
if( p->nFile>0 ) SYNTAX("F-card in event");
888900
if( p->zRepoCksum ) SYNTAX("R-card in event");
889901
--- 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

Keyboard Shortcuts

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