Fossil SCM
Same as "roy-export", but use tag value in stead of comment for storing comment related to tags. (Not actually tested with GIT yet!)
Commit
cb1fb96f0d9dfe9eaa36d9a54f6b48722496aaff
Parent
d90460dbf428e74…
2 files changed
+5
-2
+11
-3
+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 | + " value" | |
| 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 *zValue = 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", zValue==NULL?0:strlen(zValue)+1); | |
| 724 | + if( zValue!=NULL ) printf("%s\n",zValue); | |
| 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 | " value" |
| 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 *zValue = 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", zValue==NULL?0:strlen(zValue)+1); |
| 724 | if( zValue!=NULL ) printf("%s\n",zValue); |
| 725 | } |
| 726 | db_finalize(&q); |
| 727 | |
| 728 | if( markfile_out!=0 ){ |
| 729 | FILE *f; |
| 730 |
+11
-3
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -216,12 +216,15 @@ | ||
| 216 | 216 | static void finish_tag(void){ |
| 217 | 217 | Blob record, cksum; |
| 218 | 218 | if( gg.zDate && gg.zTag && gg.zFrom && gg.zUser ){ |
| 219 | 219 | blob_zero(&record); |
| 220 | 220 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 221 | - blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zTagPre, gg.zTag, | |
| 221 | + blob_appendf(&record, "T +sym-%F%F%F %s", gimport.zTagPre, gg.zTag, | |
| 222 | 222 | gimport.zTagSuf, gg.zFrom); |
| 223 | + if( gg.zComment ){ | |
| 224 | + blob_appendf(&record, " %F", gg.zComment); | |
| 225 | + } | |
| 223 | 226 | blob_appendf(&record, "U %F\n", gg.zUser); |
| 224 | 227 | md5sum_blob(&record, &cksum); |
| 225 | 228 | blob_appendf(&record, "Z %b\n", &cksum); |
| 226 | 229 | fast_insert_content(&record, 0, 0, 1); |
| 227 | 230 | blob_reset(&cksum); |
| @@ -605,12 +608,17 @@ | ||
| 605 | 608 | gg.aData = fossil_malloc( gg.nData+1 ); |
| 606 | 609 | got = fread(gg.aData, 1, gg.nData, pIn); |
| 607 | 610 | if( got!=gg.nData ){ |
| 608 | 611 | fossil_fatal("short read: got %d of %d bytes", got, gg.nData); |
| 609 | 612 | } |
| 610 | - gg.aData[got] = 0; | |
| 611 | - if( gg.zComment==0 && gg.xFinish==finish_commit ){ | |
| 613 | + /* Strip trailing newline, it's appended to the comment. */ | |
| 614 | + if( gg.aData[got-1] == '\n' ) | |
| 615 | + gg.aData[got-1] = '\0'; | |
| 616 | + else | |
| 617 | + gg.aData[got] = '\0'; | |
| 618 | + if( gg.zComment==0 && | |
| 619 | + (gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){ | |
| 612 | 620 | gg.zComment = gg.aData; |
| 613 | 621 | gg.aData = 0; |
| 614 | 622 | gg.nData = 0; |
| 615 | 623 | } |
| 616 | 624 | } |
| 617 | 625 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -216,12 +216,15 @@ | |
| 216 | static void finish_tag(void){ |
| 217 | Blob record, cksum; |
| 218 | if( gg.zDate && gg.zTag && gg.zFrom && gg.zUser ){ |
| 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); |
| @@ -605,12 +608,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 | |
| @@ -216,12 +216,15 @@ | |
| 216 | static void finish_tag(void){ |
| 217 | Blob record, cksum; |
| 218 | if( gg.zDate && gg.zTag && gg.zFrom && gg.zUser ){ |
| 219 | blob_zero(&record); |
| 220 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 221 | blob_appendf(&record, "T +sym-%F%F%F %s", gimport.zTagPre, gg.zTag, |
| 222 | gimport.zTagSuf, gg.zFrom); |
| 223 | if( gg.zComment ){ |
| 224 | blob_appendf(&record, " %F", gg.zComment); |
| 225 | } |
| 226 | blob_appendf(&record, "U %F\n", gg.zUser); |
| 227 | md5sum_blob(&record, &cksum); |
| 228 | blob_appendf(&record, "Z %b\n", &cksum); |
| 229 | fast_insert_content(&record, 0, 0, 1); |
| 230 | blob_reset(&cksum); |
| @@ -605,12 +608,17 @@ | |
| 608 | gg.aData = fossil_malloc( gg.nData+1 ); |
| 609 | got = fread(gg.aData, 1, gg.nData, pIn); |
| 610 | if( got!=gg.nData ){ |
| 611 | fossil_fatal("short read: got %d of %d bytes", got, gg.nData); |
| 612 | } |
| 613 | /* Strip trailing newline, it's appended to the comment. */ |
| 614 | if( gg.aData[got-1] == '\n' ) |
| 615 | gg.aData[got-1] = '\0'; |
| 616 | else |
| 617 | gg.aData[got] = '\0'; |
| 618 | if( gg.zComment==0 && |
| 619 | (gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){ |
| 620 | gg.zComment = gg.aData; |
| 621 | gg.aData = 0; |
| 622 | gg.nData = 0; |
| 623 | } |
| 624 | } |
| 625 |