Fossil SCM
Add the --db-only and --quick options to the test-integrity command.
Commit
6711b2225115c8a92e63b812a2569998da88903d0366b473fba7e24f294dcb9d
Parent
78abc282df14f3b…
2 files changed
+2
+20
+2
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -283,11 +283,13 @@ | ||
| 283 | 283 | }else if( strncmp(zCmd, "sync", n)==0 ){ |
| 284 | 284 | zCmd = "sync -autourl -R"; |
| 285 | 285 | collect_argument(&extra, "verbose","v"); |
| 286 | 286 | collect_argument(&extra, "unversioned","u"); |
| 287 | 287 | }else if( strncmp(zCmd, "test-integrity", n)==0 ){ |
| 288 | + collect_argument(&extra, "db-only", "d"); | |
| 288 | 289 | collect_argument(&extra, "parse", 0); |
| 290 | + collect_argument(&extra, "quick", "q"); | |
| 289 | 291 | zCmd = "test-integrity"; |
| 290 | 292 | }else if( strncmp(zCmd, "test-orphans", n)==0 ){ |
| 291 | 293 | zCmd = "test-orphans -R"; |
| 292 | 294 | }else if( strncmp(zCmd, "test-missing", n)==0 ){ |
| 293 | 295 | zCmd = "test-missing -q -R"; |
| 294 | 296 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -283,11 +283,13 @@ | |
| 283 | }else if( strncmp(zCmd, "sync", n)==0 ){ |
| 284 | zCmd = "sync -autourl -R"; |
| 285 | collect_argument(&extra, "verbose","v"); |
| 286 | collect_argument(&extra, "unversioned","u"); |
| 287 | }else if( strncmp(zCmd, "test-integrity", n)==0 ){ |
| 288 | collect_argument(&extra, "parse", 0); |
| 289 | zCmd = "test-integrity"; |
| 290 | }else if( strncmp(zCmd, "test-orphans", n)==0 ){ |
| 291 | zCmd = "test-orphans -R"; |
| 292 | }else if( strncmp(zCmd, "test-missing", n)==0 ){ |
| 293 | zCmd = "test-missing -q -R"; |
| 294 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -283,11 +283,13 @@ | |
| 283 | }else if( strncmp(zCmd, "sync", n)==0 ){ |
| 284 | zCmd = "sync -autourl -R"; |
| 285 | collect_argument(&extra, "verbose","v"); |
| 286 | collect_argument(&extra, "unversioned","u"); |
| 287 | }else if( strncmp(zCmd, "test-integrity", n)==0 ){ |
| 288 | collect_argument(&extra, "db-only", "d"); |
| 289 | collect_argument(&extra, "parse", 0); |
| 290 | collect_argument(&extra, "quick", "q"); |
| 291 | zCmd = "test-integrity"; |
| 292 | }else if( strncmp(zCmd, "test-orphans", n)==0 ){ |
| 293 | zCmd = "test-orphans -R"; |
| 294 | }else if( strncmp(zCmd, "test-missing", n)==0 ){ |
| 295 | zCmd = "test-missing -q -R"; |
| 296 |
+20
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -944,13 +944,19 @@ | ||
| 944 | 944 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 945 | 945 | ** If the BLOB table is correct, then the repository can always be |
| 946 | 946 | ** successfully reconstructed using "fossil rebuild". |
| 947 | 947 | ** |
| 948 | 948 | ** Options: |
| 949 | +** | |
| 950 | +** -d|--db-only Run "PRAGMA integrity_check" on the database only. | |
| 951 | +** No other validation is performed. | |
| 949 | 952 | ** |
| 950 | 953 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 951 | 954 | ** so forth, reporting any errors found. |
| 955 | +** | |
| 956 | +** -q|--quick Run "PRAGMA quick_check" on the database only. | |
| 957 | +** No other validation is performed. | |
| 952 | 958 | */ |
| 953 | 959 | void test_integrity(void){ |
| 954 | 960 | Stmt q; |
| 955 | 961 | Blob content; |
| 956 | 962 | int n1 = 0; |
| @@ -958,11 +964,25 @@ | ||
| 958 | 964 | int nErr = 0; |
| 959 | 965 | int total; |
| 960 | 966 | int nCA = 0; |
| 961 | 967 | int anCA[10]; |
| 962 | 968 | int bParse = find_option("parse",0,0)!=0; |
| 969 | + int bDbOnly = find_option("db-only","d",0)!=0; | |
| 970 | + int bQuick = find_option("quick","q",0)!=0; | |
| 963 | 971 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 972 | + if( bDbOnly || bQuick ){ | |
| 973 | + const char *zType = bQuick ? "quick" : "integrity"; | |
| 974 | + char *zRes; | |
| 975 | + zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); | |
| 976 | + if( fossil_strcmp(zRes,"ok")!=0 ){ | |
| 977 | + fossil_print("%s_check failed!\n", zType); | |
| 978 | + exit(1); | |
| 979 | + }else{ | |
| 980 | + fossil_print("ok\n"); | |
| 981 | + } | |
| 982 | + return; | |
| 983 | + } | |
| 964 | 984 | memset(anCA, 0, sizeof(anCA)); |
| 965 | 985 | |
| 966 | 986 | /* Make sure no public artifact is a delta from a private artifact */ |
| 967 | 987 | db_prepare(&q, |
| 968 | 988 | "SELECT " |
| 969 | 989 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -944,13 +944,19 @@ | |
| 944 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 945 | ** If the BLOB table is correct, then the repository can always be |
| 946 | ** successfully reconstructed using "fossil rebuild". |
| 947 | ** |
| 948 | ** Options: |
| 949 | ** |
| 950 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 951 | ** so forth, reporting any errors found. |
| 952 | */ |
| 953 | void test_integrity(void){ |
| 954 | Stmt q; |
| 955 | Blob content; |
| 956 | int n1 = 0; |
| @@ -958,11 +964,25 @@ | |
| 958 | int nErr = 0; |
| 959 | int total; |
| 960 | int nCA = 0; |
| 961 | int anCA[10]; |
| 962 | int bParse = find_option("parse",0,0)!=0; |
| 963 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 964 | memset(anCA, 0, sizeof(anCA)); |
| 965 | |
| 966 | /* Make sure no public artifact is a delta from a private artifact */ |
| 967 | db_prepare(&q, |
| 968 | "SELECT " |
| 969 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -944,13 +944,19 @@ | |
| 944 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 945 | ** If the BLOB table is correct, then the repository can always be |
| 946 | ** successfully reconstructed using "fossil rebuild". |
| 947 | ** |
| 948 | ** Options: |
| 949 | ** |
| 950 | ** -d|--db-only Run "PRAGMA integrity_check" on the database only. |
| 951 | ** No other validation is performed. |
| 952 | ** |
| 953 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 954 | ** so forth, reporting any errors found. |
| 955 | ** |
| 956 | ** -q|--quick Run "PRAGMA quick_check" on the database only. |
| 957 | ** No other validation is performed. |
| 958 | */ |
| 959 | void test_integrity(void){ |
| 960 | Stmt q; |
| 961 | Blob content; |
| 962 | int n1 = 0; |
| @@ -958,11 +964,25 @@ | |
| 964 | int nErr = 0; |
| 965 | int total; |
| 966 | int nCA = 0; |
| 967 | int anCA[10]; |
| 968 | int bParse = find_option("parse",0,0)!=0; |
| 969 | int bDbOnly = find_option("db-only","d",0)!=0; |
| 970 | int bQuick = find_option("quick","q",0)!=0; |
| 971 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 972 | if( bDbOnly || bQuick ){ |
| 973 | const char *zType = bQuick ? "quick" : "integrity"; |
| 974 | char *zRes; |
| 975 | zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); |
| 976 | if( fossil_strcmp(zRes,"ok")!=0 ){ |
| 977 | fossil_print("%s_check failed!\n", zType); |
| 978 | exit(1); |
| 979 | }else{ |
| 980 | fossil_print("ok\n"); |
| 981 | } |
| 982 | return; |
| 983 | } |
| 984 | memset(anCA, 0, sizeof(anCA)); |
| 985 | |
| 986 | /* Make sure no public artifact is a delta from a private artifact */ |
| 987 | db_prepare(&q, |
| 988 | "SELECT " |
| 989 |