Diff
Not logged in

Differences From:

File src/clone.c part of check-in [c9fdb846fb] - Add the "help" command and the "clean" command. More work is needed on the text for various help messages. by drh on 2007-08-18 02:45:47. [view]

To:

File src/clone.c part of check-in [134e2aeccc] - Combine the "config" and "setting" commands into a single "settings" command. by drh on 2007-09-28 20:08:32. Also file src/clone.c part of check-in [d0305b305a] - Merged mainline into my branch to get the newest application. by aku on 2007-12-05 08:07:46. [view]

@@ -40,27 +40,30 @@
 void clone_cmd(void){
   if( g.argc!=4 ){
     usage("FILE-OR-URL NEW-REPOSITORY");
   }
+  db_open_config();
   if( file_size(g.argv[3])>0 ){
     fossil_panic("file already exists: %s", g.argv[3]);
   }
   url_parse(g.argv[2]);
   db_create_repository(g.argv[3]);
   db_open_repository(g.argv[3]);
+  db_begin_transaction();
+  db_initial_setup(0, 0);
   user_select();
-  db_set("content-schema", CONTENT_SCHEMA);
-  db_set("aux-schema", AUX_SCHEMA);
+  db_set("content-schema", CONTENT_SCHEMA, 0);
+  db_set("aux-schema", AUX_SCHEMA, 0);
   if( !g.urlIsFile ){
-    db_set("last-sync-url", g.argv[2]);
+    db_set("last-sync-url", g.argv[2], 0);
   }
   db_multi_exec(
-    "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
+    "INSERT INTO config(name,value)"
+    " VALUES('server-code', lower(hex(randomblob(20))));"
   );
   if( g.urlIsFile ){
     Stmt q;
     db_multi_exec("ATTACH DATABASE %Q AS orig", g.urlName);
-    db_begin_transaction();
     db_prepare(&q,
       "SELECT name FROM orig.sqlite_master"
       " WHERE type='table'"
     );
@@ -69,9 +72,9 @@
       db_multi_exec("INSERT OR IGNORE INTO %Q SELECT * FROM orig.%Q",
                     zTab, zTab);
     }
     db_finalize(&q);
-    db_end_transaction(0);
   }else{
     client_sync(0,0,1);
   }
+  db_end_transaction(0);
 }