Fossil SCM

Keep track of the baseline for delta manifests in the PLINK table. This is a schema change and requires a "fossil rebuild".

drh 2014-11-24 21:04 UTC trunk
Commit f36ac49ddcf8d48c32494026ba0ee52c9891e6df
2 files changed +11 -2 +2 -1
+11 -2
--- src/manifest.c
+++ src/manifest.c
@@ -1774,14 +1774,23 @@
17741774
zScript = xfer_commit_code();
17751775
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
17761776
}
17771777
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
17781778
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
+ }
17791786
for(i=0; i<p->nParent; i++){
17801787
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*/);
17831792
if( i==0 ){
17841793
add_mlink(pid, 0, rid, p);
17851794
parentid = pid;
17861795
}
17871796
}
17881797
--- 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 @@
4444
** a date) which can change frequently. When the content schema changes,
4545
** we have to execute special procedures to update the schema. When
4646
** the aux schema changes, all we need to do is rebuild the database.
4747
*/
4848
#define CONTENT_SCHEMA "2"
49
-#define AUX_SCHEMA "2011-04-25 19:50"
49
+#define AUX_SCHEMA "2014-11-24 20:35"
5050
5151
#endif /* INTERFACE */
5252
5353
5454
/*
@@ -250,10 +250,11 @@
250250
@ CREATE TABLE plink(
251251
@ pid INTEGER REFERENCES blob, -- Parent manifest
252252
@ cid INTEGER REFERENCES blob, -- Child manifest
253253
@ isprim BOOLEAN, -- pid is the primary parent of cid
254254
@ mtime DATETIME, -- the date/time stamp on cid. Julian day.
255
+@ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest
255256
@ UNIQUE(pid, cid)
256257
@ );
257258
@ CREATE INDEX plink_i2 ON plink(cid,pid);
258259
@
259260
@ -- A "leaf" checkin is a checkin that has no children in the same
260261
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button