Fossil SCM

Rename "prefix" to "phase" and fix a C99-ism.

danield 2020-12-21 12:14 timeline-cmd-formatting
Commit df99abda58765884b1d0a0d67491ff8cacf1605f9c05d34ed0de005f85a1c58b
1 file changed +11 -12
+11 -12
--- src/timeline.c
+++ src/timeline.c
@@ -2741,12 +2741,12 @@
27412741
** %a author name
27422742
** %d date
27432743
** %c comment (\n, \t replaced by space, \r deleted)
27442744
** %b branch
27452745
** %t tags
2746
-** %p prefix (zero or more of: *CURRENT*, *MERGE*, *FORK*,
2747
-** *UNPUBLISHED*, *LEAF*, *BRANCH*)
2746
+** %p phase (zero or more of: *CURRENT*, *MERGE*, *FORK*,
2747
+** *UNPUBLISHED*, *LEAF*, *BRANCH*)
27482748
**
27492749
** The returned string is obtained from fossil_malloc() and should
27502750
** be freed by the caller.
27512751
*/
27522752
static char *timeline_entry_subst(
@@ -2756,16 +2756,17 @@
27562756
const char *zDate,
27572757
const char *zUser,
27582758
const char *zCom,
27592759
const char *zBranch,
27602760
const char *zTags,
2761
- const char *zPrefix
2761
+ const char *zPhase
27622762
){
2763
- Blob co;
2764
- int j;
2763
+ Blob r, co;
2764
+ int i, j;
2765
+ blob_init(&r, 0, 0);
27652766
blob_init(&co, 0, 0);
2766
- *nLine = 1;
2767
+
27672768
/* Replace LF and tab with space, delete CR */
27682769
while( zCom[0] ){
27692770
for(j=0; zCom[j] && zCom[j]!='\r' && zCom[j]!='\n' && zCom[j]!='\t'; j++){}
27702771
blob_append(&co, zCom, j);
27712772
if( zCom[j]==0 ) break;
@@ -2773,13 +2774,11 @@
27732774
blob_append(&co, " ", 1);
27742775
zCom += j+1;
27752776
}
27762777
blob_str(&co);
27772778
2778
- Blob r;
2779
- int i;
2780
- blob_init(&r, 0, 0);
2779
+ *nLine = 1;
27812780
while( zFormat[0] ){
27822781
for(i=0; zFormat[i] && zFormat[i]!='%'; i++){}
27832782
blob_append(&r, zFormat, i);
27842783
if( zFormat[i]==0 ) break;
27852784
if( zFormat[i+1]=='%' ){
@@ -2812,11 +2811,11 @@
28122811
zFormat += i+2;
28132812
}else if( zFormat[i+1]=='t' ){
28142813
blob_append(&r, zTags, -1);
28152814
zFormat += i+2;
28162815
}else if( zFormat[i+1]=='p' ){
2817
- blob_append(&r, zPrefix, -1);
2816
+ blob_append(&r, zPhase, -1);
28182817
zFormat += i+2;
28192818
}else{
28202819
blob_append(&r, zFormat+i, 1);
28212820
zFormat += i+1;
28222821
}
@@ -3119,12 +3118,12 @@
31193118
** %a author name
31203119
** %d date
31213120
** %c comment (NL, TAB replaced by space, LF deleted)
31223121
** %b branch
31233122
** %t tags
3124
-** %p zero or more of: *CURRENT*, *MERGE*, *FORK*,
3125
-** *UNPUBLISHED*, *LEAF*, *BRANCH*
3123
+** %p phase: zero or more of *CURRENT*, *MERGE*,
3124
+** *FORK*, *UNPUBLISHED*, *LEAF*, *BRANCH*
31263125
** --oneline Show only short hash and comment for each entry
31273126
** --medium Medium-verbose entry formatting
31283127
** --full Extra verbose entry formatting
31293128
** -R REPO_FILE Specifies the repository db to use. Default is
31303129
** the current checkout's repository.
31313130
--- src/timeline.c
+++ src/timeline.c
@@ -2741,12 +2741,12 @@
2741 ** %a author name
2742 ** %d date
2743 ** %c comment (\n, \t replaced by space, \r deleted)
2744 ** %b branch
2745 ** %t tags
2746 ** %p prefix (zero or more of: *CURRENT*, *MERGE*, *FORK*,
2747 ** *UNPUBLISHED*, *LEAF*, *BRANCH*)
2748 **
2749 ** The returned string is obtained from fossil_malloc() and should
2750 ** be freed by the caller.
2751 */
2752 static char *timeline_entry_subst(
@@ -2756,16 +2756,17 @@
2756 const char *zDate,
2757 const char *zUser,
2758 const char *zCom,
2759 const char *zBranch,
2760 const char *zTags,
2761 const char *zPrefix
2762 ){
2763 Blob co;
2764 int j;
 
2765 blob_init(&co, 0, 0);
2766 *nLine = 1;
2767 /* Replace LF and tab with space, delete CR */
2768 while( zCom[0] ){
2769 for(j=0; zCom[j] && zCom[j]!='\r' && zCom[j]!='\n' && zCom[j]!='\t'; j++){}
2770 blob_append(&co, zCom, j);
2771 if( zCom[j]==0 ) break;
@@ -2773,13 +2774,11 @@
2773 blob_append(&co, " ", 1);
2774 zCom += j+1;
2775 }
2776 blob_str(&co);
2777
2778 Blob r;
2779 int i;
2780 blob_init(&r, 0, 0);
2781 while( zFormat[0] ){
2782 for(i=0; zFormat[i] && zFormat[i]!='%'; i++){}
2783 blob_append(&r, zFormat, i);
2784 if( zFormat[i]==0 ) break;
2785 if( zFormat[i+1]=='%' ){
@@ -2812,11 +2811,11 @@
2812 zFormat += i+2;
2813 }else if( zFormat[i+1]=='t' ){
2814 blob_append(&r, zTags, -1);
2815 zFormat += i+2;
2816 }else if( zFormat[i+1]=='p' ){
2817 blob_append(&r, zPrefix, -1);
2818 zFormat += i+2;
2819 }else{
2820 blob_append(&r, zFormat+i, 1);
2821 zFormat += i+1;
2822 }
@@ -3119,12 +3118,12 @@
3119 ** %a author name
3120 ** %d date
3121 ** %c comment (NL, TAB replaced by space, LF deleted)
3122 ** %b branch
3123 ** %t tags
3124 ** %p zero or more of: *CURRENT*, *MERGE*, *FORK*,
3125 ** *UNPUBLISHED*, *LEAF*, *BRANCH*
3126 ** --oneline Show only short hash and comment for each entry
3127 ** --medium Medium-verbose entry formatting
3128 ** --full Extra verbose entry formatting
3129 ** -R REPO_FILE Specifies the repository db to use. Default is
3130 ** the current checkout's repository.
3131
--- src/timeline.c
+++ src/timeline.c
@@ -2741,12 +2741,12 @@
2741 ** %a author name
2742 ** %d date
2743 ** %c comment (\n, \t replaced by space, \r deleted)
2744 ** %b branch
2745 ** %t tags
2746 ** %p phase (zero or more of: *CURRENT*, *MERGE*, *FORK*,
2747 ** *UNPUBLISHED*, *LEAF*, *BRANCH*)
2748 **
2749 ** The returned string is obtained from fossil_malloc() and should
2750 ** be freed by the caller.
2751 */
2752 static char *timeline_entry_subst(
@@ -2756,16 +2756,17 @@
2756 const char *zDate,
2757 const char *zUser,
2758 const char *zCom,
2759 const char *zBranch,
2760 const char *zTags,
2761 const char *zPhase
2762 ){
2763 Blob r, co;
2764 int i, j;
2765 blob_init(&r, 0, 0);
2766 blob_init(&co, 0, 0);
2767
2768 /* Replace LF and tab with space, delete CR */
2769 while( zCom[0] ){
2770 for(j=0; zCom[j] && zCom[j]!='\r' && zCom[j]!='\n' && zCom[j]!='\t'; j++){}
2771 blob_append(&co, zCom, j);
2772 if( zCom[j]==0 ) break;
@@ -2773,13 +2774,11 @@
2774 blob_append(&co, " ", 1);
2775 zCom += j+1;
2776 }
2777 blob_str(&co);
2778
2779 *nLine = 1;
 
 
2780 while( zFormat[0] ){
2781 for(i=0; zFormat[i] && zFormat[i]!='%'; i++){}
2782 blob_append(&r, zFormat, i);
2783 if( zFormat[i]==0 ) break;
2784 if( zFormat[i+1]=='%' ){
@@ -2812,11 +2811,11 @@
2811 zFormat += i+2;
2812 }else if( zFormat[i+1]=='t' ){
2813 blob_append(&r, zTags, -1);
2814 zFormat += i+2;
2815 }else if( zFormat[i+1]=='p' ){
2816 blob_append(&r, zPhase, -1);
2817 zFormat += i+2;
2818 }else{
2819 blob_append(&r, zFormat+i, 1);
2820 zFormat += i+1;
2821 }
@@ -3119,12 +3118,12 @@
3118 ** %a author name
3119 ** %d date
3120 ** %c comment (NL, TAB replaced by space, LF deleted)
3121 ** %b branch
3122 ** %t tags
3123 ** %p phase: zero or more of *CURRENT*, *MERGE*,
3124 ** *FORK*, *UNPUBLISHED*, *LEAF*, *BRANCH*
3125 ** --oneline Show only short hash and comment for each entry
3126 ** --medium Medium-verbose entry formatting
3127 ** --full Extra verbose entry formatting
3128 ** -R REPO_FILE Specifies the repository db to use. Default is
3129 ** the current checkout's repository.
3130

Keyboard Shortcuts

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