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.
Commit
31113cd2b992cde32b6427d921fdf19fde854f1661ac318c7c3fad56dda5128d
Parent
1df20b222bab06f…
1 file changed
+33
+33
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -2250,10 +2250,38 @@ | ||
| 2250 | 2250 | if( c==0 ){ |
| 2251 | 2251 | c = fossil_strcmp(pA->zName, pB->zName); |
| 2252 | 2252 | } |
| 2253 | 2253 | return c; |
| 2254 | 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 | +} | |
| 2255 | 2283 | |
| 2256 | 2284 | /* |
| 2257 | 2285 | ** Scan artifact rid/pContent to see if it is a control artifact of |
| 2258 | 2286 | ** any type: |
| 2259 | 2287 | ** |
| @@ -2416,10 +2444,14 @@ | ||
| 2416 | 2444 | } |
| 2417 | 2445 | } |
| 2418 | 2446 | if( parentid ){ |
| 2419 | 2447 | tag_propagate_all(parentid); |
| 2420 | 2448 | } |
| 2449 | + } | |
| 2450 | + if(p->type==CFTYPE_WIKI || p->type==CFTYPE_FORUM | |
| 2451 | + || p->type==CFTYPE_EVENT){ | |
| 2452 | + manifest_add_fwt_plink(rid, p); | |
| 2421 | 2453 | } |
| 2422 | 2454 | if( p->type==CFTYPE_WIKI ){ |
| 2423 | 2455 | char *zTag = mprintf("wiki-%s", p->zWikiTitle); |
| 2424 | 2456 | int prior = 0; |
| 2425 | 2457 | char cPrefix; |
| @@ -2814,10 +2846,11 @@ | ||
| 2814 | 2846 | } |
| 2815 | 2847 | if( p->zWiki[0] ){ |
| 2816 | 2848 | backlink_extract(p->zWiki, p->zMimetype, rid, BKLNK_FORUM, p->rDate, 1); |
| 2817 | 2849 | } |
| 2818 | 2850 | } |
| 2851 | + | |
| 2819 | 2852 | db_end_transaction(0); |
| 2820 | 2853 | if( permitHooks ){ |
| 2821 | 2854 | rc = xfer_run_common_script(); |
| 2822 | 2855 | if( rc==TH_OK ){ |
| 2823 | 2856 | rc = xfer_run_script(zScript, zUuid, 0); |
| 2824 | 2857 |
| --- 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 |