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"

rdb 2022-01-15 04:11 trunk
Commit 9d98d861e559579e6f665e53f8e16885691a8b1d45d7aafbc4138b06043065a5
1 file changed +10
+10
--- src/db.c
+++ src/db.c
@@ -2776,10 +2776,12 @@
27762776
** Options:
27772777
** --template FILE Copy settings from repository file
27782778
** -A|--admin-user USERNAME Select given USERNAME as admin user
27792779
** --date-override DATETIME Use DATETIME as time of the initial check-in
27802780
** --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"
27812783
**
27822784
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
27832785
** year-month-day form, it may be truncated, the "T" may be replaced by
27842786
** a space, and it may also name a timezone offset from UTC as "-HH:MM"
27852787
** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2790,17 +2792,21 @@
27902792
void create_repository_cmd(void){
27912793
char *zPassword;
27922794
const char *zTemplate; /* Repository from which to copy settings */
27932795
const char *zDate; /* Date of the initial check-in */
27942796
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" */
27952799
int bUseSha1 = 0; /* True to set the hash-policy to sha1 */
27962800
27972801
27982802
zTemplate = find_option("template",0,1);
27992803
zDate = find_option("date-override",0,1);
28002804
zDefaultUser = find_option("admin-user","A",1);
28012805
bUseSha1 = find_option("sha1",0,0)!=0;
2806
+ zProjectName = find_option("project-name", 0, 1);
2807
+ zProjectDesc = find_option("project-desc", 0, 1);
28022808
/* We should be done with options.. */
28032809
verify_all_options();
28042810
28052811
if( g.argc!=3 ){
28062812
usage("REPOSITORY-NAME");
@@ -2817,14 +2823,18 @@
28172823
db_begin_transaction();
28182824
if( bUseSha1 ){
28192825
g.eHashPolicy = HPOLICY_SHA1;
28202826
db_set_int("hash-policy", HPOLICY_SHA1, 0);
28212827
}
2828
+ if ( zProjectName ) db_set("project-name", zProjectName, 0);
2829
+ if ( zProjectDesc ) db_set("project-description", zProjectDesc, 0);
28222830
if( zDate==0 ) zDate = "now";
28232831
db_initial_setup(zTemplate, zDate, zDefaultUser);
28242832
db_end_transaction(0);
28252833
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);
28262836
fossil_print("project-id: %s\n", db_get("project-code", 0));
28272837
fossil_print("server-id: %s\n", db_get("server-code", 0));
28282838
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
28292839
fossil_print("admin-user: %s (initial password is \"%s\")\n",
28302840
g.zLogin, zPassword);
28312841
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button