Fossil SCM
Add the --db-check option to the "fossil dbstat" command.
Commit
d4e3f4c33d4904fdea32a40218cd003b0839e081
Parent
7cec2de598536c6…
2 files changed
+1
+11
-5
+1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -197,10 +197,11 @@ | ||
| 197 | 197 | }else if( strncmp(zCmd, "dbstat", n)==0 ){ |
| 198 | 198 | zCmd = "dbstat --omit-version-info -R"; |
| 199 | 199 | showLabel = 1; |
| 200 | 200 | quiet = 1; |
| 201 | 201 | collect_argument(&extra, "brief", "b"); |
| 202 | + collect_argument(&extra, "db-check", 0); | |
| 202 | 203 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 203 | 204 | if( showFile ){ |
| 204 | 205 | zCmd = "extras --chdir"; |
| 205 | 206 | }else{ |
| 206 | 207 | zCmd = "extras --header --chdir"; |
| 207 | 208 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -197,10 +197,11 @@ | |
| 197 | }else if( strncmp(zCmd, "dbstat", n)==0 ){ |
| 198 | zCmd = "dbstat --omit-version-info -R"; |
| 199 | showLabel = 1; |
| 200 | quiet = 1; |
| 201 | collect_argument(&extra, "brief", "b"); |
| 202 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 203 | if( showFile ){ |
| 204 | zCmd = "extras --chdir"; |
| 205 | }else{ |
| 206 | zCmd = "extras --header --chdir"; |
| 207 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -197,10 +197,11 @@ | |
| 197 | }else if( strncmp(zCmd, "dbstat", n)==0 ){ |
| 198 | zCmd = "dbstat --omit-version-info -R"; |
| 199 | showLabel = 1; |
| 200 | quiet = 1; |
| 201 | collect_argument(&extra, "brief", "b"); |
| 202 | collect_argument(&extra, "db-check", 0); |
| 203 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 204 | if( showFile ){ |
| 205 | zCmd = "extras --chdir"; |
| 206 | }else{ |
| 207 | zCmd = "extras --header --chdir"; |
| 208 |
+11
-5
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -151,32 +151,35 @@ | ||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | 154 | ** COMMAND: dbstat* |
| 155 | 155 | ** |
| 156 | -** Usage: %fossil dbstat ?-brief | -b? | |
| 156 | +** Usage: %fossil dbstat OPTIONS | |
| 157 | 157 | ** |
| 158 | 158 | ** Shows statistics and global information about the repository. |
| 159 | 159 | ** |
| 160 | -** The (-brief|-b) option removes any "long-running" statistics, namely | |
| 161 | -** those whose calculations are known to slow down as the repository | |
| 162 | -** grows. | |
| 160 | +** Options: | |
| 163 | 161 | ** |
| 162 | +** --brief|-b Only show essential elements | |
| 163 | +** --db-check Run a PRAGMA quick_check on the repository database | |
| 164 | +** --omit-version-info Omit the SQLite and Fossil version information | |
| 164 | 165 | */ |
| 165 | 166 | void dbstat_cmd(void){ |
| 166 | 167 | i64 t, fsize; |
| 167 | 168 | int n, m; |
| 168 | 169 | int szMax, szAvg; |
| 169 | 170 | const char *zDb; |
| 170 | 171 | int brief; |
| 171 | 172 | int omitVers; /* Omit Fossil and SQLite version information */ |
| 173 | + int dbCheck; /* True for the --db-check option */ | |
| 172 | 174 | char zBuf[100]; |
| 173 | 175 | const int colWidth = -19 /* printf alignment/width for left column */; |
| 174 | 176 | const char *p, *z; |
| 175 | 177 | |
| 176 | 178 | brief = find_option("brief", "b",0)!=0; |
| 177 | 179 | omitVers = find_option("omit-version-info", 0, 0)!=0; |
| 180 | + dbCheck = find_option("db-check",0,0)!=0; | |
| 178 | 181 | db_find_and_open_repository(0,0); |
| 179 | 182 | |
| 180 | 183 | /* We should be done with options.. */ |
| 181 | 184 | verify_all_options(); |
| 182 | 185 | |
| @@ -269,11 +272,14 @@ | ||
| 269 | 272 | db_int(0, "PRAGMA %s.page_count", zDb), |
| 270 | 273 | db_int(0, "PRAGMA %s.page_size", zDb), |
| 271 | 274 | db_int(0, "PRAGMA %s.freelist_count", zDb), |
| 272 | 275 | db_text(0, "PRAGMA %s.encoding", zDb), |
| 273 | 276 | db_text(0, "PRAGMA %s.journal_mode", zDb)); |
| 274 | - | |
| 277 | + if( dbCheck ){ | |
| 278 | + fossil_print("%*s%s\n", colWidth, "database-check:", | |
| 279 | + db_text(0, "PRAGMA quick_check(1)")); | |
| 280 | + } | |
| 275 | 281 | } |
| 276 | 282 | |
| 277 | 283 | /* |
| 278 | 284 | ** WEBPAGE: urllist |
| 279 | 285 | ** |
| 280 | 286 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -151,32 +151,35 @@ | |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | ** COMMAND: dbstat* |
| 155 | ** |
| 156 | ** Usage: %fossil dbstat ?-brief | -b? |
| 157 | ** |
| 158 | ** Shows statistics and global information about the repository. |
| 159 | ** |
| 160 | ** The (-brief|-b) option removes any "long-running" statistics, namely |
| 161 | ** those whose calculations are known to slow down as the repository |
| 162 | ** grows. |
| 163 | ** |
| 164 | */ |
| 165 | void dbstat_cmd(void){ |
| 166 | i64 t, fsize; |
| 167 | int n, m; |
| 168 | int szMax, szAvg; |
| 169 | const char *zDb; |
| 170 | int brief; |
| 171 | int omitVers; /* Omit Fossil and SQLite version information */ |
| 172 | char zBuf[100]; |
| 173 | const int colWidth = -19 /* printf alignment/width for left column */; |
| 174 | const char *p, *z; |
| 175 | |
| 176 | brief = find_option("brief", "b",0)!=0; |
| 177 | omitVers = find_option("omit-version-info", 0, 0)!=0; |
| 178 | db_find_and_open_repository(0,0); |
| 179 | |
| 180 | /* We should be done with options.. */ |
| 181 | verify_all_options(); |
| 182 | |
| @@ -269,11 +272,14 @@ | |
| 269 | db_int(0, "PRAGMA %s.page_count", zDb), |
| 270 | db_int(0, "PRAGMA %s.page_size", zDb), |
| 271 | db_int(0, "PRAGMA %s.freelist_count", zDb), |
| 272 | db_text(0, "PRAGMA %s.encoding", zDb), |
| 273 | db_text(0, "PRAGMA %s.journal_mode", zDb)); |
| 274 | |
| 275 | } |
| 276 | |
| 277 | /* |
| 278 | ** WEBPAGE: urllist |
| 279 | ** |
| 280 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -151,32 +151,35 @@ | |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | ** COMMAND: dbstat* |
| 155 | ** |
| 156 | ** Usage: %fossil dbstat OPTIONS |
| 157 | ** |
| 158 | ** Shows statistics and global information about the repository. |
| 159 | ** |
| 160 | ** Options: |
| 161 | ** |
| 162 | ** --brief|-b Only show essential elements |
| 163 | ** --db-check Run a PRAGMA quick_check on the repository database |
| 164 | ** --omit-version-info Omit the SQLite and Fossil version information |
| 165 | */ |
| 166 | void dbstat_cmd(void){ |
| 167 | i64 t, fsize; |
| 168 | int n, m; |
| 169 | int szMax, szAvg; |
| 170 | const char *zDb; |
| 171 | int brief; |
| 172 | int omitVers; /* Omit Fossil and SQLite version information */ |
| 173 | int dbCheck; /* True for the --db-check option */ |
| 174 | char zBuf[100]; |
| 175 | const int colWidth = -19 /* printf alignment/width for left column */; |
| 176 | const char *p, *z; |
| 177 | |
| 178 | brief = find_option("brief", "b",0)!=0; |
| 179 | omitVers = find_option("omit-version-info", 0, 0)!=0; |
| 180 | dbCheck = find_option("db-check",0,0)!=0; |
| 181 | db_find_and_open_repository(0,0); |
| 182 | |
| 183 | /* We should be done with options.. */ |
| 184 | verify_all_options(); |
| 185 | |
| @@ -269,11 +272,14 @@ | |
| 272 | db_int(0, "PRAGMA %s.page_count", zDb), |
| 273 | db_int(0, "PRAGMA %s.page_size", zDb), |
| 274 | db_int(0, "PRAGMA %s.freelist_count", zDb), |
| 275 | db_text(0, "PRAGMA %s.encoding", zDb), |
| 276 | db_text(0, "PRAGMA %s.journal_mode", zDb)); |
| 277 | if( dbCheck ){ |
| 278 | fossil_print("%*s%s\n", colWidth, "database-check:", |
| 279 | db_text(0, "PRAGMA quick_check(1)")); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /* |
| 284 | ** WEBPAGE: urllist |
| 285 | ** |
| 286 |