Fossil SCM
Enhance the "fossil info" command so that if it is run with no arguments and not in an option check-out, it shows global information about the fossil setup (currently limited to the location of the configuration database).
Commit
6e71a28847cc3d79e5ee52d9bfb099da9f18de5996689bea8d1e1d8ed30eb72b
Parent
4645e9bb1aaaf0c…
1 file changed
+17
-12
+17
-12
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -215,33 +215,38 @@ | ||
| 215 | 215 | fossil_print("project-code: %s\n", db_get("project-code", "<none>")); |
| 216 | 216 | showParentProject(); |
| 217 | 217 | extraRepoInfo(); |
| 218 | 218 | return; |
| 219 | 219 | } |
| 220 | - db_find_and_open_repository(0,0); | |
| 220 | + db_find_and_open_repository(OPEN_OK_NOT_FOUND,0); | |
| 221 | 221 | verify_all_options(); |
| 222 | 222 | if( g.argc==2 ){ |
| 223 | 223 | int vid; |
| 224 | - /* 012345678901234 */ | |
| 225 | - db_record_repository_filename(0); | |
| 226 | - fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); | |
| 224 | + if( g.repositoryOpen ){ | |
| 225 | + db_record_repository_filename(0); | |
| 226 | + fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); | |
| 227 | + }else{ | |
| 228 | + db_open_config(0,1); | |
| 229 | + } | |
| 227 | 230 | if( g.localOpen ){ |
| 228 | 231 | fossil_print("repository: %s\n", db_repository_filename()); |
| 229 | 232 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 230 | 233 | } |
| 231 | - if( verboseFlag ) extraRepoInfo(); | |
| 234 | + if( verboseFlag && g.repositoryOpen ) extraRepoInfo(); | |
| 232 | 235 | if( g.zConfigDbName ){ |
| 233 | 236 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 234 | 237 | } |
| 235 | - fossil_print("project-code: %s\n", db_get("project-code", "")); | |
| 236 | - showParentProject(); | |
| 237 | - vid = g.localOpen ? db_lget_int("checkout", 0) : 0; | |
| 238 | - if( vid ){ | |
| 239 | - show_common_info(vid, "checkout:", 1, 1); | |
| 240 | - } | |
| 241 | - fossil_print("check-ins: %d\n", | |
| 238 | + if( g.repositoryOpen ){ | |
| 239 | + fossil_print("project-code: %s\n", db_get("project-code", "")); | |
| 240 | + showParentProject(); | |
| 241 | + vid = g.localOpen ? db_lget_int("checkout", 0) : 0; | |
| 242 | + if( vid ){ | |
| 243 | + show_common_info(vid, "checkout:", 1, 1); | |
| 244 | + } | |
| 245 | + fossil_print("check-ins: %d\n", | |
| 242 | 246 | db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/")); |
| 247 | + } | |
| 243 | 248 | }else{ |
| 244 | 249 | int rid; |
| 245 | 250 | rid = name_to_rid(g.argv[2]); |
| 246 | 251 | if( rid==0 ){ |
| 247 | 252 | fossil_fatal("no such object: %s", g.argv[2]); |
| 248 | 253 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -215,33 +215,38 @@ | |
| 215 | fossil_print("project-code: %s\n", db_get("project-code", "<none>")); |
| 216 | showParentProject(); |
| 217 | extraRepoInfo(); |
| 218 | return; |
| 219 | } |
| 220 | db_find_and_open_repository(0,0); |
| 221 | verify_all_options(); |
| 222 | if( g.argc==2 ){ |
| 223 | int vid; |
| 224 | /* 012345678901234 */ |
| 225 | db_record_repository_filename(0); |
| 226 | fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); |
| 227 | if( g.localOpen ){ |
| 228 | fossil_print("repository: %s\n", db_repository_filename()); |
| 229 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 230 | } |
| 231 | if( verboseFlag ) extraRepoInfo(); |
| 232 | if( g.zConfigDbName ){ |
| 233 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 234 | } |
| 235 | fossil_print("project-code: %s\n", db_get("project-code", "")); |
| 236 | showParentProject(); |
| 237 | vid = g.localOpen ? db_lget_int("checkout", 0) : 0; |
| 238 | if( vid ){ |
| 239 | show_common_info(vid, "checkout:", 1, 1); |
| 240 | } |
| 241 | fossil_print("check-ins: %d\n", |
| 242 | db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/")); |
| 243 | }else{ |
| 244 | int rid; |
| 245 | rid = name_to_rid(g.argv[2]); |
| 246 | if( rid==0 ){ |
| 247 | fossil_fatal("no such object: %s", g.argv[2]); |
| 248 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -215,33 +215,38 @@ | |
| 215 | fossil_print("project-code: %s\n", db_get("project-code", "<none>")); |
| 216 | showParentProject(); |
| 217 | extraRepoInfo(); |
| 218 | return; |
| 219 | } |
| 220 | db_find_and_open_repository(OPEN_OK_NOT_FOUND,0); |
| 221 | verify_all_options(); |
| 222 | if( g.argc==2 ){ |
| 223 | int vid; |
| 224 | if( g.repositoryOpen ){ |
| 225 | db_record_repository_filename(0); |
| 226 | fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); |
| 227 | }else{ |
| 228 | db_open_config(0,1); |
| 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", "")); |
| 240 | showParentProject(); |
| 241 | vid = g.localOpen ? db_lget_int("checkout", 0) : 0; |
| 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 | fossil_fatal("no such object: %s", g.argv[2]); |
| 253 |