Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the sym-trunk and newbranch tags to the root check-in when rebuilding. Also add the newbranch tag to the root check-in when creating a new repository. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
7c7edde1169340698ada867fcd31df6b |
| User & Date: | drh 2009-01-21 02:47:42.000 |
Context
|
2009-01-21
| ||
| 02:54 | The "fossil info" command now shows tags associated with the current check-out. ... (check-in: 2521a0a9a7 user: drh tags: trunk) | |
| 02:47 | Add the sym-trunk and newbranch tags to the root check-in when rebuilding. Also add the newbranch tag to the root check-in when creating a new repository. ... (check-in: 7c7edde116 user: drh tags: trunk) | |
| 02:22 | When creating new repositories ("fossil new") label the initial empty check-in with a propagating symbolic tag "trunk". ... (check-in: 0139767b9a user: drh tags: trunk) | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
938 939 940 941 942 943 944 945 946 947 948 949 950 951 |
zDate = db_text(0, "SELECT datetime('now')");
zDate[10]='T';
blob_appendf(&manifest, "D %s\n", zDate);
blob_appendf(&manifest, "P\n");
md5sum_init();
blob_appendf(&manifest, "R %s\n", md5sum_finish(0));
blob_appendf(&manifest, "T *sym-trunk *\n");
blob_appendf(&manifest, "U %F\n", g.zLogin);
md5sum_blob(&manifest, &hash);
blob_appendf(&manifest, "Z %b\n", &hash);
blob_reset(&hash);
content_put(&manifest, 0, 0);
}
}
| > | 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
zDate = db_text(0, "SELECT datetime('now')");
zDate[10]='T';
blob_appendf(&manifest, "D %s\n", zDate);
blob_appendf(&manifest, "P\n");
md5sum_init();
blob_appendf(&manifest, "R %s\n", md5sum_finish(0));
blob_appendf(&manifest, "T *sym-trunk *\n");
blob_appendf(&manifest, "T +newbranch *\n");
blob_appendf(&manifest, "U %F\n", g.zLogin);
md5sum_blob(&manifest, &hash);
blob_appendf(&manifest, "Z %b\n", &hash);
blob_reset(&hash);
content_put(&manifest, 0, 0);
}
}
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
db_finalize(&q2);
blob_reset(pUse);
}
}
bag_clear(&children);
rebuild_step_done(rid);
}
/*
** Core function to rebuild the infomration in the derived tables of a
** fossil repository from the blobs. This function is shared between
** 'rebuild_database' ('rebuild') and 'reconstruct_cmd'
** ('reconstruct'), both of which have to regenerate this information
** from scratch.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
db_finalize(&q2);
blob_reset(pUse);
}
}
bag_clear(&children);
rebuild_step_done(rid);
}
/*
** Check to see if the the "sym-trunk" tag exists. If not, create it
** and attach it to the very first check-in.
*/
static void rebuild_tag_trunk(void){
int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-trunk'");
int rid;
char *zUuid;
Stmt q;
if( tagid>0 ) return;
rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS("
" SELECT 1 FROM plink WHERE cid=x.pid)");
if( rid==0 ) return;
db_prepare(&q, "SELECT uuid FROM tagxref, blob"
" WHERE tagid=%d AND tagtype>0 AND blob.rid=tagxref.rid",
TAG_NEWBRANCH);
/* Block the trunk tag at all branches */
while( db_step(&q)==SQLITE_ROW ){
const char *z = db_column_text(&q, 0);
tag_add_artifact("sym-", "trunk", z, 0, 0);
}
db_finalize(&q);
/* Add the trunk tag to the root of the whole tree */
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
if( zUuid==0 ) return;
tag_add_artifact("sym-", "trunk", zUuid, 0, 2);
tag_add_artifact("", "newbranch", zUuid, 0, 1);
}
/*
** Core function to rebuild the infomration in the derived tables of a
** fossil repository from the blobs. This function is shared between
** 'rebuild_database' ('rebuild') and 'reconstruct_cmd'
** ('reconstruct'), both of which have to regenerate this information
** from scratch.
|
| ︙ | ︙ | |||
246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
}
}else{
db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
rebuild_step_done(rid);
}
}
db_finalize(&s);
if( ttyOutput ){
printf("\n");
}
return errCnt;
}
/*
| > | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
}
}else{
db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
rebuild_step_done(rid);
}
}
db_finalize(&s);
rebuild_tag_trunk();
if( ttyOutput ){
printf("\n");
}
return errCnt;
}
/*
|
| ︙ | ︙ |
Changes to src/tag.c.
| ︙ | ︙ | |||
244 245 246 247 248 249 250 | db_end_transaction(0); } /* ** Add a control record to the repository that either creates ** or cancels a tag. */ | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
db_end_transaction(0);
}
/*
** Add a control record to the repository that either creates
** or cancels a tag.
*/
void tag_add_artifact(
const char *zPrefix, /* Prefix to prepend to tag name */
const char *zTagname, /* The tag to add or cancel */
const char *zObjName, /* Name of object attached to */
const char *zValue, /* Value for the tag. Might be NULL */
int tagtype /* 0:cancel 1:singleton 2:propagated */
){
int rid;
|
| ︙ | ︙ | |||
291 292 293 294 295 296 297 |
blob_appendf(&ctrl, " %F\n", zValue);
}else{
blob_appendf(&ctrl, "\n");
}
blob_appendf(&ctrl, "U %F\n", g.zLogin);
md5sum_blob(&ctrl, &cksum);
blob_appendf(&ctrl, "Z %b\n", &cksum);
| < < < < < | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
blob_appendf(&ctrl, " %F\n", zValue);
}else{
blob_appendf(&ctrl, "\n");
}
blob_appendf(&ctrl, "U %F\n", g.zLogin);
md5sum_blob(&ctrl, &cksum);
blob_appendf(&ctrl, "Z %b\n", &cksum);
nrid = content_put(&ctrl, 0, 0);
manifest_crosslink(nrid, &ctrl);
}
/*
** COMMAND: tag
** Usage: %fossil tag SUBCOMMAND ...
**
** Run various subcommands to control tags and properties
|
| ︙ | ︙ | |||
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
if( strncmp(g.argv[2],"add",n)==0 ){
char *zValue;
if( g.argc!=5 && g.argc!=6 ){
usage("add ?--raw? ?--propagate? TAGNAME CHECK-IN ?VALUE?");
}
zValue = g.argc==6 ? g.argv[5] : 0;
tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, 1+fPropagate);
}else
if( strncmp(g.argv[2],"branch",n)==0 ){
fossil_fatal("the \"fossil tag branch\" command is discontinued\n"
"Use the \"fossil branch new\" command instead.");
}else
if( strncmp(g.argv[2],"cancel",n)==0 ){
if( g.argc!=5 ){
usage("cancel ?--raw? TAGNAME CHECK-IN");
}
tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, 0);
}else
if( strncmp(g.argv[2],"find",n)==0 ){
Stmt q;
if( g.argc!=4 ){
usage("find ?--raw? TAGNAME");
}
| > > > > | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
if( strncmp(g.argv[2],"add",n)==0 ){
char *zValue;
if( g.argc!=5 && g.argc!=6 ){
usage("add ?--raw? ?--propagate? TAGNAME CHECK-IN ?VALUE?");
}
zValue = g.argc==6 ? g.argv[5] : 0;
db_begin_transaction();
tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, 1+fPropagate);
db_end_transaction(0);
}else
if( strncmp(g.argv[2],"branch",n)==0 ){
fossil_fatal("the \"fossil tag branch\" command is discontinued\n"
"Use the \"fossil branch new\" command instead.");
}else
if( strncmp(g.argv[2],"cancel",n)==0 ){
if( g.argc!=5 ){
usage("cancel ?--raw? TAGNAME CHECK-IN");
}
db_begin_transaction();
tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, 0);
db_end_transaction(0);
}else
if( strncmp(g.argv[2],"find",n)==0 ){
Stmt q;
if( g.argc!=4 ){
usage("find ?--raw? TAGNAME");
}
|
| ︙ | ︙ |