Fossil SCM
In addition to ticket [9195b1e5f3] and commit [b8d812efb9], this adds the -A|--admin-user options to the clone command.
Commit
d3e38231f2bf9bed5e77a123cd253b1e41c38e05
Parent
fc23960258211b5…
1 file changed
+19
-5
+19
-5
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -30,25 +30,39 @@ | ||
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | /* |
| 33 | 33 | ** COMMAND: clone |
| 34 | 34 | ** |
| 35 | -** Usage: %fossil clone URL FILENAME | |
| 35 | +** Usage: %fossil clone ?OPTIONS? URL FILENAME | |
| 36 | 36 | ** |
| 37 | 37 | ** Make a clone of a repository specified by URL in the local |
| 38 | 38 | ** file named FILENAME. |
| 39 | +** | |
| 40 | +** By default, your current login name is used to create the default | |
| 41 | +** admin user. This can be overridden using the -A|--admin-user | |
| 42 | +** parameter. | |
| 43 | +** | |
| 44 | +** Options: | |
| 45 | +** | |
| 46 | +** --admin-user|-A USERNAME | |
| 47 | +** | |
| 39 | 48 | */ |
| 40 | 49 | void clone_cmd(void){ |
| 41 | 50 | char *zPassword; |
| 51 | + const char *zDefaultUser; /* Optional name of the default user */ | |
| 52 | + | |
| 42 | 53 | url_proxy_options(); |
| 43 | - if( g.argc!=4 ){ | |
| 44 | - usage("FILE-OR-URL NEW-REPOSITORY"); | |
| 54 | + if( g.argc < 4 ){ | |
| 55 | + usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); | |
| 45 | 56 | } |
| 46 | 57 | db_open_config(0); |
| 47 | 58 | if( file_size(g.argv[3])>0 ){ |
| 48 | 59 | fossil_panic("file already exists: %s", g.argv[3]); |
| 49 | 60 | } |
| 61 | + | |
| 62 | + zDefaultUser = find_option("admin-user","A",1); | |
| 63 | + | |
| 50 | 64 | url_parse(g.argv[2]); |
| 51 | 65 | if( g.urlIsFile ){ |
| 52 | 66 | file_copy(g.urlName, g.argv[3]); |
| 53 | 67 | db_close(); |
| 54 | 68 | db_open_repository(g.argv[3]); |
| @@ -66,19 +80,19 @@ | ||
| 66 | 80 | "DELETE FROM private;" |
| 67 | 81 | ); |
| 68 | 82 | shun_artifacts(); |
| 69 | 83 | g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); |
| 70 | 84 | if( g.zLogin==0 ){ |
| 71 | - db_create_default_users(1,0); | |
| 85 | + db_create_default_users(1,zDefaultUser); | |
| 72 | 86 | } |
| 73 | 87 | printf("Repository cloned into %s\n", g.argv[3]); |
| 74 | 88 | }else{ |
| 75 | 89 | db_create_repository(g.argv[3]); |
| 76 | 90 | db_open_repository(g.argv[3]); |
| 77 | 91 | db_begin_transaction(); |
| 78 | 92 | db_record_repository_filename(g.argv[3]); |
| 79 | - db_initial_setup(0, 0, 0); | |
| 93 | + db_initial_setup(0, zDefaultUser, 0); | |
| 80 | 94 | user_select(); |
| 81 | 95 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 82 | 96 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 83 | 97 | db_set("last-sync-url", g.argv[2], 0); |
| 84 | 98 | db_multi_exec( |
| 85 | 99 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -30,25 +30,39 @@ | |
| 30 | |
| 31 | |
| 32 | /* |
| 33 | ** COMMAND: clone |
| 34 | ** |
| 35 | ** Usage: %fossil clone URL FILENAME |
| 36 | ** |
| 37 | ** Make a clone of a repository specified by URL in the local |
| 38 | ** file named FILENAME. |
| 39 | */ |
| 40 | void clone_cmd(void){ |
| 41 | char *zPassword; |
| 42 | url_proxy_options(); |
| 43 | if( g.argc!=4 ){ |
| 44 | usage("FILE-OR-URL NEW-REPOSITORY"); |
| 45 | } |
| 46 | db_open_config(0); |
| 47 | if( file_size(g.argv[3])>0 ){ |
| 48 | fossil_panic("file already exists: %s", g.argv[3]); |
| 49 | } |
| 50 | url_parse(g.argv[2]); |
| 51 | if( g.urlIsFile ){ |
| 52 | file_copy(g.urlName, g.argv[3]); |
| 53 | db_close(); |
| 54 | db_open_repository(g.argv[3]); |
| @@ -66,19 +80,19 @@ | |
| 66 | "DELETE FROM private;" |
| 67 | ); |
| 68 | shun_artifacts(); |
| 69 | g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); |
| 70 | if( g.zLogin==0 ){ |
| 71 | db_create_default_users(1,0); |
| 72 | } |
| 73 | printf("Repository cloned into %s\n", g.argv[3]); |
| 74 | }else{ |
| 75 | db_create_repository(g.argv[3]); |
| 76 | db_open_repository(g.argv[3]); |
| 77 | db_begin_transaction(); |
| 78 | db_record_repository_filename(g.argv[3]); |
| 79 | db_initial_setup(0, 0, 0); |
| 80 | user_select(); |
| 81 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 82 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 83 | db_set("last-sync-url", g.argv[2], 0); |
| 84 | db_multi_exec( |
| 85 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -30,25 +30,39 @@ | |
| 30 | |
| 31 | |
| 32 | /* |
| 33 | ** COMMAND: clone |
| 34 | ** |
| 35 | ** Usage: %fossil clone ?OPTIONS? URL FILENAME |
| 36 | ** |
| 37 | ** Make a clone of a repository specified by URL in the local |
| 38 | ** file named FILENAME. |
| 39 | ** |
| 40 | ** By default, your current login name is used to create the default |
| 41 | ** admin user. This can be overridden using the -A|--admin-user |
| 42 | ** parameter. |
| 43 | ** |
| 44 | ** Options: |
| 45 | ** |
| 46 | ** --admin-user|-A USERNAME |
| 47 | ** |
| 48 | */ |
| 49 | void clone_cmd(void){ |
| 50 | char *zPassword; |
| 51 | const char *zDefaultUser; /* Optional name of the default user */ |
| 52 | |
| 53 | url_proxy_options(); |
| 54 | if( g.argc < 4 ){ |
| 55 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 56 | } |
| 57 | db_open_config(0); |
| 58 | if( file_size(g.argv[3])>0 ){ |
| 59 | fossil_panic("file already exists: %s", g.argv[3]); |
| 60 | } |
| 61 | |
| 62 | zDefaultUser = find_option("admin-user","A",1); |
| 63 | |
| 64 | url_parse(g.argv[2]); |
| 65 | if( g.urlIsFile ){ |
| 66 | file_copy(g.urlName, g.argv[3]); |
| 67 | db_close(); |
| 68 | db_open_repository(g.argv[3]); |
| @@ -66,19 +80,19 @@ | |
| 80 | "DELETE FROM private;" |
| 81 | ); |
| 82 | shun_artifacts(); |
| 83 | g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); |
| 84 | if( g.zLogin==0 ){ |
| 85 | db_create_default_users(1,zDefaultUser); |
| 86 | } |
| 87 | printf("Repository cloned into %s\n", g.argv[3]); |
| 88 | }else{ |
| 89 | db_create_repository(g.argv[3]); |
| 90 | db_open_repository(g.argv[3]); |
| 91 | db_begin_transaction(); |
| 92 | db_record_repository_filename(g.argv[3]); |
| 93 | db_initial_setup(0, zDefaultUser, 0); |
| 94 | user_select(); |
| 95 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 96 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 97 | db_set("last-sync-url", g.argv[2], 0); |
| 98 | db_multi_exec( |
| 99 |