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

renez 2010-10-01 17:44 trunk
Commit 5c59d7e9c61c2ba1c572a610b58a7f684523c211
2 files changed +2 -2 +14 -5
+2 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -181,12 +181,12 @@
181181
if( rid==0 ) return;
182182
183183
/* Add the trunk tag to the root of the whole tree */
184184
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
185185
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);
188188
}
189189
190190
/*
191191
** Core function to rebuild the infomration in the derived tables of a
192192
** fossil repository from the blobs. This function is shared between
193193
--- 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 @@
258258
void tag_add_artifact(
259259
const char *zPrefix, /* Prefix to prepend to tag name */
260260
const char *zTagname, /* The tag to add or cancel */
261261
const char *zObjName, /* Name of object attached to */
262262
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 */
264266
){
265267
int rid;
266268
int nrid;
267269
char *zDate;
268270
Blob uuid;
@@ -289,21 +291,21 @@
289291
" a hexadecimal artifact ID",
290292
zTagname
291293
);
292294
}
293295
#endif
294
- zDate = db_text(0, "SELECT datetime('now')");
296
+ zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
295297
zDate[10] = 'T';
296298
blob_appendf(&ctrl, "D %s\n", zDate);
297299
blob_appendf(&ctrl, "T %c%s%F %b",
298300
zTagtype[tagtype], zPrefix, zTagname, &uuid);
299301
if( tagtype>0 && zValue && zValue[0] ){
300302
blob_appendf(&ctrl, " %F\n", zValue);
301303
}else{
302304
blob_appendf(&ctrl, "\n");
303305
}
304
- blob_appendf(&ctrl, "U %F\n", g.zLogin);
306
+ blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
305307
md5sum_blob(&ctrl, &cksum);
306308
blob_appendf(&ctrl, "Z %b\n", &cksum);
307309
nrid = content_put(&ctrl, 0, 0);
308310
manifest_crosslink(nrid, &ctrl);
309311
}
@@ -352,10 +354,14 @@
352354
**
353355
** fossil update tag:decaf
354356
**
355357
** will assume that "decaf" is a tag/branch name.
356358
**
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
357363
*/
358364
void tag_cmd(void){
359365
int n;
360366
int fRaw = find_option("raw","",0)!=0;
361367
int fPropagate = find_option("propagate","",0)!=0;
@@ -370,16 +376,19 @@
370376
goto tag_cmd_usage;
371377
}
372378
373379
if( strncmp(g.argv[2],"add",n)==0 ){
374380
char *zValue;
381
+ const char *zDateOvrd = find_option("date-override",0,1);
382
+ const char *zUserOvrd = find_option("user-override",0,1);
375383
if( g.argc!=5 && g.argc!=6 ){
376384
usage("add ?--raw? ?--propagate? TAGNAME CHECK-IN ?VALUE?");
377385
}
378386
zValue = g.argc==6 ? g.argv[5] : 0;
379387
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);
381390
db_end_transaction(0);
382391
}else
383392
384393
if( strncmp(g.argv[2],"branch",n)==0 ){
385394
fossil_fatal("the \"fossil tag branch\" command is discontinued\n"
@@ -389,11 +398,11 @@
389398
if( strncmp(g.argv[2],"cancel",n)==0 ){
390399
if( g.argc!=5 ){
391400
usage("cancel ?--raw? TAGNAME CHECK-IN");
392401
}
393402
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);
395404
db_end_transaction(0);
396405
}else
397406
398407
if( strncmp(g.argv[2],"find",n)==0 ){
399408
Stmt q;
400409
--- 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

Keyboard Shortcuts

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