Fossil SCM
Keep track of the baseline for delta manifests in the PLINK table. This is a schema change and requires a "fossil rebuild".
Commit
f36ac49ddcf8d48c32494026ba0ee52c9891e6df
Parent
fd1a2921995a38e…
2 files changed
+11
-2
+2
-1
+11
-2
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1774,14 +1774,23 @@ | ||
| 1774 | 1774 | zScript = xfer_commit_code(); |
| 1775 | 1775 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1776 | 1776 | } |
| 1777 | 1777 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ |
| 1778 | 1778 | char *zCom; |
| 1779 | + char zBaseId[30]; | |
| 1780 | + if( p->zBaseline ){ | |
| 1781 | + sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d", | |
| 1782 | + uuid_to_rid(p->zBaseline,1)); | |
| 1783 | + }else{ | |
| 1784 | + sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL"); | |
| 1785 | + } | |
| 1779 | 1786 | for(i=0; i<p->nParent; i++){ |
| 1780 | 1787 | int pid = uuid_to_rid(p->azParent[i], 1); |
| 1781 | - db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)" | |
| 1782 | - "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate); | |
| 1788 | + db_multi_exec( | |
| 1789 | + "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)" | |
| 1790 | + "VALUES(%d, %d, %d, %.17g, %s)", | |
| 1791 | + pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/); | |
| 1783 | 1792 | if( i==0 ){ |
| 1784 | 1793 | add_mlink(pid, 0, rid, p); |
| 1785 | 1794 | parentid = pid; |
| 1786 | 1795 | } |
| 1787 | 1796 | } |
| 1788 | 1797 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1774,14 +1774,23 @@ | |
| 1774 | zScript = xfer_commit_code(); |
| 1775 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1776 | } |
| 1777 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ |
| 1778 | char *zCom; |
| 1779 | for(i=0; i<p->nParent; i++){ |
| 1780 | int pid = uuid_to_rid(p->azParent[i], 1); |
| 1781 | db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)" |
| 1782 | "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate); |
| 1783 | if( i==0 ){ |
| 1784 | add_mlink(pid, 0, rid, p); |
| 1785 | parentid = pid; |
| 1786 | } |
| 1787 | } |
| 1788 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1774,14 +1774,23 @@ | |
| 1774 | zScript = xfer_commit_code(); |
| 1775 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1776 | } |
| 1777 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ |
| 1778 | char *zCom; |
| 1779 | char zBaseId[30]; |
| 1780 | if( p->zBaseline ){ |
| 1781 | sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d", |
| 1782 | uuid_to_rid(p->zBaseline,1)); |
| 1783 | }else{ |
| 1784 | sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL"); |
| 1785 | } |
| 1786 | for(i=0; i<p->nParent; i++){ |
| 1787 | int pid = uuid_to_rid(p->azParent[i], 1); |
| 1788 | db_multi_exec( |
| 1789 | "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)" |
| 1790 | "VALUES(%d, %d, %d, %.17g, %s)", |
| 1791 | pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/); |
| 1792 | if( i==0 ){ |
| 1793 | add_mlink(pid, 0, rid, p); |
| 1794 | parentid = pid; |
| 1795 | } |
| 1796 | } |
| 1797 |
+2
-1
| --- src/schema.c | ||
| +++ src/schema.c | ||
| @@ -44,11 +44,11 @@ | ||
| 44 | 44 | ** a date) which can change frequently. When the content schema changes, |
| 45 | 45 | ** we have to execute special procedures to update the schema. When |
| 46 | 46 | ** the aux schema changes, all we need to do is rebuild the database. |
| 47 | 47 | */ |
| 48 | 48 | #define CONTENT_SCHEMA "2" |
| 49 | -#define AUX_SCHEMA "2011-04-25 19:50" | |
| 49 | +#define AUX_SCHEMA "2014-11-24 20:35" | |
| 50 | 50 | |
| 51 | 51 | #endif /* INTERFACE */ |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | /* |
| @@ -250,10 +250,11 @@ | ||
| 250 | 250 | @ CREATE TABLE plink( |
| 251 | 251 | @ pid INTEGER REFERENCES blob, -- Parent manifest |
| 252 | 252 | @ cid INTEGER REFERENCES blob, -- Child manifest |
| 253 | 253 | @ isprim BOOLEAN, -- pid is the primary parent of cid |
| 254 | 254 | @ mtime DATETIME, -- the date/time stamp on cid. Julian day. |
| 255 | +@ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest | |
| 255 | 256 | @ UNIQUE(pid, cid) |
| 256 | 257 | @ ); |
| 257 | 258 | @ CREATE INDEX plink_i2 ON plink(cid,pid); |
| 258 | 259 | @ |
| 259 | 260 | @ -- A "leaf" checkin is a checkin that has no children in the same |
| 260 | 261 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -44,11 +44,11 @@ | |
| 44 | ** a date) which can change frequently. When the content schema changes, |
| 45 | ** we have to execute special procedures to update the schema. When |
| 46 | ** the aux schema changes, all we need to do is rebuild the database. |
| 47 | */ |
| 48 | #define CONTENT_SCHEMA "2" |
| 49 | #define AUX_SCHEMA "2011-04-25 19:50" |
| 50 | |
| 51 | #endif /* INTERFACE */ |
| 52 | |
| 53 | |
| 54 | /* |
| @@ -250,10 +250,11 @@ | |
| 250 | @ CREATE TABLE plink( |
| 251 | @ pid INTEGER REFERENCES blob, -- Parent manifest |
| 252 | @ cid INTEGER REFERENCES blob, -- Child manifest |
| 253 | @ isprim BOOLEAN, -- pid is the primary parent of cid |
| 254 | @ mtime DATETIME, -- the date/time stamp on cid. Julian day. |
| 255 | @ UNIQUE(pid, cid) |
| 256 | @ ); |
| 257 | @ CREATE INDEX plink_i2 ON plink(cid,pid); |
| 258 | @ |
| 259 | @ -- A "leaf" checkin is a checkin that has no children in the same |
| 260 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -44,11 +44,11 @@ | |
| 44 | ** a date) which can change frequently. When the content schema changes, |
| 45 | ** we have to execute special procedures to update the schema. When |
| 46 | ** the aux schema changes, all we need to do is rebuild the database. |
| 47 | */ |
| 48 | #define CONTENT_SCHEMA "2" |
| 49 | #define AUX_SCHEMA "2014-11-24 20:35" |
| 50 | |
| 51 | #endif /* INTERFACE */ |
| 52 | |
| 53 | |
| 54 | /* |
| @@ -250,10 +250,11 @@ | |
| 250 | @ CREATE TABLE plink( |
| 251 | @ pid INTEGER REFERENCES blob, -- Parent manifest |
| 252 | @ cid INTEGER REFERENCES blob, -- Child manifest |
| 253 | @ isprim BOOLEAN, -- pid is the primary parent of cid |
| 254 | @ mtime DATETIME, -- the date/time stamp on cid. Julian day. |
| 255 | @ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest |
| 256 | @ UNIQUE(pid, cid) |
| 257 | @ ); |
| 258 | @ CREATE INDEX plink_i2 ON plink(cid,pid); |
| 259 | @ |
| 260 | @ -- A "leaf" checkin is a checkin that has no children in the same |
| 261 |