Fossil SCM
Add the -x/--crosslink flag to test-content-put, which causes it to treat all inputs as artifacts and crosslink them.
Commit
ff6b9dbe84a66c835bfac7601f1722ba48d2e7e398394690556c004f67944845
Parent
ff4caf13ba30b08…
2 files changed
+16
-2
+1
+16
-2
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -710,28 +710,42 @@ | ||
| 710 | 710 | ** |
| 711 | 711 | ** Options: |
| 712 | 712 | ** |
| 713 | 713 | ** --moderate Make corresponding entries to the MODREQ table |
| 714 | 714 | ** -R REPO Add the content to repository file REPO |
| 715 | +** -x|--crosslink Assume all inputs are artifacts and crosslink them. | |
| 715 | 716 | */ |
| 716 | 717 | void test_content_put_cmd(void){ |
| 717 | 718 | int rid; |
| 718 | 719 | Blob content; |
| 719 | 720 | int i; |
| 720 | 721 | int bModreq = find_option("moderate",0,0)!=0; |
| 722 | + int bCrosslink = find_option("crosslink","x",0)!=0; | |
| 721 | 723 | db_find_and_open_repository(0,0); |
| 722 | 724 | user_select(); |
| 723 | 725 | verify_all_options(); |
| 724 | 726 | db_begin_transaction(); |
| 725 | 727 | if( bModreq ) moderation_table_create(); |
| 728 | + if( bCrosslink ){ | |
| 729 | + manifest_crosslink_begin(); | |
| 730 | + } | |
| 726 | 731 | 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); | |
| 728 | 734 | rid = content_put(&content); |
| 735 | + if( bCrosslink ){ | |
| 736 | + manifest_crosslink(rid, &content, MC_NONE); | |
| 737 | + }else{ | |
| 738 | + blob_reset(&content); | |
| 739 | + } | |
| 729 | 740 | if( bModreq ){ |
| 730 | 741 | db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)",rid); |
| 731 | 742 | } |
| 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); | |
| 733 | 747 | } |
| 734 | 748 | db_end_transaction(0); |
| 735 | 749 | } |
| 736 | 750 | |
| 737 | 751 | /* |
| 738 | 752 |
| --- 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 |
M
src/db.c
+1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1329,10 +1329,11 @@ | ||
| 1329 | 1329 | ** Examples: |
| 1330 | 1330 | ** |
| 1331 | 1331 | ** symbolic_name_to_rid('trunk'); |
| 1332 | 1332 | ** symbolic_name_to_rid('trunk','w'); |
| 1333 | 1333 | ** |
| 1334 | +** Its result is either an RID or NULL. | |
| 1334 | 1335 | */ |
| 1335 | 1336 | void db_sym2rid_function( |
| 1336 | 1337 | sqlite3_context *context, |
| 1337 | 1338 | int argc, |
| 1338 | 1339 | sqlite3_value **argv |
| 1339 | 1340 |
| --- 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 |