Fossil SCM

Add an option to timeline command that does the same as timeline-truncate-at-blank on /timeline.

danield 2026-06-18 13:52 UTC trunk
Commit 0848396b86194abd25e6220d62405388ace620ad29898109093ae775cd28d628
--- src/comformat.c
+++ src/comformat.c
@@ -33,10 +33,12 @@
3333
*/
3434
#define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
3535
#define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
3636
#define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
3737
#define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
38
+#define COMMENT_PRINT_SUMMARY ((u32)0x00000020)
39
+ /* Truncate after first blank line. */
3840
#endif
3941
4042
/********* Code copied from SQLite src/shell.c.in on 2024-09-30 **********/
4143
/* Lookup table to estimate the number of columns consumed by a Unicode
4244
** character.
4345
--- src/comformat.c
+++ src/comformat.c
@@ -33,10 +33,12 @@
33 */
34 #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
35 #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
36 #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
37 #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
 
 
38 #endif
39
40 /********* Code copied from SQLite src/shell.c.in on 2024-09-30 **********/
41 /* Lookup table to estimate the number of columns consumed by a Unicode
42 ** character.
43
--- src/comformat.c
+++ src/comformat.c
@@ -33,10 +33,12 @@
33 */
34 #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
35 #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
36 #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
37 #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
38 #define COMMENT_PRINT_SUMMARY ((u32)0x00000020)
39 /* Truncate after first blank line. */
40 #endif
41
42 /********* Code copied from SQLite src/shell.c.in on 2024-09-30 **********/
43 /* Lookup table to estimate the number of columns consumed by a Unicode
44 ** character.
45
--- src/timeline.c
+++ src/timeline.c
@@ -3538,10 +3538,21 @@
35383538
zFree = mprintf("[%S] Edit to wiki page \"%s\" (user: %s)",
35393539
zId, zComShort+1, zUserShort);
35403540
}
35413541
}else{
35423542
zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
3543
+
3544
+ if( get_comment_format() & COMMENT_PRINT_SUMMARY ){
3545
+ char *z, *t;
3546
+ for(z=zFree; *z!='\0'; z++){
3547
+ if( *z=='\n' ){
3548
+ for(t=z+1; *t!='\0' && *t!='\n' && fossil_isspace(*t); t++){}
3549
+ if( *t=='\n' ) break;
3550
+ }
3551
+ }
3552
+ *z = '\0';
3553
+ }
35433554
}
35443555
35453556
if( zFormat ){
35463557
char *zEntry;
35473558
int nEntryLine = 0;
@@ -3766,10 +3777,11 @@
37663777
** PATH can be a file or a subdirectory.
37673778
** -q|--quiet Do not print notifications at the end of the timeline.
37683779
** -r|--reverse Show items in chronological order.
37693780
** -R REPO_FILE Specifies the repository db to use. Default is
37703781
** the current check-out's repository.
3782
+** -s|--summmary Truncate comments after the first blank line.
37713783
** --sql Show the SQL used to generate the timeline
37723784
** -t|--type TYPE Output items from the given types only, such as:
37733785
** ci = file commits only
37743786
** e = technical notes only
37753787
** f = forum posts only
@@ -3804,10 +3816,12 @@
38043816
const char *zFilePattern = 0;
38053817
const char *zFormat = 0;
38063818
const char *zBr = 0;
38073819
Blob treeName;
38083820
int showSql = 0;
3821
+ int bCommentGitStyle = 0;
3822
+ int oldComFmtFlags = get_comment_format();
38093823
38103824
verboseFlag = find_option("verbose","v", 0)!=0;
38113825
if( !verboseFlag){
38123826
verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
38133827
}
@@ -3816,10 +3830,13 @@
38163830
zWidth = find_option("width","W",1);
38173831
zType = find_option("type","t",1);
38183832
zUser = find_option("for-user","u",1);
38193833
zFilePattern = find_option("path","p",1);
38203834
zFormat = find_option("format","F",1);
3835
+ if( (bCommentGitStyle = (find_option("summary","s",0))!=0) ){
3836
+ g.comFmtFlags |= COMMENT_PRINT_SUMMARY;
3837
+ }
38213838
zBr = find_option("branch","b",1);
38223839
if( find_option("current-branch","c",0)!=0 ){
38233840
if( !g.localOpen ){
38243841
fossil_fatal("not within an open check-out");
38253842
}else{
@@ -4030,10 +4047,11 @@
40304047
}
40314048
db_prepare_blob(&q, &sql);
40324049
blob_reset(&sql);
40334050
print_timeline(&q, n, width, zFormat, verboseFlag);
40344051
db_finalize(&q);
4052
+ g.comFmtFlags = oldComFmtFlags;
40354053
}
40364054
40374055
/*
40384056
** WEBPAGE: thisdayinhistory
40394057
**
40404058
--- src/timeline.c
+++ src/timeline.c
@@ -3538,10 +3538,21 @@
3538 zFree = mprintf("[%S] Edit to wiki page \"%s\" (user: %s)",
3539 zId, zComShort+1, zUserShort);
3540 }
3541 }else{
3542 zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
 
 
 
 
 
 
 
 
 
 
 
3543 }
3544
3545 if( zFormat ){
3546 char *zEntry;
3547 int nEntryLine = 0;
@@ -3766,10 +3777,11 @@
3766 ** PATH can be a file or a subdirectory.
3767 ** -q|--quiet Do not print notifications at the end of the timeline.
3768 ** -r|--reverse Show items in chronological order.
3769 ** -R REPO_FILE Specifies the repository db to use. Default is
3770 ** the current check-out's repository.
 
3771 ** --sql Show the SQL used to generate the timeline
3772 ** -t|--type TYPE Output items from the given types only, such as:
3773 ** ci = file commits only
3774 ** e = technical notes only
3775 ** f = forum posts only
@@ -3804,10 +3816,12 @@
3804 const char *zFilePattern = 0;
3805 const char *zFormat = 0;
3806 const char *zBr = 0;
3807 Blob treeName;
3808 int showSql = 0;
 
 
3809
3810 verboseFlag = find_option("verbose","v", 0)!=0;
3811 if( !verboseFlag){
3812 verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
3813 }
@@ -3816,10 +3830,13 @@
3816 zWidth = find_option("width","W",1);
3817 zType = find_option("type","t",1);
3818 zUser = find_option("for-user","u",1);
3819 zFilePattern = find_option("path","p",1);
3820 zFormat = find_option("format","F",1);
 
 
 
3821 zBr = find_option("branch","b",1);
3822 if( find_option("current-branch","c",0)!=0 ){
3823 if( !g.localOpen ){
3824 fossil_fatal("not within an open check-out");
3825 }else{
@@ -4030,10 +4047,11 @@
4030 }
4031 db_prepare_blob(&q, &sql);
4032 blob_reset(&sql);
4033 print_timeline(&q, n, width, zFormat, verboseFlag);
4034 db_finalize(&q);
 
4035 }
4036
4037 /*
4038 ** WEBPAGE: thisdayinhistory
4039 **
4040
--- src/timeline.c
+++ src/timeline.c
@@ -3538,10 +3538,21 @@
3538 zFree = mprintf("[%S] Edit to wiki page \"%s\" (user: %s)",
3539 zId, zComShort+1, zUserShort);
3540 }
3541 }else{
3542 zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
3543
3544 if( get_comment_format() & COMMENT_PRINT_SUMMARY ){
3545 char *z, *t;
3546 for(z=zFree; *z!='\0'; z++){
3547 if( *z=='\n' ){
3548 for(t=z+1; *t!='\0' && *t!='\n' && fossil_isspace(*t); t++){}
3549 if( *t=='\n' ) break;
3550 }
3551 }
3552 *z = '\0';
3553 }
3554 }
3555
3556 if( zFormat ){
3557 char *zEntry;
3558 int nEntryLine = 0;
@@ -3766,10 +3777,11 @@
3777 ** PATH can be a file or a subdirectory.
3778 ** -q|--quiet Do not print notifications at the end of the timeline.
3779 ** -r|--reverse Show items in chronological order.
3780 ** -R REPO_FILE Specifies the repository db to use. Default is
3781 ** the current check-out's repository.
3782 ** -s|--summmary Truncate comments after the first blank line.
3783 ** --sql Show the SQL used to generate the timeline
3784 ** -t|--type TYPE Output items from the given types only, such as:
3785 ** ci = file commits only
3786 ** e = technical notes only
3787 ** f = forum posts only
@@ -3804,10 +3816,12 @@
3816 const char *zFilePattern = 0;
3817 const char *zFormat = 0;
3818 const char *zBr = 0;
3819 Blob treeName;
3820 int showSql = 0;
3821 int bCommentGitStyle = 0;
3822 int oldComFmtFlags = get_comment_format();
3823
3824 verboseFlag = find_option("verbose","v", 0)!=0;
3825 if( !verboseFlag){
3826 verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
3827 }
@@ -3816,10 +3830,13 @@
3830 zWidth = find_option("width","W",1);
3831 zType = find_option("type","t",1);
3832 zUser = find_option("for-user","u",1);
3833 zFilePattern = find_option("path","p",1);
3834 zFormat = find_option("format","F",1);
3835 if( (bCommentGitStyle = (find_option("summary","s",0))!=0) ){
3836 g.comFmtFlags |= COMMENT_PRINT_SUMMARY;
3837 }
3838 zBr = find_option("branch","b",1);
3839 if( find_option("current-branch","c",0)!=0 ){
3840 if( !g.localOpen ){
3841 fossil_fatal("not within an open check-out");
3842 }else{
@@ -4030,10 +4047,11 @@
4047 }
4048 db_prepare_blob(&q, &sql);
4049 blob_reset(&sql);
4050 print_timeline(&q, n, width, zFormat, verboseFlag);
4051 db_finalize(&q);
4052 g.comFmtFlags = oldComFmtFlags;
4053 }
4054
4055 /*
4056 ** WEBPAGE: thisdayinhistory
4057 **
4058

Keyboard Shortcuts

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