34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
+
+
+
+
+
|
**
** Usage: %fossil clone URL FILENAME
**
** Make a clone of a repository specified by URL in the local
** file named FILENAME.
*/
void clone_cmd(void){
char *zPassword;
url_proxy_options();
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]);
if( g.urlIsFile ){
file_copy(g.urlName, g.argv[3]);
db_close();
db_open_repository(g.argv[3]);
db_open_config();
db_record_repository_filename(g.argv[3]);
db_multi_exec(
"REPLACE INTO config(name,value)"
" VALUES('server-code', lower(hex(randomblob(20))));"
);
g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'");
if( g.zLogin==0 ){
db_create_default_users(1);
}
printf("Repository cloned into %s\n", g.argv[3]);
}else{
db_create_repository(g.argv[3]);
db_open_repository(g.argv[3]);
db_begin_transaction();
db_record_repository_filename(g.argv[3]);
db_initial_setup(0, 0);
|
80
81
82
83
84
85
86
87
88
|
85
86
87
88
89
90
91
92
93
94
95
96
97
|
+
+
+
+
|
db_end_transaction(0);
db_close();
db_open_repository(g.argv[3]);
}
db_begin_transaction();
printf("Rebuilding repository meta-data...\n");
rebuild_db(0, 1);
printf("project-id: %s\n", db_get("project-code", 0));
printf("server-id: %s\n", db_get("server-code", 0));
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
db_end_transaction(0);
}
|