| | @@ -913,15 +913,16 @@ |
| 913 | 913 | ** Fill an empty repository database with the basic information for a |
| 914 | 914 | ** repository. This function is shared between 'create_repository_cmd' |
| 915 | 915 | ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create |
| 916 | 916 | ** new repositories. |
| 917 | 917 | ** |
| 918 | | -** The makeInitialVersion flag determines whether or not an initial |
| 919 | | -** manifest is created. The makeServerCodes flag determines whether or |
| 918 | +** The zInitialDate parameter determines the date of the initial check-in |
| 919 | +** that is automatically created. If zInitialDate is 0 then no initial |
| 920 | +** check-in is created. The makeServerCodes flag determines whether or |
| 920 | 921 | ** not server and project codes are invented for this repository. |
| 921 | 922 | */ |
| 922 | | -void db_initial_setup (int makeInitialVersion, int makeServerCodes){ |
| 923 | +void db_initial_setup (const char *zInitialDate, int makeServerCodes){ |
| 923 | 924 | char *zDate; |
| 924 | 925 | Blob hash; |
| 925 | 926 | Blob manifest; |
| 926 | 927 | |
| 927 | 928 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| | @@ -937,15 +938,15 @@ |
| 937 | 938 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 938 | 939 | if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0); |
| 939 | 940 | db_create_default_users(0); |
| 940 | 941 | user_select(); |
| 941 | 942 | |
| 942 | | - if (makeInitialVersion){ |
| 943 | + if( zInitialDate ){ |
| 943 | 944 | int rid; |
| 944 | 945 | blob_zero(&manifest); |
| 945 | 946 | blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n"); |
| 946 | | - zDate = db_text(0, "SELECT datetime('now')"); |
| 947 | + zDate = db_text(0, "SELECT datetime(%Q)", zInitialDate); |
| 947 | 948 | zDate[10]='T'; |
| 948 | 949 | blob_appendf(&manifest, "D %s\n", zDate); |
| 949 | 950 | blob_appendf(&manifest, "P\n"); |
| 950 | 951 | md5sum_init(); |
| 951 | 952 | blob_appendf(&manifest, "R %s\n", md5sum_finish(0)); |
| | @@ -969,18 +970,22 @@ |
| 969 | 970 | ** This command is distinct from "clone". The "clone" command makes |
| 970 | 971 | ** a copy of an existing project. This command starts a new project. |
| 971 | 972 | */ |
| 972 | 973 | void create_repository_cmd(void){ |
| 973 | 974 | char *zPassword; |
| 975 | + const char *zDate; /* Date of the initial check-in */ |
| 976 | + |
| 977 | + zDate = find_option("date-override",0,1); |
| 978 | + if( zDate==0 ) zDate = "now"; |
| 974 | 979 | if( g.argc!=3 ){ |
| 975 | 980 | usage("REPOSITORY-NAME"); |
| 976 | 981 | } |
| 977 | 982 | db_create_repository(g.argv[2]); |
| 978 | 983 | db_open_repository(g.argv[2]); |
| 979 | 984 | db_open_config(); |
| 980 | 985 | db_begin_transaction(); |
| 981 | | - db_initial_setup(1, 1); |
| 986 | + db_initial_setup(zDate, 1); |
| 982 | 987 | db_end_transaction(0); |
| 983 | 988 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 984 | 989 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 985 | 990 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 986 | 991 | printf("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword); |
| 987 | 992 | |