Fossil SCM
Improvements to the information provided by "fossil dbstat". Better formatting for the "fossil all dbstat" command.
Commit
7cec2de598536c67b7631349f0e59806935c4862
Parent
c6d9b0a06c7980c…
2 files changed
+3
-1
+26
-10
+3
-1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -193,11 +193,13 @@ | ||
| 193 | 193 | collect_argument(&extra, "temp",0); |
| 194 | 194 | collect_argument(&extra, "verbose","v"); |
| 195 | 195 | collect_argument(&extra, "whatif",0); |
| 196 | 196 | useCheckouts = 1; |
| 197 | 197 | }else if( strncmp(zCmd, "dbstat", n)==0 ){ |
| 198 | - zCmd = "dbstat -R"; | |
| 198 | + zCmd = "dbstat --omit-version-info -R"; | |
| 199 | + showLabel = 1; | |
| 200 | + quiet = 1; | |
| 199 | 201 | collect_argument(&extra, "brief", "b"); |
| 200 | 202 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 201 | 203 | if( showFile ){ |
| 202 | 204 | zCmd = "extras --chdir"; |
| 203 | 205 | }else{ |
| 204 | 206 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -193,11 +193,13 @@ | |
| 193 | collect_argument(&extra, "temp",0); |
| 194 | collect_argument(&extra, "verbose","v"); |
| 195 | collect_argument(&extra, "whatif",0); |
| 196 | useCheckouts = 1; |
| 197 | }else if( strncmp(zCmd, "dbstat", n)==0 ){ |
| 198 | zCmd = "dbstat -R"; |
| 199 | collect_argument(&extra, "brief", "b"); |
| 200 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 201 | if( showFile ){ |
| 202 | zCmd = "extras --chdir"; |
| 203 | }else{ |
| 204 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -193,11 +193,13 @@ | |
| 193 | collect_argument(&extra, "temp",0); |
| 194 | collect_argument(&extra, "verbose","v"); |
| 195 | collect_argument(&extra, "whatif",0); |
| 196 | useCheckouts = 1; |
| 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 |
+26
-10
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -166,22 +166,28 @@ | ||
| 166 | 166 | i64 t, fsize; |
| 167 | 167 | int n, m; |
| 168 | 168 | int szMax, szAvg; |
| 169 | 169 | const char *zDb; |
| 170 | 170 | int brief; |
| 171 | + int omitVers; /* Omit Fossil and SQLite version information */ | |
| 171 | 172 | char zBuf[100]; |
| 172 | 173 | const int colWidth = -19 /* printf alignment/width for left column */; |
| 173 | - const char *p; | |
| 174 | + const char *p, *z; | |
| 174 | 175 | |
| 175 | 176 | brief = find_option("brief", "b",0)!=0; |
| 177 | + omitVers = find_option("omit-version-info", 0, 0)!=0; | |
| 176 | 178 | db_find_and_open_repository(0,0); |
| 177 | 179 | |
| 178 | 180 | /* We should be done with options.. */ |
| 179 | 181 | verify_all_options(); |
| 180 | 182 | |
| 183 | + if( (z = db_get("project-name",0))!=0 | |
| 184 | + || (z = db_get("short-project-name",0))!=0 | |
| 185 | + ){ | |
| 186 | + fossil_print("%*s%s\n", colWidth, "project-name:", z); | |
| 187 | + } | |
| 181 | 188 | fsize = file_size(g.zRepositoryName); |
| 182 | - fossil_print("%*s%s\n", colWidth, "repository-file:", g.zRepositoryName); | |
| 183 | 189 | bigSizeName(sizeof(zBuf), zBuf, fsize); |
| 184 | 190 | fossil_print( "%*s%s\n", colWidth, "repository-size:", zBuf ); |
| 185 | 191 | if( !brief ){ |
| 186 | 192 | n = db_int(0, "SELECT count(*) FROM blob"); |
| 187 | 193 | m = db_int(0, "SELECT count(*) FROM delta"); |
| @@ -226,28 +232,38 @@ | ||
| 226 | 232 | fossil_print("%*s%d (%d changes)\n", colWidth, "tickets:", n, m); |
| 227 | 233 | n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'"); |
| 228 | 234 | fossil_print("%*s%d\n", colWidth, "events:", n); |
| 229 | 235 | n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'"); |
| 230 | 236 | fossil_print("%*s%d\n", colWidth, "tagchanges:", n); |
| 237 | + z = db_text(0, "SELECT datetime(mtime) ||" | |
| 238 | + " printf(' - about %%d days ago ',julianday('now') - mtime)" | |
| 239 | + " FROM event " | |
| 240 | + " ORDER BY mtime DESC LIMIT 1"); | |
| 241 | + fossil_print("%*s%s\n", colWidth, "latest-change:", z); | |
| 231 | 242 | } |
| 232 | 243 | n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)" |
| 233 | 244 | " + 0.99"); |
| 234 | 245 | fossil_print("%*s%d days or approximately %.2f years.\n", |
| 235 | 246 | colWidth, "project-age:", n, n/365.2425); |
| 236 | 247 | p = db_get("project-code", 0); |
| 237 | 248 | if( p ){ |
| 238 | 249 | fossil_print("%*s%s\n", colWidth, "project-id:", p); |
| 239 | 250 | } |
| 251 | +#if 0 | |
| 252 | + /* Server-id is not useful information any more */ | |
| 240 | 253 | fossil_print("%*s%s\n", colWidth, "server-id:", db_get("server-code", 0)); |
| 241 | - fossil_print("%*s%s %s [%s] (%s)\n", | |
| 242 | - colWidth, "fossil-version:", | |
| 243 | - MANIFEST_DATE, MANIFEST_VERSION, RELEASE_VERSION, | |
| 244 | - COMPILER_NAME); | |
| 245 | - fossil_print("%*s%.19s [%.10s] (%s)\n", | |
| 246 | - colWidth, "sqlite-version:", | |
| 247 | - sqlite3_sourceid(), &sqlite3_sourceid()[20], | |
| 248 | - sqlite3_libversion()); | |
| 254 | +#endif | |
| 255 | + if( !omitVers ){ | |
| 256 | + fossil_print("%*s%s %s [%s] (%s)\n", | |
| 257 | + colWidth, "fossil-version:", | |
| 258 | + MANIFEST_DATE, MANIFEST_VERSION, RELEASE_VERSION, | |
| 259 | + COMPILER_NAME); | |
| 260 | + fossil_print("%*s%.19s [%.10s] (%s)\n", | |
| 261 | + colWidth, "sqlite-version:", | |
| 262 | + sqlite3_sourceid(), &sqlite3_sourceid()[20], | |
| 263 | + sqlite3_libversion()); | |
| 264 | + } | |
| 249 | 265 | zDb = db_name("repository"); |
| 250 | 266 | fossil_print("%*s%d pages, %d bytes/pg, %d free pages, " |
| 251 | 267 | "%s, %s mode\n", |
| 252 | 268 | colWidth, "database-stats:", |
| 253 | 269 | db_int(0, "PRAGMA %s.page_count", zDb), |
| 254 | 270 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -166,22 +166,28 @@ | |
| 166 | i64 t, fsize; |
| 167 | int n, m; |
| 168 | int szMax, szAvg; |
| 169 | const char *zDb; |
| 170 | int brief; |
| 171 | char zBuf[100]; |
| 172 | const int colWidth = -19 /* printf alignment/width for left column */; |
| 173 | const char *p; |
| 174 | |
| 175 | brief = find_option("brief", "b",0)!=0; |
| 176 | db_find_and_open_repository(0,0); |
| 177 | |
| 178 | /* We should be done with options.. */ |
| 179 | verify_all_options(); |
| 180 | |
| 181 | fsize = file_size(g.zRepositoryName); |
| 182 | fossil_print("%*s%s\n", colWidth, "repository-file:", g.zRepositoryName); |
| 183 | bigSizeName(sizeof(zBuf), zBuf, fsize); |
| 184 | fossil_print( "%*s%s\n", colWidth, "repository-size:", zBuf ); |
| 185 | if( !brief ){ |
| 186 | n = db_int(0, "SELECT count(*) FROM blob"); |
| 187 | m = db_int(0, "SELECT count(*) FROM delta"); |
| @@ -226,28 +232,38 @@ | |
| 226 | fossil_print("%*s%d (%d changes)\n", colWidth, "tickets:", n, m); |
| 227 | n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'"); |
| 228 | fossil_print("%*s%d\n", colWidth, "events:", n); |
| 229 | n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'"); |
| 230 | fossil_print("%*s%d\n", colWidth, "tagchanges:", n); |
| 231 | } |
| 232 | n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)" |
| 233 | " + 0.99"); |
| 234 | fossil_print("%*s%d days or approximately %.2f years.\n", |
| 235 | colWidth, "project-age:", n, n/365.2425); |
| 236 | p = db_get("project-code", 0); |
| 237 | if( p ){ |
| 238 | fossil_print("%*s%s\n", colWidth, "project-id:", p); |
| 239 | } |
| 240 | fossil_print("%*s%s\n", colWidth, "server-id:", db_get("server-code", 0)); |
| 241 | fossil_print("%*s%s %s [%s] (%s)\n", |
| 242 | colWidth, "fossil-version:", |
| 243 | MANIFEST_DATE, MANIFEST_VERSION, RELEASE_VERSION, |
| 244 | COMPILER_NAME); |
| 245 | fossil_print("%*s%.19s [%.10s] (%s)\n", |
| 246 | colWidth, "sqlite-version:", |
| 247 | sqlite3_sourceid(), &sqlite3_sourceid()[20], |
| 248 | sqlite3_libversion()); |
| 249 | zDb = db_name("repository"); |
| 250 | fossil_print("%*s%d pages, %d bytes/pg, %d free pages, " |
| 251 | "%s, %s mode\n", |
| 252 | colWidth, "database-stats:", |
| 253 | db_int(0, "PRAGMA %s.page_count", zDb), |
| 254 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -166,22 +166,28 @@ | |
| 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 | |
| 183 | if( (z = db_get("project-name",0))!=0 |
| 184 | || (z = db_get("short-project-name",0))!=0 |
| 185 | ){ |
| 186 | fossil_print("%*s%s\n", colWidth, "project-name:", z); |
| 187 | } |
| 188 | fsize = file_size(g.zRepositoryName); |
| 189 | bigSizeName(sizeof(zBuf), zBuf, fsize); |
| 190 | fossil_print( "%*s%s\n", colWidth, "repository-size:", zBuf ); |
| 191 | if( !brief ){ |
| 192 | n = db_int(0, "SELECT count(*) FROM blob"); |
| 193 | m = db_int(0, "SELECT count(*) FROM delta"); |
| @@ -226,28 +232,38 @@ | |
| 232 | fossil_print("%*s%d (%d changes)\n", colWidth, "tickets:", n, m); |
| 233 | n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'"); |
| 234 | fossil_print("%*s%d\n", colWidth, "events:", n); |
| 235 | n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'"); |
| 236 | fossil_print("%*s%d\n", colWidth, "tagchanges:", n); |
| 237 | z = db_text(0, "SELECT datetime(mtime) ||" |
| 238 | " printf(' - about %%d days ago ',julianday('now') - mtime)" |
| 239 | " FROM event " |
| 240 | " ORDER BY mtime DESC LIMIT 1"); |
| 241 | fossil_print("%*s%s\n", colWidth, "latest-change:", z); |
| 242 | } |
| 243 | n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)" |
| 244 | " + 0.99"); |
| 245 | fossil_print("%*s%d days or approximately %.2f years.\n", |
| 246 | colWidth, "project-age:", n, n/365.2425); |
| 247 | p = db_get("project-code", 0); |
| 248 | if( p ){ |
| 249 | fossil_print("%*s%s\n", colWidth, "project-id:", p); |
| 250 | } |
| 251 | #if 0 |
| 252 | /* Server-id is not useful information any more */ |
| 253 | fossil_print("%*s%s\n", colWidth, "server-id:", db_get("server-code", 0)); |
| 254 | #endif |
| 255 | if( !omitVers ){ |
| 256 | fossil_print("%*s%s %s [%s] (%s)\n", |
| 257 | colWidth, "fossil-version:", |
| 258 | MANIFEST_DATE, MANIFEST_VERSION, RELEASE_VERSION, |
| 259 | COMPILER_NAME); |
| 260 | fossil_print("%*s%.19s [%.10s] (%s)\n", |
| 261 | colWidth, "sqlite-version:", |
| 262 | sqlite3_sourceid(), &sqlite3_sourceid()[20], |
| 263 | sqlite3_libversion()); |
| 264 | } |
| 265 | zDb = db_name("repository"); |
| 266 | fossil_print("%*s%d pages, %d bytes/pg, %d free pages, " |
| 267 | "%s, %s mode\n", |
| 268 | colWidth, "database-stats:", |
| 269 | db_int(0, "PRAGMA %s.page_count", zDb), |
| 270 |