Check-in [974f025c6e]
Not logged in
Overview

SHA1 Hash:974f025c6e83ab55215a676afd1df83f402e6cc7
Date: 2008-10-17 13:30:46
User: drh
Comment:Update the "info" command so that it can take the name of a repository as its argument and then report information about that repository.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/clone.c from [2daa17c5f0] to [ac6a2f8b2b].

@@ -49,10 +49,11 @@
   url_parse(g.argv[2]);
   if( g.urlIsFile ){
     file_copy(g.urlName, g.argv[3]);
     db_close();
     db_open_repository(g.argv[3]);
+    db_open_config();
     db_record_repository_filename(g.argv[3]);
     db_multi_exec(
       "REPLACE INTO config(name,value)"
       " VALUES('server-code', lower(hex(randomblob(20))));"
     );

Modified src/info.c from [93f0a4da21] to [26d96b828e].

@@ -72,19 +72,31 @@
 
 
 /*
 ** COMMAND: info
 **
-** Usage: %fossil info ?UUID?
+** Usage: %fossil info ?UUID|FILENAME?
 **
 ** With no arguments, provide information about the current tree.
 ** If an argument is given, provide information about the record
-** that the argument refers to.
+** in the respository of the current tree that the argument refers
+** to.  Or if the argument is the name of a repository, show
+** information about that repository.
 */
 void info_cmd(void){
+  i64 fsize;
   if( g.argc!=2 && g.argc!=3 ){
-    usage("?FILEID|UUID?");
+    usage("?FILENAME|UUID?");
+  }
+  if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
+    db_open_config();
+    db_record_repository_filename(g.argv[2]);
+    db_open_repository(g.argv[2]);
+    printf("project-code: %s\n", db_get("project-code", "<none>"));
+    printf("project-name: %s\n", db_get("project-name", "<unnamed>"));
+    printf("server-code:  %s\n", db_get("server-code", "<none>"));
+    return;
   }
   db_must_be_within_tree();
   if( g.argc==2 ){
     int vid;
          /* 012345678901234 */