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.

drh 2008-10-17 13:30 trunk
Commit 974f025c6e83ab55215a676afd1df83f402e6cc7
2 files changed +1 +15 -3
--- src/clone.c
+++ src/clone.c
@@ -49,10 +49,11 @@
4949
url_parse(g.argv[2]);
5050
if( g.urlIsFile ){
5151
file_copy(g.urlName, g.argv[3]);
5252
db_close();
5353
db_open_repository(g.argv[3]);
54
+ db_open_config();
5455
db_record_repository_filename(g.argv[3]);
5556
db_multi_exec(
5657
"REPLACE INTO config(name,value)"
5758
" VALUES('server-code', lower(hex(randomblob(20))));"
5859
);
5960
--- 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 @@
7272
7373
7474
/*
7575
** COMMAND: info
7676
**
77
-** Usage: %fossil info ?UUID?
77
+** Usage: %fossil info ?UUID|FILENAME?
7878
**
7979
** With no arguments, provide information about the current tree.
8080
** 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.
8284
*/
8385
void info_cmd(void){
86
+ i64 fsize;
8487
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;
8698
}
8799
db_must_be_within_tree();
88100
if( g.argc==2 ){
89101
int vid;
90102
/* 012345678901234 */
91103
--- 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

Keyboard Shortcuts

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