Fossil SCM
Add an option to timeline command that does the same as timeline-truncate-at-blank on /timeline.
Commit
0848396b86194abd25e6220d62405388ace620ad29898109093ae775cd28d628
Parent
71b0c80bbcce72c…
2 files changed
+2
+18
+2
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -33,10 +33,12 @@ | ||
| 33 | 33 | */ |
| 34 | 34 | #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */ |
| 35 | 35 | #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */ |
| 36 | 36 | #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */ |
| 37 | 37 | #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */ |
| 38 | +#define COMMENT_PRINT_SUMMARY ((u32)0x00000020) | |
| 39 | + /* Truncate after first blank line. */ | |
| 38 | 40 | #endif |
| 39 | 41 | |
| 40 | 42 | /********* Code copied from SQLite src/shell.c.in on 2024-09-30 **********/ |
| 41 | 43 | /* Lookup table to estimate the number of columns consumed by a Unicode |
| 42 | 44 | ** character. |
| 43 | 45 |
| --- 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 |
+18
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -3538,10 +3538,21 @@ | ||
| 3538 | 3538 | zFree = mprintf("[%S] Edit to wiki page \"%s\" (user: %s)", |
| 3539 | 3539 | zId, zComShort+1, zUserShort); |
| 3540 | 3540 | } |
| 3541 | 3541 | }else{ |
| 3542 | 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 | + } | |
| 3543 | 3554 | } |
| 3544 | 3555 | |
| 3545 | 3556 | if( zFormat ){ |
| 3546 | 3557 | char *zEntry; |
| 3547 | 3558 | int nEntryLine = 0; |
| @@ -3766,10 +3777,11 @@ | ||
| 3766 | 3777 | ** PATH can be a file or a subdirectory. |
| 3767 | 3778 | ** -q|--quiet Do not print notifications at the end of the timeline. |
| 3768 | 3779 | ** -r|--reverse Show items in chronological order. |
| 3769 | 3780 | ** -R REPO_FILE Specifies the repository db to use. Default is |
| 3770 | 3781 | ** the current check-out's repository. |
| 3782 | +** -s|--summmary Truncate comments after the first blank line. | |
| 3771 | 3783 | ** --sql Show the SQL used to generate the timeline |
| 3772 | 3784 | ** -t|--type TYPE Output items from the given types only, such as: |
| 3773 | 3785 | ** ci = file commits only |
| 3774 | 3786 | ** e = technical notes only |
| 3775 | 3787 | ** f = forum posts only |
| @@ -3804,10 +3816,12 @@ | ||
| 3804 | 3816 | const char *zFilePattern = 0; |
| 3805 | 3817 | const char *zFormat = 0; |
| 3806 | 3818 | const char *zBr = 0; |
| 3807 | 3819 | Blob treeName; |
| 3808 | 3820 | int showSql = 0; |
| 3821 | + int bCommentGitStyle = 0; | |
| 3822 | + int oldComFmtFlags = get_comment_format(); | |
| 3809 | 3823 | |
| 3810 | 3824 | verboseFlag = find_option("verbose","v", 0)!=0; |
| 3811 | 3825 | if( !verboseFlag){ |
| 3812 | 3826 | verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */ |
| 3813 | 3827 | } |
| @@ -3816,10 +3830,13 @@ | ||
| 3816 | 3830 | zWidth = find_option("width","W",1); |
| 3817 | 3831 | zType = find_option("type","t",1); |
| 3818 | 3832 | zUser = find_option("for-user","u",1); |
| 3819 | 3833 | zFilePattern = find_option("path","p",1); |
| 3820 | 3834 | zFormat = find_option("format","F",1); |
| 3835 | + if( (bCommentGitStyle = (find_option("summary","s",0))!=0) ){ | |
| 3836 | + g.comFmtFlags |= COMMENT_PRINT_SUMMARY; | |
| 3837 | + } | |
| 3821 | 3838 | zBr = find_option("branch","b",1); |
| 3822 | 3839 | if( find_option("current-branch","c",0)!=0 ){ |
| 3823 | 3840 | if( !g.localOpen ){ |
| 3824 | 3841 | fossil_fatal("not within an open check-out"); |
| 3825 | 3842 | }else{ |
| @@ -4030,10 +4047,11 @@ | ||
| 4030 | 4047 | } |
| 4031 | 4048 | db_prepare_blob(&q, &sql); |
| 4032 | 4049 | blob_reset(&sql); |
| 4033 | 4050 | print_timeline(&q, n, width, zFormat, verboseFlag); |
| 4034 | 4051 | db_finalize(&q); |
| 4052 | + g.comFmtFlags = oldComFmtFlags; | |
| 4035 | 4053 | } |
| 4036 | 4054 | |
| 4037 | 4055 | /* |
| 4038 | 4056 | ** WEBPAGE: thisdayinhistory |
| 4039 | 4057 | ** |
| 4040 | 4058 |
| --- 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 |