Fossil

Check-in [3706dcb6]
Login

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

Overview
Comment:Fix the special case when path refer to the root of the repository, in that case, just ignore the path argument.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | cmdline-timeline-enhancement
Files: files | file ages | folders
SHA1:3706dcb696b2d0670292e23634d7150ff274ac6d
User & Date: mgagnon 2014-10-17 20:44:03
Original Comment: Fix the special case when path point refer to the root of the repository, in that case, just ignore the path argument.
Context
2014-10-17
21:12
Honor case-sensitive setting when specifying path to the timeline command. check-in: 5eeb870d user: mgagnon tags: cmdline-timeline-enhancement
20:44
Fix the special case when path refer to the root of the repository, in that case, just ignore the path argument. check-in: 3706dcb6 user: mgagnon tags: cmdline-timeline-enhancement
19:20
Add DISTINCT keyword to the main timeline_cmd query to avoid duplicates when specifying file or directory on the timeline command.

(to be checked by someone more experienced in SQL) check-in: dc8a5742 user: mgagnon tags: cmdline-timeline-enhancement

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/timeline.c.

1747
1748
1749
1750
1751
1752
1753

1754
1755
1756
1757
1758
1759
1760
....
1835
1836
1837
1838
1839
1840
1841










1842
1843
1844
1845
1846
1847
1848
....
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
  Blob sql;
  int objid = 0;
  Blob uuid;
  int mode = 0 ;       /* 0:none  1: before  2:after  3:children  4:parents */
  int verboseFlag = 0 ;
  int iOffset;
  const char *zFilePattern = 0;


  verboseFlag = find_option("verbose","v", 0)!=0;
  if( !verboseFlag){
    verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
  }
  db_find_and_open_repository(0, 0);
  zLimit = find_option("limit","n",1);
................................................................................
      fossil_fatal("cannot compute descendants or ancestors of a date");
    }
    if( mode==0 ){
      if( isIsoDate(zOrigin) ) zShift = ",'+1 day'";
    }
    zDate = mprintf("(SELECT julianday(%Q%s, 'utc'))", zOrigin, zShift);
  }










  if( mode==0 ) mode = 1;
  blob_zero(&sql);
  blob_append(&sql, timeline_query_for_tty(zFilePattern!=0), -1);
  blob_appendf(&sql, "  AND event.mtime %s %s",
     (mode==1 || mode==4) ? "<=" : ">=",
     zDate
  );
................................................................................
    }
    blob_appendf(&sql, "\n  AND blob.rid IN ok");
  }
  if( zType && (zType[0]!='a') ){
    blob_appendf(&sql, "\n  AND event.type=%Q ", zType);
  }
  if( zFilePattern ){
    Blob treeName;
    file_tree_name(zFilePattern, &treeName, 1);
    blob_append(&sql, "\n  AND mlink.mid=event.objid", -1);
    blob_appendf(&sql, "\n  AND mlink.fnid IN (SELECT fnid FROM filename WHERE"
                       " name=%Q OR name GLOB '%q/*')", blob_str(&treeName),
                       blob_str(&treeName));
  }
  blob_appendf(&sql, "\nORDER BY event.mtime DESC");
  if( iOffset>0 ){
    /* Don't handle LIMIT here, otherwise print_timeline()
     * will not determine the end-marker correctly! */
    blob_appendf(&sql, "\n LIMIT -1 OFFSET %d", iOffset);
  }







>







 







>
>
>
>
>
>
>
>
>
>







 







<
<


|
|







1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
....
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
....
1867
1868
1869
1870
1871
1872
1873


1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
  Blob sql;
  int objid = 0;
  Blob uuid;
  int mode = 0 ;       /* 0:none  1: before  2:after  3:children  4:parents */
  int verboseFlag = 0 ;
  int iOffset;
  const char *zFilePattern = 0;
  Blob treeName;

  verboseFlag = find_option("verbose","v", 0)!=0;
  if( !verboseFlag){
    verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
  }
  db_find_and_open_repository(0, 0);
  zLimit = find_option("limit","n",1);
................................................................................
      fossil_fatal("cannot compute descendants or ancestors of a date");
    }
    if( mode==0 ){
      if( isIsoDate(zOrigin) ) zShift = ",'+1 day'";
    }
    zDate = mprintf("(SELECT julianday(%Q%s, 'utc'))", zOrigin, zShift);
  }
  
  if( zFilePattern ){
    file_tree_name(zFilePattern, &treeName, 1);
    if( fossil_strcmp(blob_str(&treeName), ".")==0 ){
      /* When zTreeName refers to g.zLocalRoot, it's like not specifying
       * zFilePattern */
      zFilePattern = 0;
    }
  }

  if( mode==0 ) mode = 1;
  blob_zero(&sql);
  blob_append(&sql, timeline_query_for_tty(zFilePattern!=0), -1);
  blob_appendf(&sql, "  AND event.mtime %s %s",
     (mode==1 || mode==4) ? "<=" : ">=",
     zDate
  );
................................................................................
    }
    blob_appendf(&sql, "\n  AND blob.rid IN ok");
  }
  if( zType && (zType[0]!='a') ){
    blob_appendf(&sql, "\n  AND event.type=%Q ", zType);
  }
  if( zFilePattern ){


    blob_append(&sql, "\n  AND mlink.mid=event.objid", -1);
    blob_appendf(&sql, "\n  AND mlink.fnid IN (SELECT fnid FROM filename WHERE"
        " name=%Q OR name GLOB '%q/*')", blob_str(&treeName),
        blob_str(&treeName));
  }
  blob_appendf(&sql, "\nORDER BY event.mtime DESC");
  if( iOffset>0 ){
    /* Don't handle LIMIT here, otherwise print_timeline()
     * will not determine the end-marker correctly! */
    blob_appendf(&sql, "\n LIMIT -1 OFFSET %d", iOffset);
  }