Fossil SCM

Add experimental support for copying the initial settings of a repository from another repository.

mistachkin 2012-09-18 03:21 UTC trunk
Commit e771171c68edb902db42eaea1279c259ed0ac34b
+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
+82 -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
@@ -1212,17 +1227,25 @@
12121227
/*
12131228
** Fill an empty repository database with the basic information for a
12141229
** repository. This function is shared between 'create_repository_cmd'
12151230
** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
12161231
** new repositories.
1232
+**
1233
+** The zTemplate parameter determines if the settings for the repository
1234
+** should be copied from another repository. If zTemplate is 0 then the
1235
+** settings will have their normal default values. If zTemplate is
1236
+** non-zero, it is assumed that the caller of this function has already
1237
+** attached a database using the label "settingSrc". If not, the call to
1238
+** this function will fail.
12171239
**
12181240
** The zInitialDate parameter determines the date of the initial check-in
12191241
** that is automatically created. If zInitialDate is 0 then no initial
12201242
** check-in is created. The makeServerCodes flag determines whether or
12211243
** not server and project codes are invented for this repository.
12221244
*/
12231245
void db_initial_setup(
1246
+ const char *zTemplate, /* Repository from which to copy settings. */
12241247
const char *zInitialDate, /* Initial date of repository. (ex: "now") */
12251248
const char *zDefaultUser, /* Default user for the repository */
12261249
int makeServerCodes /* True to make new server & project codes */
12271250
){
12281251
char *zDate;
@@ -1241,10 +1264,53 @@
12411264
}
12421265
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
12431266
if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
12441267
db_create_default_users(0, zDefaultUser);
12451268
user_select();
1269
+
1270
+ if( zTemplate ){
1271
+ /*
1272
+ ** Copy all settings from the supplied template repository
1273
+ ** except those that are, by definition, always unique to a
1274
+ ** specific project. The list of settings excluded by this
1275
+ ** SQL statement may need to be revised in the future.
1276
+ */
1277
+ db_multi_exec(
1278
+ "INSERT OR REPLACE INTO config"
1279
+ " SELECT name,value,mtime"
1280
+ " FROM settingSrc.config WHERE name NOT IN ("
1281
+ " 'content-schema','aux-schema',"
1282
+ " 'server-code','project-code',"
1283
+ " 'last-sync-url','last-sync-pw',"
1284
+ " 'captcha-secret','login-group-code',"
1285
+ " 'login-group-name'"
1286
+ " ) AND "
1287
+ " name NOT GLOB 'ckout:*' AND"
1288
+ " name NOT GLOB 'baseurl:*' AND"
1289
+ " name NOT GLOB 'peer-name-*' AND"
1290
+ " name NOT GLOB 'peer-repo-*';"
1291
+ );
1292
+ /*
1293
+ ** Copy the user permissions, contact information, last modified
1294
+ ** time, and photo for all the "system" users from the supplied
1295
+ ** template repository into the one being setup. The other columns
1296
+ ** are not copied because they contain security information or other
1297
+ ** data specific to the other repository. The list of columns copied
1298
+ ** by this SQL statement may need to be revised in the future.
1299
+ */
1300
+ db_multi_exec("UPDATE user SET"
1301
+ " cap = (SELECT u2.cap FROM settingSrc.user u2"
1302
+ " WHERE u2.login = login),"
1303
+ " info = (SELECT u2.info FROM settingSrc.user u2"
1304
+ " WHERE u2.login = login),"
1305
+ " mtime = (SELECT u2.mtime FROM settingSrc.user u2"
1306
+ " WHERE u2.login = login),"
1307
+ " photo = (SELECT u2.photo FROM settingSrc.user u2"
1308
+ " WHERE u2.login = login)"
1309
+ " WHERE login IN ('anonymous','nobody','developer','reader');"
1310
+ );
1311
+ }
12461312
12471313
if( zInitialDate ){
12481314
int rid;
12491315
blob_zero(&manifest);
12501316
blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n");
@@ -1277,33 +1343,47 @@
12771343
**
12781344
** By default, your current login name is used to create the default
12791345
** admin user. This can be overridden using the -A|--admin-user
12801346
** parameter.
12811347
**
1348
+** By default, all settings will be initialized to their default values.
1349
+** This can be overridden using the --template parameter to specify a
1350
+** repository file from which to copy the initial settings. When a template
1351
+** repository is used, almost all of the settings accessible from the setup
1352
+** page, either directly or indirectly, will be copied. Normal users and
1353
+** their associated permissions will not be copied; however, the system
1354
+** default users "anonymous", "nobody", "reader", "developer", and their
1355
+** associated permissions will be copied.
1356
+**
12821357
** Options:
1358
+** --template FILE copy settings from repository file
12831359
** --admin-user|-A USERNAME select given USERNAME as admin user
12841360
** --date-override DATETIME use DATETIME as time of the initial checkin
12851361
**
12861362
** See also: clone
12871363
*/
12881364
void create_repository_cmd(void){
12891365
char *zPassword;
1366
+ const char *zTemplate; /* Repository from which to copy settings */
12901367
const char *zDate; /* Date of the initial check-in */
12911368
const char *zDefaultUser; /* Optional name of the default user */
12921369
1370
+ zTemplate = find_option("template",0,1);
12931371
zDate = find_option("date-override",0,1);
12941372
zDefaultUser = find_option("admin-user","A",1);
12951373
if( zDate==0 ) zDate = "now";
12961374
if( g.argc!=3 ){
12971375
usage("REPOSITORY-NAME");
12981376
}
12991377
db_create_repository(g.argv[2]);
13001378
db_open_repository(g.argv[2]);
13011379
db_open_config(0);
1380
+ if( zTemplate ) db_attach(zTemplate, "settingSrc");
13021381
db_begin_transaction();
1303
- db_initial_setup(zDate, zDefaultUser, 1);
1382
+ db_initial_setup(zTemplate, zDate, zDefaultUser, 1);
13041383
db_end_transaction(0);
1384
+ if( zTemplate ) db_detach("settingSrc");
13051385
fossil_print("project-id: %s\n", db_get("project-code", 0));
13061386
fossil_print("server-id: %s\n", db_get("server-code", 0));
13071387
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
13081388
fossil_print("admin-user: %s (initial password is \"%s\")\n",
13091389
g.zLogin, zPassword);
13101390
--- 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
@@ -1212,17 +1227,25 @@
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 +1264,53 @@
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 +1343,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
@@ -1212,17 +1227,25 @@
1227 /*
1228 ** Fill an empty repository database with the basic information for a
1229 ** repository. This function is shared between 'create_repository_cmd'
1230 ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
1231 ** new repositories.
1232 **
1233 ** The zTemplate parameter determines if the settings for the repository
1234 ** should be copied from another repository. If zTemplate is 0 then the
1235 ** settings will have their normal default values. If zTemplate is
1236 ** non-zero, it is assumed that the caller of this function has already
1237 ** attached a database using the label "settingSrc". If not, the call to
1238 ** this function will fail.
1239 **
1240 ** The zInitialDate parameter determines the date of the initial check-in
1241 ** that is automatically created. If zInitialDate is 0 then no initial
1242 ** check-in is created. The makeServerCodes flag determines whether or
1243 ** not server and project codes are invented for this repository.
1244 */
1245 void db_initial_setup(
1246 const char *zTemplate, /* Repository from which to copy settings. */
1247 const char *zInitialDate, /* Initial date of repository. (ex: "now") */
1248 const char *zDefaultUser, /* Default user for the repository */
1249 int makeServerCodes /* True to make new server & project codes */
1250 ){
1251 char *zDate;
@@ -1241,10 +1264,53 @@
1264 }
1265 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
1266 if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
1267 db_create_default_users(0, zDefaultUser);
1268 user_select();
1269
1270 if( zTemplate ){
1271 /*
1272 ** Copy all settings from the supplied template repository
1273 ** except those that are, by definition, always unique to a
1274 ** specific project. The list of settings excluded by this
1275 ** SQL statement may need to be revised in the future.
1276 */
1277 db_multi_exec(
1278 "INSERT OR REPLACE INTO config"
1279 " SELECT name,value,mtime"
1280 " FROM settingSrc.config WHERE name NOT IN ("
1281 " 'content-schema','aux-schema',"
1282 " 'server-code','project-code',"
1283 " 'last-sync-url','last-sync-pw',"
1284 " 'captcha-secret','login-group-code',"
1285 " 'login-group-name'"
1286 " ) AND "
1287 " name NOT GLOB 'ckout:*' AND"
1288 " name NOT GLOB 'baseurl:*' AND"
1289 " name NOT GLOB 'peer-name-*' AND"
1290 " name NOT GLOB 'peer-repo-*';"
1291 );
1292 /*
1293 ** Copy the user permissions, contact information, last modified
1294 ** time, and photo for all the "system" users from the supplied
1295 ** template repository into the one being setup. The other columns
1296 ** are not copied because they contain security information or other
1297 ** data specific to the other repository. The list of columns copied
1298 ** by this SQL statement may need to be revised in the future.
1299 */
1300 db_multi_exec("UPDATE user SET"
1301 " cap = (SELECT u2.cap FROM settingSrc.user u2"
1302 " WHERE u2.login = login),"
1303 " info = (SELECT u2.info FROM settingSrc.user u2"
1304 " WHERE u2.login = login),"
1305 " mtime = (SELECT u2.mtime FROM settingSrc.user u2"
1306 " WHERE u2.login = login),"
1307 " photo = (SELECT u2.photo FROM settingSrc.user u2"
1308 " WHERE u2.login = login)"
1309 " WHERE login IN ('anonymous','nobody','developer','reader');"
1310 );
1311 }
1312
1313 if( zInitialDate ){
1314 int rid;
1315 blob_zero(&manifest);
1316 blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n");
@@ -1277,33 +1343,47 @@
1343 **
1344 ** By default, your current login name is used to create the default
1345 ** admin user. This can be overridden using the -A|--admin-user
1346 ** parameter.
1347 **
1348 ** By default, all settings will be initialized to their default values.
1349 ** This can be overridden using the --template parameter to specify a
1350 ** repository file from which to copy the initial settings. When a template
1351 ** repository is used, almost all of the settings accessible from the setup
1352 ** page, either directly or indirectly, will be copied. Normal users and
1353 ** their associated permissions will not be copied; however, the system
1354 ** default users "anonymous", "nobody", "reader", "developer", and their
1355 ** associated permissions will be copied.
1356 **
1357 ** Options:
1358 ** --template FILE copy settings from repository file
1359 ** --admin-user|-A USERNAME select given USERNAME as admin user
1360 ** --date-override DATETIME use DATETIME as time of the initial checkin
1361 **
1362 ** See also: clone
1363 */
1364 void create_repository_cmd(void){
1365 char *zPassword;
1366 const char *zTemplate; /* Repository from which to copy settings */
1367 const char *zDate; /* Date of the initial check-in */
1368 const char *zDefaultUser; /* Optional name of the default user */
1369
1370 zTemplate = find_option("template",0,1);
1371 zDate = find_option("date-override",0,1);
1372 zDefaultUser = find_option("admin-user","A",1);
1373 if( zDate==0 ) zDate = "now";
1374 if( g.argc!=3 ){
1375 usage("REPOSITORY-NAME");
1376 }
1377 db_create_repository(g.argv[2]);
1378 db_open_repository(g.argv[2]);
1379 db_open_config(0);
1380 if( zTemplate ) db_attach(zTemplate, "settingSrc");
1381 db_begin_transaction();
1382 db_initial_setup(zTemplate, zDate, zDefaultUser, 1);
1383 db_end_transaction(0);
1384 if( zTemplate ) db_detach("settingSrc");
1385 fossil_print("project-id: %s\n", db_get("project-code", 0));
1386 fossil_print("server-id: %s\n", db_get("server-code", 0));
1387 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
1388 fossil_print("admin-user: %s (initial password is \"%s\")\n",
1389 g.zLogin, zPassword);
1390
+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