Fossil SCM
Close leaves of private branches merged with the --integrate flag by separate private control artifacts, to avoid +close tags referring private branches in public check-in manifests.
Commit
4e2498a2b67ce2f20a71579ba7ee72bf88b4fadc66071082f3ca048cc25b8b3b
Parent
6b6c09c5bff8444…
1 file changed
+43
-2
+43
-2
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -2076,10 +2076,11 @@ | ||
| 2076 | 2076 | Blob muuid; /* Manifest uuid */ |
| 2077 | 2077 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 2078 | 2078 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 2079 | 2079 | int szD; /* Size of the delta manifest */ |
| 2080 | 2080 | int szB; /* Size of the baseline manifest */ |
| 2081 | + int nClosedPrivateLeaves = 0; /* Number of closed private leafs */ | |
| 2081 | 2082 | int nConflict = 0; /* Number of unresolved merge conflicts */ |
| 2082 | 2083 | int abortCommit = 0; /* Abort the commit due to text format conversions */ |
| 2083 | 2084 | Blob ans; /* Answer to continuation prompts */ |
| 2084 | 2085 | char cReply; /* First character of ans */ |
| 2085 | 2086 | int bRecheck = 0; /* Repeat fork and closed-branch checks*/ |
| @@ -2561,12 +2562,52 @@ | ||
| 2561 | 2562 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 2562 | 2563 | |
| 2563 | 2564 | db_prepare(&q, "SELECT mhash,merge FROM vmerge WHERE id=-4"); |
| 2564 | 2565 | while( db_step(&q)==SQLITE_ROW ){ |
| 2565 | 2566 | const char *zIntegrateUuid = db_column_text(&q, 0); |
| 2566 | - if( is_a_leaf(db_column_int(&q, 1)) ){ | |
| 2567 | - fossil_print("Closed: %s\n", zIntegrateUuid); | |
| 2567 | + int rid = db_column_int(&q, 1); | |
| 2568 | + if( is_a_leaf(rid) ){ | |
| 2569 | + if( !content_is_private(rid) ){ | |
| 2570 | + fossil_print("Closed: %s\n", zIntegrateUuid); | |
| 2571 | + }else{ | |
| 2572 | + /* Close leaves of private branches by separate private control | |
| 2573 | + ** artifacts. */ | |
| 2574 | + Blob bCtrl; /* Control artifact to close the private leaf */ | |
| 2575 | + char *zCtrlDate; /* Timestamp of check-in plus N seconds */ | |
| 2576 | + Blob bCtrlXsum; /* Checksum of the control artifact */ | |
| 2577 | + int iCtrlRid; /* RID of the control artifact */ | |
| 2578 | + if( db_exists( | |
| 2579 | + "SELECT 1 FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0", | |
| 2580 | + TAG_CLOSED, rid) ){ | |
| 2581 | + continue; /* Already closed. */ | |
| 2582 | + } | |
| 2583 | + nClosedPrivateLeaves++; | |
| 2584 | + blob_zero(&bCtrl); | |
| 2585 | + zCtrlDate = db_text(0, | |
| 2586 | + "SELECT" | |
| 2587 | + " strftime('%%Y-%%m-%%dT%%H:%%M:%%f',mtime,'+%d seconds')" | |
| 2588 | + " FROM event WHERE objid=%d", | |
| 2589 | + nClosedPrivateLeaves, nvid); | |
| 2590 | + blob_appendf(&bCtrl, "D %z\n", date_in_standard_format(zCtrlDate)); | |
| 2591 | + if( zCtrlDate ) fossil_free(zCtrlDate); | |
| 2592 | + blob_appendf(&bCtrl, "T +closed %s\n", zIntegrateUuid); | |
| 2593 | + blob_appendf(&bCtrl, "U %F\n", | |
| 2594 | + sCiInfo.zUserOvrd ? sCiInfo.zUserOvrd : login_name()); | |
| 2595 | + md5sum_blob(&bCtrl, &bCtrlXsum); | |
| 2596 | + blob_appendf(&bCtrl, "Z %b\n", &bCtrlXsum); | |
| 2597 | + blob_reset(&bCtrlXsum); | |
| 2598 | + iCtrlRid = content_put_ex(&bCtrl, 0, 0, 0, /*isPrivate=*/1); | |
| 2599 | + if( iCtrlRid==0 ){ | |
| 2600 | + fossil_fatal("trouble committing control artifact: %s", g.zErrMsg); | |
| 2601 | + } | |
| 2602 | + fossil_print("Closed: %s (private)\n", zIntegrateUuid); | |
| 2603 | + if( dryRunFlag ) fossil_print("%s", blob_str(&bCtrl)); | |
| 2604 | + if( manifest_crosslink(iCtrlRid, &bCtrl, | |
| 2605 | + dryRunFlag ? MC_NONE : MC_PERMIT_HOOKS)==0 ){ | |
| 2606 | + fossil_fatal("%s", g.zErrMsg); | |
| 2607 | + } | |
| 2608 | + } | |
| 2568 | 2609 | }else{ |
| 2569 | 2610 | fossil_print("Not_Closed: %s (not a leaf any more)\n", zIntegrateUuid); |
| 2570 | 2611 | } |
| 2571 | 2612 | } |
| 2572 | 2613 | db_finalize(&q); |
| 2573 | 2614 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2076,10 +2076,11 @@ | |
| 2076 | Blob muuid; /* Manifest uuid */ |
| 2077 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 2078 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 2079 | int szD; /* Size of the delta manifest */ |
| 2080 | int szB; /* Size of the baseline manifest */ |
| 2081 | int nConflict = 0; /* Number of unresolved merge conflicts */ |
| 2082 | int abortCommit = 0; /* Abort the commit due to text format conversions */ |
| 2083 | Blob ans; /* Answer to continuation prompts */ |
| 2084 | char cReply; /* First character of ans */ |
| 2085 | int bRecheck = 0; /* Repeat fork and closed-branch checks*/ |
| @@ -2561,12 +2562,52 @@ | |
| 2561 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 2562 | |
| 2563 | db_prepare(&q, "SELECT mhash,merge FROM vmerge WHERE id=-4"); |
| 2564 | while( db_step(&q)==SQLITE_ROW ){ |
| 2565 | const char *zIntegrateUuid = db_column_text(&q, 0); |
| 2566 | if( is_a_leaf(db_column_int(&q, 1)) ){ |
| 2567 | fossil_print("Closed: %s\n", zIntegrateUuid); |
| 2568 | }else{ |
| 2569 | fossil_print("Not_Closed: %s (not a leaf any more)\n", zIntegrateUuid); |
| 2570 | } |
| 2571 | } |
| 2572 | db_finalize(&q); |
| 2573 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2076,10 +2076,11 @@ | |
| 2076 | Blob muuid; /* Manifest uuid */ |
| 2077 | Blob cksum1, cksum2; /* Before and after commit checksums */ |
| 2078 | Blob cksum1b; /* Checksum recorded in the manifest */ |
| 2079 | int szD; /* Size of the delta manifest */ |
| 2080 | int szB; /* Size of the baseline manifest */ |
| 2081 | int nClosedPrivateLeaves = 0; /* Number of closed private leafs */ |
| 2082 | int nConflict = 0; /* Number of unresolved merge conflicts */ |
| 2083 | int abortCommit = 0; /* Abort the commit due to text format conversions */ |
| 2084 | Blob ans; /* Answer to continuation prompts */ |
| 2085 | char cReply; /* First character of ans */ |
| 2086 | int bRecheck = 0; /* Repeat fork and closed-branch checks*/ |
| @@ -2561,12 +2562,52 @@ | |
| 2562 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 2563 | |
| 2564 | db_prepare(&q, "SELECT mhash,merge FROM vmerge WHERE id=-4"); |
| 2565 | while( db_step(&q)==SQLITE_ROW ){ |
| 2566 | const char *zIntegrateUuid = db_column_text(&q, 0); |
| 2567 | int rid = db_column_int(&q, 1); |
| 2568 | if( is_a_leaf(rid) ){ |
| 2569 | if( !content_is_private(rid) ){ |
| 2570 | fossil_print("Closed: %s\n", zIntegrateUuid); |
| 2571 | }else{ |
| 2572 | /* Close leaves of private branches by separate private control |
| 2573 | ** artifacts. */ |
| 2574 | Blob bCtrl; /* Control artifact to close the private leaf */ |
| 2575 | char *zCtrlDate; /* Timestamp of check-in plus N seconds */ |
| 2576 | Blob bCtrlXsum; /* Checksum of the control artifact */ |
| 2577 | int iCtrlRid; /* RID of the control artifact */ |
| 2578 | if( db_exists( |
| 2579 | "SELECT 1 FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 2580 | TAG_CLOSED, rid) ){ |
| 2581 | continue; /* Already closed. */ |
| 2582 | } |
| 2583 | nClosedPrivateLeaves++; |
| 2584 | blob_zero(&bCtrl); |
| 2585 | zCtrlDate = db_text(0, |
| 2586 | "SELECT" |
| 2587 | " strftime('%%Y-%%m-%%dT%%H:%%M:%%f',mtime,'+%d seconds')" |
| 2588 | " FROM event WHERE objid=%d", |
| 2589 | nClosedPrivateLeaves, nvid); |
| 2590 | blob_appendf(&bCtrl, "D %z\n", date_in_standard_format(zCtrlDate)); |
| 2591 | if( zCtrlDate ) fossil_free(zCtrlDate); |
| 2592 | blob_appendf(&bCtrl, "T +closed %s\n", zIntegrateUuid); |
| 2593 | blob_appendf(&bCtrl, "U %F\n", |
| 2594 | sCiInfo.zUserOvrd ? sCiInfo.zUserOvrd : login_name()); |
| 2595 | md5sum_blob(&bCtrl, &bCtrlXsum); |
| 2596 | blob_appendf(&bCtrl, "Z %b\n", &bCtrlXsum); |
| 2597 | blob_reset(&bCtrlXsum); |
| 2598 | iCtrlRid = content_put_ex(&bCtrl, 0, 0, 0, /*isPrivate=*/1); |
| 2599 | if( iCtrlRid==0 ){ |
| 2600 | fossil_fatal("trouble committing control artifact: %s", g.zErrMsg); |
| 2601 | } |
| 2602 | fossil_print("Closed: %s (private)\n", zIntegrateUuid); |
| 2603 | if( dryRunFlag ) fossil_print("%s", blob_str(&bCtrl)); |
| 2604 | if( manifest_crosslink(iCtrlRid, &bCtrl, |
| 2605 | dryRunFlag ? MC_NONE : MC_PERMIT_HOOKS)==0 ){ |
| 2606 | fossil_fatal("%s", g.zErrMsg); |
| 2607 | } |
| 2608 | } |
| 2609 | }else{ |
| 2610 | fossil_print("Not_Closed: %s (not a leaf any more)\n", zIntegrateUuid); |
| 2611 | } |
| 2612 | } |
| 2613 | db_finalize(&q); |
| 2614 |