Fossil SCM
On the "fossil info" command with no arguments and outside of an open checkout, or with the -v option, show the location of the fossil executable and the version number.
Commit
1da8afdf876efbbd07a9334e8f260b6fc6862dd138e6b9fa271e4c2e88ecf5cd
Parent
6e71a28847cc3d7…
2 files changed
+17
-1
+3
-3
+17
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -229,11 +229,13 @@ | ||
| 229 | 229 | } |
| 230 | 230 | if( g.localOpen ){ |
| 231 | 231 | fossil_print("repository: %s\n", db_repository_filename()); |
| 232 | 232 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 233 | 233 | } |
| 234 | - if( verboseFlag && g.repositoryOpen ) extraRepoInfo(); | |
| 234 | + if( verboseFlag && g.repositoryOpen ){ | |
| 235 | + extraRepoInfo(); | |
| 236 | + } | |
| 235 | 237 | if( g.zConfigDbName ){ |
| 236 | 238 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 237 | 239 | } |
| 238 | 240 | if( g.repositoryOpen ){ |
| 239 | 241 | fossil_print("project-code: %s\n", db_get("project-code", "")); |
| @@ -242,10 +244,24 @@ | ||
| 242 | 244 | if( vid ){ |
| 243 | 245 | show_common_info(vid, "checkout:", 1, 1); |
| 244 | 246 | } |
| 245 | 247 | fossil_print("check-ins: %d\n", |
| 246 | 248 | db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/")); |
| 249 | + } | |
| 250 | + if( verboseFlag || !g.repositoryOpen ){ | |
| 251 | + Blob vx; | |
| 252 | + char *z; | |
| 253 | + fossil_version_blob(&vx, 0); | |
| 254 | + z = strstr(blob_str(&vx), "version"); | |
| 255 | + if( z ){ | |
| 256 | + z += 8; | |
| 257 | + }else{ | |
| 258 | + z = blob_str(&vx); | |
| 259 | + } | |
| 260 | + fossil_print("fossil: %s\n", g.nameOfExe); | |
| 261 | + fossil_print("version: %s", z); | |
| 262 | + blob_reset(&vx); | |
| 247 | 263 | } |
| 248 | 264 | }else{ |
| 249 | 265 | int rid; |
| 250 | 266 | rid = name_to_rid(g.argv[2]); |
| 251 | 267 | if( rid==0 ){ |
| 252 | 268 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -229,11 +229,13 @@ | |
| 229 | } |
| 230 | if( g.localOpen ){ |
| 231 | fossil_print("repository: %s\n", db_repository_filename()); |
| 232 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 233 | } |
| 234 | if( verboseFlag && g.repositoryOpen ) extraRepoInfo(); |
| 235 | if( g.zConfigDbName ){ |
| 236 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 237 | } |
| 238 | if( g.repositoryOpen ){ |
| 239 | fossil_print("project-code: %s\n", db_get("project-code", "")); |
| @@ -242,10 +244,24 @@ | |
| 242 | if( vid ){ |
| 243 | show_common_info(vid, "checkout:", 1, 1); |
| 244 | } |
| 245 | fossil_print("check-ins: %d\n", |
| 246 | db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/")); |
| 247 | } |
| 248 | }else{ |
| 249 | int rid; |
| 250 | rid = name_to_rid(g.argv[2]); |
| 251 | if( rid==0 ){ |
| 252 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -229,11 +229,13 @@ | |
| 229 | } |
| 230 | if( g.localOpen ){ |
| 231 | fossil_print("repository: %s\n", db_repository_filename()); |
| 232 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 233 | } |
| 234 | if( verboseFlag && g.repositoryOpen ){ |
| 235 | extraRepoInfo(); |
| 236 | } |
| 237 | if( g.zConfigDbName ){ |
| 238 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 239 | } |
| 240 | if( g.repositoryOpen ){ |
| 241 | fossil_print("project-code: %s\n", db_get("project-code", "")); |
| @@ -242,10 +244,24 @@ | |
| 244 | if( vid ){ |
| 245 | show_common_info(vid, "checkout:", 1, 1); |
| 246 | } |
| 247 | fossil_print("check-ins: %d\n", |
| 248 | db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/")); |
| 249 | } |
| 250 | if( verboseFlag || !g.repositoryOpen ){ |
| 251 | Blob vx; |
| 252 | char *z; |
| 253 | fossil_version_blob(&vx, 0); |
| 254 | z = strstr(blob_str(&vx), "version"); |
| 255 | if( z ){ |
| 256 | z += 8; |
| 257 | }else{ |
| 258 | z = blob_str(&vx); |
| 259 | } |
| 260 | fossil_print("fossil: %s\n", g.nameOfExe); |
| 261 | fossil_print("version: %s", z); |
| 262 | blob_reset(&vx); |
| 263 | } |
| 264 | }else{ |
| 265 | int rid; |
| 266 | rid = name_to_rid(g.argv[2]); |
| 267 | if( rid==0 ){ |
| 268 |
+3
-3
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1116,11 +1116,11 @@ | ||
| 1116 | 1116 | /* |
| 1117 | 1117 | ** This function populates a blob with version information. It is used by |
| 1118 | 1118 | ** the "version" command and "test-version" web page. It assumes the blob |
| 1119 | 1119 | ** passed to it is uninitialized; otherwise, it will leak memory. |
| 1120 | 1120 | */ |
| 1121 | -static void get_version_blob( | |
| 1121 | +void fossil_version_blob( | |
| 1122 | 1122 | Blob *pOut, /* Write the manifest here */ |
| 1123 | 1123 | int bVerbose /* Non-zero for full information. */ |
| 1124 | 1124 | ){ |
| 1125 | 1125 | #if defined(FOSSIL_ENABLE_TCL) |
| 1126 | 1126 | int rc; |
| @@ -1251,11 +1251,11 @@ | ||
| 1251 | 1251 | Blob versionInfo; |
| 1252 | 1252 | int verboseFlag = find_option("verbose","v",0)!=0; |
| 1253 | 1253 | |
| 1254 | 1254 | /* We should be done with options.. */ |
| 1255 | 1255 | verify_all_options(); |
| 1256 | - get_version_blob(&versionInfo, verboseFlag); | |
| 1256 | + fossil_version_blob(&versionInfo, verboseFlag); | |
| 1257 | 1257 | fossil_print("%s", blob_str(&versionInfo)); |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | 1260 | |
| 1261 | 1261 | /* |
| @@ -1274,11 +1274,11 @@ | ||
| 1274 | 1274 | login_check_credentials(); |
| 1275 | 1275 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1276 | 1276 | verboseFlag = PD("verbose", 0) != 0; |
| 1277 | 1277 | style_header("Version Information"); |
| 1278 | 1278 | style_submenu_element("Stat", "stat"); |
| 1279 | - get_version_blob(&versionInfo, verboseFlag); | |
| 1279 | + fossil_version_blob(&versionInfo, verboseFlag); | |
| 1280 | 1280 | @ <pre> |
| 1281 | 1281 | @ %h(blob_str(&versionInfo)) |
| 1282 | 1282 | @ </pre> |
| 1283 | 1283 | style_footer(); |
| 1284 | 1284 | } |
| 1285 | 1285 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1116,11 +1116,11 @@ | |
| 1116 | /* |
| 1117 | ** This function populates a blob with version information. It is used by |
| 1118 | ** the "version" command and "test-version" web page. It assumes the blob |
| 1119 | ** passed to it is uninitialized; otherwise, it will leak memory. |
| 1120 | */ |
| 1121 | static void get_version_blob( |
| 1122 | Blob *pOut, /* Write the manifest here */ |
| 1123 | int bVerbose /* Non-zero for full information. */ |
| 1124 | ){ |
| 1125 | #if defined(FOSSIL_ENABLE_TCL) |
| 1126 | int rc; |
| @@ -1251,11 +1251,11 @@ | |
| 1251 | Blob versionInfo; |
| 1252 | int verboseFlag = find_option("verbose","v",0)!=0; |
| 1253 | |
| 1254 | /* We should be done with options.. */ |
| 1255 | verify_all_options(); |
| 1256 | get_version_blob(&versionInfo, verboseFlag); |
| 1257 | fossil_print("%s", blob_str(&versionInfo)); |
| 1258 | } |
| 1259 | |
| 1260 | |
| 1261 | /* |
| @@ -1274,11 +1274,11 @@ | |
| 1274 | login_check_credentials(); |
| 1275 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1276 | verboseFlag = PD("verbose", 0) != 0; |
| 1277 | style_header("Version Information"); |
| 1278 | style_submenu_element("Stat", "stat"); |
| 1279 | get_version_blob(&versionInfo, verboseFlag); |
| 1280 | @ <pre> |
| 1281 | @ %h(blob_str(&versionInfo)) |
| 1282 | @ </pre> |
| 1283 | style_footer(); |
| 1284 | } |
| 1285 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1116,11 +1116,11 @@ | |
| 1116 | /* |
| 1117 | ** This function populates a blob with version information. It is used by |
| 1118 | ** the "version" command and "test-version" web page. It assumes the blob |
| 1119 | ** passed to it is uninitialized; otherwise, it will leak memory. |
| 1120 | */ |
| 1121 | void fossil_version_blob( |
| 1122 | Blob *pOut, /* Write the manifest here */ |
| 1123 | int bVerbose /* Non-zero for full information. */ |
| 1124 | ){ |
| 1125 | #if defined(FOSSIL_ENABLE_TCL) |
| 1126 | int rc; |
| @@ -1251,11 +1251,11 @@ | |
| 1251 | Blob versionInfo; |
| 1252 | int verboseFlag = find_option("verbose","v",0)!=0; |
| 1253 | |
| 1254 | /* We should be done with options.. */ |
| 1255 | verify_all_options(); |
| 1256 | fossil_version_blob(&versionInfo, verboseFlag); |
| 1257 | fossil_print("%s", blob_str(&versionInfo)); |
| 1258 | } |
| 1259 | |
| 1260 | |
| 1261 | /* |
| @@ -1274,11 +1274,11 @@ | |
| 1274 | login_check_credentials(); |
| 1275 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1276 | verboseFlag = PD("verbose", 0) != 0; |
| 1277 | style_header("Version Information"); |
| 1278 | style_submenu_element("Stat", "stat"); |
| 1279 | fossil_version_blob(&versionInfo, verboseFlag); |
| 1280 | @ <pre> |
| 1281 | @ %h(blob_str(&versionInfo)) |
| 1282 | @ </pre> |
| 1283 | style_footer(); |
| 1284 | } |
| 1285 |