Fossil SCM
Revise the "fossil version -v" command to give less detail. Use -vv or -v -v to get the original full detail.
Commit
bbbd7ef8f5da79aa9c9712956c57d225c4e2504a5ec405defc733fd14cdeec00
Parent
a3bdee629d124fa…
1 file changed
+33
-23
+33
-23
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1176,38 +1176,51 @@ | ||
| 1176 | 1176 | ** the "version" command and "test-version" web page. It assumes the blob |
| 1177 | 1177 | ** passed to it is uninitialized; otherwise, it will leak memory. |
| 1178 | 1178 | */ |
| 1179 | 1179 | void fossil_version_blob( |
| 1180 | 1180 | 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 */ | |
| 1182 | 1182 | ){ |
| 1183 | 1183 | #if defined(FOSSIL_ENABLE_TCL) |
| 1184 | 1184 | int rc; |
| 1185 | 1185 | const char *zRc; |
| 1186 | 1186 | #endif |
| 1187 | 1187 | Stmt q; |
| 1188 | 1188 | size_t pageSize = 0; |
| 1189 | 1189 | blob_zero(pOut); |
| 1190 | 1190 | blob_appendf(pOut, "This is fossil version %s\n", get_version()); |
| 1191 | - if( !bVerbose ) return; | |
| 1191 | + if( eVerbose<=0 ) return; | |
| 1192 | + | |
| 1192 | 1193 | blob_appendf(pOut, "Compiled on %s %s using %s (%d-bit)\n", |
| 1193 | 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 | + | |
| 1194 | 1215 | blob_appendf(pOut, "Schema version %s\n", AUX_SCHEMA_MAX); |
| 1195 | 1216 | fossil_get_page_size(&pageSize); |
| 1196 | 1217 | blob_appendf(pOut, "Detected memory page size is %lu bytes\n", |
| 1197 | 1218 | (unsigned long)pageSize); |
| 1198 | - blob_appendf(pOut, "zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); | |
| 1199 | 1219 | #if FOSSIL_HARDENED_SHA1 |
| 1200 | 1220 | blob_appendf(pOut, "hardened-SHA1 by Marc Stevens and Dan Shumow\n"); |
| 1201 | 1221 | #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 | 1222 | #if defined(FOSSIL_DEBUG) |
| 1210 | 1223 | blob_append(pOut, "FOSSIL_DEBUG\n", -1); |
| 1211 | 1224 | #endif |
| 1212 | 1225 | #if defined(FOSSIL_ENABLE_DELTA_CKSUM_TEST) |
| 1213 | 1226 | blob_append(pOut, "FOSSIL_ENABLE_DELTA_CKSUM_TEST\n", -1); |
| @@ -1219,18 +1232,10 @@ | ||
| 1219 | 1232 | #if defined(FOSSIL_ENABLE_TH1_DOCS) |
| 1220 | 1233 | blob_append(pOut, "FOSSIL_ENABLE_TH1_DOCS\n", -1); |
| 1221 | 1234 | #endif |
| 1222 | 1235 | #if defined(FOSSIL_ENABLE_TH1_HOOKS) |
| 1223 | 1236 | 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 | 1237 | #endif |
| 1233 | 1238 | #if defined(USE_TCL_STUBS) |
| 1234 | 1239 | blob_append(pOut, "USE_TCL_STUBS\n", -1); |
| 1235 | 1240 | #endif |
| 1236 | 1241 | #if defined(FOSSIL_ENABLE_TCL_STUBS) |
| @@ -1263,12 +1268,11 @@ | ||
| 1263 | 1268 | blob_append(pOut, "USE_SEE\n", -1); |
| 1264 | 1269 | #endif |
| 1265 | 1270 | #if defined(FOSSIL_ALLOW_OUT_OF_ORDER_DATES) |
| 1266 | 1271 | blob_append(pOut, "FOSSIL_ALLOW_OUT_OF_ORDER_DATES\n"); |
| 1267 | 1272 | #endif |
| 1268 | - blob_appendf(pOut, "SQLite %s %.30s\n", sqlite3_libversion(), | |
| 1269 | - sqlite3_sourceid()); | |
| 1273 | + | |
| 1270 | 1274 | if( g.db==0 ) sqlite3_open(":memory:", &g.db); |
| 1271 | 1275 | db_prepare(&q, |
| 1272 | 1276 | "pragma compile_options"); |
| 1273 | 1277 | while( db_step(&q)==SQLITE_ROW ){ |
| 1274 | 1278 | const char *text = db_column_text(&q, 0); |
| @@ -1296,15 +1300,20 @@ | ||
| 1296 | 1300 | ** Usage: %fossil version ?-v|--verbose? |
| 1297 | 1301 | ** |
| 1298 | 1302 | ** Print the source code version number for the fossil executable. |
| 1299 | 1303 | ** If the verbose option is specified, additional details will |
| 1300 | 1304 | ** 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. | |
| 1302 | 1308 | */ |
| 1303 | 1309 | void version_cmd(void){ |
| 1304 | 1310 | 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; | |
| 1306 | 1315 | |
| 1307 | 1316 | /* We should be done with options.. */ |
| 1308 | 1317 | verify_all_options(); |
| 1309 | 1318 | fossil_version_blob(&versionInfo, verboseFlag); |
| 1310 | 1319 | fossil_print("%s", blob_str(&versionInfo)); |
| @@ -1320,15 +1329,16 @@ | ||
| 1320 | 1329 | ** |
| 1321 | 1330 | ** verbose Show details |
| 1322 | 1331 | */ |
| 1323 | 1332 | void test_version_page(void){ |
| 1324 | 1333 | Blob versionInfo; |
| 1334 | + char *zVerbose; | |
| 1325 | 1335 | int verboseFlag; |
| 1326 | 1336 | |
| 1327 | 1337 | login_check_credentials(); |
| 1328 | 1338 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1329 | - verboseFlag = PD("verbose", 0) != 0; | |
| 1339 | + verboseFlag = P("verbose")!=0 ? 2 : 1; | |
| 1330 | 1340 | style_header("Version Information"); |
| 1331 | 1341 | style_submenu_element("Stat", "stat"); |
| 1332 | 1342 | fossil_version_blob(&versionInfo, verboseFlag); |
| 1333 | 1343 | @ <pre> |
| 1334 | 1344 | @ %h(blob_str(&versionInfo)) |
| 1335 | 1345 |
| --- 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 |