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.
Commit
752bdd38c73da128a15ec37a800bd5c7c1d59e3e
Parent
d90460dbf428e74…
5 files changed
+5
-2
+8
-2
+5
-5
+1
+7
-6
+5
-2
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -697,30 +697,33 @@ | ||
| 697 | 697 | |
| 698 | 698 | |
| 699 | 699 | /* Output tags */ |
| 700 | 700 | db_prepare(&q, |
| 701 | 701 | "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" | |
| 703 | 704 | " FROM tagxref JOIN tag USING(tagid)" |
| 704 | 705 | " WHERE tagtype=1 AND tagname GLOB 'sym-*'" |
| 705 | 706 | ); |
| 706 | 707 | while( db_step(&q)==SQLITE_ROW ){ |
| 707 | 708 | const char *zTagname = db_column_text(&q, 0); |
| 708 | 709 | int rid = db_column_int(&q, 1); |
| 709 | 710 | char *zMark = mark_name_from_rid(rid, &unused_mark); |
| 710 | 711 | const char *zSecSince1970 = db_column_text(&q, 2); |
| 711 | 712 | const char *zUser = db_column_text(&q, 3); |
| 713 | + const char *zComment = db_column_text(&q, 4); | |
| 712 | 714 | if( rid==0 || !bag_find(&vers, rid) ) continue; |
| 713 | 715 | zTagname += 4; |
| 714 | 716 | printf("tag "); |
| 715 | 717 | print_ref(zTagname); |
| 716 | 718 | printf("\nfrom %s\n", zMark); |
| 717 | 719 | free(zMark); |
| 718 | 720 | printf("tagger"); |
| 719 | 721 | print_person(zUser); |
| 720 | 722 | 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); | |
| 722 | 725 | } |
| 723 | 726 | db_finalize(&q); |
| 724 | 727 | |
| 725 | 728 | if( markfile_out!=0 ){ |
| 726 | 729 | FILE *f; |
| 727 | 730 |
| --- 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 @@ | ||
| 219 | 219 | blob_zero(&record); |
| 220 | 220 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 221 | 221 | blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zTagPre, gg.zTag, |
| 222 | 222 | gimport.zTagSuf, gg.zFrom); |
| 223 | 223 | blob_appendf(&record, "U %F\n", gg.zUser); |
| 224 | + if( gg.zComment ) blob_appendf(&record, "C %F\n", gg.zComment); | |
| 224 | 225 | md5sum_blob(&record, &cksum); |
| 225 | 226 | blob_appendf(&record, "Z %b\n", &cksum); |
| 226 | 227 | fast_insert_content(&record, 0, 0, 1); |
| 227 | 228 | blob_reset(&cksum); |
| 228 | 229 | } |
| @@ -605,12 +606,17 @@ | ||
| 605 | 606 | gg.aData = fossil_malloc( gg.nData+1 ); |
| 606 | 607 | got = fread(gg.aData, 1, gg.nData, pIn); |
| 607 | 608 | if( got!=gg.nData ){ |
| 608 | 609 | fossil_fatal("short read: got %d of %d bytes", got, gg.nData); |
| 609 | 610 | } |
| 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) ){ | |
| 612 | 618 | gg.zComment = gg.aData; |
| 613 | 619 | gg.aData = 0; |
| 614 | 620 | gg.nData = 0; |
| 615 | 621 | } |
| 616 | 622 | } |
| 617 | 623 |
| --- 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 @@ | ||
| 1999 | 1999 | } |
| 2000 | 2000 | } |
| 2001 | 2001 | } |
| 2002 | 2002 | if( p->type==CFTYPE_CLUSTER ){ |
| 2003 | 2003 | static Stmt del1; |
| 2004 | - tag_insert("cluster", 1, 0, rid, p->rDate, rid); | |
| 2004 | + tag_insert("cluster", 1, 0, rid, p->rDate, rid, NULL); | |
| 2005 | 2005 | db_static_prepare(&del1, "DELETE FROM unclustered WHERE rid=:rid"); |
| 2006 | 2006 | for(i=0; i<p->nCChild; i++){ |
| 2007 | 2007 | int mid; |
| 2008 | 2008 | mid = uuid_to_rid(p->azCChild[i], 1); |
| 2009 | 2009 | if( mid>0 ){ |
| @@ -2033,11 +2033,11 @@ | ||
| 2033 | 2033 | default: |
| 2034 | 2034 | fossil_error(1, "unknown tag type in manifest: %s", p->aTag); |
| 2035 | 2035 | return 0; |
| 2036 | 2036 | } |
| 2037 | 2037 | tag_insert(&p->aTag[i].zName[1], type, p->aTag[i].zValue, |
| 2038 | - rid, p->rDate, tid); | |
| 2038 | + rid, p->rDate, tid, p->zComment); | |
| 2039 | 2039 | } |
| 2040 | 2040 | } |
| 2041 | 2041 | if( parentid ){ |
| 2042 | 2042 | tag_propagate_all(parentid); |
| 2043 | 2043 | } |
| @@ -2050,11 +2050,11 @@ | ||
| 2050 | 2050 | int nWiki; |
| 2051 | 2051 | char zLength[40]; |
| 2052 | 2052 | while( fossil_isspace(p->zWiki[0]) ) p->zWiki++; |
| 2053 | 2053 | nWiki = strlen(p->zWiki); |
| 2054 | 2054 | 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); | |
| 2056 | 2056 | fossil_free(zTag); |
| 2057 | 2057 | prior = db_int(0, |
| 2058 | 2058 | "SELECT rid FROM tagxref" |
| 2059 | 2059 | " WHERE tagid=%d AND mtime<%.17g" |
| 2060 | 2060 | " ORDER BY mtime DESC", |
| @@ -2091,11 +2091,11 @@ | ||
| 2091 | 2091 | char zLength[40]; |
| 2092 | 2092 | Stmt qatt; |
| 2093 | 2093 | while( fossil_isspace(p->zWiki[0]) ) p->zWiki++; |
| 2094 | 2094 | nWiki = strlen(p->zWiki); |
| 2095 | 2095 | 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); | |
| 2097 | 2097 | fossil_free(zTag); |
| 2098 | 2098 | prior = db_int(0, |
| 2099 | 2099 | "SELECT rid FROM tagxref" |
| 2100 | 2100 | " WHERE tagid=%d AND mtime<%.17g AND rid!=%d" |
| 2101 | 2101 | " ORDER BY mtime DESC", |
| @@ -2165,11 +2165,11 @@ | ||
| 2165 | 2165 | if( p->type==CFTYPE_TICKET ){ |
| 2166 | 2166 | char *zTag; |
| 2167 | 2167 | Stmt qatt; |
| 2168 | 2168 | assert( manifest_crosslink_busy==1 ); |
| 2169 | 2169 | 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); | |
| 2171 | 2171 | fossil_free(zTag); |
| 2172 | 2172 | db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)", |
| 2173 | 2173 | p->zTicketUuid); |
| 2174 | 2174 | /* Locate and update comment for any attachments */ |
| 2175 | 2175 | db_prepare(&qatt, |
| 2176 | 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); |
| 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 |
+1
| --- src/schema.c | ||
| +++ src/schema.c | ||
| @@ -384,10 +384,11 @@ | ||
| 384 | 384 | @ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags |
| 385 | 385 | @ origid INTEGER REFERENCES blob, -- check-in holding propagated tag |
| 386 | 386 | @ value TEXT, -- Value of the tag. Might be NULL. |
| 387 | 387 | @ mtime TIMESTAMP, -- Time of addition or removal. Julian day |
| 388 | 388 | @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to |
| 389 | +@ tagcomment TEXT, -- Comment of the tag | |
| 389 | 390 | @ UNIQUE(rid, tagid) |
| 390 | 391 | @ ); |
| 391 | 392 | @ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime); |
| 392 | 393 | @ |
| 393 | 394 | @ -- When a hyperlink occurs from one artifact to another (for example |
| 394 | 395 |
| --- 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 @@ | ||
| 158 | 158 | const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */ |
| 159 | 159 | int tagtype, /* 0:cancel 1:singleton 2:propagated */ |
| 160 | 160 | const char *zValue, /* Value if the tag is really a property */ |
| 161 | 161 | int srcId, /* Artifact that contains this tag */ |
| 162 | 162 | 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 */ | |
| 164 | 165 | ){ |
| 165 | 166 | Stmt s; |
| 166 | 167 | const char *zCol; |
| 167 | 168 | int tagid = tag_findid(zTag, 1); |
| 168 | 169 | int rc; |
| @@ -183,13 +184,13 @@ | ||
| 183 | 184 | if( rc==SQLITE_ROW ){ |
| 184 | 185 | /* Another entry that is more recent already exists. Do nothing */ |
| 185 | 186 | return tagid; |
| 186 | 187 | } |
| 187 | 188 | 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 | |
| 191 | 192 | ); |
| 192 | 193 | db_bind_double(&s, ":mtime", mtime); |
| 193 | 194 | db_step(&s); |
| 194 | 195 | db_finalize(&s); |
| 195 | 196 | if( tagid==TAG_BRANCH ) leaf_eventually_check(rid); |
| @@ -275,11 +276,11 @@ | ||
| 275 | 276 | fossil_fatal("no such object: %s", g.argv[3]); |
| 276 | 277 | } |
| 277 | 278 | g.markPrivate = content_is_private(rid); |
| 278 | 279 | zValue = g.argc==5 ? g.argv[4] : 0; |
| 279 | 280 | db_begin_transaction(); |
| 280 | - tag_insert(zTag, tagtype, zValue, -1, 0.0, rid); | |
| 281 | + tag_insert(zTag, tagtype, zValue, -1, 0.0, rid, NULL); | |
| 281 | 282 | db_end_transaction(0); |
| 282 | 283 | } |
| 283 | 284 | |
| 284 | 285 | /* |
| 285 | 286 | ** OR this value into the tagtype argument to tag_add_artifact to |
| @@ -631,11 +632,11 @@ | ||
| 631 | 632 | zUuid = rid_to_uuid(pid); |
| 632 | 633 | blob_append(&value, zUuid, UUID_SIZE); |
| 633 | 634 | fossil_free(zUuid); |
| 634 | 635 | } |
| 635 | 636 | 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); | |
| 637 | 638 | }else{ |
| 638 | 639 | zUuid = rid_to_uuid(rid); |
| 639 | 640 | tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0); |
| 640 | 641 | } |
| 641 | 642 | } |
| 642 | 643 |
| --- 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 |