Fossil SCM

Add the days= query parameter to /timeline

drh 2018-04-26 19:53 trunk
Commit cd11e359d3034df48171c3478e56e6dce57ef4eac04542a5d036a9be9aed2b1b
1 file changed +12
--- src/timeline.c
+++ src/timeline.c
@@ -1373,10 +1373,11 @@
13731373
** namechng Show only check-ins that have filename changes
13741374
** forks Show only forks and their children
13751375
** ym=YYYY-MM Show only events for the given year/month
13761376
** yw=YYYY-WW Show only events for the given week of the given year
13771377
** ymd=YYYY-MM-DD Show only events on the given day
1378
+** days=N Show events over the previous N days
13781379
** datefmt=N Override the date format
13791380
** bisect Show the check-ins that are in the current bisect
13801381
** showid Show RIDs
13811382
** showsql Show the SQL text
13821383
**
@@ -1414,10 +1415,12 @@
14141415
const char *zUses = P("uf"); /* Only show check-ins hold this file */
14151416
const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
14161417
const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
14171418
char *zYearWeekStart = 0; /* YYYY-MM-DD for start of YYYY-WW */
14181419
const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
1420
+ const char *zNDays = P("days"); /* Show events over the previous N days */
1421
+ int nDays; /* Numeric value for zNDays */
14191422
const char *zChng = P("chng"); /* List of GLOBs for files that changed */
14201423
int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
14211424
int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
14221425
int forkOnly = PB("forks"); /* Show only forks and their children */
14231426
int bisectOnly = PB("bisect"); /* Show the check-ins of the bisect */
@@ -1786,10 +1789,16 @@
17861789
zDay = db_text(0, "SELECT date('now')");
17871790
}
17881791
blob_append_sql(&cond, " AND %Q=date(event.mtime) ",
17891792
zDay);
17901793
}
1794
+ else if( zNDays ){
1795
+ nDays = atoi(zNDays);
1796
+ if( nDays<1 ) nDays = 1;
1797
+ blob_append_sql(&cond, " AND event.mtime>=julianday('now','-%d days') ",
1798
+ nDays);
1799
+ }
17911800
if( zTagSql ){
17921801
blob_append_sql(&cond,
17931802
" AND (EXISTS(SELECT 1 FROM tagxref NATURAL JOIN tag"
17941803
" WHERE %s AND tagtype>0 AND rid=blob.rid)\n", zTagSql/*safe-for-%s*/);
17951804
@@ -1939,10 +1948,13 @@
19391948
}else if( zYearWeek ){
19401949
blob_appendf(&desc, "%ss for week %h beginning on %h",
19411950
zEType, zYearWeek, zYearWeekStart);
19421951
}else if( zDay ){
19431952
blob_appendf(&desc, "%ss occurring on %h", zEType, zDay);
1953
+ }else if( zNDays ){
1954
+ blob_appendf(&desc, "%ss with the past %d day%s",
1955
+ zEType, nDays, nDays>1 ? "s" : "");
19441956
}else if( zBefore==0 && zCirca==0 && n>=nEntry && nEntry>0 ){
19451957
blob_appendf(&desc, "%d most recent %ss", n, zEType);
19461958
}else{
19471959
blob_appendf(&desc, "%d %ss", n, zEType);
19481960
}
19491961
--- src/timeline.c
+++ src/timeline.c
@@ -1373,10 +1373,11 @@
1373 ** namechng Show only check-ins that have filename changes
1374 ** forks Show only forks and their children
1375 ** ym=YYYY-MM Show only events for the given year/month
1376 ** yw=YYYY-WW Show only events for the given week of the given year
1377 ** ymd=YYYY-MM-DD Show only events on the given day
 
1378 ** datefmt=N Override the date format
1379 ** bisect Show the check-ins that are in the current bisect
1380 ** showid Show RIDs
1381 ** showsql Show the SQL text
1382 **
@@ -1414,10 +1415,12 @@
1414 const char *zUses = P("uf"); /* Only show check-ins hold this file */
1415 const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
1416 const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
1417 char *zYearWeekStart = 0; /* YYYY-MM-DD for start of YYYY-WW */
1418 const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
 
 
1419 const char *zChng = P("chng"); /* List of GLOBs for files that changed */
1420 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1421 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
1422 int forkOnly = PB("forks"); /* Show only forks and their children */
1423 int bisectOnly = PB("bisect"); /* Show the check-ins of the bisect */
@@ -1786,10 +1789,16 @@
1786 zDay = db_text(0, "SELECT date('now')");
1787 }
1788 blob_append_sql(&cond, " AND %Q=date(event.mtime) ",
1789 zDay);
1790 }
 
 
 
 
 
 
1791 if( zTagSql ){
1792 blob_append_sql(&cond,
1793 " AND (EXISTS(SELECT 1 FROM tagxref NATURAL JOIN tag"
1794 " WHERE %s AND tagtype>0 AND rid=blob.rid)\n", zTagSql/*safe-for-%s*/);
1795
@@ -1939,10 +1948,13 @@
1939 }else if( zYearWeek ){
1940 blob_appendf(&desc, "%ss for week %h beginning on %h",
1941 zEType, zYearWeek, zYearWeekStart);
1942 }else if( zDay ){
1943 blob_appendf(&desc, "%ss occurring on %h", zEType, zDay);
 
 
 
1944 }else if( zBefore==0 && zCirca==0 && n>=nEntry && nEntry>0 ){
1945 blob_appendf(&desc, "%d most recent %ss", n, zEType);
1946 }else{
1947 blob_appendf(&desc, "%d %ss", n, zEType);
1948 }
1949
--- src/timeline.c
+++ src/timeline.c
@@ -1373,10 +1373,11 @@
1373 ** namechng Show only check-ins that have filename changes
1374 ** forks Show only forks and their children
1375 ** ym=YYYY-MM Show only events for the given year/month
1376 ** yw=YYYY-WW Show only events for the given week of the given year
1377 ** ymd=YYYY-MM-DD Show only events on the given day
1378 ** days=N Show events over the previous N days
1379 ** datefmt=N Override the date format
1380 ** bisect Show the check-ins that are in the current bisect
1381 ** showid Show RIDs
1382 ** showsql Show the SQL text
1383 **
@@ -1414,10 +1415,12 @@
1415 const char *zUses = P("uf"); /* Only show check-ins hold this file */
1416 const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
1417 const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
1418 char *zYearWeekStart = 0; /* YYYY-MM-DD for start of YYYY-WW */
1419 const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
1420 const char *zNDays = P("days"); /* Show events over the previous N days */
1421 int nDays; /* Numeric value for zNDays */
1422 const char *zChng = P("chng"); /* List of GLOBs for files that changed */
1423 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1424 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
1425 int forkOnly = PB("forks"); /* Show only forks and their children */
1426 int bisectOnly = PB("bisect"); /* Show the check-ins of the bisect */
@@ -1786,10 +1789,16 @@
1789 zDay = db_text(0, "SELECT date('now')");
1790 }
1791 blob_append_sql(&cond, " AND %Q=date(event.mtime) ",
1792 zDay);
1793 }
1794 else if( zNDays ){
1795 nDays = atoi(zNDays);
1796 if( nDays<1 ) nDays = 1;
1797 blob_append_sql(&cond, " AND event.mtime>=julianday('now','-%d days') ",
1798 nDays);
1799 }
1800 if( zTagSql ){
1801 blob_append_sql(&cond,
1802 " AND (EXISTS(SELECT 1 FROM tagxref NATURAL JOIN tag"
1803 " WHERE %s AND tagtype>0 AND rid=blob.rid)\n", zTagSql/*safe-for-%s*/);
1804
@@ -1939,10 +1948,13 @@
1948 }else if( zYearWeek ){
1949 blob_appendf(&desc, "%ss for week %h beginning on %h",
1950 zEType, zYearWeek, zYearWeekStart);
1951 }else if( zDay ){
1952 blob_appendf(&desc, "%ss occurring on %h", zEType, zDay);
1953 }else if( zNDays ){
1954 blob_appendf(&desc, "%ss with the past %d day%s",
1955 zEType, nDays, nDays>1 ? "s" : "");
1956 }else if( zBefore==0 && zCirca==0 && n>=nEntry && nEntry>0 ){
1957 blob_appendf(&desc, "%d most recent %ss", n, zEType);
1958 }else{
1959 blob_appendf(&desc, "%d %ss", n, zEType);
1960 }
1961

Keyboard Shortcuts

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