Overview
SHA1 Hash: | 097479f99a066273a51e6c2444b2a4b7892d5026 |
---|---|
Date: | 2007-09-26 02:00:26 |
User: | drh |
Comment: | Better defaults for new databases and clones. Use *CURRENT* to identify the current checkout for TTY timelines. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/clone.c from [9c95e6e8e6] to [c14cca48fb].
@@ -45,23 +45,25 @@ 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); if( !g.urlIsFile ){ db_set("last-sync-url", g.argv[2]); } 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'" ); while( db_step(&q)==SQLITE_ROW ){ @@ -68,10 +70,10 @@ const char *zTab = db_column_text(&q, 0); 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); }
Modified src/construct.c from [238e2858a9] to [8121471811].
@@ -140,11 +140,11 @@ db_create_repository(zRepository); db_open_repository(zRepository); db_open_config(); db_begin_transaction(); - db_initial_setup(0); + db_initial_setup(0, 1); printf("project-id: %s\n", db_get("project-code", 0)); printf("server-id: %s\n", db_get("server-code", 0)); printf("admin-user: %s (no password set yet!)\n", g.zLogin); printf("baseline: %s\n", db_text(0, "SELECT uuid FROM blob"));
Modified src/db.c from [df88f7f101] to [cfa5a42c54].
@@ -673,27 +673,32 @@ ** Fill an empty repository database with the basic information for a ** repository. This function is shared between 'create_repository_cmd' ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create ** new repositories. ** -** The caller determines wheter the function inserts an empty root -** manifest (zRoot == TRUE), or not (zRoot == FALSE). +** The makeInitialVersion flag determines whether or not an initial +** manifest is created. The makeServerCodes flag determines whether or +** not server and project codes are invented for this repository. */ - -void db_initial_setup (int zRoot){ +void db_initial_setup (int makeInitialVersion, int makeServerCodes){ char *zDate; char *zUser; Blob hash; Blob manifest; db_set("content-schema", CONTENT_SCHEMA); db_set("aux-schema", AUX_SCHEMA); - db_set_int("authenticate-localhost", 0); - db_multi_exec( - "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));" - "INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));" - ); + if( makeServerCodes ){ + db_multi_exec( + "INSERT INTO config(name,value)" + " VALUES('server-code', lower(hex(randomblob(20))));" + "INSERT INTO config(name,value)" + " VALUES('project-code', lower(hex(randomblob(20))));" + ); + } + db_set_int("autosync", 1); + db_set_int("localauth", 0); zUser = db_global_get("default-user", 0); if( zUser==0 ){ zUser = getenv("USER"); } if( zUser==0 ){ @@ -709,11 +714,11 @@ "INSERT INTO user(login,pw,cap,info)" " VALUES('nobody','','jor','Nobody');" ); user_select(); - if (zRoot){ + if (makeInitialVersion){ blob_zero(&manifest); blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n"); zDate = db_text(0, "SELECT datetime('now')"); zDate[10]='T'; blob_appendf(&manifest, "D %s\n", zDate); @@ -742,11 +747,11 @@ } db_create_repository(g.argv[2]); db_open_repository(g.argv[2]); db_open_config(); db_begin_transaction(); - db_initial_setup (1); + db_initial_setup(1, 1); db_end_transaction(0); printf("project-id: %s\n", db_get("project-code", 0)); printf("server-id: %s\n", db_get("server-code", 0)); printf("admin-user: %s (no password set yet!)\n", g.zLogin); printf("baseline: %s\n", db_text(0, "SELECT uuid FROM blob")); @@ -963,16 +968,25 @@ ** COMMAND: setting ** %fossil setting ?PROPERTY? ?VALUE? ** ** With no arguments, list all properties and their values. With just ** a property name, show the value of that property. With a value -** arugment, change the property for the current repository. +** argument, change the property for the current repository. +** +** autosync If enabled, automatically pull prior to +** commit or update and automatically push +** after commit or tag or branch creation. +** +** localauth If true, require that HTTP connections from +** 127.0.0.1 be authenticated by password. If +** false, all HTTP requests from localhost have +** unrestricted access to the repository. */ void setting_cmd(void){ static const char *azName[] = { "autosync", - "safemerge" + "localauth" }; int i; db_find_and_open_repository(); if( g.argc==2 ){ for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
Modified src/login.c from [d1ac22275c] to [afd46b3a87].
@@ -228,12 +228,11 @@ /* If the HTTP connection is coming over 127.0.0.1 and if ** local login is disabled, then there is no need to check ** user credentials. */ zRemoteAddr = PD("REMOTE_ADDR","nil"); - if( strcmp(zRemoteAddr, "127.0.0.1")==0 - && db_get_int("authenticate-localhost",1)==0 ){ + if( strcmp(zRemoteAddr, "127.0.0.1")==0 && db_get_int("localauth",0)==0 ){ uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'"); g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid); zCap = "s"; g.noPswd = 1; }
Modified src/setup.c from [10731e95e7] to [fcf807f096].
@@ -497,11 +497,11 @@ db_begin_transaction(); @ <form action="%s(g.zBaseURL)/setup_access" method="POST"> @ <hr> onoff_attribute("Require password for local access", - "authenticate-localhost", "localauth", 1); + "localauth", "localauth", 1); @ <p>When enabled, the password sign-in is required for @ web access coming from 127.0.0.1. When disabled, web access @ from 127.0.0.1 is allows without any login - the user id is selected @ from the ~/.fossil database. Password login is always required @ for incoming web connections on internet addresses other than
Modified src/sync.c from [6c1dfe7a9d] to [6476b9b83d].
@@ -37,11 +37,11 @@ const char *zUrl; if( db_get_int("autosync", 0)==0 ){ return 0; } zUrl = db_get("last-sync-url", 0); - if( zUrl ){ + if( zUrl==0 ){ return 0; /* No default server */ } url_parse(zUrl); if( g.urlIsFile ){ return 0; /* Network sync only */
Modified src/timeline.c from [9aeba121ea] to [8bccb237e4].
@@ -395,11 +395,10 @@ ** 5. Number of parents */ void print_timeline(Stmt *q, int mxLine){ int nLine = 0; char zPrevDate[20]; - char *delims; const char *zCurrentUuid=0; Stmt currentQ; int rid = db_lget_int("checkout", 0); zPrevDate[0] = 0; @@ -416,42 +415,36 @@ const char *zDate = db_column_text(q, 2); const char *zCom = db_column_text(q, 3); int nChild = db_column_int(q, 4); int nParent = db_column_int(q, 5); char *zFree = 0; - char zUuid[UUID_SIZE+1]; - - if( strcmp(zCurrentUuid, zId)==0 ){ - delims = "<>"; - }else{ - delims = "[]"; - } + int n = 0; + char zPrefix[80]; + char zUuid[UUID_SIZE+1]; sprintf(zUuid, "%.10s", zId); if( memcmp(zDate, zPrevDate, 10) ){ printf("=== %.10s ===\n", zDate); memcpy(zPrevDate, zDate, 10); nLine++; } if( zCom==0 ) zCom = ""; printf("%.8s ", &zDate[11]); - if( nChild>1 || nParent>1 ){ - int n = 0; - char zPrefix[50]; - if( nParent>1 ){ - sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); - n = strlen(zPrefix); - } - if( nChild>1 ){ - sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); - n = strlen(zPrefix); - } - zFree = sqlite3_mprintf("%c%.10s%c %s%s", delims[0], zUuid, delims[1], - zPrefix, zCom); - }else{ - zFree = sqlite3_mprintf("%c%.10s%c %s", delims[0], zUuid, delims[1], zCom); + zPrefix[0] = 0; + if( nParent>1 ){ + sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); + n = strlen(zPrefix); + } + if( nChild>1 ){ + sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); + n = strlen(zPrefix); + } + if( strcmp(zCurrentUuid,zId)==0 ){ + sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* "); + n += strlen(zPrefix); } + zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom); nLine += comment_print(zFree, 9, 79); sqlite3_free(zFree); } db_finalize(¤tQ); }
Modified src/user.c from [bd013e3f3c] to [0bda709383].
@@ -292,11 +292,12 @@ if( attempt_user(db_get("default-user", 0)) ) return; if( attempt_user(getenv("USER")) ) return; - db_prepare(&s, "SELECT uid, login FROM user WHERE login<>'anonymous'"); + db_prepare(&s, "SELECT uid, login FROM user" + " WHERE login NOT IN ('anonymous','nobody')"); if( db_step(&s)==SQLITE_ROW ){ g.userUid = db_column_int(&s, 0); g.zLogin = mprintf("%s", db_column_text(&s, 1)); } db_finalize(&s); @@ -311,11 +312,11 @@ } if( g.userUid==0 ){ db_multi_exec( "INSERT INTO user(login, pw, cap, info)" - "VALUES('anonymous', '', '', '')" + "VALUES('anonymous', '', 'cfghjkmnoqw', '')" ); g.userUid = db_last_insert_rowid(); g.zLogin = "anonymous"; } }