Fossil SCM

Improvements to the information provided by "fossil dbstat". Better formatting for the "fossil all dbstat" command.

drh 2014-10-14 17:49 trunk
Commit 7cec2de598536c67b7631349f0e59806935c4862
2 files changed +3 -1 +26 -10
+3 -1
--- src/allrepo.c
+++ src/allrepo.c
@@ -193,11 +193,13 @@
193193
collect_argument(&extra, "temp",0);
194194
collect_argument(&extra, "verbose","v");
195195
collect_argument(&extra, "whatif",0);
196196
useCheckouts = 1;
197197
}else if( strncmp(zCmd, "dbstat", n)==0 ){
198
- zCmd = "dbstat -R";
198
+ zCmd = "dbstat --omit-version-info -R";
199
+ showLabel = 1;
200
+ quiet = 1;
199201
collect_argument(&extra, "brief", "b");
200202
}else if( strncmp(zCmd, "extras", n)==0 ){
201203
if( showFile ){
202204
zCmd = "extras --chdir";
203205
}else{
204206
--- 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 @@
166166
i64 t, fsize;
167167
int n, m;
168168
int szMax, szAvg;
169169
const char *zDb;
170170
int brief;
171
+ int omitVers; /* Omit Fossil and SQLite version information */
171172
char zBuf[100];
172173
const int colWidth = -19 /* printf alignment/width for left column */;
173
- const char *p;
174
+ const char *p, *z;
174175
175176
brief = find_option("brief", "b",0)!=0;
177
+ omitVers = find_option("omit-version-info", 0, 0)!=0;
176178
db_find_and_open_repository(0,0);
177179
178180
/* We should be done with options.. */
179181
verify_all_options();
180182
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
+ }
181188
fsize = file_size(g.zRepositoryName);
182
- fossil_print("%*s%s\n", colWidth, "repository-file:", g.zRepositoryName);
183189
bigSizeName(sizeof(zBuf), zBuf, fsize);
184190
fossil_print( "%*s%s\n", colWidth, "repository-size:", zBuf );
185191
if( !brief ){
186192
n = db_int(0, "SELECT count(*) FROM blob");
187193
m = db_int(0, "SELECT count(*) FROM delta");
@@ -226,28 +232,38 @@
226232
fossil_print("%*s%d (%d changes)\n", colWidth, "tickets:", n, m);
227233
n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'");
228234
fossil_print("%*s%d\n", colWidth, "events:", n);
229235
n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'");
230236
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);
231242
}
232243
n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)"
233244
" + 0.99");
234245
fossil_print("%*s%d days or approximately %.2f years.\n",
235246
colWidth, "project-age:", n, n/365.2425);
236247
p = db_get("project-code", 0);
237248
if( p ){
238249
fossil_print("%*s%s\n", colWidth, "project-id:", p);
239250
}
251
+#if 0
252
+ /* Server-id is not useful information any more */
240253
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
+ }
249265
zDb = db_name("repository");
250266
fossil_print("%*s%d pages, %d bytes/pg, %d free pages, "
251267
"%s, %s mode\n",
252268
colWidth, "database-stats:",
253269
db_int(0, "PRAGMA %s.page_count", zDb),
254270
--- 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

Keyboard Shortcuts

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