Fossil

Check-in [2c6d015c00]
Login

Check-in [2c6d015c00]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the (experimental) /tarlist page to offer suggested tarballs and ZIPs for download.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | timeline-enhance-2025
Files: files | file ages | folders
SHA3-256: 2c6d015c008a268d77e42228fd267fd53fa47f05f7fb03a1fc04f8fbc15a3c1a
User & Date: drh 2025-10-16 23:18:51.783
Context
2025-10-16
23:29
Remove the button from the timeline extra text, thus undoing part of check-in [ba434ab46095ca57]. But keep the hash at the end of the list, only show it when not in "Classic" mode, and continue to omit the "Leaf" marker, which seemed pointless. ... (check-in: ece92e22bc user: drh tags: timeline-enhance-2025)
23:18
Add the (experimental) /tarlist page to offer suggested tarballs and ZIPs for download. ... (check-in: 2c6d015c00 user: drh tags: timeline-enhance-2025)
18:47
Reformat the "extra" section of timeline entries. Very experimental. ... (check-in: ba434ab460 user: drh tags: timeline-enhance-2025)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
  return zOut;
}

/*
** Return true if the string zVal represents "true" (or "false").
*/
int is_truth(const char *zVal){
  static const char *const azOn[] = { "on", "yes", "true", "1" };
  int i;
  for(i=0; i<count(azOn); i++){
    if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
  }
  return 0;
}
int is_false(const char *zVal){
  static const char *const azOff[] = { "off", "no", "false", "0" };
  int i;
  for(i=0; i<count(azOff); i++){
    if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
  }







|




|







3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
  return zOut;
}

/*
** Return true if the string zVal represents "true" (or "false").
*/
int is_truth(const char *zVal){
  static const char *const azOn[] = { "on", "yes", "true" };
  int i;
  for(i=0; i<count(azOn); i++){
    if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
  }
  return atoi(zVal);
}
int is_false(const char *zVal){
  static const char *const azOff[] = { "off", "no", "false", "0" };
  int i;
  for(i=0; i<count(azOff); i++){
    if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
  }
Changes to src/setup.c.
1423
1424
1425
1426
1427
1428
1429





















1430
1431
1432
1433
1434
1435
1436
  @ </ol>
  @
  @ <p>The default value is blank, meaning no added entries.
  @ (Property: sitemap-extra)
  @ <p>
  textarea_attribute("Custom Sitemap Entries", 8, 80,
      "sitemap-extra", "smextra", "", 0);





















  @ <hr>
  @ <p><input type="submit"  name="submit" value="Apply Changes"></p>
  @ </div></form>
  db_end_transaction(0);
  style_finish_page();
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
  @ </ol>
  @
  @ <p>The default value is blank, meaning no added entries.
  @ (Property: sitemap-extra)
  @ <p>
  textarea_attribute("Custom Sitemap Entries", 8, 80,
      "sitemap-extra", "smextra", "", 0);
  @ <hr>
  @ <p>Configuration for the <a href="%R/tarlist">/tarlist</a> page.
  @ The value is a TCL list divided into pairs.
  @ <ol>
  @ <li> The first term of each pair is an integer (N).
  @ <li> The second term of each pair is a glob pattern (PATTERN).
  @ </ol>
  @ For each pair, the most recent N check-ins that have a tag that
  @ matches PATTERN are included in on the /tarlist page.  The special
  @ pattern of "OPEN-LEAF" matches all open leaf check-ins.  Example:
  @ <blockquote><tt>1 trunk 3 release 5 OPEN-LEAF</tt></blockquote>
  @ The example pattern above shows the union of the most recent trunk
  @ check-in, the 5 most recent open leaf check-ins, and the 3 most
  @ recent check-ins tagged with "release".  
  @ <p>
  @ The /tarlist page is omitted from the <a href="%R/sitemap">/sitemap</a>
  @ if the first token is "0".  The default value is "5 OPEN-LEAF".
  @ (Property: suggested-tarlist)
  @ <p>
  textarea_attribute("Check-ins To Show On /tarlist", 2, 80,
      "suggested-tarlist", "sgtrlst", "", 0);
  @ <hr>
  @ <p><input type="submit"  name="submit" value="Apply Changes"></p>
  @ </div></form>
  db_end_transaction(0);
  style_finish_page();
}

Changes to src/sitemap.c.
130
131
132
133
134
135
136



137
138
139
140
141
142
143
    @   <li>%z(href("%R/tree?type=flat"))Flat-view</a></li>
    @   <li>%z(href("%R/fileage?name=trunk"))File ages for Trunk</a></li>
    @   <li>%z(href("%R/uvlist"))Unversioned Files</a>
    if( g.perm.Write && zEditGlob[0]!=0 ){
      @   <li>%z(href("%R/fileedit"))On-line File Editor</li>
    }
    @ </ul>



  }
  if( g.perm.Read ){
    @ <li>%z(href("%R/timeline"))Project Timeline</a>
    @ <ul>
    @   <li>%z(href("%R/reports"))Activity Reports</a></li>
    @   <li>%z(href("%R/sitemap-timeline"))Other timelines</a></li>
    @ </ul>







>
>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    @   <li>%z(href("%R/tree?type=flat"))Flat-view</a></li>
    @   <li>%z(href("%R/fileage?name=trunk"))File ages for Trunk</a></li>
    @   <li>%z(href("%R/uvlist"))Unversioned Files</a>
    if( g.perm.Write && zEditGlob[0]!=0 ){
      @   <li>%z(href("%R/fileedit"))On-line File Editor</li>
    }
    @ </ul>
  }
  if( g.perm.Zip && db_get_boolean("suggested-tarlist",1)!=0 ){
    @ <li>%z(href("%R/tarlist"))Tarballs and ZIPs</a>
  }
  if( g.perm.Read ){
    @ <li>%z(href("%R/timeline"))Project Timeline</a>
    @ <ul>
    @   <li>%z(href("%R/reports"))Activity Reports</a></li>
    @   <li>%z(href("%R/sitemap-timeline"))Other timelines</a></li>
    @ </ul>
Changes to src/tar.c.
929
930
931
932
933
934
935











































































































































  fossil_free(zName);
  fossil_free(zRid);
  g.zOpenRevision = 0;
  blob_reset(&cacheKey);
  cgi_set_content(&tarball);
  cgi_set_content_type("application/x-compressed");
}


















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
  fossil_free(zName);
  fossil_free(zRid);
  g.zOpenRevision = 0;
  blob_reset(&cacheKey);
  cgi_set_content(&tarball);
  cgi_set_content_type("application/x-compressed");
}

/*
** This routine is called for each check-in on the /tarlist page to
** construct the "extra" information after the description.
*/
static void tarlist_extra(
  Stmt *pQuery,               /* Current row of the timeline query */
  int tmFlags,                /* Flags to www_print_timeline() */
  const char *zThisUser,      /* Suppress links to this user */
  const char *zThisTag        /* Suppress links to this tag */
){
  int rid = db_column_int(pQuery, 0);
  const char *zUuid = db_column_text(pQuery, 1);
  const char *zDate = db_column_text(pQuery, 2);
  char *zBrName = branch_of_rid(rid);
  static const char *zProject = 0;
  int nProject;
  char *zNm;

  if( zProject==0 ) zProject = db_get("project-name","unnamed");
  zNm = mprintf("%s-%sZ-%.8s", zProject, zDate, zUuid);
  nProject = (int)strlen(zProject);
  zNm[nProject+11] = 'T';
  @ <strong>%h(zBrName)</strong><br>\
  @ %z(href("%R/timeline?c=%!S&y=ci&n=11",zUuid))<button>Context</button></a>
  @ %z(href("%R/tarball/%!S/%t.tar.gz",zUuid,zNm))\
  @    <button>Tarball</button></a>
  @  %z(href("%R/zip/%!S/%t.zip",zUuid,zNm))\
  @    <button>ZIP&nbsp;Archive</button></a>
  fossil_free(zBrName);
  fossil_free(zNm);
}

/*
** SETTING: suggested-tarlist               width=70  block-text
**
** This setting controls the suggested tarball/ZIP downloads on the
** [[/tarlist]] page.  The value is a TCL list.  Each pair of items
** defines a set of check-ins to be added to the suggestion list.
** The first item of each pair is an integer count (N) and second
** item is a tag GLOB pattern (PATTERN). For each pair, the most
** recent N check-ins that have a tag matching PATTERN are added
** to the list.  The special pattern "OPEN-LEAF" matches any open
** leaf check-in.
**
** Example:
**
**        3 OPEN-LEAF 3 release 1 trunk
**
** The value causes the /tarlist page to show the union of the 3
** most recent open leaves, the three most recent check-ins marked
** "release", and the single most recent trunk check-in.
*/

/*
** WEBPAGE: /tarlist
**
** Show a special no-graph timeline of recent important check-ins with
** an opportunity to pull tarballs and ZIPs.
*/
void tarlist_page(void){
  Stmt q;                       /* The actual timeline query */
  const char *zTarlistCfg;      /* Configuration string */
  char **azItem;                /* Decomposed elements of zTarlistCfg */
  int *anItem;                  /* Bytes in each term of azItem[] */
  int nItem;                    /* Number of terms in azItem[] */
  int i;                        /* Loop counter */
  int tmFlags;                  /* Timeline display flags */
  int n;                        /* Number of suggested downloads */

  login_check_credentials();
  if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }

  style_set_current_feature("timeline");
  style_header("Suggested Tarballs And ZIP Archives");

  zTarlistCfg = db_get("suggested-tarlist","5 OPEN-LEAF");
  db_multi_exec(
    "CREATE TEMP TABLE tarlist(rid INTEGER PRIMARY KEY);"
  );
  if( !g.interp ) Th_FossilInit(0);
  Th_SplitList(g.interp, zTarlistCfg, (int)strlen(zTarlistCfg),
                   &azItem, &anItem, &nItem);
  for(i=0; i<nItem-1; i+=2){
    int cnt;
    char *zLabel;
    if( anItem[i]==1 && azItem[i][0]=='*' ){
      cnt = -1;
    }else if( anItem[i]<1 ){
      cnt = 0;
    }else{
      cnt = atoi(azItem[i]);
    }
    if( cnt==0 ) continue;
    zLabel = fossil_strndup(azItem[i+1],anItem[i+1]);
    if( fossil_strcmp("OPEN-LEAF",zLabel)==0 ){
      db_multi_exec(
        "INSERT OR IGNORE INTO tarlist(rid)"
         " SELECT leaf.rid FROM leaf, event"
          " WHERE event.objid=leaf.rid"
            " AND NOT EXISTS(SELECT 1 FROM tagxref"
                            " WHERE tagxref.rid=leaf.rid"
                              " AND tagid=%d AND tagtype>0)"
          " ORDER BY event.mtime DESC LIMIT %d", TAG_CLOSED, cnt
      );
    }else{
      db_multi_exec(
        "WITH taglist(tid) AS"
            " (SELECT tagid FROM tag WHERE tagname GLOB 'sym-%q')"
        "INSERT OR IGNORE INTO tarlist(rid)"
        " SELECT event.objid FROM event CROSS JOIN tagxref"
        "  WHERE event.type='ci'"
        "    AND tagxref.tagid IN taglist"
        "    AND tagtype>0"
        "    AND tagxref.rid=event.objid"
        "  ORDER BY event.mtime DESC LIMIT %d", zLabel, cnt
      );
    }
    fossil_free(zLabel);
  }
  Th_Free(g.interp, azItem);

  n = db_int(0, "SELECT count(*) FROM tarlist");
  if( n==0 ){
    @ <h2>No tarball/ZIP suggestions are available at this time</h2>
  }else{
    @ <h2>%d(n) Tarball/ZIP Download Suggestions:</h2>
    db_prepare(&q,
      "%s AND blob.rid IN tarlist ORDER BY event.mtime DESC",
      timeline_query_for_www()
    );

    tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL | TIMELINE_COLUMNAR
            | TIMELINE_BRCOLOR;
    www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, tarlist_extra);
    db_finalize(&q);
  }
  style_finish_page();
}