Fossil with Commonmark

Changes On Branch mistake
Login

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

Changes In Branch mistake Excluding Merge-Ins

This is equivalent to a diff from 802939b18d to 63b967e0ab

2018-03-19
20:24
If the dp= and r= query parameters are both supplied to /timeline, use only the r= query parameter and ignore dp=. check-in: 7c690c0896 user: drh tags: trunk
19:55
This doesn't quite work, so I'll try a different approach. Was: When clicking on the "Move to branch ...." links in the timeline, show only check-ins relevant to that branch. Closed-Leaf check-in: 63b967e0ab user: drh tags: mistake
2018-03-17
23:11
Do no update the display cookie except when the user specifically changes the selectors on the /timeline submenu. check-in: 802939b18d user: drh tags: trunk
22:32
Fix harmless compiler warning. check-in: e2a90ed56e user: mistachkin tags: trunk

Changes to src/timeline.c.

1331
1332
1333
1334
1335
1336
1337





























































1338
1339
1340
1341
1342
1343
1344
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    blob_append(&expr, zEnd, -1);
    return blob_str(&expr);
  }

  /* If execution reaches this point, the pattern was empty.  Return NULL. */
  return 0;
}

/*
** Add SQL text to the WHERE clause expression in pCond that restricts
** the timeline to elements of the zTagSql tag or branch.  In other words,
** handle the r= and t= query parameters.
**
** zTagSql is an SQL expression that identifies the tags to be displayed.
** If zTagSql is NULL, this routine is a no-op.
**
** If the "related" flag is set, the first check-in before and after the
** branch is also shown.  If related==0, then only the specified tag or
** branch is shown.
*/
static void timeline_tag_or_branch_conditional(
  const char *zTagSql,    /* SQL expression for the tag or branch to display */
  Blob *pCond,            /* WHERE clause under construction */
  int related,            /* TRUE to show related check-ins */
  int tmFlags             /* Other timeline flags */
){
  if( zTagSql ){
    blob_append_sql(pCond,
      " AND (EXISTS(SELECT 1 FROM tagxref NATURAL JOIN tag"
      " WHERE %s AND tagtype>0 AND rid=blob.rid)\n", zTagSql/*safe-for-%s*/);

    if( related ){
      /* The next two blob_appendf() calls add SQL that causes check-ins that
      ** are not part of the branch which are parents or children of the
      ** branch to be included in the report.  This related check-ins are
      ** useful in helping to visualize what has happened on a quiescent
      ** branch that is infrequently merged with a much more activate branch.
      */
      blob_append_sql(pCond,
        " OR EXISTS(SELECT 1 FROM plink CROSS JOIN tagxref ON rid=cid"
        " NATURAL JOIN tag WHERE %s AND tagtype>0 AND pid=blob.rid)\n",
         zTagSql/*safe-for-%s*/
      );
      if( (tmFlags & TIMELINE_UNHIDE)==0 ){
        blob_append_sql(pCond,
          " AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=cid"
                     " WHERE tagid=%d AND tagtype>0 AND pid=blob.rid)\n",
          TAG_HIDDEN
        );
      }
      if( P("mionly")==0 ){
        blob_append_sql(pCond,
          " OR EXISTS(SELECT 1 FROM plink CROSS JOIN tagxref ON rid=pid"
          " NATURAL JOIN tag WHERE %s AND tagtype>0 AND cid=blob.rid)\n",
          zTagSql/*safe-for-%s*/
        );
        if( (tmFlags & TIMELINE_UNHIDE)==0 ){
          blob_append_sql(pCond,
            " AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=pid"
            " WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)\n",
            TAG_HIDDEN
          );
        }
      }
    }
    blob_append_sql(pCond, ")");
  }
}

/*
** WEBPAGE: timeline
**
** Query parameters:
**
**    a=TIMEORTAG     After this event
1675
1676
1677
1678
1679
1680
1681

1682
1683
1684
1685
1686
1687
1688
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750







+







    }
    db_multi_exec(
       "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)"
    );
    zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d",
                         p_rid ? p_rid : d_rid);
    blob_append_sql(&sql, " AND event.objid IN ok");
    timeline_tag_or_branch_conditional(zTagSql, &sql, related, tmFlags);
    nd = 0;
    if( d_rid ){
      compute_descendants(d_rid, nEntry+1);
      nd = db_int(0, "SELECT count(*)-1 FROM ok");
      if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
      if( nd>0 ) blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
      if( useDividers ) selectedRid = d_rid;
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774

1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1825
1826
1827
1828
1829
1830
1831





1832




































1833
1834
1835
1836
1837
1838
1839







-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







      blob_append_sql(&cond, " AND %Q=strftime('%%Y-%%W',event.mtime) ",
                   zYearWeek);
    }
    else if( zDay ){
      blob_append_sql(&cond, " AND %Q=strftime('%%Y-%%m-%%d',event.mtime) ",
                   zDay);
    }
    if( zTagSql ){
      blob_append_sql(&cond,
        " AND (EXISTS(SELECT 1 FROM tagxref NATURAL JOIN tag"
        " WHERE %s AND tagtype>0 AND rid=blob.rid)\n", zTagSql/*safe-for-%s*/);

    timeline_tag_or_branch_conditional(zTagSql, &cond, related, tmFlags);
      if( related ){
        /* The next two blob_appendf() calls add SQL that causes check-ins that
        ** are not part of the branch which are parents or children of the
        ** branch to be included in the report.  This related check-ins are
        ** useful in helping to visualize what has happened on a quiescent
        ** branch that is infrequently merged with a much more activate branch.
        */
        blob_append_sql(&cond,
          " OR EXISTS(SELECT 1 FROM plink CROSS JOIN tagxref ON rid=cid"
          " NATURAL JOIN tag WHERE %s AND tagtype>0 AND pid=blob.rid)\n",
           zTagSql/*safe-for-%s*/
        );
        if( (tmFlags & TIMELINE_UNHIDE)==0 ){
          blob_append_sql(&cond,
            " AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=cid"
                       " WHERE tagid=%d AND tagtype>0 AND pid=blob.rid)\n",
            TAG_HIDDEN
          );
        }
        if( P("mionly")==0 ){
          blob_append_sql(&cond,
            " OR EXISTS(SELECT 1 FROM plink CROSS JOIN tagxref ON rid=pid"
            " NATURAL JOIN tag WHERE %s AND tagtype>0 AND cid=blob.rid)\n",
            zTagSql/*safe-for-%s*/
          );
          if( (tmFlags & TIMELINE_UNHIDE)==0 ){
            blob_append_sql(&cond,
              " AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=pid"
              " WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)\n",
              TAG_HIDDEN
            );
          }
        }
      }
      blob_append_sql(&cond, ")");
    }
    if( (zType[0]=='w' && !g.perm.RdWiki)
     || (zType[0]=='t' && !g.perm.RdTkt)
     || (zType[0]=='e' && !g.perm.RdWiki)
     || (zType[0]=='c' && !g.perm.Read)
     || (zType[0]=='g' && !g.perm.Read)
    ){
      zType = "all";