Fossil SCM
Add the "tarzip" query parameter to /timeline.
Commit
2dc364f6a3c62119a1c19a438484d59ee1c1322f58f49fe457a31cb7dae71d52
Parent
6827cd0582b2f21…
2 files changed
+42
-25
+13
-4
+42
-25
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -936,40 +936,57 @@ | ||
| 936 | 936 | |
| 937 | 937 | /* |
| 938 | 938 | ** This routine is called for each check-in on the /tarlist page to |
| 939 | 939 | ** construct the "extra" information after the description. |
| 940 | 940 | */ |
| 941 | -static void tarlist_extra( | |
| 941 | +void tarlist_extra( | |
| 942 | 942 | Stmt *pQuery, /* Current row of the timeline query */ |
| 943 | 943 | int tmFlags, /* Flags to www_print_timeline() */ |
| 944 | 944 | const char *zThisUser, /* Suppress links to this user */ |
| 945 | 945 | const char *zThisTag /* Suppress links to this tag */ |
| 946 | 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: \ | |
| 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 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: \ | |
| 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: \ | |
| 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 Archive</button></a> | |
| 985 | + fossil_free(zBrName); | |
| 986 | + fossil_free(zNm); | |
| 987 | + } | |
| 971 | 988 | } |
| 972 | 989 | |
| 973 | 990 | /* |
| 974 | 991 | ** SETTING: suggested-tarlist width=70 block-text |
| 975 | 992 | ** |
| 976 | 993 |
| --- 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: \ |
| 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 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: \ |
| 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: \ |
| 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 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 @@ | ||
| 179 | 179 | ** Example: "(check-in: [abcdefg], user: drh, tags: trunk)" |
| 180 | 180 | ** |
| 181 | 181 | ** This routine is used if no xExtra argument is supplied to |
| 182 | 182 | ** www_print_timeline(). |
| 183 | 183 | */ |
| 184 | -static void defaultExtra( | |
| 184 | +void timeline_extra( | |
| 185 | 185 | Stmt *pQuery, /* Current row of the timeline query */ |
| 186 | 186 | int tmFlags, /* Flags to www_print_timeline() */ |
| 187 | 187 | const char *zThisUser, /* Suppress links to this user */ |
| 188 | 188 | const char *zThisTag /* Suppress links to this tag */ |
| 189 | 189 | ){ |
| @@ -375,11 +375,11 @@ | ||
| 375 | 375 | |
| 376 | 376 | |
| 377 | 377 | if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){ |
| 378 | 378 | vid = db_lget_int("checkout", 0); |
| 379 | 379 | } |
| 380 | - if( xExtra==0 ) xExtra = defaultExtra; | |
| 380 | + if( xExtra==0 ) xExtra = timeline_extra; | |
| 381 | 381 | zPrevDate[0] = 0; |
| 382 | 382 | mxWikiLen = db_get_int("timeline-max-comment", 0); |
| 383 | 383 | dateFormat = db_get_int("timeline-date-format", 0); |
| 384 | 384 | bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0); |
| 385 | 385 | bTimestampLinksToInfo = db_get_boolean("timeline-tslink-info", 0); |
| @@ -1670,11 +1670,12 @@ | ||
| 1670 | 1670 | ** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob", |
| 1671 | 1671 | ** "like", or "regexp". |
| 1672 | 1672 | ** u=USER Only show items associated with USER |
| 1673 | 1673 | ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', or 'all'. |
| 1674 | 1674 | ** 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. | |
| 1676 | 1677 | ** advm Use the "Advanced" or "Busy" menu design. |
| 1677 | 1678 | ** ng No Graph. |
| 1678 | 1679 | ** ncp Omit cherrypick merges |
| 1679 | 1680 | ** nd Do not highlight the focus check-in |
| 1680 | 1681 | ** nsm Omit the submenu |
| @@ -3224,10 +3225,11 @@ | ||
| 3224 | 3225 | } |
| 3225 | 3226 | cgi_check_for_malice(); |
| 3226 | 3227 | { |
| 3227 | 3228 | Matcher *pLeftBranch; |
| 3228 | 3229 | const char *zPattern = P("sl"); |
| 3230 | + void (*xExtra)(Stmt*,int,const char*,const char*) = 0; | |
| 3229 | 3231 | if( zPattern!=0 ){ |
| 3230 | 3232 | MatchStyle ms; |
| 3231 | 3233 | if( zMatchStyle!=0 ){ |
| 3232 | 3234 | ms = matchStyle; |
| 3233 | 3235 | }else{ |
| @@ -3235,12 +3237,19 @@ | ||
| 3235 | 3237 | } |
| 3236 | 3238 | pLeftBranch = match_create(ms,zPattern); |
| 3237 | 3239 | }else{ |
| 3238 | 3240 | pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName); |
| 3239 | 3241 | } |
| 3242 | + if( PB("tarzip") ){ | |
| 3243 | + if( tmFlags & TIMELINE_COMPACT ){ | |
| 3244 | + tmFlags &= ~TIMELINE_COMPACT; | |
| 3245 | + tmFlags |= TIMELINE_VERBOSE; | |
| 3246 | + } | |
| 3247 | + xExtra = tarlist_extra; | |
| 3248 | + } | |
| 3240 | 3249 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch, |
| 3241 | - selectedRid, secondaryRid, 0); | |
| 3250 | + selectedRid, secondaryRid, xExtra); | |
| 3242 | 3251 | match_free(pLeftBranch); |
| 3243 | 3252 | } |
| 3244 | 3253 | db_finalize(&q); |
| 3245 | 3254 | if( zOlderButton ){ |
| 3246 | 3255 | @ %z(chref("button","%s",zOlderButton))%h(zOlderButtonLabel)\ |
| 3247 | 3256 |
| --- 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 |