33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
**
** By default, your current login name is used to create the default
** admin user. This can be overridden using the -A|--admin-user
** parameter.
**
** Options:
**
** --admin-user|-A USERNAME
**
*/
void clone_cmd(void){
char *zPassword;
const char *zDefaultUser; /* Optional name of the default user */
int nErr = 0;
url_proxy_options();
if( g.argc < 4 ){
usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
}
db_open_config(0);
if( file_size(g.argv[3])>0 ){
fossil_panic("file already exists: %s", g.argv[3]);
|
|
>
>
>
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
**
** By default, your current login name is used to create the default
** admin user. This can be overridden using the -A|--admin-user
** parameter.
**
** Options:
**
** --admin-user|-A USERNAME Make USERNAME the administrator
** --private Also clone private branches
**
*/
void clone_cmd(void){
char *zPassword;
const char *zDefaultUser; /* Optional name of the default user */
int nErr = 0;
int bPrivate; /* Also clone private branches */
bPrivate = find_option("private",0,0)!=0;
url_proxy_options();
if( g.argc < 4 ){
usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
}
db_open_config(0);
if( file_size(g.argv[3])>0 ){
fossil_panic("file already exists: %s", g.argv[3]);
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
db_set("last-sync-url", g.argv[2], 0);
db_multi_exec(
"REPLACE INTO config(name,value)"
" VALUES('server-code', lower(hex(randomblob(20))));"
);
url_enable_proxy(0);
g.xlinkClusterOnly = 1;
nErr = client_sync(0,0,1,CONFIGSET_ALL,0);
g.xlinkClusterOnly = 0;
verify_cancel();
db_end_transaction(0);
db_close(1);
if( nErr ){
unlink(g.argv[3]);
fossil_fatal("server returned an error - clone aborted");
|
|
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
db_set("last-sync-url", g.argv[2], 0);
db_multi_exec(
"REPLACE INTO config(name,value)"
" VALUES('server-code', lower(hex(randomblob(20))));"
);
url_enable_proxy(0);
g.xlinkClusterOnly = 1;
nErr = client_sync(0,0,1,bPrivate,CONFIGSET_ALL,0);
g.xlinkClusterOnly = 0;
verify_cancel();
db_end_transaction(0);
db_close(1);
if( nErr ){
unlink(g.argv[3]);
fossil_fatal("server returned an error - clone aborted");
|