Fossil SCM

Revise the "fossil version -v" command to give less detail. Use -vv or -v -v to get the original full detail.

drh 2022-07-21 20:00 trunk
Commit bbbd7ef8f5da79aa9c9712956c57d225c4e2504a5ec405defc733fd14cdeec00
1 file changed +33 -23
+33 -23
--- src/main.c
+++ src/main.c
@@ -1176,38 +1176,51 @@
11761176
** the "version" command and "test-version" web page. It assumes the blob
11771177
** passed to it is uninitialized; otherwise, it will leak memory.
11781178
*/
11791179
void fossil_version_blob(
11801180
Blob *pOut, /* Write the manifest here */
1181
- int bVerbose /* Non-zero for full information. */
1181
+ int eVerbose /* 0: brief. 1: more text, 2: lots of text */
11821182
){
11831183
#if defined(FOSSIL_ENABLE_TCL)
11841184
int rc;
11851185
const char *zRc;
11861186
#endif
11871187
Stmt q;
11881188
size_t pageSize = 0;
11891189
blob_zero(pOut);
11901190
blob_appendf(pOut, "This is fossil version %s\n", get_version());
1191
- if( !bVerbose ) return;
1191
+ if( eVerbose<=0 ) return;
1192
+
11921193
blob_appendf(pOut, "Compiled on %s %s using %s (%d-bit)\n",
11931194
__DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8);
1195
+ blob_appendf(pOut, "SQLite %s %.30s\n", sqlite3_libversion(),
1196
+ sqlite3_sourceid());
1197
+#if defined(FOSSIL_ENABLE_SSL)
1198
+ blob_appendf(pOut, "SSL (%s)\n", SSLeay_version(SSLEAY_VERSION));
1199
+#endif
1200
+ blob_appendf(pOut, "zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
1201
+#if defined(FOSSIL_HAVE_FUSEFS)
1202
+ blob_appendf(pOut, "libfuse %s, loaded %s\n", fusefs_inc_version(),
1203
+ fusefs_lib_version());
1204
+#endif
1205
+#if defined(FOSSIL_ENABLE_TCL)
1206
+ Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_FORCE_TCL);
1207
+ rc = Th_Eval(g.interp, 0, "tclInvoke info patchlevel", -1);
1208
+ zRc = Th_ReturnCodeName(rc, 0);
1209
+ blob_appendf(pOut, "TCL (Tcl %s, loaded %s: %s)\n",
1210
+ TCL_PATCH_LEVEL, zRc, Th_GetResult(g.interp, 0)
1211
+ );
1212
+#endif
1213
+ if( eVerbose<=1 ) return;
1214
+
11941215
blob_appendf(pOut, "Schema version %s\n", AUX_SCHEMA_MAX);
11951216
fossil_get_page_size(&pageSize);
11961217
blob_appendf(pOut, "Detected memory page size is %lu bytes\n",
11971218
(unsigned long)pageSize);
1198
- blob_appendf(pOut, "zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
11991219
#if FOSSIL_HARDENED_SHA1
12001220
blob_appendf(pOut, "hardened-SHA1 by Marc Stevens and Dan Shumow\n");
12011221
#endif
1202
-#if defined(FOSSIL_ENABLE_SSL)
1203
- blob_appendf(pOut, "SSL (%s)\n", SSLeay_version(SSLEAY_VERSION));
1204
-#endif
1205
-#if defined(FOSSIL_HAVE_FUSEFS)
1206
- blob_appendf(pOut, "libfuse %s, loaded %s\n", fusefs_inc_version(),
1207
- fusefs_lib_version());
1208
-#endif
12091222
#if defined(FOSSIL_DEBUG)
12101223
blob_append(pOut, "FOSSIL_DEBUG\n", -1);
12111224
#endif
12121225
#if defined(FOSSIL_ENABLE_DELTA_CKSUM_TEST)
12131226
blob_append(pOut, "FOSSIL_ENABLE_DELTA_CKSUM_TEST\n", -1);
@@ -1219,18 +1232,10 @@
12191232
#if defined(FOSSIL_ENABLE_TH1_DOCS)
12201233
blob_append(pOut, "FOSSIL_ENABLE_TH1_DOCS\n", -1);
12211234
#endif
12221235
#if defined(FOSSIL_ENABLE_TH1_HOOKS)
12231236
blob_append(pOut, "FOSSIL_ENABLE_TH1_HOOKS\n", -1);
1224
-#endif
1225
-#if defined(FOSSIL_ENABLE_TCL)
1226
- Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_FORCE_TCL);
1227
- rc = Th_Eval(g.interp, 0, "tclInvoke info patchlevel", -1);
1228
- zRc = Th_ReturnCodeName(rc, 0);
1229
- blob_appendf(pOut, "TCL (Tcl %s, loaded %s: %s)\n",
1230
- TCL_PATCH_LEVEL, zRc, Th_GetResult(g.interp, 0)
1231
- );
12321237
#endif
12331238
#if defined(USE_TCL_STUBS)
12341239
blob_append(pOut, "USE_TCL_STUBS\n", -1);
12351240
#endif
12361241
#if defined(FOSSIL_ENABLE_TCL_STUBS)
@@ -1263,12 +1268,11 @@
12631268
blob_append(pOut, "USE_SEE\n", -1);
12641269
#endif
12651270
#if defined(FOSSIL_ALLOW_OUT_OF_ORDER_DATES)
12661271
blob_append(pOut, "FOSSIL_ALLOW_OUT_OF_ORDER_DATES\n");
12671272
#endif
1268
- blob_appendf(pOut, "SQLite %s %.30s\n", sqlite3_libversion(),
1269
- sqlite3_sourceid());
1273
+
12701274
if( g.db==0 ) sqlite3_open(":memory:", &g.db);
12711275
db_prepare(&q,
12721276
"pragma compile_options");
12731277
while( db_step(&q)==SQLITE_ROW ){
12741278
const char *text = db_column_text(&q, 0);
@@ -1296,15 +1300,20 @@
12961300
** Usage: %fossil version ?-v|--verbose?
12971301
**
12981302
** Print the source code version number for the fossil executable.
12991303
** If the verbose option is specified, additional details will
13001304
** be output about what optional features this binary was compiled
1301
-** with
1305
+** with.
1306
+**
1307
+** Repeat the -v option or use -vv for even more information.
13021308
*/
13031309
void version_cmd(void){
13041310
Blob versionInfo;
1305
- int verboseFlag = find_option("verbose","v",0)!=0;
1311
+ int verboseFlag = 0;
1312
+
1313
+ while( find_option("verbose","v",0)!=0 ) verboseFlag++;
1314
+ while( find_option("vv",0,0)!=0 ) verboseFlag += 2;
13061315
13071316
/* We should be done with options.. */
13081317
verify_all_options();
13091318
fossil_version_blob(&versionInfo, verboseFlag);
13101319
fossil_print("%s", blob_str(&versionInfo));
@@ -1320,15 +1329,16 @@
13201329
**
13211330
** verbose Show details
13221331
*/
13231332
void test_version_page(void){
13241333
Blob versionInfo;
1334
+ char *zVerbose;
13251335
int verboseFlag;
13261336
13271337
login_check_credentials();
13281338
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1329
- verboseFlag = PD("verbose", 0) != 0;
1339
+ verboseFlag = P("verbose")!=0 ? 2 : 1;
13301340
style_header("Version Information");
13311341
style_submenu_element("Stat", "stat");
13321342
fossil_version_blob(&versionInfo, verboseFlag);
13331343
@ <pre>
13341344
@ %h(blob_str(&versionInfo))
13351345
--- src/main.c
+++ src/main.c
@@ -1176,38 +1176,51 @@
1176 ** the "version" command and "test-version" web page. It assumes the blob
1177 ** passed to it is uninitialized; otherwise, it will leak memory.
1178 */
1179 void fossil_version_blob(
1180 Blob *pOut, /* Write the manifest here */
1181 int bVerbose /* Non-zero for full information. */
1182 ){
1183 #if defined(FOSSIL_ENABLE_TCL)
1184 int rc;
1185 const char *zRc;
1186 #endif
1187 Stmt q;
1188 size_t pageSize = 0;
1189 blob_zero(pOut);
1190 blob_appendf(pOut, "This is fossil version %s\n", get_version());
1191 if( !bVerbose ) return;
 
1192 blob_appendf(pOut, "Compiled on %s %s using %s (%d-bit)\n",
1193 __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1194 blob_appendf(pOut, "Schema version %s\n", AUX_SCHEMA_MAX);
1195 fossil_get_page_size(&pageSize);
1196 blob_appendf(pOut, "Detected memory page size is %lu bytes\n",
1197 (unsigned long)pageSize);
1198 blob_appendf(pOut, "zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
1199 #if FOSSIL_HARDENED_SHA1
1200 blob_appendf(pOut, "hardened-SHA1 by Marc Stevens and Dan Shumow\n");
1201 #endif
1202 #if defined(FOSSIL_ENABLE_SSL)
1203 blob_appendf(pOut, "SSL (%s)\n", SSLeay_version(SSLEAY_VERSION));
1204 #endif
1205 #if defined(FOSSIL_HAVE_FUSEFS)
1206 blob_appendf(pOut, "libfuse %s, loaded %s\n", fusefs_inc_version(),
1207 fusefs_lib_version());
1208 #endif
1209 #if defined(FOSSIL_DEBUG)
1210 blob_append(pOut, "FOSSIL_DEBUG\n", -1);
1211 #endif
1212 #if defined(FOSSIL_ENABLE_DELTA_CKSUM_TEST)
1213 blob_append(pOut, "FOSSIL_ENABLE_DELTA_CKSUM_TEST\n", -1);
@@ -1219,18 +1232,10 @@
1219 #if defined(FOSSIL_ENABLE_TH1_DOCS)
1220 blob_append(pOut, "FOSSIL_ENABLE_TH1_DOCS\n", -1);
1221 #endif
1222 #if defined(FOSSIL_ENABLE_TH1_HOOKS)
1223 blob_append(pOut, "FOSSIL_ENABLE_TH1_HOOKS\n", -1);
1224 #endif
1225 #if defined(FOSSIL_ENABLE_TCL)
1226 Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_FORCE_TCL);
1227 rc = Th_Eval(g.interp, 0, "tclInvoke info patchlevel", -1);
1228 zRc = Th_ReturnCodeName(rc, 0);
1229 blob_appendf(pOut, "TCL (Tcl %s, loaded %s: %s)\n",
1230 TCL_PATCH_LEVEL, zRc, Th_GetResult(g.interp, 0)
1231 );
1232 #endif
1233 #if defined(USE_TCL_STUBS)
1234 blob_append(pOut, "USE_TCL_STUBS\n", -1);
1235 #endif
1236 #if defined(FOSSIL_ENABLE_TCL_STUBS)
@@ -1263,12 +1268,11 @@
1263 blob_append(pOut, "USE_SEE\n", -1);
1264 #endif
1265 #if defined(FOSSIL_ALLOW_OUT_OF_ORDER_DATES)
1266 blob_append(pOut, "FOSSIL_ALLOW_OUT_OF_ORDER_DATES\n");
1267 #endif
1268 blob_appendf(pOut, "SQLite %s %.30s\n", sqlite3_libversion(),
1269 sqlite3_sourceid());
1270 if( g.db==0 ) sqlite3_open(":memory:", &g.db);
1271 db_prepare(&q,
1272 "pragma compile_options");
1273 while( db_step(&q)==SQLITE_ROW ){
1274 const char *text = db_column_text(&q, 0);
@@ -1296,15 +1300,20 @@
1296 ** Usage: %fossil version ?-v|--verbose?
1297 **
1298 ** Print the source code version number for the fossil executable.
1299 ** If the verbose option is specified, additional details will
1300 ** be output about what optional features this binary was compiled
1301 ** with
 
 
1302 */
1303 void version_cmd(void){
1304 Blob versionInfo;
1305 int verboseFlag = find_option("verbose","v",0)!=0;
 
 
 
1306
1307 /* We should be done with options.. */
1308 verify_all_options();
1309 fossil_version_blob(&versionInfo, verboseFlag);
1310 fossil_print("%s", blob_str(&versionInfo));
@@ -1320,15 +1329,16 @@
1320 **
1321 ** verbose Show details
1322 */
1323 void test_version_page(void){
1324 Blob versionInfo;
 
1325 int verboseFlag;
1326
1327 login_check_credentials();
1328 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1329 verboseFlag = PD("verbose", 0) != 0;
1330 style_header("Version Information");
1331 style_submenu_element("Stat", "stat");
1332 fossil_version_blob(&versionInfo, verboseFlag);
1333 @ <pre>
1334 @ %h(blob_str(&versionInfo))
1335
--- src/main.c
+++ src/main.c
@@ -1176,38 +1176,51 @@
1176 ** the "version" command and "test-version" web page. It assumes the blob
1177 ** passed to it is uninitialized; otherwise, it will leak memory.
1178 */
1179 void fossil_version_blob(
1180 Blob *pOut, /* Write the manifest here */
1181 int eVerbose /* 0: brief. 1: more text, 2: lots of text */
1182 ){
1183 #if defined(FOSSIL_ENABLE_TCL)
1184 int rc;
1185 const char *zRc;
1186 #endif
1187 Stmt q;
1188 size_t pageSize = 0;
1189 blob_zero(pOut);
1190 blob_appendf(pOut, "This is fossil version %s\n", get_version());
1191 if( eVerbose<=0 ) return;
1192
1193 blob_appendf(pOut, "Compiled on %s %s using %s (%d-bit)\n",
1194 __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8);
1195 blob_appendf(pOut, "SQLite %s %.30s\n", sqlite3_libversion(),
1196 sqlite3_sourceid());
1197 #if defined(FOSSIL_ENABLE_SSL)
1198 blob_appendf(pOut, "SSL (%s)\n", SSLeay_version(SSLEAY_VERSION));
1199 #endif
1200 blob_appendf(pOut, "zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
1201 #if defined(FOSSIL_HAVE_FUSEFS)
1202 blob_appendf(pOut, "libfuse %s, loaded %s\n", fusefs_inc_version(),
1203 fusefs_lib_version());
1204 #endif
1205 #if defined(FOSSIL_ENABLE_TCL)
1206 Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_FORCE_TCL);
1207 rc = Th_Eval(g.interp, 0, "tclInvoke info patchlevel", -1);
1208 zRc = Th_ReturnCodeName(rc, 0);
1209 blob_appendf(pOut, "TCL (Tcl %s, loaded %s: %s)\n",
1210 TCL_PATCH_LEVEL, zRc, Th_GetResult(g.interp, 0)
1211 );
1212 #endif
1213 if( eVerbose<=1 ) return;
1214
1215 blob_appendf(pOut, "Schema version %s\n", AUX_SCHEMA_MAX);
1216 fossil_get_page_size(&pageSize);
1217 blob_appendf(pOut, "Detected memory page size is %lu bytes\n",
1218 (unsigned long)pageSize);
 
1219 #if FOSSIL_HARDENED_SHA1
1220 blob_appendf(pOut, "hardened-SHA1 by Marc Stevens and Dan Shumow\n");
1221 #endif
 
 
 
 
 
 
 
1222 #if defined(FOSSIL_DEBUG)
1223 blob_append(pOut, "FOSSIL_DEBUG\n", -1);
1224 #endif
1225 #if defined(FOSSIL_ENABLE_DELTA_CKSUM_TEST)
1226 blob_append(pOut, "FOSSIL_ENABLE_DELTA_CKSUM_TEST\n", -1);
@@ -1219,18 +1232,10 @@
1232 #if defined(FOSSIL_ENABLE_TH1_DOCS)
1233 blob_append(pOut, "FOSSIL_ENABLE_TH1_DOCS\n", -1);
1234 #endif
1235 #if defined(FOSSIL_ENABLE_TH1_HOOKS)
1236 blob_append(pOut, "FOSSIL_ENABLE_TH1_HOOKS\n", -1);
 
 
 
 
 
 
 
 
1237 #endif
1238 #if defined(USE_TCL_STUBS)
1239 blob_append(pOut, "USE_TCL_STUBS\n", -1);
1240 #endif
1241 #if defined(FOSSIL_ENABLE_TCL_STUBS)
@@ -1263,12 +1268,11 @@
1268 blob_append(pOut, "USE_SEE\n", -1);
1269 #endif
1270 #if defined(FOSSIL_ALLOW_OUT_OF_ORDER_DATES)
1271 blob_append(pOut, "FOSSIL_ALLOW_OUT_OF_ORDER_DATES\n");
1272 #endif
1273
 
1274 if( g.db==0 ) sqlite3_open(":memory:", &g.db);
1275 db_prepare(&q,
1276 "pragma compile_options");
1277 while( db_step(&q)==SQLITE_ROW ){
1278 const char *text = db_column_text(&q, 0);
@@ -1296,15 +1300,20 @@
1300 ** Usage: %fossil version ?-v|--verbose?
1301 **
1302 ** Print the source code version number for the fossil executable.
1303 ** If the verbose option is specified, additional details will
1304 ** be output about what optional features this binary was compiled
1305 ** with.
1306 **
1307 ** Repeat the -v option or use -vv for even more information.
1308 */
1309 void version_cmd(void){
1310 Blob versionInfo;
1311 int verboseFlag = 0;
1312
1313 while( find_option("verbose","v",0)!=0 ) verboseFlag++;
1314 while( find_option("vv",0,0)!=0 ) verboseFlag += 2;
1315
1316 /* We should be done with options.. */
1317 verify_all_options();
1318 fossil_version_blob(&versionInfo, verboseFlag);
1319 fossil_print("%s", blob_str(&versionInfo));
@@ -1320,15 +1329,16 @@
1329 **
1330 ** verbose Show details
1331 */
1332 void test_version_page(void){
1333 Blob versionInfo;
1334 char *zVerbose;
1335 int verboseFlag;
1336
1337 login_check_credentials();
1338 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1339 verboseFlag = P("verbose")!=0 ? 2 : 1;
1340 style_header("Version Information");
1341 style_submenu_element("Stat", "stat");
1342 fossil_version_blob(&versionInfo, verboseFlag);
1343 @ <pre>
1344 @ %h(blob_str(&versionInfo))
1345

Keyboard Shortcuts

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