Fossil SCM

Allow fossil branch new --date-override 'YYYY-MM-DD HH:MM:SS' --user-override user thebranch checkin To aid in importing historic data from other scm's

renez 2010-10-01 18:02 trunk
Commit 2cc6fd910744ec9905e0ccf2322b8e4753d2ae6e
1 file changed +6 -2
+6 -2
--- src/branch.c
+++ src/branch.c
@@ -38,13 +38,17 @@
3838
const char *zColor; /* Color of the new branch */
3939
Blob branch; /* manifest for the new branch */
4040
Blob parent; /* root check-in manifest */
4141
Manifest mParent; /* Parsed parent manifest */
4242
Blob mcksum; /* Self-checksum on the manifest */
43
+ const char *zDateOvrd; /* Override date string */
44
+ const char *zUserOvrd; /* Override user name */
4345
4446
noSign = find_option("nosign","",0)!=0;
4547
zColor = find_option("bgcolor","c",1);
48
+ zDateOvrd = find_option("date-override",0,1);
49
+ zUserOvrd = find_option("user-override",0,1);
4650
verify_all_options();
4751
if( g.argc<5 ){
4852
usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?");
4953
}
5054
db_find_and_open_repository(1);
@@ -72,11 +76,11 @@
7276
7377
/* Create a manifest for the new branch */
7478
blob_zero(&branch);
7579
zComment = mprintf("Create new branch named \"%h\"", zBranch);
7680
blob_appendf(&branch, "C %F\n", zComment);
77
- zDate = db_text(0, "SELECT datetime('now')");
81
+ zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
7882
zDate[10] = 'T';
7983
blob_appendf(&branch, "D %s\n", zDate);
8084
8185
/* Copy all of the content from the parent into the branch */
8286
content_get(rootid, &parent);
@@ -120,11 +124,11 @@
120124
const char *zTag = db_column_text(&q, 0);
121125
blob_appendf(&branch, "T -%F *\n", zTag);
122126
}
123127
db_finalize(&q);
124128
125
- blob_appendf(&branch, "U %F\n", g.zLogin);
129
+ blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
126130
md5sum_blob(&branch, &mcksum);
127131
blob_appendf(&branch, "Z %b\n", &mcksum);
128132
if( !noSign && clearsign(&branch, &branch) ){
129133
Blob ans;
130134
blob_zero(&ans);
131135
--- src/branch.c
+++ src/branch.c
@@ -38,13 +38,17 @@
38 const char *zColor; /* Color of the new branch */
39 Blob branch; /* manifest for the new branch */
40 Blob parent; /* root check-in manifest */
41 Manifest mParent; /* Parsed parent manifest */
42 Blob mcksum; /* Self-checksum on the manifest */
 
 
43
44 noSign = find_option("nosign","",0)!=0;
45 zColor = find_option("bgcolor","c",1);
 
 
46 verify_all_options();
47 if( g.argc<5 ){
48 usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?");
49 }
50 db_find_and_open_repository(1);
@@ -72,11 +76,11 @@
72
73 /* Create a manifest for the new branch */
74 blob_zero(&branch);
75 zComment = mprintf("Create new branch named \"%h\"", zBranch);
76 blob_appendf(&branch, "C %F\n", zComment);
77 zDate = db_text(0, "SELECT datetime('now')");
78 zDate[10] = 'T';
79 blob_appendf(&branch, "D %s\n", zDate);
80
81 /* Copy all of the content from the parent into the branch */
82 content_get(rootid, &parent);
@@ -120,11 +124,11 @@
120 const char *zTag = db_column_text(&q, 0);
121 blob_appendf(&branch, "T -%F *\n", zTag);
122 }
123 db_finalize(&q);
124
125 blob_appendf(&branch, "U %F\n", g.zLogin);
126 md5sum_blob(&branch, &mcksum);
127 blob_appendf(&branch, "Z %b\n", &mcksum);
128 if( !noSign && clearsign(&branch, &branch) ){
129 Blob ans;
130 blob_zero(&ans);
131
--- src/branch.c
+++ src/branch.c
@@ -38,13 +38,17 @@
38 const char *zColor; /* Color of the new branch */
39 Blob branch; /* manifest for the new branch */
40 Blob parent; /* root check-in manifest */
41 Manifest mParent; /* Parsed parent manifest */
42 Blob mcksum; /* Self-checksum on the manifest */
43 const char *zDateOvrd; /* Override date string */
44 const char *zUserOvrd; /* Override user name */
45
46 noSign = find_option("nosign","",0)!=0;
47 zColor = find_option("bgcolor","c",1);
48 zDateOvrd = find_option("date-override",0,1);
49 zUserOvrd = find_option("user-override",0,1);
50 verify_all_options();
51 if( g.argc<5 ){
52 usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?");
53 }
54 db_find_and_open_repository(1);
@@ -72,11 +76,11 @@
76
77 /* Create a manifest for the new branch */
78 blob_zero(&branch);
79 zComment = mprintf("Create new branch named \"%h\"", zBranch);
80 blob_appendf(&branch, "C %F\n", zComment);
81 zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
82 zDate[10] = 'T';
83 blob_appendf(&branch, "D %s\n", zDate);
84
85 /* Copy all of the content from the parent into the branch */
86 content_get(rootid, &parent);
@@ -120,11 +124,11 @@
124 const char *zTag = db_column_text(&q, 0);
125 blob_appendf(&branch, "T -%F *\n", zTag);
126 }
127 db_finalize(&q);
128
129 blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
130 md5sum_blob(&branch, &mcksum);
131 blob_appendf(&branch, "Z %b\n", &mcksum);
132 if( !noSign && clearsign(&branch, &branch) ){
133 Blob ans;
134 blob_zero(&ans);
135

Keyboard Shortcuts

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