Fossil SCM

Merge support for the --template option of the 'new' command to trunk.

aku 2012-09-18 21:21 trunk merge
Commit 75bcb48089c3e374bafa58ee3090d769c9f7db6b
+1 -1
--- src/clone.c
+++ src/clone.c
@@ -141,11 +141,11 @@
141141
}else{
142142
db_create_repository(g.argv[3]);
143143
db_open_repository(g.argv[3]);
144144
db_begin_transaction();
145145
db_record_repository_filename(g.argv[3]);
146
- db_initial_setup(0, zDefaultUser, 0);
146
+ db_initial_setup(0, 0, zDefaultUser, 0);
147147
user_select();
148148
db_set("content-schema", CONTENT_SCHEMA, 0);
149149
db_set("aux-schema", AUX_SCHEMA, 0);
150150
db_set("last-sync-url", g.argv[2], 0);
151151
if( g.zSSLIdentity!=0 ){
152152
--- src/clone.c
+++ src/clone.c
@@ -141,11 +141,11 @@
141 }else{
142 db_create_repository(g.argv[3]);
143 db_open_repository(g.argv[3]);
144 db_begin_transaction();
145 db_record_repository_filename(g.argv[3]);
146 db_initial_setup(0, zDefaultUser, 0);
147 user_select();
148 db_set("content-schema", CONTENT_SCHEMA, 0);
149 db_set("aux-schema", AUX_SCHEMA, 0);
150 db_set("last-sync-url", g.argv[2], 0);
151 if( g.zSSLIdentity!=0 ){
152
--- src/clone.c
+++ src/clone.c
@@ -141,11 +141,11 @@
141 }else{
142 db_create_repository(g.argv[3]);
143 db_open_repository(g.argv[3]);
144 db_begin_transaction();
145 db_record_repository_filename(g.argv[3]);
146 db_initial_setup(0, 0, zDefaultUser, 0);
147 user_select();
148 db_set("content-schema", CONTENT_SCHEMA, 0);
149 db_set("aux-schema", AUX_SCHEMA, 0);
150 db_set("last-sync-url", g.argv[2], 0);
151 if( g.zSSLIdentity!=0 ){
152
--- src/configure.c
+++ src/configure.c
@@ -157,10 +157,32 @@
157157
}
158158
}
159159
}
160160
return 0;
161161
}
162
+
163
+/*
164
+** Return a pointer to a string that contains the RHS of an IN operator
165
+** that will select CONFIG table names that are part of the configuration
166
+** that matchines iMatch.
167
+*/
168
+const char *configure_inop_rhs(int iMask){
169
+ Blob x;
170
+ int i;
171
+ const char *zSep = "";
172
+
173
+ blob_zero(&x);
174
+ blob_append(&x, "(", 1);
175
+ for(i=0; i<count(aConfig); i++){
176
+ if( (aConfig[i].groupMask & iMask)==0 ) continue;
177
+ if( aConfig[i].zName[0]=='@' ) continue;
178
+ blob_appendf(&x, "%s'%s'", zSep, aConfig[i].zName);
179
+ zSep = ",";
180
+ }
181
+ blob_append(&x, ")", 1);
182
+ return blob_str(&x);
183
+}
162184
163185
/*
164186
** Return the mask for the named configuration parameter if it can be
165187
** safely exported. Return 0 if the parameter is not safe to export.
166188
**
167189
--- src/configure.c
+++ src/configure.c
@@ -157,10 +157,32 @@
157 }
158 }
159 }
160 return 0;
161 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
163 /*
164 ** Return the mask for the named configuration parameter if it can be
165 ** safely exported. Return 0 if the parameter is not safe to export.
166 **
167
--- src/configure.c
+++ src/configure.c
@@ -157,10 +157,32 @@
157 }
158 }
159 }
160 return 0;
161 }
162
163 /*
164 ** Return a pointer to a string that contains the RHS of an IN operator
165 ** that will select CONFIG table names that are part of the configuration
166 ** that matchines iMatch.
167 */
168 const char *configure_inop_rhs(int iMask){
169 Blob x;
170 int i;
171 const char *zSep = "";
172
173 blob_zero(&x);
174 blob_append(&x, "(", 1);
175 for(i=0; i<count(aConfig); i++){
176 if( (aConfig[i].groupMask & iMask)==0 ) continue;
177 if( aConfig[i].zName[0]=='@' ) continue;
178 blob_appendf(&x, "%s'%s'", zSep, aConfig[i].zName);
179 zSep = ",";
180 }
181 blob_append(&x, ")", 1);
182 return blob_str(&x);
183 }
184
185 /*
186 ** Return the mask for the named configuration parameter if it can be
187 ** safely exported. Return 0 if the parameter is not safe to export.
188 **
189
+96 -2
--- src/db.c
+++ src/db.c
@@ -701,10 +701,25 @@
701701
sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
702702
sqlite3_create_function(db, "now", 0, SQLITE_ANY, 0, db_now_function, 0, 0);
703703
return db;
704704
}
705705
706
+
707
+/*
708
+** Detaches the zLabel database.
709
+*/
710
+void db_detach(const char *zLabel){
711
+ db_multi_exec("DETACH DATABASE %s", zLabel);
712
+}
713
+
714
+/*
715
+** zDbName is the name of a database file. Attach zDbName using
716
+** the name zLabel.
717
+*/
718
+void db_attach(const char *zDbName, const char *zLabel){
719
+ db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);
720
+}
706721
707722
/*
708723
** zDbName is the name of a database file. If no other database
709724
** file is open, then open this one. If another database file is
710725
** already open, then attach zDbName using the name zLabel.
@@ -713,11 +728,11 @@
713728
if( !g.db ){
714729
g.db = openDatabase(zDbName);
715730
g.zMainDbType = zLabel;
716731
db_connection_init();
717732
}else{
718
- db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);
733
+ db_attach(zDbName, zLabel);
719734
}
720735
}
721736
722737
/*
723738
** Open the user database in "~/.fossil". Create the database anew if
@@ -1206,23 +1221,51 @@
12061221
"INSERT INTO user(login,pw,cap,info)"
12071222
" VALUES('reader','','kptw','Reader');"
12081223
);
12091224
}
12101225
}
1226
+
1227
+/*
1228
+** Return a pointer to a string that contains the RHS of an IN operator
1229
+** that will select CONFIG table names that are in the list of control
1230
+** settings.
1231
+*/
1232
+const char *db_setting_inop_rhs(){
1233
+ Blob x;
1234
+ int i;
1235
+ const char *zSep = "";
1236
+
1237
+ blob_zero(&x);
1238
+ blob_append(&x, "(", 1);
1239
+ for(i=0; ctrlSettings[i].name; i++){
1240
+ blob_appendf(&x, "%s'%s'", zSep, ctrlSettings[i].name);
1241
+ zSep = ",";
1242
+ }
1243
+ blob_append(&x, ")", 1);
1244
+ return blob_str(&x);
1245
+}
12111246
12121247
/*
12131248
** Fill an empty repository database with the basic information for a
12141249
** repository. This function is shared between 'create_repository_cmd'
12151250
** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
12161251
** new repositories.
1252
+**
1253
+** The zTemplate parameter determines if the settings for the repository
1254
+** should be copied from another repository. If zTemplate is 0 then the
1255
+** settings will have their normal default values. If zTemplate is
1256
+** non-zero, it is assumed that the caller of this function has already
1257
+** attached a database using the label "settingSrc". If not, the call to
1258
+** this function will fail.
12171259
**
12181260
** The zInitialDate parameter determines the date of the initial check-in
12191261
** that is automatically created. If zInitialDate is 0 then no initial
12201262
** check-in is created. The makeServerCodes flag determines whether or
12211263
** not server and project codes are invented for this repository.
12221264
*/
12231265
void db_initial_setup(
1266
+ const char *zTemplate, /* Repository from which to copy settings. */
12241267
const char *zInitialDate, /* Initial date of repository. (ex: "now") */
12251268
const char *zDefaultUser, /* Default user for the repository */
12261269
int makeServerCodes /* True to make new server & project codes */
12271270
){
12281271
char *zDate;
@@ -1241,10 +1284,47 @@
12411284
}
12421285
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
12431286
if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
12441287
db_create_default_users(0, zDefaultUser);
12451288
user_select();
1289
+
1290
+ if( zTemplate ){
1291
+ /*
1292
+ ** Copy all settings from the supplied template repository.
1293
+ */
1294
+ db_multi_exec(
1295
+ "INSERT OR REPLACE INTO config"
1296
+ " SELECT name,value,mtime FROM settingSrc.config"
1297
+ " WHERE (name IN %s OR name IN %s)"
1298
+ " AND name NOT GLOB 'project-*';",
1299
+ configure_inop_rhs(CONFIGSET_ALL),
1300
+ db_setting_inop_rhs()
1301
+ );
1302
+ db_multi_exec(
1303
+ "REPLACE INTO reportfmt SELECT * FROM settingSrc.reportfmt;"
1304
+ );
1305
+
1306
+ /*
1307
+ ** Copy the user permissions, contact information, last modified
1308
+ ** time, and photo for all the "system" users from the supplied
1309
+ ** template repository into the one being setup. The other columns
1310
+ ** are not copied because they contain security information or other
1311
+ ** data specific to the other repository. The list of columns copied
1312
+ ** by this SQL statement may need to be revised in the future.
1313
+ */
1314
+ db_multi_exec("UPDATE user SET"
1315
+ " cap = (SELECT u2.cap FROM settingSrc.user u2"
1316
+ " WHERE u2.login = user.login),"
1317
+ " info = (SELECT u2.info FROM settingSrc.user u2"
1318
+ " WHERE u2.login = user.login),"
1319
+ " mtime = (SELECT u2.mtime FROM settingSrc.user u2"
1320
+ " WHERE u2.login = user.login),"
1321
+ " photo = (SELECT u2.photo FROM settingSrc.user u2"
1322
+ " WHERE u2.login = user.login)"
1323
+ " WHERE user.login IN ('anonymous','nobody','developer','reader');"
1324
+ );
1325
+ }
12461326
12471327
if( zInitialDate ){
12481328
int rid;
12491329
blob_zero(&manifest);
12501330
blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n");
@@ -1277,33 +1357,47 @@
12771357
**
12781358
** By default, your current login name is used to create the default
12791359
** admin user. This can be overridden using the -A|--admin-user
12801360
** parameter.
12811361
**
1362
+** By default, all settings will be initialized to their default values.
1363
+** This can be overridden using the --template parameter to specify a
1364
+** repository file from which to copy the initial settings. When a template
1365
+** repository is used, almost all of the settings accessible from the setup
1366
+** page, either directly or indirectly, will be copied. Normal users and
1367
+** their associated permissions will not be copied; however, the system
1368
+** default users "anonymous", "nobody", "reader", "developer", and their
1369
+** associated permissions will be copied.
1370
+**
12821371
** Options:
1372
+** --template FILE copy settings from repository file
12831373
** --admin-user|-A USERNAME select given USERNAME as admin user
12841374
** --date-override DATETIME use DATETIME as time of the initial checkin
12851375
**
12861376
** See also: clone
12871377
*/
12881378
void create_repository_cmd(void){
12891379
char *zPassword;
1380
+ const char *zTemplate; /* Repository from which to copy settings */
12901381
const char *zDate; /* Date of the initial check-in */
12911382
const char *zDefaultUser; /* Optional name of the default user */
12921383
1384
+ zTemplate = find_option("template",0,1);
12931385
zDate = find_option("date-override",0,1);
12941386
zDefaultUser = find_option("admin-user","A",1);
12951387
if( zDate==0 ) zDate = "now";
12961388
if( g.argc!=3 ){
12971389
usage("REPOSITORY-NAME");
12981390
}
12991391
db_create_repository(g.argv[2]);
13001392
db_open_repository(g.argv[2]);
13011393
db_open_config(0);
1394
+ if( zTemplate ) db_attach(zTemplate, "settingSrc");
13021395
db_begin_transaction();
1303
- db_initial_setup(zDate, zDefaultUser, 1);
1396
+ db_initial_setup(zTemplate, zDate, zDefaultUser, 1);
13041397
db_end_transaction(0);
1398
+ if( zTemplate ) db_detach("settingSrc");
13051399
fossil_print("project-id: %s\n", db_get("project-code", 0));
13061400
fossil_print("server-id: %s\n", db_get("server-code", 0));
13071401
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
13081402
fossil_print("admin-user: %s (initial password is \"%s\")\n",
13091403
g.zLogin, zPassword);
13101404
--- src/db.c
+++ src/db.c
@@ -701,10 +701,25 @@
701 sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
702 sqlite3_create_function(db, "now", 0, SQLITE_ANY, 0, db_now_function, 0, 0);
703 return db;
704 }
705
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
706
707 /*
708 ** zDbName is the name of a database file. If no other database
709 ** file is open, then open this one. If another database file is
710 ** already open, then attach zDbName using the name zLabel.
@@ -713,11 +728,11 @@
713 if( !g.db ){
714 g.db = openDatabase(zDbName);
715 g.zMainDbType = zLabel;
716 db_connection_init();
717 }else{
718 db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);
719 }
720 }
721
722 /*
723 ** Open the user database in "~/.fossil". Create the database anew if
@@ -1206,23 +1221,51 @@
1206 "INSERT INTO user(login,pw,cap,info)"
1207 " VALUES('reader','','kptw','Reader');"
1208 );
1209 }
1210 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1211
1212 /*
1213 ** Fill an empty repository database with the basic information for a
1214 ** repository. This function is shared between 'create_repository_cmd'
1215 ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
1216 ** new repositories.
 
 
 
 
 
 
 
1217 **
1218 ** The zInitialDate parameter determines the date of the initial check-in
1219 ** that is automatically created. If zInitialDate is 0 then no initial
1220 ** check-in is created. The makeServerCodes flag determines whether or
1221 ** not server and project codes are invented for this repository.
1222 */
1223 void db_initial_setup(
 
1224 const char *zInitialDate, /* Initial date of repository. (ex: "now") */
1225 const char *zDefaultUser, /* Default user for the repository */
1226 int makeServerCodes /* True to make new server & project codes */
1227 ){
1228 char *zDate;
@@ -1241,10 +1284,47 @@
1241 }
1242 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
1243 if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
1244 db_create_default_users(0, zDefaultUser);
1245 user_select();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1246
1247 if( zInitialDate ){
1248 int rid;
1249 blob_zero(&manifest);
1250 blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n");
@@ -1277,33 +1357,47 @@
1277 **
1278 ** By default, your current login name is used to create the default
1279 ** admin user. This can be overridden using the -A|--admin-user
1280 ** parameter.
1281 **
 
 
 
 
 
 
 
 
 
1282 ** Options:
 
1283 ** --admin-user|-A USERNAME select given USERNAME as admin user
1284 ** --date-override DATETIME use DATETIME as time of the initial checkin
1285 **
1286 ** See also: clone
1287 */
1288 void create_repository_cmd(void){
1289 char *zPassword;
 
1290 const char *zDate; /* Date of the initial check-in */
1291 const char *zDefaultUser; /* Optional name of the default user */
1292
 
1293 zDate = find_option("date-override",0,1);
1294 zDefaultUser = find_option("admin-user","A",1);
1295 if( zDate==0 ) zDate = "now";
1296 if( g.argc!=3 ){
1297 usage("REPOSITORY-NAME");
1298 }
1299 db_create_repository(g.argv[2]);
1300 db_open_repository(g.argv[2]);
1301 db_open_config(0);
 
1302 db_begin_transaction();
1303 db_initial_setup(zDate, zDefaultUser, 1);
1304 db_end_transaction(0);
 
1305 fossil_print("project-id: %s\n", db_get("project-code", 0));
1306 fossil_print("server-id: %s\n", db_get("server-code", 0));
1307 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
1308 fossil_print("admin-user: %s (initial password is \"%s\")\n",
1309 g.zLogin, zPassword);
1310
--- src/db.c
+++ src/db.c
@@ -701,10 +701,25 @@
701 sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
702 sqlite3_create_function(db, "now", 0, SQLITE_ANY, 0, db_now_function, 0, 0);
703 return db;
704 }
705
706
707 /*
708 ** Detaches the zLabel database.
709 */
710 void db_detach(const char *zLabel){
711 db_multi_exec("DETACH DATABASE %s", zLabel);
712 }
713
714 /*
715 ** zDbName is the name of a database file. Attach zDbName using
716 ** the name zLabel.
717 */
718 void db_attach(const char *zDbName, const char *zLabel){
719 db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);
720 }
721
722 /*
723 ** zDbName is the name of a database file. If no other database
724 ** file is open, then open this one. If another database file is
725 ** already open, then attach zDbName using the name zLabel.
@@ -713,11 +728,11 @@
728 if( !g.db ){
729 g.db = openDatabase(zDbName);
730 g.zMainDbType = zLabel;
731 db_connection_init();
732 }else{
733 db_attach(zDbName, zLabel);
734 }
735 }
736
737 /*
738 ** Open the user database in "~/.fossil". Create the database anew if
@@ -1206,23 +1221,51 @@
1221 "INSERT INTO user(login,pw,cap,info)"
1222 " VALUES('reader','','kptw','Reader');"
1223 );
1224 }
1225 }
1226
1227 /*
1228 ** Return a pointer to a string that contains the RHS of an IN operator
1229 ** that will select CONFIG table names that are in the list of control
1230 ** settings.
1231 */
1232 const char *db_setting_inop_rhs(){
1233 Blob x;
1234 int i;
1235 const char *zSep = "";
1236
1237 blob_zero(&x);
1238 blob_append(&x, "(", 1);
1239 for(i=0; ctrlSettings[i].name; i++){
1240 blob_appendf(&x, "%s'%s'", zSep, ctrlSettings[i].name);
1241 zSep = ",";
1242 }
1243 blob_append(&x, ")", 1);
1244 return blob_str(&x);
1245 }
1246
1247 /*
1248 ** Fill an empty repository database with the basic information for a
1249 ** repository. This function is shared between 'create_repository_cmd'
1250 ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
1251 ** new repositories.
1252 **
1253 ** The zTemplate parameter determines if the settings for the repository
1254 ** should be copied from another repository. If zTemplate is 0 then the
1255 ** settings will have their normal default values. If zTemplate is
1256 ** non-zero, it is assumed that the caller of this function has already
1257 ** attached a database using the label "settingSrc". If not, the call to
1258 ** this function will fail.
1259 **
1260 ** The zInitialDate parameter determines the date of the initial check-in
1261 ** that is automatically created. If zInitialDate is 0 then no initial
1262 ** check-in is created. The makeServerCodes flag determines whether or
1263 ** not server and project codes are invented for this repository.
1264 */
1265 void db_initial_setup(
1266 const char *zTemplate, /* Repository from which to copy settings. */
1267 const char *zInitialDate, /* Initial date of repository. (ex: "now") */
1268 const char *zDefaultUser, /* Default user for the repository */
1269 int makeServerCodes /* True to make new server & project codes */
1270 ){
1271 char *zDate;
@@ -1241,10 +1284,47 @@
1284 }
1285 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
1286 if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
1287 db_create_default_users(0, zDefaultUser);
1288 user_select();
1289
1290 if( zTemplate ){
1291 /*
1292 ** Copy all settings from the supplied template repository.
1293 */
1294 db_multi_exec(
1295 "INSERT OR REPLACE INTO config"
1296 " SELECT name,value,mtime FROM settingSrc.config"
1297 " WHERE (name IN %s OR name IN %s)"
1298 " AND name NOT GLOB 'project-*';",
1299 configure_inop_rhs(CONFIGSET_ALL),
1300 db_setting_inop_rhs()
1301 );
1302 db_multi_exec(
1303 "REPLACE INTO reportfmt SELECT * FROM settingSrc.reportfmt;"
1304 );
1305
1306 /*
1307 ** Copy the user permissions, contact information, last modified
1308 ** time, and photo for all the "system" users from the supplied
1309 ** template repository into the one being setup. The other columns
1310 ** are not copied because they contain security information or other
1311 ** data specific to the other repository. The list of columns copied
1312 ** by this SQL statement may need to be revised in the future.
1313 */
1314 db_multi_exec("UPDATE user SET"
1315 " cap = (SELECT u2.cap FROM settingSrc.user u2"
1316 " WHERE u2.login = user.login),"
1317 " info = (SELECT u2.info FROM settingSrc.user u2"
1318 " WHERE u2.login = user.login),"
1319 " mtime = (SELECT u2.mtime FROM settingSrc.user u2"
1320 " WHERE u2.login = user.login),"
1321 " photo = (SELECT u2.photo FROM settingSrc.user u2"
1322 " WHERE u2.login = user.login)"
1323 " WHERE user.login IN ('anonymous','nobody','developer','reader');"
1324 );
1325 }
1326
1327 if( zInitialDate ){
1328 int rid;
1329 blob_zero(&manifest);
1330 blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n");
@@ -1277,33 +1357,47 @@
1357 **
1358 ** By default, your current login name is used to create the default
1359 ** admin user. This can be overridden using the -A|--admin-user
1360 ** parameter.
1361 **
1362 ** By default, all settings will be initialized to their default values.
1363 ** This can be overridden using the --template parameter to specify a
1364 ** repository file from which to copy the initial settings. When a template
1365 ** repository is used, almost all of the settings accessible from the setup
1366 ** page, either directly or indirectly, will be copied. Normal users and
1367 ** their associated permissions will not be copied; however, the system
1368 ** default users "anonymous", "nobody", "reader", "developer", and their
1369 ** associated permissions will be copied.
1370 **
1371 ** Options:
1372 ** --template FILE copy settings from repository file
1373 ** --admin-user|-A USERNAME select given USERNAME as admin user
1374 ** --date-override DATETIME use DATETIME as time of the initial checkin
1375 **
1376 ** See also: clone
1377 */
1378 void create_repository_cmd(void){
1379 char *zPassword;
1380 const char *zTemplate; /* Repository from which to copy settings */
1381 const char *zDate; /* Date of the initial check-in */
1382 const char *zDefaultUser; /* Optional name of the default user */
1383
1384 zTemplate = find_option("template",0,1);
1385 zDate = find_option("date-override",0,1);
1386 zDefaultUser = find_option("admin-user","A",1);
1387 if( zDate==0 ) zDate = "now";
1388 if( g.argc!=3 ){
1389 usage("REPOSITORY-NAME");
1390 }
1391 db_create_repository(g.argv[2]);
1392 db_open_repository(g.argv[2]);
1393 db_open_config(0);
1394 if( zTemplate ) db_attach(zTemplate, "settingSrc");
1395 db_begin_transaction();
1396 db_initial_setup(zTemplate, zDate, zDefaultUser, 1);
1397 db_end_transaction(0);
1398 if( zTemplate ) db_detach("settingSrc");
1399 fossil_print("project-id: %s\n", db_get("project-code", 0));
1400 fossil_print("server-id: %s\n", db_get("server-code", 0));
1401 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
1402 fossil_print("admin-user: %s (initial password is \"%s\")\n",
1403 g.zLogin, zPassword);
1404
+1 -1
--- src/import.c
+++ src/import.c
@@ -771,11 +771,11 @@
771771
"CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
772772
);
773773
774774
775775
db_begin_transaction();
776
- if( !incrFlag ) db_initial_setup(0, 0, 1);
776
+ if( !incrFlag ) db_initial_setup(0, 0, 0, 1);
777777
git_fast_import(pIn);
778778
db_prepare(&q, "SELECT tcontent FROM xtag");
779779
while( db_step(&q)==SQLITE_ROW ){
780780
Blob record;
781781
db_ephemeral_blob(&q, 0, &record);
782782
--- src/import.c
+++ src/import.c
@@ -771,11 +771,11 @@
771 "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
772 );
773
774
775 db_begin_transaction();
776 if( !incrFlag ) db_initial_setup(0, 0, 1);
777 git_fast_import(pIn);
778 db_prepare(&q, "SELECT tcontent FROM xtag");
779 while( db_step(&q)==SQLITE_ROW ){
780 Blob record;
781 db_ephemeral_blob(&q, 0, &record);
782
--- src/import.c
+++ src/import.c
@@ -771,11 +771,11 @@
771 "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
772 );
773
774
775 db_begin_transaction();
776 if( !incrFlag ) db_initial_setup(0, 0, 0, 1);
777 git_fast_import(pIn);
778 db_prepare(&q, "SELECT tcontent FROM xtag");
779 while( db_step(&q)==SQLITE_ROW ){
780 Blob record;
781 db_ephemeral_blob(&q, 0, &record);
782
+2 -2
--- src/login.c
+++ src/login.c
@@ -1444,21 +1444,21 @@
14441444
if( rc ) return;
14451445
14461446
/* Attach the other repository. Make sure the username/password is
14471447
** valid and has Setup permission.
14481448
*/
1449
- db_multi_exec("ATTACH %Q AS other", zRepo);
1449
+ db_attach(zRepo, "other");
14501450
zOtherProjCode = db_text("x", "SELECT value FROM other.config"
14511451
" WHERE name='project-code'");
14521452
zPwHash = sha1_shared_secret(zPassword, zLogin, zOtherProjCode);
14531453
if( !db_exists(
14541454
"SELECT 1 FROM other.user"
14551455
" WHERE login=%Q AND cap GLOB '*s*'"
14561456
" AND (pw=%Q OR pw=%Q)",
14571457
zLogin, zPassword, zPwHash)
14581458
){
1459
- db_multi_exec("DETACH other");
1459
+ db_detach("other");
14601460
*pzErrMsg = "The supplied username/password does not correspond to a"
14611461
" user Setup permission on the other repository.";
14621462
return;
14631463
}
14641464
14651465
--- src/login.c
+++ src/login.c
@@ -1444,21 +1444,21 @@
1444 if( rc ) return;
1445
1446 /* Attach the other repository. Make sure the username/password is
1447 ** valid and has Setup permission.
1448 */
1449 db_multi_exec("ATTACH %Q AS other", zRepo);
1450 zOtherProjCode = db_text("x", "SELECT value FROM other.config"
1451 " WHERE name='project-code'");
1452 zPwHash = sha1_shared_secret(zPassword, zLogin, zOtherProjCode);
1453 if( !db_exists(
1454 "SELECT 1 FROM other.user"
1455 " WHERE login=%Q AND cap GLOB '*s*'"
1456 " AND (pw=%Q OR pw=%Q)",
1457 zLogin, zPassword, zPwHash)
1458 ){
1459 db_multi_exec("DETACH other");
1460 *pzErrMsg = "The supplied username/password does not correspond to a"
1461 " user Setup permission on the other repository.";
1462 return;
1463 }
1464
1465
--- src/login.c
+++ src/login.c
@@ -1444,21 +1444,21 @@
1444 if( rc ) return;
1445
1446 /* Attach the other repository. Make sure the username/password is
1447 ** valid and has Setup permission.
1448 */
1449 db_attach(zRepo, "other");
1450 zOtherProjCode = db_text("x", "SELECT value FROM other.config"
1451 " WHERE name='project-code'");
1452 zPwHash = sha1_shared_secret(zPassword, zLogin, zOtherProjCode);
1453 if( !db_exists(
1454 "SELECT 1 FROM other.user"
1455 " WHERE login=%Q AND cap GLOB '*s*'"
1456 " AND (pw=%Q OR pw=%Q)",
1457 zLogin, zPassword, zPwHash)
1458 ){
1459 db_detach("other");
1460 *pzErrMsg = "The supplied username/password does not correspond to a"
1461 " user Setup permission on the other repository.";
1462 return;
1463 }
1464
1465
+1 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -886,11 +886,11 @@
886886
}
887887
db_create_repository(g.argv[2]);
888888
db_open_repository(g.argv[2]);
889889
db_open_config(0);
890890
db_begin_transaction();
891
- db_initial_setup(0, 0, 1);
891
+ db_initial_setup(0, 0, 0, 1);
892892
893893
fossil_print("Reading files from directory \"%s\"...\n", g.argv[3]);
894894
recon_read_dir(g.argv[3]);
895895
fossil_print("\nBuilding the Fossil repository...\n");
896896
897897
--- src/rebuild.c
+++ src/rebuild.c
@@ -886,11 +886,11 @@
886 }
887 db_create_repository(g.argv[2]);
888 db_open_repository(g.argv[2]);
889 db_open_config(0);
890 db_begin_transaction();
891 db_initial_setup(0, 0, 1);
892
893 fossil_print("Reading files from directory \"%s\"...\n", g.argv[3]);
894 recon_read_dir(g.argv[3]);
895 fossil_print("\nBuilding the Fossil repository...\n");
896
897
--- src/rebuild.c
+++ src/rebuild.c
@@ -886,11 +886,11 @@
886 }
887 db_create_repository(g.argv[2]);
888 db_open_repository(g.argv[2]);
889 db_open_config(0);
890 db_begin_transaction();
891 db_initial_setup(0, 0, 0, 1);
892
893 fossil_print("Reading files from directory \"%s\"...\n", g.argv[3]);
894 recon_read_dir(g.argv[3]);
895 fossil_print("\nBuilding the Fossil repository...\n");
896
897

Keyboard Shortcuts

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