Fossil SCM

Experimentally insert plink entries for forum, wiki, and technote manifests which have a parent. This enables tags to propagate on those artifact types. Propagation of wiki tags was verified in another repo, but this needs more testing to ensure that checkin-centric algos are not unduly impacted.

stephan 2021-05-29 21:58 trunk
Commit 31113cd2b992cde32b6427d921fdf19fde854f1661ac318c7c3fad56dda5128d
1 file changed +33
--- src/manifest.c
+++ src/manifest.c
@@ -2250,10 +2250,38 @@
22502250
if( c==0 ){
22512251
c = fossil_strcmp(pA->zName, pB->zName);
22522252
}
22532253
return c;
22542254
}
2255
+
2256
+/*
2257
+** Inserts plink entries for FORUM, WIKI, and TECHNOTE manifests. May
2258
+** assert for other manifest types. If a parent entry exists, it also
2259
+** propagates any tags for that parent. This is a no-op if
2260
+** p->nParent==0.
2261
+*/
2262
+static void manifest_add_fwt_plink(int rid, Manifest *p){
2263
+ int i;
2264
+ int parentId = 0;
2265
+ assert(p->type==CFTYPE_WIKI ||
2266
+ p->type==CFTYPE_FORUM ||
2267
+ p->type==CFTYPE_EVENT);
2268
+ for(i=0; i<p->nParent; ++i){
2269
+ int const pid = uuid_to_rid(p->azParent[i], 1);
2270
+ if(0==i){
2271
+ parentId = pid;
2272
+ }
2273
+ db_multi_exec(
2274
+ "INSERT OR IGNORE INTO plink"
2275
+ "(pid, cid, isprim, mtime, baseid)"
2276
+ "VALUES(%d, %d, %d, %.17g, NULL)",
2277
+ pid, rid, i==0, p->rDate);
2278
+ }
2279
+ if(parentId){
2280
+ tag_propagate_all(parentId);
2281
+ }
2282
+}
22552283
22562284
/*
22572285
** Scan artifact rid/pContent to see if it is a control artifact of
22582286
** any type:
22592287
**
@@ -2416,10 +2444,14 @@
24162444
}
24172445
}
24182446
if( parentid ){
24192447
tag_propagate_all(parentid);
24202448
}
2449
+ }
2450
+ if(p->type==CFTYPE_WIKI || p->type==CFTYPE_FORUM
2451
+ || p->type==CFTYPE_EVENT){
2452
+ manifest_add_fwt_plink(rid, p);
24212453
}
24222454
if( p->type==CFTYPE_WIKI ){
24232455
char *zTag = mprintf("wiki-%s", p->zWikiTitle);
24242456
int prior = 0;
24252457
char cPrefix;
@@ -2814,10 +2846,11 @@
28142846
}
28152847
if( p->zWiki[0] ){
28162848
backlink_extract(p->zWiki, p->zMimetype, rid, BKLNK_FORUM, p->rDate, 1);
28172849
}
28182850
}
2851
+
28192852
db_end_transaction(0);
28202853
if( permitHooks ){
28212854
rc = xfer_run_common_script();
28222855
if( rc==TH_OK ){
28232856
rc = xfer_run_script(zScript, zUuid, 0);
28242857
--- src/manifest.c
+++ src/manifest.c
@@ -2250,10 +2250,38 @@
2250 if( c==0 ){
2251 c = fossil_strcmp(pA->zName, pB->zName);
2252 }
2253 return c;
2254 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2255
2256 /*
2257 ** Scan artifact rid/pContent to see if it is a control artifact of
2258 ** any type:
2259 **
@@ -2416,10 +2444,14 @@
2416 }
2417 }
2418 if( parentid ){
2419 tag_propagate_all(parentid);
2420 }
 
 
 
 
2421 }
2422 if( p->type==CFTYPE_WIKI ){
2423 char *zTag = mprintf("wiki-%s", p->zWikiTitle);
2424 int prior = 0;
2425 char cPrefix;
@@ -2814,10 +2846,11 @@
2814 }
2815 if( p->zWiki[0] ){
2816 backlink_extract(p->zWiki, p->zMimetype, rid, BKLNK_FORUM, p->rDate, 1);
2817 }
2818 }
 
2819 db_end_transaction(0);
2820 if( permitHooks ){
2821 rc = xfer_run_common_script();
2822 if( rc==TH_OK ){
2823 rc = xfer_run_script(zScript, zUuid, 0);
2824
--- src/manifest.c
+++ src/manifest.c
@@ -2250,10 +2250,38 @@
2250 if( c==0 ){
2251 c = fossil_strcmp(pA->zName, pB->zName);
2252 }
2253 return c;
2254 }
2255
2256 /*
2257 ** Inserts plink entries for FORUM, WIKI, and TECHNOTE manifests. May
2258 ** assert for other manifest types. If a parent entry exists, it also
2259 ** propagates any tags for that parent. This is a no-op if
2260 ** p->nParent==0.
2261 */
2262 static void manifest_add_fwt_plink(int rid, Manifest *p){
2263 int i;
2264 int parentId = 0;
2265 assert(p->type==CFTYPE_WIKI ||
2266 p->type==CFTYPE_FORUM ||
2267 p->type==CFTYPE_EVENT);
2268 for(i=0; i<p->nParent; ++i){
2269 int const pid = uuid_to_rid(p->azParent[i], 1);
2270 if(0==i){
2271 parentId = pid;
2272 }
2273 db_multi_exec(
2274 "INSERT OR IGNORE INTO plink"
2275 "(pid, cid, isprim, mtime, baseid)"
2276 "VALUES(%d, %d, %d, %.17g, NULL)",
2277 pid, rid, i==0, p->rDate);
2278 }
2279 if(parentId){
2280 tag_propagate_all(parentId);
2281 }
2282 }
2283
2284 /*
2285 ** Scan artifact rid/pContent to see if it is a control artifact of
2286 ** any type:
2287 **
@@ -2416,10 +2444,14 @@
2444 }
2445 }
2446 if( parentid ){
2447 tag_propagate_all(parentid);
2448 }
2449 }
2450 if(p->type==CFTYPE_WIKI || p->type==CFTYPE_FORUM
2451 || p->type==CFTYPE_EVENT){
2452 manifest_add_fwt_plink(rid, p);
2453 }
2454 if( p->type==CFTYPE_WIKI ){
2455 char *zTag = mprintf("wiki-%s", p->zWikiTitle);
2456 int prior = 0;
2457 char cPrefix;
@@ -2814,10 +2846,11 @@
2846 }
2847 if( p->zWiki[0] ){
2848 backlink_extract(p->zWiki, p->zMimetype, rid, BKLNK_FORUM, p->rDate, 1);
2849 }
2850 }
2851
2852 db_end_transaction(0);
2853 if( permitHooks ){
2854 rc = xfer_run_common_script();
2855 if( rc==TH_OK ){
2856 rc = xfer_run_script(zScript, zUuid, 0);
2857

Keyboard Shortcuts

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