Fossil SCM
Fix the "fossil timeline" command so that it works with the new EVENT.COMMENT format for wiki page changes. Ticket [4e558dbf3d2511ce].
Commit
471443b46424077046400be9053f0f9b6a4f2eb42eb748525de766196c5adb71
Parent
18891326a4cc59e…
1 file changed
+16
-2
+16
-2
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -2671,10 +2671,11 @@ | ||
| 2671 | 2671 | ** 3. Comment string and user |
| 2672 | 2672 | ** 4. Number of non-merge children |
| 2673 | 2673 | ** 5. Number of parents |
| 2674 | 2674 | ** 6. mtime |
| 2675 | 2675 | ** 7. branch |
| 2676 | +** 8. event-type: 'ci', 'w', 't', 'f', and so forth. | |
| 2676 | 2677 | */ |
| 2677 | 2678 | void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){ |
| 2678 | 2679 | int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit; |
| 2679 | 2680 | int nLine = 0; |
| 2680 | 2681 | int nEntry = 0; |
| @@ -2695,10 +2696,11 @@ | ||
| 2695 | 2696 | const char *zId = db_column_text(q, 1); |
| 2696 | 2697 | const char *zDate = db_column_text(q, 2); |
| 2697 | 2698 | const char *zCom = db_column_text(q, 3); |
| 2698 | 2699 | int nChild = db_column_int(q, 4); |
| 2699 | 2700 | int nParent = db_column_int(q, 5); |
| 2701 | + const char *zType = db_column_text(q, 8); | |
| 2700 | 2702 | char *zFree = 0; |
| 2701 | 2703 | int n = 0; |
| 2702 | 2704 | char zPrefix[80]; |
| 2703 | 2705 | |
| 2704 | 2706 | if( nAbsLimit!=0 ){ |
| @@ -2738,11 +2740,22 @@ | ||
| 2738 | 2740 | } |
| 2739 | 2741 | if( content_is_private(rid) ){ |
| 2740 | 2742 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* "); |
| 2741 | 2743 | n += strlen(zPrefix+n); |
| 2742 | 2744 | } |
| 2743 | - zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom); | |
| 2745 | + if( zType[0]=='w' && (zCom[0]=='+' || zCom[0]=='-' || zCom[0]==':') ){ | |
| 2746 | + /* Special processing for Wiki comments */ | |
| 2747 | + if( zCom[0]=='+' ){ | |
| 2748 | + zFree = mprintf("[%S] Add wiki page \"%s\"", zId, zCom+1); | |
| 2749 | + }else if( zCom[0]=='-' ){ | |
| 2750 | + zFree = mprintf("[%S] Delete wiki page \"%s\"", zId, zCom+1); | |
| 2751 | + }else{ | |
| 2752 | + zFree = mprintf("[%S] Edit to wiki page \"%s\"", zId, zCom+1); | |
| 2753 | + } | |
| 2754 | + }else{ | |
| 2755 | + zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom); | |
| 2756 | + } | |
| 2744 | 2757 | /* record another X lines */ |
| 2745 | 2758 | nLine += comment_print(zFree, zCom, 9, width, get_comment_format()); |
| 2746 | 2759 | fossil_free(zFree); |
| 2747 | 2760 | |
| 2748 | 2761 | if(verboseFlag){ |
| @@ -2808,11 +2821,12 @@ | ||
| 2808 | 2821 | @ || ')' as comment, |
| 2809 | 2822 | @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim) |
| 2810 | 2823 | @ AS primPlinkCount, |
| 2811 | 2824 | @ (SELECT count(*) FROM plink WHERE cid=blob.rid) AS plinkCount, |
| 2812 | 2825 | @ event.mtime AS mtime, |
| 2813 | - @ tagxref.value AS branch | |
| 2826 | + @ tagxref.value AS branch, | |
| 2827 | + @ event.type | |
| 2814 | 2828 | @ FROM tag CROSS JOIN event CROSS JOIN blob |
| 2815 | 2829 | @ LEFT JOIN tagxref ON tagxref.tagid=tag.tagid |
| 2816 | 2830 | @ AND tagxref.tagtype>0 |
| 2817 | 2831 | @ AND tagxref.rid=blob.rid |
| 2818 | 2832 | @ WHERE blob.rid=event.objid |
| 2819 | 2833 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2671,10 +2671,11 @@ | |
| 2671 | ** 3. Comment string and user |
| 2672 | ** 4. Number of non-merge children |
| 2673 | ** 5. Number of parents |
| 2674 | ** 6. mtime |
| 2675 | ** 7. branch |
| 2676 | */ |
| 2677 | void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){ |
| 2678 | int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit; |
| 2679 | int nLine = 0; |
| 2680 | int nEntry = 0; |
| @@ -2695,10 +2696,11 @@ | |
| 2695 | const char *zId = db_column_text(q, 1); |
| 2696 | const char *zDate = db_column_text(q, 2); |
| 2697 | const char *zCom = db_column_text(q, 3); |
| 2698 | int nChild = db_column_int(q, 4); |
| 2699 | int nParent = db_column_int(q, 5); |
| 2700 | char *zFree = 0; |
| 2701 | int n = 0; |
| 2702 | char zPrefix[80]; |
| 2703 | |
| 2704 | if( nAbsLimit!=0 ){ |
| @@ -2738,11 +2740,22 @@ | |
| 2738 | } |
| 2739 | if( content_is_private(rid) ){ |
| 2740 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* "); |
| 2741 | n += strlen(zPrefix+n); |
| 2742 | } |
| 2743 | zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom); |
| 2744 | /* record another X lines */ |
| 2745 | nLine += comment_print(zFree, zCom, 9, width, get_comment_format()); |
| 2746 | fossil_free(zFree); |
| 2747 | |
| 2748 | if(verboseFlag){ |
| @@ -2808,11 +2821,12 @@ | |
| 2808 | @ || ')' as comment, |
| 2809 | @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim) |
| 2810 | @ AS primPlinkCount, |
| 2811 | @ (SELECT count(*) FROM plink WHERE cid=blob.rid) AS plinkCount, |
| 2812 | @ event.mtime AS mtime, |
| 2813 | @ tagxref.value AS branch |
| 2814 | @ FROM tag CROSS JOIN event CROSS JOIN blob |
| 2815 | @ LEFT JOIN tagxref ON tagxref.tagid=tag.tagid |
| 2816 | @ AND tagxref.tagtype>0 |
| 2817 | @ AND tagxref.rid=blob.rid |
| 2818 | @ WHERE blob.rid=event.objid |
| 2819 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2671,10 +2671,11 @@ | |
| 2671 | ** 3. Comment string and user |
| 2672 | ** 4. Number of non-merge children |
| 2673 | ** 5. Number of parents |
| 2674 | ** 6. mtime |
| 2675 | ** 7. branch |
| 2676 | ** 8. event-type: 'ci', 'w', 't', 'f', and so forth. |
| 2677 | */ |
| 2678 | void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){ |
| 2679 | int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit; |
| 2680 | int nLine = 0; |
| 2681 | int nEntry = 0; |
| @@ -2695,10 +2696,11 @@ | |
| 2696 | const char *zId = db_column_text(q, 1); |
| 2697 | const char *zDate = db_column_text(q, 2); |
| 2698 | const char *zCom = db_column_text(q, 3); |
| 2699 | int nChild = db_column_int(q, 4); |
| 2700 | int nParent = db_column_int(q, 5); |
| 2701 | const char *zType = db_column_text(q, 8); |
| 2702 | char *zFree = 0; |
| 2703 | int n = 0; |
| 2704 | char zPrefix[80]; |
| 2705 | |
| 2706 | if( nAbsLimit!=0 ){ |
| @@ -2738,11 +2740,22 @@ | |
| 2740 | } |
| 2741 | if( content_is_private(rid) ){ |
| 2742 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* "); |
| 2743 | n += strlen(zPrefix+n); |
| 2744 | } |
| 2745 | if( zType[0]=='w' && (zCom[0]=='+' || zCom[0]=='-' || zCom[0]==':') ){ |
| 2746 | /* Special processing for Wiki comments */ |
| 2747 | if( zCom[0]=='+' ){ |
| 2748 | zFree = mprintf("[%S] Add wiki page \"%s\"", zId, zCom+1); |
| 2749 | }else if( zCom[0]=='-' ){ |
| 2750 | zFree = mprintf("[%S] Delete wiki page \"%s\"", zId, zCom+1); |
| 2751 | }else{ |
| 2752 | zFree = mprintf("[%S] Edit to wiki page \"%s\"", zId, zCom+1); |
| 2753 | } |
| 2754 | }else{ |
| 2755 | zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom); |
| 2756 | } |
| 2757 | /* record another X lines */ |
| 2758 | nLine += comment_print(zFree, zCom, 9, width, get_comment_format()); |
| 2759 | fossil_free(zFree); |
| 2760 | |
| 2761 | if(verboseFlag){ |
| @@ -2808,11 +2821,12 @@ | |
| 2821 | @ || ')' as comment, |
| 2822 | @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim) |
| 2823 | @ AS primPlinkCount, |
| 2824 | @ (SELECT count(*) FROM plink WHERE cid=blob.rid) AS plinkCount, |
| 2825 | @ event.mtime AS mtime, |
| 2826 | @ tagxref.value AS branch, |
| 2827 | @ event.type |
| 2828 | @ FROM tag CROSS JOIN event CROSS JOIN blob |
| 2829 | @ LEFT JOIN tagxref ON tagxref.tagid=tag.tagid |
| 2830 | @ AND tagxref.tagtype>0 |
| 2831 | @ AND tagxref.rid=blob.rid |
| 2832 | @ WHERE blob.rid=event.objid |
| 2833 |