Fossil SCM

Add comment cards to tags, which are accepted by git import and exported to git export. They are visible via the timeline, but currently lack an editable means via the UI.

roy.marples 2017-02-13 03:34 UTC roy-export
Commit 752bdd38c73da128a15ec37a800bd5c7c1d59e3e
+5 -2
--- src/export.c
+++ src/export.c
@@ -697,30 +697,33 @@
697697
698698
699699
/* Output tags */
700700
db_prepare(&q,
701701
"SELECT tagname, rid, strftime('%%s',mtime),"
702
- " (SELECT coalesce(euser, user) FROM event WHERE objid=rid)"
702
+ " (SELECT coalesce(euser, user) FROM event WHERE objid=rid),"
703
+ " tagcomment"
703704
" FROM tagxref JOIN tag USING(tagid)"
704705
" WHERE tagtype=1 AND tagname GLOB 'sym-*'"
705706
);
706707
while( db_step(&q)==SQLITE_ROW ){
707708
const char *zTagname = db_column_text(&q, 0);
708709
int rid = db_column_int(&q, 1);
709710
char *zMark = mark_name_from_rid(rid, &unused_mark);
710711
const char *zSecSince1970 = db_column_text(&q, 2);
711712
const char *zUser = db_column_text(&q, 3);
713
+ const char *zComment = db_column_text(&q, 4);
712714
if( rid==0 || !bag_find(&vers, rid) ) continue;
713715
zTagname += 4;
714716
printf("tag ");
715717
print_ref(zTagname);
716718
printf("\nfrom %s\n", zMark);
717719
free(zMark);
718720
printf("tagger");
719721
print_person(zUser);
720722
printf(" %s +0000\n", zSecSince1970);
721
- printf("data 0\n");
723
+ printf("data %d\n", zComment==NULL?0:strlen(zComment)+1);
724
+ if( zComment!=NULL ) printf("%s\n",zComment);
722725
}
723726
db_finalize(&q);
724727
725728
if( markfile_out!=0 ){
726729
FILE *f;
727730
--- src/export.c
+++ src/export.c
@@ -697,30 +697,33 @@
697
698
699 /* Output tags */
700 db_prepare(&q,
701 "SELECT tagname, rid, strftime('%%s',mtime),"
702 " (SELECT coalesce(euser, user) FROM event WHERE objid=rid)"
 
703 " FROM tagxref JOIN tag USING(tagid)"
704 " WHERE tagtype=1 AND tagname GLOB 'sym-*'"
705 );
706 while( db_step(&q)==SQLITE_ROW ){
707 const char *zTagname = db_column_text(&q, 0);
708 int rid = db_column_int(&q, 1);
709 char *zMark = mark_name_from_rid(rid, &unused_mark);
710 const char *zSecSince1970 = db_column_text(&q, 2);
711 const char *zUser = db_column_text(&q, 3);
 
712 if( rid==0 || !bag_find(&vers, rid) ) continue;
713 zTagname += 4;
714 printf("tag ");
715 print_ref(zTagname);
716 printf("\nfrom %s\n", zMark);
717 free(zMark);
718 printf("tagger");
719 print_person(zUser);
720 printf(" %s +0000\n", zSecSince1970);
721 printf("data 0\n");
 
722 }
723 db_finalize(&q);
724
725 if( markfile_out!=0 ){
726 FILE *f;
727
--- src/export.c
+++ src/export.c
@@ -697,30 +697,33 @@
697
698
699 /* Output tags */
700 db_prepare(&q,
701 "SELECT tagname, rid, strftime('%%s',mtime),"
702 " (SELECT coalesce(euser, user) FROM event WHERE objid=rid),"
703 " tagcomment"
704 " FROM tagxref JOIN tag USING(tagid)"
705 " WHERE tagtype=1 AND tagname GLOB 'sym-*'"
706 );
707 while( db_step(&q)==SQLITE_ROW ){
708 const char *zTagname = db_column_text(&q, 0);
709 int rid = db_column_int(&q, 1);
710 char *zMark = mark_name_from_rid(rid, &unused_mark);
711 const char *zSecSince1970 = db_column_text(&q, 2);
712 const char *zUser = db_column_text(&q, 3);
713 const char *zComment = db_column_text(&q, 4);
714 if( rid==0 || !bag_find(&vers, rid) ) continue;
715 zTagname += 4;
716 printf("tag ");
717 print_ref(zTagname);
718 printf("\nfrom %s\n", zMark);
719 free(zMark);
720 printf("tagger");
721 print_person(zUser);
722 printf(" %s +0000\n", zSecSince1970);
723 printf("data %d\n", zComment==NULL?0:strlen(zComment)+1);
724 if( zComment!=NULL ) printf("%s\n",zComment);
725 }
726 db_finalize(&q);
727
728 if( markfile_out!=0 ){
729 FILE *f;
730
+8 -2
--- src/import.c
+++ src/import.c
@@ -219,10 +219,11 @@
219219
blob_zero(&record);
220220
blob_appendf(&record, "D %s\n", gg.zDate);
221221
blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zTagPre, gg.zTag,
222222
gimport.zTagSuf, gg.zFrom);
223223
blob_appendf(&record, "U %F\n", gg.zUser);
224
+ if( gg.zComment ) blob_appendf(&record, "C %F\n", gg.zComment);
224225
md5sum_blob(&record, &cksum);
225226
blob_appendf(&record, "Z %b\n", &cksum);
226227
fast_insert_content(&record, 0, 0, 1);
227228
blob_reset(&cksum);
228229
}
@@ -605,12 +606,17 @@
605606
gg.aData = fossil_malloc( gg.nData+1 );
606607
got = fread(gg.aData, 1, gg.nData, pIn);
607608
if( got!=gg.nData ){
608609
fossil_fatal("short read: got %d of %d bytes", got, gg.nData);
609610
}
610
- gg.aData[got] = 0;
611
- if( gg.zComment==0 && gg.xFinish==finish_commit ){
611
+ /* Strip trailing newline, it's appended to the comment. */
612
+ if( gg.aData[got-1] == '\n' )
613
+ gg.aData[got-1] = '\0';
614
+ else
615
+ gg.aData[got] = '\0';
616
+ if( gg.zComment==0 &&
617
+ (gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){
612618
gg.zComment = gg.aData;
613619
gg.aData = 0;
614620
gg.nData = 0;
615621
}
616622
}
617623
--- src/import.c
+++ src/import.c
@@ -219,10 +219,11 @@
219 blob_zero(&record);
220 blob_appendf(&record, "D %s\n", gg.zDate);
221 blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zTagPre, gg.zTag,
222 gimport.zTagSuf, gg.zFrom);
223 blob_appendf(&record, "U %F\n", gg.zUser);
 
224 md5sum_blob(&record, &cksum);
225 blob_appendf(&record, "Z %b\n", &cksum);
226 fast_insert_content(&record, 0, 0, 1);
227 blob_reset(&cksum);
228 }
@@ -605,12 +606,17 @@
605 gg.aData = fossil_malloc( gg.nData+1 );
606 got = fread(gg.aData, 1, gg.nData, pIn);
607 if( got!=gg.nData ){
608 fossil_fatal("short read: got %d of %d bytes", got, gg.nData);
609 }
610 gg.aData[got] = 0;
611 if( gg.zComment==0 && gg.xFinish==finish_commit ){
 
 
 
 
 
612 gg.zComment = gg.aData;
613 gg.aData = 0;
614 gg.nData = 0;
615 }
616 }
617
--- src/import.c
+++ src/import.c
@@ -219,10 +219,11 @@
219 blob_zero(&record);
220 blob_appendf(&record, "D %s\n", gg.zDate);
221 blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zTagPre, gg.zTag,
222 gimport.zTagSuf, gg.zFrom);
223 blob_appendf(&record, "U %F\n", gg.zUser);
224 if( gg.zComment ) blob_appendf(&record, "C %F\n", gg.zComment);
225 md5sum_blob(&record, &cksum);
226 blob_appendf(&record, "Z %b\n", &cksum);
227 fast_insert_content(&record, 0, 0, 1);
228 blob_reset(&cksum);
229 }
@@ -605,12 +606,17 @@
606 gg.aData = fossil_malloc( gg.nData+1 );
607 got = fread(gg.aData, 1, gg.nData, pIn);
608 if( got!=gg.nData ){
609 fossil_fatal("short read: got %d of %d bytes", got, gg.nData);
610 }
611 /* Strip trailing newline, it's appended to the comment. */
612 if( gg.aData[got-1] == '\n' )
613 gg.aData[got-1] = '\0';
614 else
615 gg.aData[got] = '\0';
616 if( gg.zComment==0 &&
617 (gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){
618 gg.zComment = gg.aData;
619 gg.aData = 0;
620 gg.nData = 0;
621 }
622 }
623
+5 -5
--- src/manifest.c
+++ src/manifest.c
@@ -1999,11 +1999,11 @@
19991999
}
20002000
}
20012001
}
20022002
if( p->type==CFTYPE_CLUSTER ){
20032003
static Stmt del1;
2004
- tag_insert("cluster", 1, 0, rid, p->rDate, rid);
2004
+ tag_insert("cluster", 1, 0, rid, p->rDate, rid, NULL);
20052005
db_static_prepare(&del1, "DELETE FROM unclustered WHERE rid=:rid");
20062006
for(i=0; i<p->nCChild; i++){
20072007
int mid;
20082008
mid = uuid_to_rid(p->azCChild[i], 1);
20092009
if( mid>0 ){
@@ -2033,11 +2033,11 @@
20332033
default:
20342034
fossil_error(1, "unknown tag type in manifest: %s", p->aTag);
20352035
return 0;
20362036
}
20372037
tag_insert(&p->aTag[i].zName[1], type, p->aTag[i].zValue,
2038
- rid, p->rDate, tid);
2038
+ rid, p->rDate, tid, p->zComment);
20392039
}
20402040
}
20412041
if( parentid ){
20422042
tag_propagate_all(parentid);
20432043
}
@@ -2050,11 +2050,11 @@
20502050
int nWiki;
20512051
char zLength[40];
20522052
while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
20532053
nWiki = strlen(p->zWiki);
20542054
sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2055
- tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
2055
+ tag_insert(zTag, 1, zLength, rid, p->rDate, rid, p->zComment);
20562056
fossil_free(zTag);
20572057
prior = db_int(0,
20582058
"SELECT rid FROM tagxref"
20592059
" WHERE tagid=%d AND mtime<%.17g"
20602060
" ORDER BY mtime DESC",
@@ -2091,11 +2091,11 @@
20912091
char zLength[40];
20922092
Stmt qatt;
20932093
while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
20942094
nWiki = strlen(p->zWiki);
20952095
sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2096
- tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
2096
+ tag_insert(zTag, 1, zLength, rid, p->rDate, rid, p->zComment);
20972097
fossil_free(zTag);
20982098
prior = db_int(0,
20992099
"SELECT rid FROM tagxref"
21002100
" WHERE tagid=%d AND mtime<%.17g AND rid!=%d"
21012101
" ORDER BY mtime DESC",
@@ -2165,11 +2165,11 @@
21652165
if( p->type==CFTYPE_TICKET ){
21662166
char *zTag;
21672167
Stmt qatt;
21682168
assert( manifest_crosslink_busy==1 );
21692169
zTag = mprintf("tkt-%s", p->zTicketUuid);
2170
- tag_insert(zTag, 1, 0, rid, p->rDate, rid);
2170
+ tag_insert(zTag, 1, 0, rid, p->rDate, rid, p->zComment);
21712171
fossil_free(zTag);
21722172
db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
21732173
p->zTicketUuid);
21742174
/* Locate and update comment for any attachments */
21752175
db_prepare(&qatt,
21762176
--- src/manifest.c
+++ src/manifest.c
@@ -1999,11 +1999,11 @@
1999 }
2000 }
2001 }
2002 if( p->type==CFTYPE_CLUSTER ){
2003 static Stmt del1;
2004 tag_insert("cluster", 1, 0, rid, p->rDate, rid);
2005 db_static_prepare(&del1, "DELETE FROM unclustered WHERE rid=:rid");
2006 for(i=0; i<p->nCChild; i++){
2007 int mid;
2008 mid = uuid_to_rid(p->azCChild[i], 1);
2009 if( mid>0 ){
@@ -2033,11 +2033,11 @@
2033 default:
2034 fossil_error(1, "unknown tag type in manifest: %s", p->aTag);
2035 return 0;
2036 }
2037 tag_insert(&p->aTag[i].zName[1], type, p->aTag[i].zValue,
2038 rid, p->rDate, tid);
2039 }
2040 }
2041 if( parentid ){
2042 tag_propagate_all(parentid);
2043 }
@@ -2050,11 +2050,11 @@
2050 int nWiki;
2051 char zLength[40];
2052 while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
2053 nWiki = strlen(p->zWiki);
2054 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2055 tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
2056 fossil_free(zTag);
2057 prior = db_int(0,
2058 "SELECT rid FROM tagxref"
2059 " WHERE tagid=%d AND mtime<%.17g"
2060 " ORDER BY mtime DESC",
@@ -2091,11 +2091,11 @@
2091 char zLength[40];
2092 Stmt qatt;
2093 while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
2094 nWiki = strlen(p->zWiki);
2095 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2096 tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
2097 fossil_free(zTag);
2098 prior = db_int(0,
2099 "SELECT rid FROM tagxref"
2100 " WHERE tagid=%d AND mtime<%.17g AND rid!=%d"
2101 " ORDER BY mtime DESC",
@@ -2165,11 +2165,11 @@
2165 if( p->type==CFTYPE_TICKET ){
2166 char *zTag;
2167 Stmt qatt;
2168 assert( manifest_crosslink_busy==1 );
2169 zTag = mprintf("tkt-%s", p->zTicketUuid);
2170 tag_insert(zTag, 1, 0, rid, p->rDate, rid);
2171 fossil_free(zTag);
2172 db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
2173 p->zTicketUuid);
2174 /* Locate and update comment for any attachments */
2175 db_prepare(&qatt,
2176
--- src/manifest.c
+++ src/manifest.c
@@ -1999,11 +1999,11 @@
1999 }
2000 }
2001 }
2002 if( p->type==CFTYPE_CLUSTER ){
2003 static Stmt del1;
2004 tag_insert("cluster", 1, 0, rid, p->rDate, rid, NULL);
2005 db_static_prepare(&del1, "DELETE FROM unclustered WHERE rid=:rid");
2006 for(i=0; i<p->nCChild; i++){
2007 int mid;
2008 mid = uuid_to_rid(p->azCChild[i], 1);
2009 if( mid>0 ){
@@ -2033,11 +2033,11 @@
2033 default:
2034 fossil_error(1, "unknown tag type in manifest: %s", p->aTag);
2035 return 0;
2036 }
2037 tag_insert(&p->aTag[i].zName[1], type, p->aTag[i].zValue,
2038 rid, p->rDate, tid, p->zComment);
2039 }
2040 }
2041 if( parentid ){
2042 tag_propagate_all(parentid);
2043 }
@@ -2050,11 +2050,11 @@
2050 int nWiki;
2051 char zLength[40];
2052 while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
2053 nWiki = strlen(p->zWiki);
2054 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2055 tag_insert(zTag, 1, zLength, rid, p->rDate, rid, p->zComment);
2056 fossil_free(zTag);
2057 prior = db_int(0,
2058 "SELECT rid FROM tagxref"
2059 " WHERE tagid=%d AND mtime<%.17g"
2060 " ORDER BY mtime DESC",
@@ -2091,11 +2091,11 @@
2091 char zLength[40];
2092 Stmt qatt;
2093 while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
2094 nWiki = strlen(p->zWiki);
2095 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2096 tag_insert(zTag, 1, zLength, rid, p->rDate, rid, p->zComment);
2097 fossil_free(zTag);
2098 prior = db_int(0,
2099 "SELECT rid FROM tagxref"
2100 " WHERE tagid=%d AND mtime<%.17g AND rid!=%d"
2101 " ORDER BY mtime DESC",
@@ -2165,11 +2165,11 @@
2165 if( p->type==CFTYPE_TICKET ){
2166 char *zTag;
2167 Stmt qatt;
2168 assert( manifest_crosslink_busy==1 );
2169 zTag = mprintf("tkt-%s", p->zTicketUuid);
2170 tag_insert(zTag, 1, 0, rid, p->rDate, rid, p->zComment);
2171 fossil_free(zTag);
2172 db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
2173 p->zTicketUuid);
2174 /* Locate and update comment for any attachments */
2175 db_prepare(&qatt,
2176
--- src/schema.c
+++ src/schema.c
@@ -384,10 +384,11 @@
384384
@ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
385385
@ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
386386
@ value TEXT, -- Value of the tag. Might be NULL.
387387
@ mtime TIMESTAMP, -- Time of addition or removal. Julian day
388388
@ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
389
+@ tagcomment TEXT, -- Comment of the tag
389390
@ UNIQUE(rid, tagid)
390391
@ );
391392
@ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
392393
@
393394
@ -- When a hyperlink occurs from one artifact to another (for example
394395
--- src/schema.c
+++ src/schema.c
@@ -384,10 +384,11 @@
384 @ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
385 @ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
386 @ value TEXT, -- Value of the tag. Might be NULL.
387 @ mtime TIMESTAMP, -- Time of addition or removal. Julian day
388 @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
 
389 @ UNIQUE(rid, tagid)
390 @ );
391 @ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
392 @
393 @ -- When a hyperlink occurs from one artifact to another (for example
394
--- src/schema.c
+++ src/schema.c
@@ -384,10 +384,11 @@
384 @ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
385 @ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
386 @ value TEXT, -- Value of the tag. Might be NULL.
387 @ mtime TIMESTAMP, -- Time of addition or removal. Julian day
388 @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
389 @ tagcomment TEXT, -- Comment of the tag
390 @ UNIQUE(rid, tagid)
391 @ );
392 @ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
393 @
394 @ -- When a hyperlink occurs from one artifact to another (for example
395
+7 -6
--- src/tag.c
+++ src/tag.c
@@ -158,11 +158,12 @@
158158
const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
159159
int tagtype, /* 0:cancel 1:singleton 2:propagated */
160160
const char *zValue, /* Value if the tag is really a property */
161161
int srcId, /* Artifact that contains this tag */
162162
double mtime, /* Timestamp. Use default if <=0.0 */
163
- int rid /* Artifact to which the tag is to attached */
163
+ int rid, /* Artifact to which the tag is to attached */
164
+ const char *zComment /* Comment for the tag */
164165
){
165166
Stmt s;
166167
const char *zCol;
167168
int tagid = tag_findid(zTag, 1);
168169
int rc;
@@ -183,13 +184,13 @@
183184
if( rc==SQLITE_ROW ){
184185
/* Another entry that is more recent already exists. Do nothing */
185186
return tagid;
186187
}
187188
db_prepare(&s,
188
- "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)"
189
- " VALUES(%d,%d,%d,%d,%Q,:mtime,%d)",
190
- tagid, tagtype, srcId, rid, zValue, rid
189
+ "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid,tagcomment)"
190
+ " VALUES(%d,%d,%d,%d,%Q,:mtime,%d,%Q)",
191
+ tagid, tagtype, srcId, rid, zValue, rid, zComment
191192
);
192193
db_bind_double(&s, ":mtime", mtime);
193194
db_step(&s);
194195
db_finalize(&s);
195196
if( tagid==TAG_BRANCH ) leaf_eventually_check(rid);
@@ -275,11 +276,11 @@
275276
fossil_fatal("no such object: %s", g.argv[3]);
276277
}
277278
g.markPrivate = content_is_private(rid);
278279
zValue = g.argc==5 ? g.argv[4] : 0;
279280
db_begin_transaction();
280
- tag_insert(zTag, tagtype, zValue, -1, 0.0, rid);
281
+ tag_insert(zTag, tagtype, zValue, -1, 0.0, rid, NULL);
281282
db_end_transaction(0);
282283
}
283284
284285
/*
285286
** OR this value into the tagtype argument to tag_add_artifact to
@@ -631,11 +632,11 @@
631632
zUuid = rid_to_uuid(pid);
632633
blob_append(&value, zUuid, UUID_SIZE);
633634
fossil_free(zUuid);
634635
}
635636
if( bTest && !dryRun ){
636
- tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid);
637
+ tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid, NULL);
637638
}else{
638639
zUuid = rid_to_uuid(rid);
639640
tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0);
640641
}
641642
}
642643
--- src/tag.c
+++ src/tag.c
@@ -158,11 +158,12 @@
158 const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
159 int tagtype, /* 0:cancel 1:singleton 2:propagated */
160 const char *zValue, /* Value if the tag is really a property */
161 int srcId, /* Artifact that contains this tag */
162 double mtime, /* Timestamp. Use default if <=0.0 */
163 int rid /* Artifact to which the tag is to attached */
 
164 ){
165 Stmt s;
166 const char *zCol;
167 int tagid = tag_findid(zTag, 1);
168 int rc;
@@ -183,13 +184,13 @@
183 if( rc==SQLITE_ROW ){
184 /* Another entry that is more recent already exists. Do nothing */
185 return tagid;
186 }
187 db_prepare(&s,
188 "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)"
189 " VALUES(%d,%d,%d,%d,%Q,:mtime,%d)",
190 tagid, tagtype, srcId, rid, zValue, rid
191 );
192 db_bind_double(&s, ":mtime", mtime);
193 db_step(&s);
194 db_finalize(&s);
195 if( tagid==TAG_BRANCH ) leaf_eventually_check(rid);
@@ -275,11 +276,11 @@
275 fossil_fatal("no such object: %s", g.argv[3]);
276 }
277 g.markPrivate = content_is_private(rid);
278 zValue = g.argc==5 ? g.argv[4] : 0;
279 db_begin_transaction();
280 tag_insert(zTag, tagtype, zValue, -1, 0.0, rid);
281 db_end_transaction(0);
282 }
283
284 /*
285 ** OR this value into the tagtype argument to tag_add_artifact to
@@ -631,11 +632,11 @@
631 zUuid = rid_to_uuid(pid);
632 blob_append(&value, zUuid, UUID_SIZE);
633 fossil_free(zUuid);
634 }
635 if( bTest && !dryRun ){
636 tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid);
637 }else{
638 zUuid = rid_to_uuid(rid);
639 tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0);
640 }
641 }
642
--- src/tag.c
+++ src/tag.c
@@ -158,11 +158,12 @@
158 const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
159 int tagtype, /* 0:cancel 1:singleton 2:propagated */
160 const char *zValue, /* Value if the tag is really a property */
161 int srcId, /* Artifact that contains this tag */
162 double mtime, /* Timestamp. Use default if <=0.0 */
163 int rid, /* Artifact to which the tag is to attached */
164 const char *zComment /* Comment for the tag */
165 ){
166 Stmt s;
167 const char *zCol;
168 int tagid = tag_findid(zTag, 1);
169 int rc;
@@ -183,13 +184,13 @@
184 if( rc==SQLITE_ROW ){
185 /* Another entry that is more recent already exists. Do nothing */
186 return tagid;
187 }
188 db_prepare(&s,
189 "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid,tagcomment)"
190 " VALUES(%d,%d,%d,%d,%Q,:mtime,%d,%Q)",
191 tagid, tagtype, srcId, rid, zValue, rid, zComment
192 );
193 db_bind_double(&s, ":mtime", mtime);
194 db_step(&s);
195 db_finalize(&s);
196 if( tagid==TAG_BRANCH ) leaf_eventually_check(rid);
@@ -275,11 +276,11 @@
276 fossil_fatal("no such object: %s", g.argv[3]);
277 }
278 g.markPrivate = content_is_private(rid);
279 zValue = g.argc==5 ? g.argv[4] : 0;
280 db_begin_transaction();
281 tag_insert(zTag, tagtype, zValue, -1, 0.0, rid, NULL);
282 db_end_transaction(0);
283 }
284
285 /*
286 ** OR this value into the tagtype argument to tag_add_artifact to
@@ -631,11 +632,11 @@
632 zUuid = rid_to_uuid(pid);
633 blob_append(&value, zUuid, UUID_SIZE);
634 fossil_free(zUuid);
635 }
636 if( bTest && !dryRun ){
637 tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid, NULL);
638 }else{
639 zUuid = rid_to_uuid(rid);
640 tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0);
641 }
642 }
643

Keyboard Shortcuts

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