Fossil SCM
Allow fossil tag add --date-override 'YYYY-MM-DD HH:MM:SS' --user-override user thetag checkin To aid in importing historic data from other scm's
Commit
5c59d7e9c61c2ba1c572a610b58a7f684523c211
Parent
172dccb66fa571b…
2 files changed
+2
-2
+14
-5
+2
-2
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -181,12 +181,12 @@ | ||
| 181 | 181 | if( rid==0 ) return; |
| 182 | 182 | |
| 183 | 183 | /* Add the trunk tag to the root of the whole tree */ |
| 184 | 184 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 185 | 185 | if( zUuid==0 ) return; |
| 186 | - tag_add_artifact("sym-", "trunk", zUuid, 0, 2); | |
| 187 | - tag_add_artifact("", "branch", zUuid, "trunk", 2); | |
| 186 | + tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0); | |
| 187 | + tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0); | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /* |
| 191 | 191 | ** Core function to rebuild the infomration in the derived tables of a |
| 192 | 192 | ** fossil repository from the blobs. This function is shared between |
| 193 | 193 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -181,12 +181,12 @@ | |
| 181 | if( rid==0 ) return; |
| 182 | |
| 183 | /* Add the trunk tag to the root of the whole tree */ |
| 184 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 185 | if( zUuid==0 ) return; |
| 186 | tag_add_artifact("sym-", "trunk", zUuid, 0, 2); |
| 187 | tag_add_artifact("", "branch", zUuid, "trunk", 2); |
| 188 | } |
| 189 | |
| 190 | /* |
| 191 | ** Core function to rebuild the infomration in the derived tables of a |
| 192 | ** fossil repository from the blobs. This function is shared between |
| 193 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -181,12 +181,12 @@ | |
| 181 | if( rid==0 ) return; |
| 182 | |
| 183 | /* Add the trunk tag to the root of the whole tree */ |
| 184 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 185 | if( zUuid==0 ) return; |
| 186 | tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0); |
| 187 | tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0); |
| 188 | } |
| 189 | |
| 190 | /* |
| 191 | ** Core function to rebuild the infomration in the derived tables of a |
| 192 | ** fossil repository from the blobs. This function is shared between |
| 193 |
+14
-5
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -258,11 +258,13 @@ | ||
| 258 | 258 | void tag_add_artifact( |
| 259 | 259 | const char *zPrefix, /* Prefix to prepend to tag name */ |
| 260 | 260 | const char *zTagname, /* The tag to add or cancel */ |
| 261 | 261 | const char *zObjName, /* Name of object attached to */ |
| 262 | 262 | const char *zValue, /* Value for the tag. Might be NULL */ |
| 263 | - int tagtype /* 0:cancel 1:singleton 2:propagated */ | |
| 263 | + int tagtype, /* 0:cancel 1:singleton 2:propagated */ | |
| 264 | + const char *zDateOvrd, /* Override date string */ | |
| 265 | + const char *zUserOvrd /* Override user name */ | |
| 264 | 266 | ){ |
| 265 | 267 | int rid; |
| 266 | 268 | int nrid; |
| 267 | 269 | char *zDate; |
| 268 | 270 | Blob uuid; |
| @@ -289,21 +291,21 @@ | ||
| 289 | 291 | " a hexadecimal artifact ID", |
| 290 | 292 | zTagname |
| 291 | 293 | ); |
| 292 | 294 | } |
| 293 | 295 | #endif |
| 294 | - zDate = db_text(0, "SELECT datetime('now')"); | |
| 296 | + zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now"); | |
| 295 | 297 | zDate[10] = 'T'; |
| 296 | 298 | blob_appendf(&ctrl, "D %s\n", zDate); |
| 297 | 299 | blob_appendf(&ctrl, "T %c%s%F %b", |
| 298 | 300 | zTagtype[tagtype], zPrefix, zTagname, &uuid); |
| 299 | 301 | if( tagtype>0 && zValue && zValue[0] ){ |
| 300 | 302 | blob_appendf(&ctrl, " %F\n", zValue); |
| 301 | 303 | }else{ |
| 302 | 304 | blob_appendf(&ctrl, "\n"); |
| 303 | 305 | } |
| 304 | - blob_appendf(&ctrl, "U %F\n", g.zLogin); | |
| 306 | + blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); | |
| 305 | 307 | md5sum_blob(&ctrl, &cksum); |
| 306 | 308 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 307 | 309 | nrid = content_put(&ctrl, 0, 0); |
| 308 | 310 | manifest_crosslink(nrid, &ctrl); |
| 309 | 311 | } |
| @@ -352,10 +354,14 @@ | ||
| 352 | 354 | ** |
| 353 | 355 | ** fossil update tag:decaf |
| 354 | 356 | ** |
| 355 | 357 | ** will assume that "decaf" is a tag/branch name. |
| 356 | 358 | ** |
| 359 | +** only allow --date-override and --user-override in | |
| 360 | +** %fossil tag add --date-override 'YYYY-MMM-DD HH:MM:SS' \ | |
| 361 | +** --user-override user | |
| 362 | +** in order to import history from other scm systems | |
| 357 | 363 | */ |
| 358 | 364 | void tag_cmd(void){ |
| 359 | 365 | int n; |
| 360 | 366 | int fRaw = find_option("raw","",0)!=0; |
| 361 | 367 | int fPropagate = find_option("propagate","",0)!=0; |
| @@ -370,16 +376,19 @@ | ||
| 370 | 376 | goto tag_cmd_usage; |
| 371 | 377 | } |
| 372 | 378 | |
| 373 | 379 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 374 | 380 | char *zValue; |
| 381 | + const char *zDateOvrd = find_option("date-override",0,1); | |
| 382 | + const char *zUserOvrd = find_option("user-override",0,1); | |
| 375 | 383 | if( g.argc!=5 && g.argc!=6 ){ |
| 376 | 384 | usage("add ?--raw? ?--propagate? TAGNAME CHECK-IN ?VALUE?"); |
| 377 | 385 | } |
| 378 | 386 | zValue = g.argc==6 ? g.argv[5] : 0; |
| 379 | 387 | db_begin_transaction(); |
| 380 | - tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, 1+fPropagate); | |
| 388 | + tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, | |
| 389 | + 1+fPropagate,zDateOvrd,zUserOvrd); | |
| 381 | 390 | db_end_transaction(0); |
| 382 | 391 | }else |
| 383 | 392 | |
| 384 | 393 | if( strncmp(g.argv[2],"branch",n)==0 ){ |
| 385 | 394 | fossil_fatal("the \"fossil tag branch\" command is discontinued\n" |
| @@ -389,11 +398,11 @@ | ||
| 389 | 398 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 390 | 399 | if( g.argc!=5 ){ |
| 391 | 400 | usage("cancel ?--raw? TAGNAME CHECK-IN"); |
| 392 | 401 | } |
| 393 | 402 | db_begin_transaction(); |
| 394 | - tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, 0); | |
| 403 | + tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, 0, 0, 0); | |
| 395 | 404 | db_end_transaction(0); |
| 396 | 405 | }else |
| 397 | 406 | |
| 398 | 407 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 399 | 408 | Stmt q; |
| 400 | 409 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -258,11 +258,13 @@ | |
| 258 | void tag_add_artifact( |
| 259 | const char *zPrefix, /* Prefix to prepend to tag name */ |
| 260 | const char *zTagname, /* The tag to add or cancel */ |
| 261 | const char *zObjName, /* Name of object attached to */ |
| 262 | const char *zValue, /* Value for the tag. Might be NULL */ |
| 263 | int tagtype /* 0:cancel 1:singleton 2:propagated */ |
| 264 | ){ |
| 265 | int rid; |
| 266 | int nrid; |
| 267 | char *zDate; |
| 268 | Blob uuid; |
| @@ -289,21 +291,21 @@ | |
| 289 | " a hexadecimal artifact ID", |
| 290 | zTagname |
| 291 | ); |
| 292 | } |
| 293 | #endif |
| 294 | zDate = db_text(0, "SELECT datetime('now')"); |
| 295 | zDate[10] = 'T'; |
| 296 | blob_appendf(&ctrl, "D %s\n", zDate); |
| 297 | blob_appendf(&ctrl, "T %c%s%F %b", |
| 298 | zTagtype[tagtype], zPrefix, zTagname, &uuid); |
| 299 | if( tagtype>0 && zValue && zValue[0] ){ |
| 300 | blob_appendf(&ctrl, " %F\n", zValue); |
| 301 | }else{ |
| 302 | blob_appendf(&ctrl, "\n"); |
| 303 | } |
| 304 | blob_appendf(&ctrl, "U %F\n", g.zLogin); |
| 305 | md5sum_blob(&ctrl, &cksum); |
| 306 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 307 | nrid = content_put(&ctrl, 0, 0); |
| 308 | manifest_crosslink(nrid, &ctrl); |
| 309 | } |
| @@ -352,10 +354,14 @@ | |
| 352 | ** |
| 353 | ** fossil update tag:decaf |
| 354 | ** |
| 355 | ** will assume that "decaf" is a tag/branch name. |
| 356 | ** |
| 357 | */ |
| 358 | void tag_cmd(void){ |
| 359 | int n; |
| 360 | int fRaw = find_option("raw","",0)!=0; |
| 361 | int fPropagate = find_option("propagate","",0)!=0; |
| @@ -370,16 +376,19 @@ | |
| 370 | goto tag_cmd_usage; |
| 371 | } |
| 372 | |
| 373 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 374 | char *zValue; |
| 375 | if( g.argc!=5 && g.argc!=6 ){ |
| 376 | usage("add ?--raw? ?--propagate? TAGNAME CHECK-IN ?VALUE?"); |
| 377 | } |
| 378 | zValue = g.argc==6 ? g.argv[5] : 0; |
| 379 | db_begin_transaction(); |
| 380 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, 1+fPropagate); |
| 381 | db_end_transaction(0); |
| 382 | }else |
| 383 | |
| 384 | if( strncmp(g.argv[2],"branch",n)==0 ){ |
| 385 | fossil_fatal("the \"fossil tag branch\" command is discontinued\n" |
| @@ -389,11 +398,11 @@ | |
| 389 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 390 | if( g.argc!=5 ){ |
| 391 | usage("cancel ?--raw? TAGNAME CHECK-IN"); |
| 392 | } |
| 393 | db_begin_transaction(); |
| 394 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, 0); |
| 395 | db_end_transaction(0); |
| 396 | }else |
| 397 | |
| 398 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 399 | Stmt q; |
| 400 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -258,11 +258,13 @@ | |
| 258 | void tag_add_artifact( |
| 259 | const char *zPrefix, /* Prefix to prepend to tag name */ |
| 260 | const char *zTagname, /* The tag to add or cancel */ |
| 261 | const char *zObjName, /* Name of object attached to */ |
| 262 | const char *zValue, /* Value for the tag. Might be NULL */ |
| 263 | int tagtype, /* 0:cancel 1:singleton 2:propagated */ |
| 264 | const char *zDateOvrd, /* Override date string */ |
| 265 | const char *zUserOvrd /* Override user name */ |
| 266 | ){ |
| 267 | int rid; |
| 268 | int nrid; |
| 269 | char *zDate; |
| 270 | Blob uuid; |
| @@ -289,21 +291,21 @@ | |
| 291 | " a hexadecimal artifact ID", |
| 292 | zTagname |
| 293 | ); |
| 294 | } |
| 295 | #endif |
| 296 | zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now"); |
| 297 | zDate[10] = 'T'; |
| 298 | blob_appendf(&ctrl, "D %s\n", zDate); |
| 299 | blob_appendf(&ctrl, "T %c%s%F %b", |
| 300 | zTagtype[tagtype], zPrefix, zTagname, &uuid); |
| 301 | if( tagtype>0 && zValue && zValue[0] ){ |
| 302 | blob_appendf(&ctrl, " %F\n", zValue); |
| 303 | }else{ |
| 304 | blob_appendf(&ctrl, "\n"); |
| 305 | } |
| 306 | blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 307 | md5sum_blob(&ctrl, &cksum); |
| 308 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 309 | nrid = content_put(&ctrl, 0, 0); |
| 310 | manifest_crosslink(nrid, &ctrl); |
| 311 | } |
| @@ -352,10 +354,14 @@ | |
| 354 | ** |
| 355 | ** fossil update tag:decaf |
| 356 | ** |
| 357 | ** will assume that "decaf" is a tag/branch name. |
| 358 | ** |
| 359 | ** only allow --date-override and --user-override in |
| 360 | ** %fossil tag add --date-override 'YYYY-MMM-DD HH:MM:SS' \ |
| 361 | ** --user-override user |
| 362 | ** in order to import history from other scm systems |
| 363 | */ |
| 364 | void tag_cmd(void){ |
| 365 | int n; |
| 366 | int fRaw = find_option("raw","",0)!=0; |
| 367 | int fPropagate = find_option("propagate","",0)!=0; |
| @@ -370,16 +376,19 @@ | |
| 376 | goto tag_cmd_usage; |
| 377 | } |
| 378 | |
| 379 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 380 | char *zValue; |
| 381 | const char *zDateOvrd = find_option("date-override",0,1); |
| 382 | const char *zUserOvrd = find_option("user-override",0,1); |
| 383 | if( g.argc!=5 && g.argc!=6 ){ |
| 384 | usage("add ?--raw? ?--propagate? TAGNAME CHECK-IN ?VALUE?"); |
| 385 | } |
| 386 | zValue = g.argc==6 ? g.argv[5] : 0; |
| 387 | db_begin_transaction(); |
| 388 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, |
| 389 | 1+fPropagate,zDateOvrd,zUserOvrd); |
| 390 | db_end_transaction(0); |
| 391 | }else |
| 392 | |
| 393 | if( strncmp(g.argv[2],"branch",n)==0 ){ |
| 394 | fossil_fatal("the \"fossil tag branch\" command is discontinued\n" |
| @@ -389,11 +398,11 @@ | |
| 398 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 399 | if( g.argc!=5 ){ |
| 400 | usage("cancel ?--raw? TAGNAME CHECK-IN"); |
| 401 | } |
| 402 | db_begin_transaction(); |
| 403 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, 0, 0, 0); |
| 404 | db_end_transaction(0); |
| 405 | }else |
| 406 | |
| 407 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 408 | Stmt q; |
| 409 |