Fossil SCM

Fix the "fossil timeline" command so that it works with the new EVENT.COMMENT format for wiki page changes. Ticket [4e558dbf3d2511ce].

drh 2020-11-25 21:45 trunk
Commit 471443b46424077046400be9053f0f9b6a4f2eb42eb748525de766196c5adb71
1 file changed +16 -2
+16 -2
--- src/timeline.c
+++ src/timeline.c
@@ -2671,10 +2671,11 @@
26712671
** 3. Comment string and user
26722672
** 4. Number of non-merge children
26732673
** 5. Number of parents
26742674
** 6. mtime
26752675
** 7. branch
2676
+** 8. event-type: 'ci', 'w', 't', 'f', and so forth.
26762677
*/
26772678
void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){
26782679
int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
26792680
int nLine = 0;
26802681
int nEntry = 0;
@@ -2695,10 +2696,11 @@
26952696
const char *zId = db_column_text(q, 1);
26962697
const char *zDate = db_column_text(q, 2);
26972698
const char *zCom = db_column_text(q, 3);
26982699
int nChild = db_column_int(q, 4);
26992700
int nParent = db_column_int(q, 5);
2701
+ const char *zType = db_column_text(q, 8);
27002702
char *zFree = 0;
27012703
int n = 0;
27022704
char zPrefix[80];
27032705
27042706
if( nAbsLimit!=0 ){
@@ -2738,11 +2740,22 @@
27382740
}
27392741
if( content_is_private(rid) ){
27402742
sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* ");
27412743
n += strlen(zPrefix+n);
27422744
}
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
+ }
27442757
/* record another X lines */
27452758
nLine += comment_print(zFree, zCom, 9, width, get_comment_format());
27462759
fossil_free(zFree);
27472760
27482761
if(verboseFlag){
@@ -2808,11 +2821,12 @@
28082821
@ || ')' as comment,
28092822
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim)
28102823
@ AS primPlinkCount,
28112824
@ (SELECT count(*) FROM plink WHERE cid=blob.rid) AS plinkCount,
28122825
@ event.mtime AS mtime,
2813
- @ tagxref.value AS branch
2826
+ @ tagxref.value AS branch,
2827
+ @ event.type
28142828
@ FROM tag CROSS JOIN event CROSS JOIN blob
28152829
@ LEFT JOIN tagxref ON tagxref.tagid=tag.tagid
28162830
@ AND tagxref.tagtype>0
28172831
@ AND tagxref.rid=blob.rid
28182832
@ WHERE blob.rid=event.objid
28192833
--- 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

Keyboard Shortcuts

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