Overview
SHA1 Hash: | 0239325f58a4a0c99463582852ba86f95875e25c |
---|---|
Date: | 2009-11-09 00:58:05 |
User: | drh |
Comment: | 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. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/timeline.c from [f95beac657] to [0dbb20dfeb].
@@ -848,13 +848,25 @@ } 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 ** WHEN argument can be any unique abbreviation of one of these @@ -885,11 +897,11 @@ char *zOrigin; 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 ){ n = atoi(zCount); @@ -941,10 +953,14 @@ objid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid); 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", timeline_query_for_tty_m(),