Fossil SCM

Add the "tarzip" query parameter to /timeline.

drh 2025-10-17 12:39 timeline-enhance-2025
Commit 2dc364f6a3c62119a1c19a438484d59ee1c1322f58f49fe457a31cb7dae71d52
2 files changed +42 -25 +13 -4
+42 -25
--- src/tar.c
+++ src/tar.c
@@ -936,40 +936,57 @@
936936
937937
/*
938938
** This routine is called for each check-in on the /tarlist page to
939939
** construct the "extra" information after the description.
940940
*/
941
-static void tarlist_extra(
941
+void tarlist_extra(
942942
Stmt *pQuery, /* Current row of the timeline query */
943943
int tmFlags, /* Flags to www_print_timeline() */
944944
const char *zThisUser, /* Suppress links to this user */
945945
const char *zThisTag /* Suppress links to this tag */
946946
){
947
- int rid = db_column_int(pQuery, 0);
948
- const char *zUuid = db_column_text(pQuery, 1);
949
- const char *zDate = db_column_text(pQuery, 2);
950
- char *zBrName = branch_of_rid(rid);
951
- static const char *zProject = 0;
952
- int nProject;
953
- char *zNm;
954
-
955
- if( zProject==0 ) zProject = db_get("project-name","unnamed");
956
- zNm = mprintf("%s-%sZ-%.8s", zProject, zDate, zUuid);
957
- nProject = (int)strlen(zProject);
958
- zNm[nProject+11] = 'T';
959
- @ <strong><nobr>check-in: \
960
- @ %z(href("%R/info/%!S",zUuid))%S(zUuid)</a></nobr></strong><br>
961
- if( fossil_strcmp(zBrName,"trunk")!=0 ){
962
- @ <nobr>branch:&nbsp;\
963
- @ %z(href("%R/timeline?r=%t",zBrName))%h(zBrName)</a></nobr><br>\
964
- }
965
- @ %z(href("%R/tarball/%!S/%t.tar.gz",zUuid,zNm))\
966
- @ <button>Tarball</button></a>
967
- @ %z(href("%R/zip/%!S/%t.zip",zUuid,zNm))\
968
- @ <button>ZIP&nbsp;Archive</button></a>
969
- fossil_free(zBrName);
970
- fossil_free(zNm);
947
+ const char *zType = db_column_text(pQuery, 7);
948
+ assert( zType!=0 );
949
+ if( zType[0]!='c' ){
950
+ timeline_extra(pQuery, tmFlags, zThisUser, zThisTag);
951
+ }else{
952
+ int rid = db_column_int(pQuery, 0);
953
+ const char *zUuid = db_column_text(pQuery, 1);
954
+ const char *zDate = db_column_text(pQuery, 2);
955
+ char *zBrName = branch_of_rid(rid);
956
+ static const char *zProject = 0;
957
+ int nProject;
958
+ char *zNm;
959
+
960
+ if( zProject==0 ) zProject = db_get("project-name","unnamed");
961
+ zNm = mprintf("%s-%sZ-%.8s", zProject, zDate, zUuid);
962
+ nProject = (int)strlen(zProject);
963
+ zNm[nProject+11] = 'T';
964
+ if( tmFlags & TIMELINE_COLUMNAR ){
965
+ @ <strong><nobr>check-in: \
966
+ @ %z(href("%R/info/%!S",zUuid))%S(zUuid)</a></nobr></strong><br>
967
+ if( fossil_strcmp(zBrName,"trunk")!=0 ){
968
+ @ <nobr>branch:&nbsp;\
969
+ @ %z(href("%R/timeline?r=%t",zBrName))%h(zBrName)</a></nobr><br>\
970
+ }
971
+ }else{
972
+ if( (tmFlags & TIMELINE_CLASSIC)==0 ){
973
+ @ <strong>check-in: \
974
+ @ %z(href("%R/info/%!S",zUuid))%S(zUuid)</a></strong>
975
+ }
976
+ if( (tmFlags & TIMELINE_GRAPH)==0 && fossil_strcmp(zBrName,"trunk")!=0 ){
977
+ @ branch:&nbsp;\
978
+ @ %z(href("%R/timeline?r=%t",zBrName))%h(zBrName)</a>
979
+ }
980
+ }
981
+ @ %z(href("%R/tarball/%!S/%t.tar.gz",zUuid,zNm))\
982
+ @ <button>Tarball</button></a>
983
+ @ %z(href("%R/zip/%!S/%t.zip",zUuid,zNm))\
984
+ @ <button>ZIP&nbsp;Archive</button></a>
985
+ fossil_free(zBrName);
986
+ fossil_free(zNm);
987
+ }
971988
}
972989
973990
/*
974991
** SETTING: suggested-tarlist width=70 block-text
975992
**
976993
--- src/tar.c
+++ src/tar.c
@@ -936,40 +936,57 @@
936
937 /*
938 ** This routine is called for each check-in on the /tarlist page to
939 ** construct the "extra" information after the description.
940 */
941 static void tarlist_extra(
942 Stmt *pQuery, /* Current row of the timeline query */
943 int tmFlags, /* Flags to www_print_timeline() */
944 const char *zThisUser, /* Suppress links to this user */
945 const char *zThisTag /* Suppress links to this tag */
946 ){
947 int rid = db_column_int(pQuery, 0);
948 const char *zUuid = db_column_text(pQuery, 1);
949 const char *zDate = db_column_text(pQuery, 2);
950 char *zBrName = branch_of_rid(rid);
951 static const char *zProject = 0;
952 int nProject;
953 char *zNm;
954
955 if( zProject==0 ) zProject = db_get("project-name","unnamed");
956 zNm = mprintf("%s-%sZ-%.8s", zProject, zDate, zUuid);
957 nProject = (int)strlen(zProject);
958 zNm[nProject+11] = 'T';
959 @ <strong><nobr>check-in: \
960 @ %z(href("%R/info/%!S",zUuid))%S(zUuid)</a></nobr></strong><br>
961 if( fossil_strcmp(zBrName,"trunk")!=0 ){
962 @ <nobr>branch:&nbsp;\
963 @ %z(href("%R/timeline?r=%t",zBrName))%h(zBrName)</a></nobr><br>\
964 }
965 @ %z(href("%R/tarball/%!S/%t.tar.gz",zUuid,zNm))\
966 @ <button>Tarball</button></a>
967 @ %z(href("%R/zip/%!S/%t.zip",zUuid,zNm))\
968 @ <button>ZIP&nbsp;Archive</button></a>
969 fossil_free(zBrName);
970 fossil_free(zNm);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971 }
972
973 /*
974 ** SETTING: suggested-tarlist width=70 block-text
975 **
976
--- src/tar.c
+++ src/tar.c
@@ -936,40 +936,57 @@
936
937 /*
938 ** This routine is called for each check-in on the /tarlist page to
939 ** construct the "extra" information after the description.
940 */
941 void tarlist_extra(
942 Stmt *pQuery, /* Current row of the timeline query */
943 int tmFlags, /* Flags to www_print_timeline() */
944 const char *zThisUser, /* Suppress links to this user */
945 const char *zThisTag /* Suppress links to this tag */
946 ){
947 const char *zType = db_column_text(pQuery, 7);
948 assert( zType!=0 );
949 if( zType[0]!='c' ){
950 timeline_extra(pQuery, tmFlags, zThisUser, zThisTag);
951 }else{
952 int rid = db_column_int(pQuery, 0);
953 const char *zUuid = db_column_text(pQuery, 1);
954 const char *zDate = db_column_text(pQuery, 2);
955 char *zBrName = branch_of_rid(rid);
956 static const char *zProject = 0;
957 int nProject;
958 char *zNm;
959
960 if( zProject==0 ) zProject = db_get("project-name","unnamed");
961 zNm = mprintf("%s-%sZ-%.8s", zProject, zDate, zUuid);
962 nProject = (int)strlen(zProject);
963 zNm[nProject+11] = 'T';
964 if( tmFlags & TIMELINE_COLUMNAR ){
965 @ <strong><nobr>check-in: \
966 @ %z(href("%R/info/%!S",zUuid))%S(zUuid)</a></nobr></strong><br>
967 if( fossil_strcmp(zBrName,"trunk")!=0 ){
968 @ <nobr>branch:&nbsp;\
969 @ %z(href("%R/timeline?r=%t",zBrName))%h(zBrName)</a></nobr><br>\
970 }
971 }else{
972 if( (tmFlags & TIMELINE_CLASSIC)==0 ){
973 @ <strong>check-in: \
974 @ %z(href("%R/info/%!S",zUuid))%S(zUuid)</a></strong>
975 }
976 if( (tmFlags & TIMELINE_GRAPH)==0 && fossil_strcmp(zBrName,"trunk")!=0 ){
977 @ branch:&nbsp;\
978 @ %z(href("%R/timeline?r=%t",zBrName))%h(zBrName)</a>
979 }
980 }
981 @ %z(href("%R/tarball/%!S/%t.tar.gz",zUuid,zNm))\
982 @ <button>Tarball</button></a>
983 @ %z(href("%R/zip/%!S/%t.zip",zUuid,zNm))\
984 @ <button>ZIP&nbsp;Archive</button></a>
985 fossil_free(zBrName);
986 fossil_free(zNm);
987 }
988 }
989
990 /*
991 ** SETTING: suggested-tarlist width=70 block-text
992 **
993
+13 -4
--- src/timeline.c
+++ src/timeline.c
@@ -179,11 +179,11 @@
179179
** Example: "(check-in: [abcdefg], user: drh, tags: trunk)"
180180
**
181181
** This routine is used if no xExtra argument is supplied to
182182
** www_print_timeline().
183183
*/
184
-static void defaultExtra(
184
+void timeline_extra(
185185
Stmt *pQuery, /* Current row of the timeline query */
186186
int tmFlags, /* Flags to www_print_timeline() */
187187
const char *zThisUser, /* Suppress links to this user */
188188
const char *zThisTag /* Suppress links to this tag */
189189
){
@@ -375,11 +375,11 @@
375375
376376
377377
if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){
378378
vid = db_lget_int("checkout", 0);
379379
}
380
- if( xExtra==0 ) xExtra = defaultExtra;
380
+ if( xExtra==0 ) xExtra = timeline_extra;
381381
zPrevDate[0] = 0;
382382
mxWikiLen = db_get_int("timeline-max-comment", 0);
383383
dateFormat = db_get_int("timeline-date-format", 0);
384384
bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
385385
bTimestampLinksToInfo = db_get_boolean("timeline-tslink-info", 0);
@@ -1670,11 +1670,12 @@
16701670
** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob",
16711671
** "like", or "regexp".
16721672
** u=USER Only show items associated with USER
16731673
** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', or 'all'.
16741674
** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar",
1675
-* x: "Classic".
1675
+** x: "Classic".
1676
+** tarzip Show "Tarball" and "ZIP" buttons on check-ins.
16761677
** advm Use the "Advanced" or "Busy" menu design.
16771678
** ng No Graph.
16781679
** ncp Omit cherrypick merges
16791680
** nd Do not highlight the focus check-in
16801681
** nsm Omit the submenu
@@ -3224,10 +3225,11 @@
32243225
}
32253226
cgi_check_for_malice();
32263227
{
32273228
Matcher *pLeftBranch;
32283229
const char *zPattern = P("sl");
3230
+ void (*xExtra)(Stmt*,int,const char*,const char*) = 0;
32293231
if( zPattern!=0 ){
32303232
MatchStyle ms;
32313233
if( zMatchStyle!=0 ){
32323234
ms = matchStyle;
32333235
}else{
@@ -3235,12 +3237,19 @@
32353237
}
32363238
pLeftBranch = match_create(ms,zPattern);
32373239
}else{
32383240
pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName);
32393241
}
3242
+ if( PB("tarzip") ){
3243
+ if( tmFlags & TIMELINE_COMPACT ){
3244
+ tmFlags &= ~TIMELINE_COMPACT;
3245
+ tmFlags |= TIMELINE_VERBOSE;
3246
+ }
3247
+ xExtra = tarlist_extra;
3248
+ }
32403249
www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
3241
- selectedRid, secondaryRid, 0);
3250
+ selectedRid, secondaryRid, xExtra);
32423251
match_free(pLeftBranch);
32433252
}
32443253
db_finalize(&q);
32453254
if( zOlderButton ){
32463255
@ %z(chref("button","%s",zOlderButton))%h(zOlderButtonLabel)\
32473256
--- src/timeline.c
+++ src/timeline.c
@@ -179,11 +179,11 @@
179 ** Example: "(check-in: [abcdefg], user: drh, tags: trunk)"
180 **
181 ** This routine is used if no xExtra argument is supplied to
182 ** www_print_timeline().
183 */
184 static void defaultExtra(
185 Stmt *pQuery, /* Current row of the timeline query */
186 int tmFlags, /* Flags to www_print_timeline() */
187 const char *zThisUser, /* Suppress links to this user */
188 const char *zThisTag /* Suppress links to this tag */
189 ){
@@ -375,11 +375,11 @@
375
376
377 if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){
378 vid = db_lget_int("checkout", 0);
379 }
380 if( xExtra==0 ) xExtra = defaultExtra;
381 zPrevDate[0] = 0;
382 mxWikiLen = db_get_int("timeline-max-comment", 0);
383 dateFormat = db_get_int("timeline-date-format", 0);
384 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
385 bTimestampLinksToInfo = db_get_boolean("timeline-tslink-info", 0);
@@ -1670,11 +1670,12 @@
1670 ** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob",
1671 ** "like", or "regexp".
1672 ** u=USER Only show items associated with USER
1673 ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', or 'all'.
1674 ** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar",
1675 * x: "Classic".
 
1676 ** advm Use the "Advanced" or "Busy" menu design.
1677 ** ng No Graph.
1678 ** ncp Omit cherrypick merges
1679 ** nd Do not highlight the focus check-in
1680 ** nsm Omit the submenu
@@ -3224,10 +3225,11 @@
3224 }
3225 cgi_check_for_malice();
3226 {
3227 Matcher *pLeftBranch;
3228 const char *zPattern = P("sl");
 
3229 if( zPattern!=0 ){
3230 MatchStyle ms;
3231 if( zMatchStyle!=0 ){
3232 ms = matchStyle;
3233 }else{
@@ -3235,12 +3237,19 @@
3235 }
3236 pLeftBranch = match_create(ms,zPattern);
3237 }else{
3238 pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName);
3239 }
 
 
 
 
 
 
 
3240 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
3241 selectedRid, secondaryRid, 0);
3242 match_free(pLeftBranch);
3243 }
3244 db_finalize(&q);
3245 if( zOlderButton ){
3246 @ %z(chref("button","%s",zOlderButton))%h(zOlderButtonLabel)\
3247
--- src/timeline.c
+++ src/timeline.c
@@ -179,11 +179,11 @@
179 ** Example: "(check-in: [abcdefg], user: drh, tags: trunk)"
180 **
181 ** This routine is used if no xExtra argument is supplied to
182 ** www_print_timeline().
183 */
184 void timeline_extra(
185 Stmt *pQuery, /* Current row of the timeline query */
186 int tmFlags, /* Flags to www_print_timeline() */
187 const char *zThisUser, /* Suppress links to this user */
188 const char *zThisTag /* Suppress links to this tag */
189 ){
@@ -375,11 +375,11 @@
375
376
377 if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){
378 vid = db_lget_int("checkout", 0);
379 }
380 if( xExtra==0 ) xExtra = timeline_extra;
381 zPrevDate[0] = 0;
382 mxWikiLen = db_get_int("timeline-max-comment", 0);
383 dateFormat = db_get_int("timeline-date-format", 0);
384 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
385 bTimestampLinksToInfo = db_get_boolean("timeline-tslink-info", 0);
@@ -1670,11 +1670,12 @@
1670 ** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob",
1671 ** "like", or "regexp".
1672 ** u=USER Only show items associated with USER
1673 ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', or 'all'.
1674 ** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar",
1675 ** x: "Classic".
1676 ** tarzip Show "Tarball" and "ZIP" buttons on check-ins.
1677 ** advm Use the "Advanced" or "Busy" menu design.
1678 ** ng No Graph.
1679 ** ncp Omit cherrypick merges
1680 ** nd Do not highlight the focus check-in
1681 ** nsm Omit the submenu
@@ -3224,10 +3225,11 @@
3225 }
3226 cgi_check_for_malice();
3227 {
3228 Matcher *pLeftBranch;
3229 const char *zPattern = P("sl");
3230 void (*xExtra)(Stmt*,int,const char*,const char*) = 0;
3231 if( zPattern!=0 ){
3232 MatchStyle ms;
3233 if( zMatchStyle!=0 ){
3234 ms = matchStyle;
3235 }else{
@@ -3235,12 +3237,19 @@
3237 }
3238 pLeftBranch = match_create(ms,zPattern);
3239 }else{
3240 pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName);
3241 }
3242 if( PB("tarzip") ){
3243 if( tmFlags & TIMELINE_COMPACT ){
3244 tmFlags &= ~TIMELINE_COMPACT;
3245 tmFlags |= TIMELINE_VERBOSE;
3246 }
3247 xExtra = tarlist_extra;
3248 }
3249 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
3250 selectedRid, secondaryRid, xExtra);
3251 match_free(pLeftBranch);
3252 }
3253 db_finalize(&q);
3254 if( zOlderButton ){
3255 @ %z(chref("button","%s",zOlderButton))%h(zOlderButtonLabel)\
3256

Keyboard Shortcuts

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