Fossil

Check-in [0239325f]
Login

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

Overview
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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0239325f58a4a0c99463582852ba86f95875e25c
User & Date: drh 2009-11-09 00:58:05
Context
2009-11-09
21:32
Fix an issue with the command-line timeline. Fix typos in documentation. check-in: e2431b17 user: drh tags: trunk
15:24
Create new branch named "ssl" check-in: bd2fa6aa user: dmitry tags: ssl
00:58
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. check-in: 0239325f user: drh tags: trunk
2009-11-08
21:41
Add the "search" command to the command-line interface. This command is still experimental. Currently it only search the timeline. check-in: 20600107 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/timeline.c.

844
845
846
847
848
849
850












851
852
853
854
855
856
857
858
859
860
861
862
...
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
...
940
941
942
943
944
945
946




947
948
949
950
951
952
953
  zType = find_option( "type", "t", 1 );
  if( zType && *zType )
  {
      blob_appendf( &bl, " AND event.type=%Q", zType );
  }
  return blob_buffer(&bl);
}













/*
** COMMAND: timeline
**
** Usage: %fossil timeline ?WHEN? ?BASELINE|DATETIME? ?-n|--count N? ?-t|--type 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
** keywords:
**
................................................................................
  const char *zCount;
  const char *zType;
  char *zOrigin;
  char *zDate;
  char *zSQL;
  int objid = 0;
  Blob uuid;
  int mode = 1 ;       /* 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);
  }else{
    n = 20;
................................................................................
  }else if( name_to_uuid(&uuid, 0)==0 ){
    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");
    }




    zDate = mprintf("(SELECT julianday(%Q, 'utc'))", zOrigin);
  }
  zSQL = mprintf("%z AND event.mtime %s %s",
     timeline_query_for_tty_m(),
     (mode==1 || mode==4) ? "<=" : ">=",
     zDate
  );







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




|







 







|







 







>
>
>
>







844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
...
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
...
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
  zType = find_option( "type", "t", 1 );
  if( zType && *zType )
  {
      blob_appendf( &bl, " AND event.type=%Q", zType );
  }
  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 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
** keywords:
**
................................................................................
  const char *zCount;
  const char *zType;
  char *zOrigin;
  char *zDate;
  char *zSQL;
  int objid = 0;
  Blob uuid;
  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);
  }else{
    n = 20;
................................................................................
  }else if( name_to_uuid(&uuid, 0)==0 ){
    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(),
     (mode==1 || mode==4) ? "<=" : ">=",
     zDate
  );