Fossil SCM
Add the --sha1 option to the "fossil new" command, to simplify the creation of new SHA1-only repositories.
Commit
91f5ad9b94ef47d2e2404f9b2181d6a4f2084485
Parent
d9b3a863efa3781…
1 file changed
+10
-3
M
src/db.c
+10
-3
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1906,13 +1906,14 @@ | ||
| 1906 | 1906 | ** their associated permissions will not be copied; however, the system |
| 1907 | 1907 | ** default users "anonymous", "nobody", "reader", "developer", and their |
| 1908 | 1908 | ** associated permissions will be copied. |
| 1909 | 1909 | ** |
| 1910 | 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 | |
| 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" | |
| 1914 | 1915 | ** |
| 1915 | 1916 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 1916 | 1917 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 1917 | 1918 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 1918 | 1919 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -1923,15 +1924,17 @@ | ||
| 1923 | 1924 | void create_repository_cmd(void){ |
| 1924 | 1925 | char *zPassword; |
| 1925 | 1926 | const char *zTemplate; /* Repository from which to copy settings */ |
| 1926 | 1927 | const char *zDate; /* Date of the initial check-in */ |
| 1927 | 1928 | const char *zDefaultUser; /* Optional name of the default user */ |
| 1929 | + int bUseSha1 = 0; /* True to set the hash-policy to sha1 */ | |
| 1928 | 1930 | |
| 1929 | 1931 | |
| 1930 | 1932 | zTemplate = find_option("template",0,1); |
| 1931 | 1933 | zDate = find_option("date-override",0,1); |
| 1932 | 1934 | zDefaultUser = find_option("admin-user","A",1); |
| 1935 | + bUseSha1 = find_option("sha1",0,0)!=0; | |
| 1933 | 1936 | /* We should be done with options.. */ |
| 1934 | 1937 | verify_all_options(); |
| 1935 | 1938 | |
| 1936 | 1939 | if( g.argc!=3 ){ |
| 1937 | 1940 | usage("REPOSITORY-NAME"); |
| @@ -1944,10 +1947,14 @@ | ||
| 1944 | 1947 | db_create_repository(g.argv[2]); |
| 1945 | 1948 | db_open_repository(g.argv[2]); |
| 1946 | 1949 | db_open_config(0, 0); |
| 1947 | 1950 | if( zTemplate ) db_attach(zTemplate, "settingSrc"); |
| 1948 | 1951 | db_begin_transaction(); |
| 1952 | + if( bUseSha1 ){ | |
| 1953 | + g.eHashPolicy = HPOLICY_SHA1; | |
| 1954 | + db_set_int("hash-policy", HPOLICY_SHA1, 0); | |
| 1955 | + } | |
| 1949 | 1956 | if( zDate==0 ) zDate = "now"; |
| 1950 | 1957 | db_initial_setup(zTemplate, zDate, zDefaultUser); |
| 1951 | 1958 | db_end_transaction(0); |
| 1952 | 1959 | if( zTemplate ) db_detach("settingSrc"); |
| 1953 | 1960 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 1954 | 1961 |
| --- 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 |