Differences From:
File
src/timeline.c
part of check-in
[7a2c37063a]
- merge trunk into creole branch
by
bob on
2009-09-22 07:49:39.
Also file
src/timeline.c
part of check-in
[eb1db585a5]
- Fix a C++-ism in timeline.c.
by
drh on
2009-09-14 16:56:29.
[view]
To:
File
src/timeline.c
part of check-in
[0239325f58]
- On the "timeline" command, if a YYYY-MM-DD date string is entered without the
"before" keyword, then show all changes on the date given.
by
drh on
2009-11-09 00:58:05.
[view]
@@ -849,11 +849,23 @@
return blob_buffer(&bl);
}
/*
+** Return true if the input string is a date in the ISO 8601 format:
+** YYYY-MM-DD.
+*/
+static int isIsoDate(const char *z){
+ return strlen(z)==10
+ && z[4]=='-'
+ && z[7]=='-'
+ && isdigit(z[0])
+ && isdigit(z[5]);
+}
+
+/*
** COMMAND: timeline
**
-** Usage: %fossil timeline ?WHEN? ?BASELINE|DATETIME? ?-n|--count N? ?-t|--type TYPE?
+** Usage: %fossil timeline ?WHEN? ?BASELINE|DATETIME? ?-n N? ?-t TYPE?
**
** Print a summary of activity going backwards in date and time
** specified or from the current date and time if no arguments
** are given. Show as many as N (default 20) check-ins. The
@@ -886,9 +898,9 @@
char *zDate;
char *zSQL;
int objid = 0;
Blob uuid;
- int mode = 1 ; /* 1: before 2:after 3:children 4:parents */
+ int mode = 0 ; /* 0:none 1: before 2:after 3:children 4:parents */
db_find_and_open_repository(1);
zCount = find_option("count","n",1);
zType = find_option("type","t",1);
if( zCount ){
@@ -942,8 +954,12 @@
zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
}else{
if( mode==3 || mode==4 ){
fossil_fatal("cannot compute descendants or ancestors of a date");
+ }
+ if( mode==0 ){
+ mode = 1;
+ if( isIsoDate(zOrigin) ) zOrigin[9]++;
}
zDate = mprintf("(SELECT julianday(%Q, 'utc'))", zOrigin);
}
zSQL = mprintf("%z AND event.mtime %s %s",