Fossil SCM
Update the "info" command so that it can take the name of a repository as its argument and then report information about that repository.
Commit
974f025c6e83ab55215a676afd1df83f402e6cc7
Parent
2bd0690fe8d58ec…
2 files changed
+1
+15
-3
+1
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -49,10 +49,11 @@ | ||
| 49 | 49 | url_parse(g.argv[2]); |
| 50 | 50 | if( g.urlIsFile ){ |
| 51 | 51 | file_copy(g.urlName, g.argv[3]); |
| 52 | 52 | db_close(); |
| 53 | 53 | db_open_repository(g.argv[3]); |
| 54 | + db_open_config(); | |
| 54 | 55 | db_record_repository_filename(g.argv[3]); |
| 55 | 56 | db_multi_exec( |
| 56 | 57 | "REPLACE INTO config(name,value)" |
| 57 | 58 | " VALUES('server-code', lower(hex(randomblob(20))));" |
| 58 | 59 | ); |
| 59 | 60 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -49,10 +49,11 @@ | |
| 49 | url_parse(g.argv[2]); |
| 50 | if( g.urlIsFile ){ |
| 51 | file_copy(g.urlName, g.argv[3]); |
| 52 | db_close(); |
| 53 | db_open_repository(g.argv[3]); |
| 54 | db_record_repository_filename(g.argv[3]); |
| 55 | db_multi_exec( |
| 56 | "REPLACE INTO config(name,value)" |
| 57 | " VALUES('server-code', lower(hex(randomblob(20))));" |
| 58 | ); |
| 59 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -49,10 +49,11 @@ | |
| 49 | url_parse(g.argv[2]); |
| 50 | if( g.urlIsFile ){ |
| 51 | file_copy(g.urlName, g.argv[3]); |
| 52 | db_close(); |
| 53 | db_open_repository(g.argv[3]); |
| 54 | db_open_config(); |
| 55 | db_record_repository_filename(g.argv[3]); |
| 56 | db_multi_exec( |
| 57 | "REPLACE INTO config(name,value)" |
| 58 | " VALUES('server-code', lower(hex(randomblob(20))));" |
| 59 | ); |
| 60 |
+15
-3
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -72,19 +72,31 @@ | ||
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | /* |
| 75 | 75 | ** COMMAND: info |
| 76 | 76 | ** |
| 77 | -** Usage: %fossil info ?UUID? | |
| 77 | +** Usage: %fossil info ?UUID|FILENAME? | |
| 78 | 78 | ** |
| 79 | 79 | ** With no arguments, provide information about the current tree. |
| 80 | 80 | ** If an argument is given, provide information about the record |
| 81 | -** that the argument refers to. | |
| 81 | +** in the respository of the current tree that the argument refers | |
| 82 | +** to. Or if the argument is the name of a repository, show | |
| 83 | +** information about that repository. | |
| 82 | 84 | */ |
| 83 | 85 | void info_cmd(void){ |
| 86 | + i64 fsize; | |
| 84 | 87 | if( g.argc!=2 && g.argc!=3 ){ |
| 85 | - usage("?FILEID|UUID?"); | |
| 88 | + usage("?FILENAME|UUID?"); | |
| 89 | + } | |
| 90 | + if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){ | |
| 91 | + db_open_config(); | |
| 92 | + db_record_repository_filename(g.argv[2]); | |
| 93 | + db_open_repository(g.argv[2]); | |
| 94 | + printf("project-code: %s\n", db_get("project-code", "<none>")); | |
| 95 | + printf("project-name: %s\n", db_get("project-name", "<unnamed>")); | |
| 96 | + printf("server-code: %s\n", db_get("server-code", "<none>")); | |
| 97 | + return; | |
| 86 | 98 | } |
| 87 | 99 | db_must_be_within_tree(); |
| 88 | 100 | if( g.argc==2 ){ |
| 89 | 101 | int vid; |
| 90 | 102 | /* 012345678901234 */ |
| 91 | 103 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -72,19 +72,31 @@ | |
| 72 | |
| 73 | |
| 74 | /* |
| 75 | ** COMMAND: info |
| 76 | ** |
| 77 | ** Usage: %fossil info ?UUID? |
| 78 | ** |
| 79 | ** With no arguments, provide information about the current tree. |
| 80 | ** If an argument is given, provide information about the record |
| 81 | ** that the argument refers to. |
| 82 | */ |
| 83 | void info_cmd(void){ |
| 84 | if( g.argc!=2 && g.argc!=3 ){ |
| 85 | usage("?FILEID|UUID?"); |
| 86 | } |
| 87 | db_must_be_within_tree(); |
| 88 | if( g.argc==2 ){ |
| 89 | int vid; |
| 90 | /* 012345678901234 */ |
| 91 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -72,19 +72,31 @@ | |
| 72 | |
| 73 | |
| 74 | /* |
| 75 | ** COMMAND: info |
| 76 | ** |
| 77 | ** Usage: %fossil info ?UUID|FILENAME? |
| 78 | ** |
| 79 | ** With no arguments, provide information about the current tree. |
| 80 | ** If an argument is given, provide information about the record |
| 81 | ** in the respository of the current tree that the argument refers |
| 82 | ** to. Or if the argument is the name of a repository, show |
| 83 | ** information about that repository. |
| 84 | */ |
| 85 | void info_cmd(void){ |
| 86 | i64 fsize; |
| 87 | if( g.argc!=2 && g.argc!=3 ){ |
| 88 | usage("?FILENAME|UUID?"); |
| 89 | } |
| 90 | if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){ |
| 91 | db_open_config(); |
| 92 | db_record_repository_filename(g.argv[2]); |
| 93 | db_open_repository(g.argv[2]); |
| 94 | printf("project-code: %s\n", db_get("project-code", "<none>")); |
| 95 | printf("project-name: %s\n", db_get("project-name", "<unnamed>")); |
| 96 | printf("server-code: %s\n", db_get("server-code", "<none>")); |
| 97 | return; |
| 98 | } |
| 99 | db_must_be_within_tree(); |
| 100 | if( g.argc==2 ){ |
| 101 | int vid; |
| 102 | /* 012345678901234 */ |
| 103 |