Fossil SCM

Add the --sha1 option to the "fossil new" command, to simplify the creation of new SHA1-only repositories.

drh 2017-03-05 00:08 fossil-2.1
Commit 91f5ad9b94ef47d2e2404f9b2181d6a4f2084485
1 file changed +10 -3
+10 -3
--- src/db.c
+++ src/db.c
@@ -1906,13 +1906,14 @@
19061906
** their associated permissions will not be copied; however, the system
19071907
** default users "anonymous", "nobody", "reader", "developer", and their
19081908
** associated permissions will be copied.
19091909
**
19101910
** Options:
1911
-** --template FILE copy settings from repository file
1912
-** --admin-user|-A USERNAME select given USERNAME as admin user
1913
-** --date-override DATETIME use DATETIME as time of the initial check-in
1911
+** --template FILE Copy settings from repository file
1912
+** --admin-user|-A USERNAME Select given USERNAME as admin user
1913
+** --date-override DATETIME Use DATETIME as time of the initial check-in
1914
+** --sha1 Use a initial hash policy of "sha1"
19141915
**
19151916
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
19161917
** year-month-day form, it may be truncated, the "T" may be replaced by
19171918
** a space, and it may also name a timezone offset from UTC as "-HH:MM"
19181919
** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -1923,15 +1924,17 @@
19231924
void create_repository_cmd(void){
19241925
char *zPassword;
19251926
const char *zTemplate; /* Repository from which to copy settings */
19261927
const char *zDate; /* Date of the initial check-in */
19271928
const char *zDefaultUser; /* Optional name of the default user */
1929
+ int bUseSha1 = 0; /* True to set the hash-policy to sha1 */
19281930
19291931
19301932
zTemplate = find_option("template",0,1);
19311933
zDate = find_option("date-override",0,1);
19321934
zDefaultUser = find_option("admin-user","A",1);
1935
+ bUseSha1 = find_option("sha1",0,0)!=0;
19331936
/* We should be done with options.. */
19341937
verify_all_options();
19351938
19361939
if( g.argc!=3 ){
19371940
usage("REPOSITORY-NAME");
@@ -1944,10 +1947,14 @@
19441947
db_create_repository(g.argv[2]);
19451948
db_open_repository(g.argv[2]);
19461949
db_open_config(0, 0);
19471950
if( zTemplate ) db_attach(zTemplate, "settingSrc");
19481951
db_begin_transaction();
1952
+ if( bUseSha1 ){
1953
+ g.eHashPolicy = HPOLICY_SHA1;
1954
+ db_set_int("hash-policy", HPOLICY_SHA1, 0);
1955
+ }
19491956
if( zDate==0 ) zDate = "now";
19501957
db_initial_setup(zTemplate, zDate, zDefaultUser);
19511958
db_end_transaction(0);
19521959
if( zTemplate ) db_detach("settingSrc");
19531960
fossil_print("project-id: %s\n", db_get("project-code", 0));
19541961
--- src/db.c
+++ src/db.c
@@ -1906,13 +1906,14 @@
1906 ** their associated permissions will not be copied; however, the system
1907 ** default users "anonymous", "nobody", "reader", "developer", and their
1908 ** associated permissions will be copied.
1909 **
1910 ** Options:
1911 ** --template FILE copy settings from repository file
1912 ** --admin-user|-A USERNAME select given USERNAME as admin user
1913 ** --date-override DATETIME use DATETIME as time of the initial check-in
 
1914 **
1915 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
1916 ** year-month-day form, it may be truncated, the "T" may be replaced by
1917 ** a space, and it may also name a timezone offset from UTC as "-HH:MM"
1918 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -1923,15 +1924,17 @@
1923 void create_repository_cmd(void){
1924 char *zPassword;
1925 const char *zTemplate; /* Repository from which to copy settings */
1926 const char *zDate; /* Date of the initial check-in */
1927 const char *zDefaultUser; /* Optional name of the default user */
 
1928
1929
1930 zTemplate = find_option("template",0,1);
1931 zDate = find_option("date-override",0,1);
1932 zDefaultUser = find_option("admin-user","A",1);
 
1933 /* We should be done with options.. */
1934 verify_all_options();
1935
1936 if( g.argc!=3 ){
1937 usage("REPOSITORY-NAME");
@@ -1944,10 +1947,14 @@
1944 db_create_repository(g.argv[2]);
1945 db_open_repository(g.argv[2]);
1946 db_open_config(0, 0);
1947 if( zTemplate ) db_attach(zTemplate, "settingSrc");
1948 db_begin_transaction();
 
 
 
 
1949 if( zDate==0 ) zDate = "now";
1950 db_initial_setup(zTemplate, zDate, zDefaultUser);
1951 db_end_transaction(0);
1952 if( zTemplate ) db_detach("settingSrc");
1953 fossil_print("project-id: %s\n", db_get("project-code", 0));
1954
--- src/db.c
+++ src/db.c
@@ -1906,13 +1906,14 @@
1906 ** their associated permissions will not be copied; however, the system
1907 ** default users "anonymous", "nobody", "reader", "developer", and their
1908 ** associated permissions will be copied.
1909 **
1910 ** Options:
1911 ** --template FILE Copy settings from repository file
1912 ** --admin-user|-A USERNAME Select given USERNAME as admin user
1913 ** --date-override DATETIME Use DATETIME as time of the initial check-in
1914 ** --sha1 Use a initial hash policy of "sha1"
1915 **
1916 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
1917 ** year-month-day form, it may be truncated, the "T" may be replaced by
1918 ** a space, and it may also name a timezone offset from UTC as "-HH:MM"
1919 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -1923,15 +1924,17 @@
1924 void create_repository_cmd(void){
1925 char *zPassword;
1926 const char *zTemplate; /* Repository from which to copy settings */
1927 const char *zDate; /* Date of the initial check-in */
1928 const char *zDefaultUser; /* Optional name of the default user */
1929 int bUseSha1 = 0; /* True to set the hash-policy to sha1 */
1930
1931
1932 zTemplate = find_option("template",0,1);
1933 zDate = find_option("date-override",0,1);
1934 zDefaultUser = find_option("admin-user","A",1);
1935 bUseSha1 = find_option("sha1",0,0)!=0;
1936 /* We should be done with options.. */
1937 verify_all_options();
1938
1939 if( g.argc!=3 ){
1940 usage("REPOSITORY-NAME");
@@ -1944,10 +1947,14 @@
1947 db_create_repository(g.argv[2]);
1948 db_open_repository(g.argv[2]);
1949 db_open_config(0, 0);
1950 if( zTemplate ) db_attach(zTemplate, "settingSrc");
1951 db_begin_transaction();
1952 if( bUseSha1 ){
1953 g.eHashPolicy = HPOLICY_SHA1;
1954 db_set_int("hash-policy", HPOLICY_SHA1, 0);
1955 }
1956 if( zDate==0 ) zDate = "now";
1957 db_initial_setup(zTemplate, zDate, zDefaultUser);
1958 db_end_transaction(0);
1959 if( zTemplate ) db_detach("settingSrc");
1960 fossil_print("project-id: %s\n", db_get("project-code", 0));
1961

Keyboard Shortcuts

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