Fossil SCM

Add the -x/--crosslink flag to test-content-put, which causes it to treat all inputs as artifacts and crosslink them.

stephan 2026-06-02 09:15 UTC trunk
Commit ff6b9dbe84a66c835bfac7601f1722ba48d2e7e398394690556c004f67944845
2 files changed +16 -2 +1
+16 -2
--- src/content.c
+++ src/content.c
@@ -710,28 +710,42 @@
710710
**
711711
** Options:
712712
**
713713
** --moderate Make corresponding entries to the MODREQ table
714714
** -R REPO Add the content to repository file REPO
715
+** -x|--crosslink Assume all inputs are artifacts and crosslink them.
715716
*/
716717
void test_content_put_cmd(void){
717718
int rid;
718719
Blob content;
719720
int i;
720721
int bModreq = find_option("moderate",0,0)!=0;
722
+ int bCrosslink = find_option("crosslink","x",0)!=0;
721723
db_find_and_open_repository(0,0);
722724
user_select();
723725
verify_all_options();
724726
db_begin_transaction();
725727
if( bModreq ) moderation_table_create();
728
+ if( bCrosslink ){
729
+ manifest_crosslink_begin();
730
+ }
726731
for(i=2; i<g.argc; i++){
727
- blob_read_from_file(&content, g.argv[i], ExtFILE);
732
+ const char *zFile = g.argv[i];
733
+ blob_read_from_file(&content, zFile, ExtFILE);
728734
rid = content_put(&content);
735
+ if( bCrosslink ){
736
+ manifest_crosslink(rid, &content, MC_NONE);
737
+ }else{
738
+ blob_reset(&content);
739
+ }
729740
if( bModreq ){
730741
db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)",rid);
731742
}
732
- fossil_print("inserted as record %d\n", rid);
743
+ fossil_print("inserted as record %d: %s\n", rid, zFile);
744
+ }
745
+ if( bCrosslink ){
746
+ manifest_crosslink_end(MC_NONE);
733747
}
734748
db_end_transaction(0);
735749
}
736750
737751
/*
738752
--- src/content.c
+++ src/content.c
@@ -710,28 +710,42 @@
710 **
711 ** Options:
712 **
713 ** --moderate Make corresponding entries to the MODREQ table
714 ** -R REPO Add the content to repository file REPO
 
715 */
716 void test_content_put_cmd(void){
717 int rid;
718 Blob content;
719 int i;
720 int bModreq = find_option("moderate",0,0)!=0;
 
721 db_find_and_open_repository(0,0);
722 user_select();
723 verify_all_options();
724 db_begin_transaction();
725 if( bModreq ) moderation_table_create();
 
 
 
726 for(i=2; i<g.argc; i++){
727 blob_read_from_file(&content, g.argv[i], ExtFILE);
 
728 rid = content_put(&content);
 
 
 
 
 
729 if( bModreq ){
730 db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)",rid);
731 }
732 fossil_print("inserted as record %d\n", rid);
 
 
 
733 }
734 db_end_transaction(0);
735 }
736
737 /*
738
--- src/content.c
+++ src/content.c
@@ -710,28 +710,42 @@
710 **
711 ** Options:
712 **
713 ** --moderate Make corresponding entries to the MODREQ table
714 ** -R REPO Add the content to repository file REPO
715 ** -x|--crosslink Assume all inputs are artifacts and crosslink them.
716 */
717 void test_content_put_cmd(void){
718 int rid;
719 Blob content;
720 int i;
721 int bModreq = find_option("moderate",0,0)!=0;
722 int bCrosslink = find_option("crosslink","x",0)!=0;
723 db_find_and_open_repository(0,0);
724 user_select();
725 verify_all_options();
726 db_begin_transaction();
727 if( bModreq ) moderation_table_create();
728 if( bCrosslink ){
729 manifest_crosslink_begin();
730 }
731 for(i=2; i<g.argc; i++){
732 const char *zFile = g.argv[i];
733 blob_read_from_file(&content, zFile, ExtFILE);
734 rid = content_put(&content);
735 if( bCrosslink ){
736 manifest_crosslink(rid, &content, MC_NONE);
737 }else{
738 blob_reset(&content);
739 }
740 if( bModreq ){
741 db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)",rid);
742 }
743 fossil_print("inserted as record %d: %s\n", rid, zFile);
744 }
745 if( bCrosslink ){
746 manifest_crosslink_end(MC_NONE);
747 }
748 db_end_transaction(0);
749 }
750
751 /*
752
+1
--- src/db.c
+++ src/db.c
@@ -1329,10 +1329,11 @@
13291329
** Examples:
13301330
**
13311331
** symbolic_name_to_rid('trunk');
13321332
** symbolic_name_to_rid('trunk','w');
13331333
**
1334
+** Its result is either an RID or NULL.
13341335
*/
13351336
void db_sym2rid_function(
13361337
sqlite3_context *context,
13371338
int argc,
13381339
sqlite3_value **argv
13391340
--- src/db.c
+++ src/db.c
@@ -1329,10 +1329,11 @@
1329 ** Examples:
1330 **
1331 ** symbolic_name_to_rid('trunk');
1332 ** symbolic_name_to_rid('trunk','w');
1333 **
 
1334 */
1335 void db_sym2rid_function(
1336 sqlite3_context *context,
1337 int argc,
1338 sqlite3_value **argv
1339
--- src/db.c
+++ src/db.c
@@ -1329,10 +1329,11 @@
1329 ** Examples:
1330 **
1331 ** symbolic_name_to_rid('trunk');
1332 ** symbolic_name_to_rid('trunk','w');
1333 **
1334 ** Its result is either an RID or NULL.
1335 */
1336 void db_sym2rid_function(
1337 sqlite3_context *context,
1338 int argc,
1339 sqlite3_value **argv
1340

Keyboard Shortcuts

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