Fossil SCM
fossil init: added options to set the project name and/or description during fossil init. --project-name --project-desc quote "string that contain spaces"
Commit
9d98d861e559579e6f665e53f8e16885691a8b1d45d7aafbc4138b06043065a5
Parent
b3f3a898c8dd975…
1 file changed
+10
M
src/db.c
+10
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2776,10 +2776,12 @@ | ||
| 2776 | 2776 | ** Options: |
| 2777 | 2777 | ** --template FILE Copy settings from repository file |
| 2778 | 2778 | ** -A|--admin-user USERNAME Select given USERNAME as admin user |
| 2779 | 2779 | ** --date-override DATETIME Use DATETIME as time of the initial check-in |
| 2780 | 2780 | ** --sha1 Use an initial hash policy of "sha1" |
| 2781 | +** --project-name STRING The name of the project "project name in quotes" | |
| 2782 | +** --project-desc STRING The descritption of the project "project description in quotes" | |
| 2781 | 2783 | ** |
| 2782 | 2784 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2783 | 2785 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2784 | 2786 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2785 | 2787 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2790,17 +2792,21 @@ | ||
| 2790 | 2792 | void create_repository_cmd(void){ |
| 2791 | 2793 | char *zPassword; |
| 2792 | 2794 | const char *zTemplate; /* Repository from which to copy settings */ |
| 2793 | 2795 | const char *zDate; /* Date of the initial check-in */ |
| 2794 | 2796 | const char *zDefaultUser; /* Optional name of the default user */ |
| 2797 | + const char *zProjectName; /* Optional project name of the repo */ | |
| 2798 | + const char *zProjectDesc; /* Optional project description "description of project in quotes" */ | |
| 2795 | 2799 | int bUseSha1 = 0; /* True to set the hash-policy to sha1 */ |
| 2796 | 2800 | |
| 2797 | 2801 | |
| 2798 | 2802 | zTemplate = find_option("template",0,1); |
| 2799 | 2803 | zDate = find_option("date-override",0,1); |
| 2800 | 2804 | zDefaultUser = find_option("admin-user","A",1); |
| 2801 | 2805 | bUseSha1 = find_option("sha1",0,0)!=0; |
| 2806 | + zProjectName = find_option("project-name", 0, 1); | |
| 2807 | + zProjectDesc = find_option("project-desc", 0, 1); | |
| 2802 | 2808 | /* We should be done with options.. */ |
| 2803 | 2809 | verify_all_options(); |
| 2804 | 2810 | |
| 2805 | 2811 | if( g.argc!=3 ){ |
| 2806 | 2812 | usage("REPOSITORY-NAME"); |
| @@ -2817,14 +2823,18 @@ | ||
| 2817 | 2823 | db_begin_transaction(); |
| 2818 | 2824 | if( bUseSha1 ){ |
| 2819 | 2825 | g.eHashPolicy = HPOLICY_SHA1; |
| 2820 | 2826 | db_set_int("hash-policy", HPOLICY_SHA1, 0); |
| 2821 | 2827 | } |
| 2828 | + if ( zProjectName ) db_set("project-name", zProjectName, 0); | |
| 2829 | + if ( zProjectDesc ) db_set("project-description", zProjectDesc, 0); | |
| 2822 | 2830 | if( zDate==0 ) zDate = "now"; |
| 2823 | 2831 | db_initial_setup(zTemplate, zDate, zDefaultUser); |
| 2824 | 2832 | db_end_transaction(0); |
| 2825 | 2833 | if( zTemplate ) db_detach("settingSrc"); |
| 2834 | + if( zProjectName ) fossil_print("project-name: %s\n", zProjectName); | |
| 2835 | + if( zProjectDesc ) fossil_print("project-description: %s\n", zProjectDesc); | |
| 2826 | 2836 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 2827 | 2837 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2828 | 2838 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2829 | 2839 | fossil_print("admin-user: %s (initial password is \"%s\")\n", |
| 2830 | 2840 | g.zLogin, zPassword); |
| 2831 | 2841 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2776,10 +2776,12 @@ | |
| 2776 | ** Options: |
| 2777 | ** --template FILE Copy settings from repository file |
| 2778 | ** -A|--admin-user USERNAME Select given USERNAME as admin user |
| 2779 | ** --date-override DATETIME Use DATETIME as time of the initial check-in |
| 2780 | ** --sha1 Use an initial hash policy of "sha1" |
| 2781 | ** |
| 2782 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2783 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2784 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2785 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2790,17 +2792,21 @@ | |
| 2790 | void create_repository_cmd(void){ |
| 2791 | char *zPassword; |
| 2792 | const char *zTemplate; /* Repository from which to copy settings */ |
| 2793 | const char *zDate; /* Date of the initial check-in */ |
| 2794 | const char *zDefaultUser; /* Optional name of the default user */ |
| 2795 | int bUseSha1 = 0; /* True to set the hash-policy to sha1 */ |
| 2796 | |
| 2797 | |
| 2798 | zTemplate = find_option("template",0,1); |
| 2799 | zDate = find_option("date-override",0,1); |
| 2800 | zDefaultUser = find_option("admin-user","A",1); |
| 2801 | bUseSha1 = find_option("sha1",0,0)!=0; |
| 2802 | /* We should be done with options.. */ |
| 2803 | verify_all_options(); |
| 2804 | |
| 2805 | if( g.argc!=3 ){ |
| 2806 | usage("REPOSITORY-NAME"); |
| @@ -2817,14 +2823,18 @@ | |
| 2817 | db_begin_transaction(); |
| 2818 | if( bUseSha1 ){ |
| 2819 | g.eHashPolicy = HPOLICY_SHA1; |
| 2820 | db_set_int("hash-policy", HPOLICY_SHA1, 0); |
| 2821 | } |
| 2822 | if( zDate==0 ) zDate = "now"; |
| 2823 | db_initial_setup(zTemplate, zDate, zDefaultUser); |
| 2824 | db_end_transaction(0); |
| 2825 | if( zTemplate ) db_detach("settingSrc"); |
| 2826 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 2827 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2828 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2829 | fossil_print("admin-user: %s (initial password is \"%s\")\n", |
| 2830 | g.zLogin, zPassword); |
| 2831 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2776,10 +2776,12 @@ | |
| 2776 | ** Options: |
| 2777 | ** --template FILE Copy settings from repository file |
| 2778 | ** -A|--admin-user USERNAME Select given USERNAME as admin user |
| 2779 | ** --date-override DATETIME Use DATETIME as time of the initial check-in |
| 2780 | ** --sha1 Use an initial hash policy of "sha1" |
| 2781 | ** --project-name STRING The name of the project "project name in quotes" |
| 2782 | ** --project-desc STRING The descritption of the project "project description in quotes" |
| 2783 | ** |
| 2784 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2785 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2786 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2787 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2790,17 +2792,21 @@ | |
| 2792 | void create_repository_cmd(void){ |
| 2793 | char *zPassword; |
| 2794 | const char *zTemplate; /* Repository from which to copy settings */ |
| 2795 | const char *zDate; /* Date of the initial check-in */ |
| 2796 | const char *zDefaultUser; /* Optional name of the default user */ |
| 2797 | const char *zProjectName; /* Optional project name of the repo */ |
| 2798 | const char *zProjectDesc; /* Optional project description "description of project in quotes" */ |
| 2799 | int bUseSha1 = 0; /* True to set the hash-policy to sha1 */ |
| 2800 | |
| 2801 | |
| 2802 | zTemplate = find_option("template",0,1); |
| 2803 | zDate = find_option("date-override",0,1); |
| 2804 | zDefaultUser = find_option("admin-user","A",1); |
| 2805 | bUseSha1 = find_option("sha1",0,0)!=0; |
| 2806 | zProjectName = find_option("project-name", 0, 1); |
| 2807 | zProjectDesc = find_option("project-desc", 0, 1); |
| 2808 | /* We should be done with options.. */ |
| 2809 | verify_all_options(); |
| 2810 | |
| 2811 | if( g.argc!=3 ){ |
| 2812 | usage("REPOSITORY-NAME"); |
| @@ -2817,14 +2823,18 @@ | |
| 2823 | db_begin_transaction(); |
| 2824 | if( bUseSha1 ){ |
| 2825 | g.eHashPolicy = HPOLICY_SHA1; |
| 2826 | db_set_int("hash-policy", HPOLICY_SHA1, 0); |
| 2827 | } |
| 2828 | if ( zProjectName ) db_set("project-name", zProjectName, 0); |
| 2829 | if ( zProjectDesc ) db_set("project-description", zProjectDesc, 0); |
| 2830 | if( zDate==0 ) zDate = "now"; |
| 2831 | db_initial_setup(zTemplate, zDate, zDefaultUser); |
| 2832 | db_end_transaction(0); |
| 2833 | if( zTemplate ) db_detach("settingSrc"); |
| 2834 | if( zProjectName ) fossil_print("project-name: %s\n", zProjectName); |
| 2835 | if( zProjectDesc ) fossil_print("project-description: %s\n", zProjectDesc); |
| 2836 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 2837 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2838 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2839 | fossil_print("admin-user: %s (initial password is \"%s\")\n", |
| 2840 | g.zLogin, zPassword); |
| 2841 |