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
Commit
2cc6fd910744ec9905e0ccf2322b8e4753d2ae6e
Parent
5c59d7e9c61c2ba…
1 file changed
+6
-2
+6
-2
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -38,13 +38,17 @@ | ||
| 38 | 38 | const char *zColor; /* Color of the new branch */ |
| 39 | 39 | Blob branch; /* manifest for the new branch */ |
| 40 | 40 | Blob parent; /* root check-in manifest */ |
| 41 | 41 | Manifest mParent; /* Parsed parent manifest */ |
| 42 | 42 | Blob mcksum; /* Self-checksum on the manifest */ |
| 43 | + const char *zDateOvrd; /* Override date string */ | |
| 44 | + const char *zUserOvrd; /* Override user name */ | |
| 43 | 45 | |
| 44 | 46 | noSign = find_option("nosign","",0)!=0; |
| 45 | 47 | zColor = find_option("bgcolor","c",1); |
| 48 | + zDateOvrd = find_option("date-override",0,1); | |
| 49 | + zUserOvrd = find_option("user-override",0,1); | |
| 46 | 50 | verify_all_options(); |
| 47 | 51 | if( g.argc<5 ){ |
| 48 | 52 | usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?"); |
| 49 | 53 | } |
| 50 | 54 | db_find_and_open_repository(1); |
| @@ -72,11 +76,11 @@ | ||
| 72 | 76 | |
| 73 | 77 | /* Create a manifest for the new branch */ |
| 74 | 78 | blob_zero(&branch); |
| 75 | 79 | zComment = mprintf("Create new branch named \"%h\"", zBranch); |
| 76 | 80 | blob_appendf(&branch, "C %F\n", zComment); |
| 77 | - zDate = db_text(0, "SELECT datetime('now')"); | |
| 81 | + zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now"); | |
| 78 | 82 | zDate[10] = 'T'; |
| 79 | 83 | blob_appendf(&branch, "D %s\n", zDate); |
| 80 | 84 | |
| 81 | 85 | /* Copy all of the content from the parent into the branch */ |
| 82 | 86 | content_get(rootid, &parent); |
| @@ -120,11 +124,11 @@ | ||
| 120 | 124 | const char *zTag = db_column_text(&q, 0); |
| 121 | 125 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 122 | 126 | } |
| 123 | 127 | db_finalize(&q); |
| 124 | 128 | |
| 125 | - blob_appendf(&branch, "U %F\n", g.zLogin); | |
| 129 | + blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); | |
| 126 | 130 | md5sum_blob(&branch, &mcksum); |
| 127 | 131 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 128 | 132 | if( !noSign && clearsign(&branch, &branch) ){ |
| 129 | 133 | Blob ans; |
| 130 | 134 | blob_zero(&ans); |
| 131 | 135 |
| --- 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 |