Fossil SCM

Do not separate timeline entries by an empty line when using custom formatting strings.

danield 2023-11-20 18:57 trunk
Commit 256983fdd5219cbc6fc0c08452a5fe141d6475d2326b02158d6ce7966a80dbd7
1 file changed +24 -12
+24 -12
--- src/timeline.c
+++ src/timeline.c
@@ -35,10 +35,17 @@
3535
#define TIMELINE_MODE_BEFORE 1
3636
#define TIMELINE_MODE_AFTER 2
3737
#define TIMELINE_MODE_CHILDREN 3
3838
#define TIMELINE_MODE_PARENTS 4
3939
40
+#define TIMELINE_FMT_ONELINE \
41
+ "%h %c"
42
+#define TIMELINE_FMT_MEDIUM \
43
+ "Commit: %h%nDate: %d%nAuthor: %a%nComment: %c"
44
+#define TIMELINE_FMT_FULL \
45
+ "Commit: %H%nDate: %d%nAuthor: %a%nComment: %c%n"\
46
+ "Branch: %b%nTags: %t%nPhase: %p"
4047
/*
4148
** Add an appropriate tag to the output if "rid" is unpublished (private)
4249
*/
4350
#define UNPUB_TAG "<em>(unpublished)</em>"
4451
void tag_private_status(int rid){
@@ -3019,12 +3026,15 @@
30193026
char zPrevDate[20];
30203027
const char *zCurrentUuid = 0;
30213028
int fchngQueryInit = 0; /* True if fchngQuery is initialized */
30223029
Stmt fchngQuery; /* Query for file changes on check-ins */
30233030
int rc;
3024
- int bVerboseNewline = (zFormat!=0 && (fossil_strcmp(zFormat, "%h %c")!=0) );
3025
- /* True: print a newline after file listing */
3031
+ /* True: separate entries with a newline after file listing */
3032
+ int bVerboseNL = (zFormat && (fossil_strcmp(zFormat, TIMELINE_FMT_ONELINE)!=0));
3033
+ /* True: separate entries with a newline even with no file listing */
3034
+ int bNoVerboseNL = (zFormat && (fossil_strcmp(zFormat, TIMELINE_FMT_MEDIUM)==0 ||
3035
+ fossil_strcmp(zFormat, TIMELINE_FMT_FULL)==0));
30263036
30273037
zPrevDate[0] = 0;
30283038
if( g.localOpen ){
30293039
int rid = db_lget_int("checkout", 0);
30303040
zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -3153,14 +3163,14 @@
31533163
fossil_print(" EDITED %s\n", zFilename);
31543164
}
31553165
nLine++; /* record another line */
31563166
}
31573167
db_reset(&fchngQuery);
3168
+ if( bVerboseNL ) fossil_print("\n");
3169
+ }else{
3170
+ if( bNoVerboseNL ) fossil_print("\n");
31583171
}
3159
- /* With special formatting (except for "oneline") and --verbose,
3160
- ** print a newline after the file listing */
3161
- if( bVerboseNewline ) fossil_print("\n");
31623172
31633173
nEntry++; /* record another complete entry */
31643174
}
31653175
if( rc==SQLITE_DONE ){
31663176
/* Did the underlying query actually have all entries? */
@@ -3342,17 +3352,19 @@
33423352
int vid = db_lget_int("checkout", 0);
33433353
zBr = db_text(0, "SELECT value FROM tagxref WHERE rid=%d AND tagid=%d",
33443354
vid, TAG_BRANCH);
33453355
}
33463356
}
3347
- if( find_option("oneline",0,0)!= 0 || fossil_strcmp(zFormat,"oneline")==0 )
3348
- zFormat = "%h %c";
3349
- if( find_option("medium",0,0)!= 0 || fossil_strcmp(zFormat,"medium")==0 )
3350
- zFormat = "Commit: %h%nDate: %d%nAuthor: %a%nComment: %c";
3351
- if( find_option("full",0,0)!= 0 || fossil_strcmp(zFormat,"full")==0 )
3352
- zFormat = "Commit: %H%nDate: %d%nAuthor: %a%nComment: %c%n"
3353
- "Branch: %b%nTags: %t%nPhase: %p";
3357
+ if( find_option("oneline",0,0)!= 0 || fossil_strcmp(zFormat,"oneline")==0 ){
3358
+ zFormat = TIMELINE_FMT_ONELINE;
3359
+ }
3360
+ if( find_option("medium",0,0)!= 0 || fossil_strcmp(zFormat,"medium")==0 ){
3361
+ zFormat = TIMELINE_FMT_MEDIUM;
3362
+ }
3363
+ if( find_option("full",0,0)!= 0 || fossil_strcmp(zFormat,"full")==0 ){
3364
+ zFormat = TIMELINE_FMT_FULL;
3365
+ }
33543366
showSql = find_option("sql",0,0)!=0;
33553367
33563368
if( !zLimit ){
33573369
zLimit = find_option("count",0,1);
33583370
}
33593371
--- src/timeline.c
+++ src/timeline.c
@@ -35,10 +35,17 @@
35 #define TIMELINE_MODE_BEFORE 1
36 #define TIMELINE_MODE_AFTER 2
37 #define TIMELINE_MODE_CHILDREN 3
38 #define TIMELINE_MODE_PARENTS 4
39
 
 
 
 
 
 
 
40 /*
41 ** Add an appropriate tag to the output if "rid" is unpublished (private)
42 */
43 #define UNPUB_TAG "<em>(unpublished)</em>"
44 void tag_private_status(int rid){
@@ -3019,12 +3026,15 @@
3019 char zPrevDate[20];
3020 const char *zCurrentUuid = 0;
3021 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
3022 Stmt fchngQuery; /* Query for file changes on check-ins */
3023 int rc;
3024 int bVerboseNewline = (zFormat!=0 && (fossil_strcmp(zFormat, "%h %c")!=0) );
3025 /* True: print a newline after file listing */
 
 
 
3026
3027 zPrevDate[0] = 0;
3028 if( g.localOpen ){
3029 int rid = db_lget_int("checkout", 0);
3030 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -3153,14 +3163,14 @@
3153 fossil_print(" EDITED %s\n", zFilename);
3154 }
3155 nLine++; /* record another line */
3156 }
3157 db_reset(&fchngQuery);
 
 
 
3158 }
3159 /* With special formatting (except for "oneline") and --verbose,
3160 ** print a newline after the file listing */
3161 if( bVerboseNewline ) fossil_print("\n");
3162
3163 nEntry++; /* record another complete entry */
3164 }
3165 if( rc==SQLITE_DONE ){
3166 /* Did the underlying query actually have all entries? */
@@ -3342,17 +3352,19 @@
3342 int vid = db_lget_int("checkout", 0);
3343 zBr = db_text(0, "SELECT value FROM tagxref WHERE rid=%d AND tagid=%d",
3344 vid, TAG_BRANCH);
3345 }
3346 }
3347 if( find_option("oneline",0,0)!= 0 || fossil_strcmp(zFormat,"oneline")==0 )
3348 zFormat = "%h %c";
3349 if( find_option("medium",0,0)!= 0 || fossil_strcmp(zFormat,"medium")==0 )
3350 zFormat = "Commit: %h%nDate: %d%nAuthor: %a%nComment: %c";
3351 if( find_option("full",0,0)!= 0 || fossil_strcmp(zFormat,"full")==0 )
3352 zFormat = "Commit: %H%nDate: %d%nAuthor: %a%nComment: %c%n"
3353 "Branch: %b%nTags: %t%nPhase: %p";
 
 
3354 showSql = find_option("sql",0,0)!=0;
3355
3356 if( !zLimit ){
3357 zLimit = find_option("count",0,1);
3358 }
3359
--- src/timeline.c
+++ src/timeline.c
@@ -35,10 +35,17 @@
35 #define TIMELINE_MODE_BEFORE 1
36 #define TIMELINE_MODE_AFTER 2
37 #define TIMELINE_MODE_CHILDREN 3
38 #define TIMELINE_MODE_PARENTS 4
39
40 #define TIMELINE_FMT_ONELINE \
41 "%h %c"
42 #define TIMELINE_FMT_MEDIUM \
43 "Commit: %h%nDate: %d%nAuthor: %a%nComment: %c"
44 #define TIMELINE_FMT_FULL \
45 "Commit: %H%nDate: %d%nAuthor: %a%nComment: %c%n"\
46 "Branch: %b%nTags: %t%nPhase: %p"
47 /*
48 ** Add an appropriate tag to the output if "rid" is unpublished (private)
49 */
50 #define UNPUB_TAG "<em>(unpublished)</em>"
51 void tag_private_status(int rid){
@@ -3019,12 +3026,15 @@
3026 char zPrevDate[20];
3027 const char *zCurrentUuid = 0;
3028 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
3029 Stmt fchngQuery; /* Query for file changes on check-ins */
3030 int rc;
3031 /* True: separate entries with a newline after file listing */
3032 int bVerboseNL = (zFormat && (fossil_strcmp(zFormat, TIMELINE_FMT_ONELINE)!=0));
3033 /* True: separate entries with a newline even with no file listing */
3034 int bNoVerboseNL = (zFormat && (fossil_strcmp(zFormat, TIMELINE_FMT_MEDIUM)==0 ||
3035 fossil_strcmp(zFormat, TIMELINE_FMT_FULL)==0));
3036
3037 zPrevDate[0] = 0;
3038 if( g.localOpen ){
3039 int rid = db_lget_int("checkout", 0);
3040 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -3153,14 +3163,14 @@
3163 fossil_print(" EDITED %s\n", zFilename);
3164 }
3165 nLine++; /* record another line */
3166 }
3167 db_reset(&fchngQuery);
3168 if( bVerboseNL ) fossil_print("\n");
3169 }else{
3170 if( bNoVerboseNL ) fossil_print("\n");
3171 }
 
 
 
3172
3173 nEntry++; /* record another complete entry */
3174 }
3175 if( rc==SQLITE_DONE ){
3176 /* Did the underlying query actually have all entries? */
@@ -3342,17 +3352,19 @@
3352 int vid = db_lget_int("checkout", 0);
3353 zBr = db_text(0, "SELECT value FROM tagxref WHERE rid=%d AND tagid=%d",
3354 vid, TAG_BRANCH);
3355 }
3356 }
3357 if( find_option("oneline",0,0)!= 0 || fossil_strcmp(zFormat,"oneline")==0 ){
3358 zFormat = TIMELINE_FMT_ONELINE;
3359 }
3360 if( find_option("medium",0,0)!= 0 || fossil_strcmp(zFormat,"medium")==0 ){
3361 zFormat = TIMELINE_FMT_MEDIUM;
3362 }
3363 if( find_option("full",0,0)!= 0 || fossil_strcmp(zFormat,"full")==0 ){
3364 zFormat = TIMELINE_FMT_FULL;
3365 }
3366 showSql = find_option("sql",0,0)!=0;
3367
3368 if( !zLimit ){
3369 zLimit = find_option("count",0,1);
3370 }
3371

Keyboard Shortcuts

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