Diff
Not logged in

Differences From:

File src/db.c part of check-in [bf75ea9852] - The "configuration" command will now sync ticket report formats, shunned UUIDs, and user information (but not user passwords). Added the "config merge" method. Fix an initialization bug that was given Admin privilege to anonymous by default. by drh on 2008-10-04 20:40:27. [view]

To:

File src/db.c part of check-in [9346f2290c] - Added the "all" command for things like "fossil all sync". I am not sure "all" is quite the right name for this command, so I may yet change it. by drh on 2008-10-17 00:20:21. [view]

@@ -556,8 +556,9 @@
 */
 void db_open_config(void){
   char *zDbName;
   const char *zHome;
+  if( g.configOpen ) return;
 #ifdef __MINGW32__
   zHome = getenv("LOCALAPPDATA");
   if( zHome==0 ){
     zHome = getenv("APPDATA");
@@ -576,9 +577,8 @@
   zDbName = mprintf("%//_fossil", zHome);
 #else
   zDbName = mprintf("%s/.fossil", zHome);
 #endif
-  if( g.configOpen ) return;
   if( file_size(zDbName)<1024*3 ){
     db_init_database(zDbName, zConfigSchema, (char*)0);
   }
   db_open_or_attach(zDbName, "configdb");
@@ -1121,8 +1121,29 @@
   db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
 }
 
 /*
+** Record the name of a local repository in the global_config() database.
+** The repostiroy filename %s is recorded as an entry with a "name" field
+** of the following form:
+**
+**       repo:%s
+**
+** The value field is set to 1.
+*/
+void db_record_repository_filename(const char *zName){
+  if( zName==0 ){
+    if( !g.localOpen ) return;
+    zName = db_lget("repository", 0);
+  }
+  db_multi_exec(
+     "INSERT OR IGNORE INTO global_config(name,value)"
+     "VALUES('repo:%q',1)",
+     zName
+  );
+}
+
+/*
 ** COMMAND: open
 **
 ** Usage: open FILENAME
 **
@@ -1145,8 +1166,9 @@
   db_open_repository(blob_str(&path));
   db_init_database("./_FOSSIL_", zLocalSchema, (char*)0);
   db_open_local();
   db_lset("repository", blob_str(&path));
+  db_record_repository_filename(blob_str(&path));
   vid = db_int(0, "SELECT pid FROM plink y"
                   " WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
   if( vid==0 ){
     db_lset_int("checkout", 1);