Fossil SCM

Provide --user-override option on the ci command and the --date-override option on the new command. Make a correction to the file format document.

drh 2009-08-08 22:40 trunk
Commit 8b630bb57a21912ca2b925fb8cabaa0d66d0654c
+3 -1
--- src/checkin.c
+++ src/checkin.c
@@ -410,10 +410,11 @@
410410
char *zManifestFile; /* Name of the manifest file */
411411
int nBasename; /* Length of "g.zLocalRoot/" */
412412
const char *zBranch; /* Create a new branch with this name */
413413
const char *zBgColor; /* Set background color when branching */
414414
const char *zDateOvrd; /* Override date string */
415
+ const char *zUserOvrd; /* Override user name */
415416
Blob filename; /* complete filename */
416417
Blob manifest;
417418
Blob muuid; /* Manifest uuid */
418419
Blob mcksum; /* Self-checksum on the manifest */
419420
Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -424,10 +425,11 @@
424425
zComment = find_option("comment","m",1);
425426
forceFlag = find_option("force", "f", 0)!=0;
426427
zBranch = find_option("branch","b",1);
427428
zBgColor = find_option("bgcolor",0,1);
428429
zDateOvrd = find_option("date-override",0,1);
430
+ zUserOvrd = find_option("user-override",0,1);
429431
db_must_be_within_tree();
430432
noSign = db_get_boolean("omitsign", 0)|noSign;
431433
if( db_get_boolean("clearsign", 1)==0 ){ noSign = 1; }
432434
verify_all_options();
433435
@@ -623,11 +625,11 @@
623625
const char *zTag = db_column_text(&q, 0);
624626
blob_appendf(&manifest, "T -%F *\n", zTag);
625627
}
626628
db_finalize(&q);
627629
}
628
- blob_appendf(&manifest, "U %F\n", g.zLogin);
630
+ blob_appendf(&manifest, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
629631
md5sum_blob(&manifest, &mcksum);
630632
blob_appendf(&manifest, "Z %b\n", &mcksum);
631633
zManifestFile = mprintf("%smanifest", g.zLocalRoot);
632634
if( !noSign && clearsign(&manifest, &manifest) ){
633635
Blob ans;
634636
--- src/checkin.c
+++ src/checkin.c
@@ -410,10 +410,11 @@
410 char *zManifestFile; /* Name of the manifest file */
411 int nBasename; /* Length of "g.zLocalRoot/" */
412 const char *zBranch; /* Create a new branch with this name */
413 const char *zBgColor; /* Set background color when branching */
414 const char *zDateOvrd; /* Override date string */
 
415 Blob filename; /* complete filename */
416 Blob manifest;
417 Blob muuid; /* Manifest uuid */
418 Blob mcksum; /* Self-checksum on the manifest */
419 Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -424,10 +425,11 @@
424 zComment = find_option("comment","m",1);
425 forceFlag = find_option("force", "f", 0)!=0;
426 zBranch = find_option("branch","b",1);
427 zBgColor = find_option("bgcolor",0,1);
428 zDateOvrd = find_option("date-override",0,1);
 
429 db_must_be_within_tree();
430 noSign = db_get_boolean("omitsign", 0)|noSign;
431 if( db_get_boolean("clearsign", 1)==0 ){ noSign = 1; }
432 verify_all_options();
433
@@ -623,11 +625,11 @@
623 const char *zTag = db_column_text(&q, 0);
624 blob_appendf(&manifest, "T -%F *\n", zTag);
625 }
626 db_finalize(&q);
627 }
628 blob_appendf(&manifest, "U %F\n", g.zLogin);
629 md5sum_blob(&manifest, &mcksum);
630 blob_appendf(&manifest, "Z %b\n", &mcksum);
631 zManifestFile = mprintf("%smanifest", g.zLocalRoot);
632 if( !noSign && clearsign(&manifest, &manifest) ){
633 Blob ans;
634
--- src/checkin.c
+++ src/checkin.c
@@ -410,10 +410,11 @@
410 char *zManifestFile; /* Name of the manifest file */
411 int nBasename; /* Length of "g.zLocalRoot/" */
412 const char *zBranch; /* Create a new branch with this name */
413 const char *zBgColor; /* Set background color when branching */
414 const char *zDateOvrd; /* Override date string */
415 const char *zUserOvrd; /* Override user name */
416 Blob filename; /* complete filename */
417 Blob manifest;
418 Blob muuid; /* Manifest uuid */
419 Blob mcksum; /* Self-checksum on the manifest */
420 Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -424,10 +425,11 @@
425 zComment = find_option("comment","m",1);
426 forceFlag = find_option("force", "f", 0)!=0;
427 zBranch = find_option("branch","b",1);
428 zBgColor = find_option("bgcolor",0,1);
429 zDateOvrd = find_option("date-override",0,1);
430 zUserOvrd = find_option("user-override",0,1);
431 db_must_be_within_tree();
432 noSign = db_get_boolean("omitsign", 0)|noSign;
433 if( db_get_boolean("clearsign", 1)==0 ){ noSign = 1; }
434 verify_all_options();
435
@@ -623,11 +625,11 @@
625 const char *zTag = db_column_text(&q, 0);
626 blob_appendf(&manifest, "T -%F *\n", zTag);
627 }
628 db_finalize(&q);
629 }
630 blob_appendf(&manifest, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
631 md5sum_blob(&manifest, &mcksum);
632 blob_appendf(&manifest, "Z %b\n", &mcksum);
633 zManifestFile = mprintf("%smanifest", g.zLocalRoot);
634 if( !noSign && clearsign(&manifest, &manifest) ){
635 Blob ans;
636
+11 -6
--- src/db.c
+++ src/db.c
@@ -913,15 +913,16 @@
913913
** Fill an empty repository database with the basic information for a
914914
** repository. This function is shared between 'create_repository_cmd'
915915
** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
916916
** new repositories.
917917
**
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
920921
** not server and project codes are invented for this repository.
921922
*/
922
-void db_initial_setup (int makeInitialVersion, int makeServerCodes){
923
+void db_initial_setup (const char *zInitialDate, int makeServerCodes){
923924
char *zDate;
924925
Blob hash;
925926
Blob manifest;
926927
927928
db_set("content-schema", CONTENT_SCHEMA, 0);
@@ -937,15 +938,15 @@
937938
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
938939
if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
939940
db_create_default_users(0);
940941
user_select();
941942
942
- if (makeInitialVersion){
943
+ if( zInitialDate ){
943944
int rid;
944945
blob_zero(&manifest);
945946
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);
947948
zDate[10]='T';
948949
blob_appendf(&manifest, "D %s\n", zDate);
949950
blob_appendf(&manifest, "P\n");
950951
md5sum_init();
951952
blob_appendf(&manifest, "R %s\n", md5sum_finish(0));
@@ -969,18 +970,22 @@
969970
** This command is distinct from "clone". The "clone" command makes
970971
** a copy of an existing project. This command starts a new project.
971972
*/
972973
void create_repository_cmd(void){
973974
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";
974979
if( g.argc!=3 ){
975980
usage("REPOSITORY-NAME");
976981
}
977982
db_create_repository(g.argv[2]);
978983
db_open_repository(g.argv[2]);
979984
db_open_config();
980985
db_begin_transaction();
981
- db_initial_setup(1, 1);
986
+ db_initial_setup(zDate, 1);
982987
db_end_transaction(0);
983988
printf("project-id: %s\n", db_get("project-code", 0));
984989
printf("server-id: %s\n", db_get("server-code", 0));
985990
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
986991
printf("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword);
987992
--- src/db.c
+++ src/db.c
@@ -913,15 +913,16 @@
913 ** Fill an empty repository database with the basic information for a
914 ** repository. This function is shared between 'create_repository_cmd'
915 ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
916 ** new repositories.
917 **
918 ** The makeInitialVersion flag determines whether or not an initial
919 ** manifest is created. The makeServerCodes flag determines whether or
 
920 ** not server and project codes are invented for this repository.
921 */
922 void db_initial_setup (int makeInitialVersion, int makeServerCodes){
923 char *zDate;
924 Blob hash;
925 Blob manifest;
926
927 db_set("content-schema", CONTENT_SCHEMA, 0);
@@ -937,15 +938,15 @@
937 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
938 if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
939 db_create_default_users(0);
940 user_select();
941
942 if (makeInitialVersion){
943 int rid;
944 blob_zero(&manifest);
945 blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n");
946 zDate = db_text(0, "SELECT datetime('now')");
947 zDate[10]='T';
948 blob_appendf(&manifest, "D %s\n", zDate);
949 blob_appendf(&manifest, "P\n");
950 md5sum_init();
951 blob_appendf(&manifest, "R %s\n", md5sum_finish(0));
@@ -969,18 +970,22 @@
969 ** This command is distinct from "clone". The "clone" command makes
970 ** a copy of an existing project. This command starts a new project.
971 */
972 void create_repository_cmd(void){
973 char *zPassword;
 
 
 
 
974 if( g.argc!=3 ){
975 usage("REPOSITORY-NAME");
976 }
977 db_create_repository(g.argv[2]);
978 db_open_repository(g.argv[2]);
979 db_open_config();
980 db_begin_transaction();
981 db_initial_setup(1, 1);
982 db_end_transaction(0);
983 printf("project-id: %s\n", db_get("project-code", 0));
984 printf("server-id: %s\n", db_get("server-code", 0));
985 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
986 printf("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword);
987
--- src/db.c
+++ src/db.c
@@ -913,15 +913,16 @@
913 ** Fill an empty repository database with the basic information for a
914 ** repository. This function is shared between 'create_repository_cmd'
915 ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
916 ** new repositories.
917 **
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
921 ** not server and project codes are invented for this repository.
922 */
923 void db_initial_setup (const char *zInitialDate, int makeServerCodes){
924 char *zDate;
925 Blob hash;
926 Blob manifest;
927
928 db_set("content-schema", CONTENT_SCHEMA, 0);
@@ -937,15 +938,15 @@
938 if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
939 if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
940 db_create_default_users(0);
941 user_select();
942
943 if( zInitialDate ){
944 int rid;
945 blob_zero(&manifest);
946 blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n");
947 zDate = db_text(0, "SELECT datetime(%Q)", zInitialDate);
948 zDate[10]='T';
949 blob_appendf(&manifest, "D %s\n", zDate);
950 blob_appendf(&manifest, "P\n");
951 md5sum_init();
952 blob_appendf(&manifest, "R %s\n", md5sum_finish(0));
@@ -969,18 +970,22 @@
970 ** This command is distinct from "clone". The "clone" command makes
971 ** a copy of an existing project. This command starts a new project.
972 */
973 void create_repository_cmd(void){
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";
979 if( g.argc!=3 ){
980 usage("REPOSITORY-NAME");
981 }
982 db_create_repository(g.argv[2]);
983 db_open_repository(g.argv[2]);
984 db_open_config();
985 db_begin_transaction();
986 db_initial_setup(zDate, 1);
987 db_end_transaction(0);
988 printf("project-id: %s\n", db_get("project-code", 0));
989 printf("server-id: %s\n", db_get("server-code", 0));
990 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
991 printf("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword);
992
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -158,17 +158,10 @@
158158
The optional 4th argument is the name of the same file as it existed in
159159
the parent check-in. If the name of the file is unchanged from its
160160
parent, then the 4th argument is omitted.
161161
</p>
162162
163
-<p>
164
-A manifest has zero or more N-cards. Each N card records a name changes
165
-to one of the files in the manifest. The first argument to the N code is
166
-the name of the file in the parent check-in. The second argument is the
167
-name of the file in the check-in defined by the manifest.
168
-</p>
169
-
170163
<p>
171164
A manifest has zero or one P-cards. Most manifests have one P-card.
172165
The P-card has a varying number of arguments that
173166
defines other manifests from which the current manifest
174167
is derived. Each argument is an 40-character lowercase
175168
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -158,17 +158,10 @@
158 The optional 4th argument is the name of the same file as it existed in
159 the parent check-in. If the name of the file is unchanged from its
160 parent, then the 4th argument is omitted.
161 </p>
162
163 <p>
164 A manifest has zero or more N-cards. Each N card records a name changes
165 to one of the files in the manifest. The first argument to the N code is
166 the name of the file in the parent check-in. The second argument is the
167 name of the file in the check-in defined by the manifest.
168 </p>
169
170 <p>
171 A manifest has zero or one P-cards. Most manifests have one P-card.
172 The P-card has a varying number of arguments that
173 defines other manifests from which the current manifest
174 is derived. Each argument is an 40-character lowercase
175
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -158,17 +158,10 @@
158 The optional 4th argument is the name of the same file as it existed in
159 the parent check-in. If the name of the file is unchanged from its
160 parent, then the 4th argument is omitted.
161 </p>
162
 
 
 
 
 
 
 
163 <p>
164 A manifest has zero or one P-cards. Most manifests have one P-card.
165 The P-card has a varying number of arguments that
166 defines other manifests from which the current manifest
167 is derived. Each argument is an 40-character lowercase
168

Keyboard Shortcuts

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