Fossil SCM
This is the correct fix for the blog-timeline problem.
Commit
9b26d1e9a2ada29fb98a0ea3623c883204b5bb3a
Parent
bc37d1c5a4e70bb…
1 file changed
+19
-1
+19
-1
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1696,24 +1696,42 @@ | ||
| 1696 | 1696 | free(zComment); |
| 1697 | 1697 | } |
| 1698 | 1698 | if( p->type==CFTYPE_EVENT ){ |
| 1699 | 1699 | char *zTag = mprintf("event-%s", p->zEventId); |
| 1700 | 1700 | int tagid = tag_findid(zTag, 1); |
| 1701 | - int subsequent; | |
| 1701 | + int prior, subsequent; | |
| 1702 | 1702 | int nWiki; |
| 1703 | 1703 | char zLength[40]; |
| 1704 | 1704 | while( fossil_isspace(p->zWiki[0]) ) p->zWiki++; |
| 1705 | 1705 | nWiki = strlen(p->zWiki); |
| 1706 | 1706 | sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki); |
| 1707 | 1707 | tag_insert(zTag, 1, zLength, rid, p->rDate, rid); |
| 1708 | 1708 | free(zTag); |
| 1709 | + prior = db_int(0, | |
| 1710 | + "SELECT rid FROM tagxref" | |
| 1711 | + " WHERE tagid=%d AND mtime<%.17g AND rid!=%d" | |
| 1712 | + " ORDER BY mtime DESC", | |
| 1713 | + tagid, p->rDate, rid | |
| 1714 | + ); | |
| 1709 | 1715 | subsequent = db_int(0, |
| 1710 | 1716 | "SELECT rid FROM tagxref" |
| 1711 | 1717 | " WHERE tagid=%d AND mtime>=%.17g AND rid!=%d" |
| 1712 | 1718 | " ORDER BY mtime", |
| 1713 | 1719 | tagid, p->rDate, rid |
| 1714 | 1720 | ); |
| 1721 | + if( prior ){ | |
| 1722 | + content_deltify(prior, rid, 0); | |
| 1723 | + if( !subsequent ){ | |
| 1724 | + db_multi_exec( | |
| 1725 | + "DELETE FROM event" | |
| 1726 | + " WHERE type='e'" | |
| 1727 | + " AND tagid=%d" | |
| 1728 | + " AND objid IN (SELECT rid FROM tagxref WHERE tagid=%d)", | |
| 1729 | + tagid, tagid | |
| 1730 | + ); | |
| 1731 | + } | |
| 1732 | + } | |
| 1715 | 1733 | if( subsequent ){ |
| 1716 | 1734 | content_deltify(rid, subsequent, 0); |
| 1717 | 1735 | }else{ |
| 1718 | 1736 | db_multi_exec( |
| 1719 | 1737 | "REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)" |
| 1720 | 1738 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1696,24 +1696,42 @@ | |
| 1696 | free(zComment); |
| 1697 | } |
| 1698 | if( p->type==CFTYPE_EVENT ){ |
| 1699 | char *zTag = mprintf("event-%s", p->zEventId); |
| 1700 | int tagid = tag_findid(zTag, 1); |
| 1701 | int subsequent; |
| 1702 | int nWiki; |
| 1703 | char zLength[40]; |
| 1704 | while( fossil_isspace(p->zWiki[0]) ) p->zWiki++; |
| 1705 | nWiki = strlen(p->zWiki); |
| 1706 | sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki); |
| 1707 | tag_insert(zTag, 1, zLength, rid, p->rDate, rid); |
| 1708 | free(zTag); |
| 1709 | subsequent = db_int(0, |
| 1710 | "SELECT rid FROM tagxref" |
| 1711 | " WHERE tagid=%d AND mtime>=%.17g AND rid!=%d" |
| 1712 | " ORDER BY mtime", |
| 1713 | tagid, p->rDate, rid |
| 1714 | ); |
| 1715 | if( subsequent ){ |
| 1716 | content_deltify(rid, subsequent, 0); |
| 1717 | }else{ |
| 1718 | db_multi_exec( |
| 1719 | "REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)" |
| 1720 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1696,24 +1696,42 @@ | |
| 1696 | free(zComment); |
| 1697 | } |
| 1698 | if( p->type==CFTYPE_EVENT ){ |
| 1699 | char *zTag = mprintf("event-%s", p->zEventId); |
| 1700 | int tagid = tag_findid(zTag, 1); |
| 1701 | int prior, subsequent; |
| 1702 | int nWiki; |
| 1703 | char zLength[40]; |
| 1704 | while( fossil_isspace(p->zWiki[0]) ) p->zWiki++; |
| 1705 | nWiki = strlen(p->zWiki); |
| 1706 | sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki); |
| 1707 | tag_insert(zTag, 1, zLength, rid, p->rDate, rid); |
| 1708 | free(zTag); |
| 1709 | prior = db_int(0, |
| 1710 | "SELECT rid FROM tagxref" |
| 1711 | " WHERE tagid=%d AND mtime<%.17g AND rid!=%d" |
| 1712 | " ORDER BY mtime DESC", |
| 1713 | tagid, p->rDate, rid |
| 1714 | ); |
| 1715 | subsequent = db_int(0, |
| 1716 | "SELECT rid FROM tagxref" |
| 1717 | " WHERE tagid=%d AND mtime>=%.17g AND rid!=%d" |
| 1718 | " ORDER BY mtime", |
| 1719 | tagid, p->rDate, rid |
| 1720 | ); |
| 1721 | if( prior ){ |
| 1722 | content_deltify(prior, rid, 0); |
| 1723 | if( !subsequent ){ |
| 1724 | db_multi_exec( |
| 1725 | "DELETE FROM event" |
| 1726 | " WHERE type='e'" |
| 1727 | " AND tagid=%d" |
| 1728 | " AND objid IN (SELECT rid FROM tagxref WHERE tagid=%d)", |
| 1729 | tagid, tagid |
| 1730 | ); |
| 1731 | } |
| 1732 | } |
| 1733 | if( subsequent ){ |
| 1734 | content_deltify(rid, subsequent, 0); |
| 1735 | }else{ |
| 1736 | db_multi_exec( |
| 1737 | "REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)" |
| 1738 |