Fossil SCM

Tweak check-in times slightly so that parents always come before their children.

drh 2010-11-10 01:43 trunk
Commit 0e87f42762a0c328fabd2b7d96f06215c03016a4
2 files changed +39 -2 +7 -4
+39 -2
--- src/manifest.c
+++ src/manifest.c
@@ -1221,10 +1221,20 @@
12211221
if( (pParent->zBaseline==0)==(pChild->zBaseline==0) ){
12221222
content_deltify(pid, cid, 0);
12231223
}else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){
12241224
content_deltify(pParent->pBaseline->rid, cid, 0);
12251225
}
1226
+
1227
+ /* Remember all children less than 2 seconds younger than their parent,
1228
+ ** as we might want to fudge the times for those children.
1229
+ */
1230
+ if( pChild->rDate<pParent->rDate+2.3e-5 ){
1231
+ db_multi_exec(
1232
+ "INSERT OR REPLACE INTO time_fudge VALUES(%d, %.17g, %d, %.17g);",
1233
+ pParent->rid, pParent->rDate, pChild->rid, pChild->rDate
1234
+ );
1235
+ }
12261236
12271237
for(i=0, pChildFile=pChild->aFile; i<pChild->nFile; i++, pChildFile++){
12281238
if( pChildFile->zPrior ){
12291239
pParentFile = manifest_file_seek(pParent, pChildFile->zPrior);
12301240
if( pParentFile ){
@@ -1267,26 +1277,53 @@
12671277
*/
12681278
void manifest_crosslink_begin(void){
12691279
assert( manifest_crosslink_busy==0 );
12701280
manifest_crosslink_busy = 1;
12711281
db_begin_transaction();
1272
- db_multi_exec("CREATE TEMP TABLE pending_tkt(uuid TEXT UNIQUE)");
1282
+ db_multi_exec(
1283
+ "CREATE TEMP TABLE pending_tkt(uuid TEXT UNIQUE);"
1284
+ "CREATE TEMP TABLE time_fudge("
1285
+ " mid INTEGER PRIMARY KEY,"
1286
+ " m1 REAL,"
1287
+ " cid INTEGER,"
1288
+ " m2 REAL"
1289
+ ");"
1290
+ );
12731291
}
12741292
12751293
/*
12761294
** Finish up a sequence of manifest_crosslink calls.
12771295
*/
12781296
void manifest_crosslink_end(void){
1279
- Stmt q;
1297
+ Stmt q, u;
1298
+ int i;
12801299
assert( manifest_crosslink_busy==1 );
12811300
db_prepare(&q, "SELECT uuid FROM pending_tkt");
12821301
while( db_step(&q)==SQLITE_ROW ){
12831302
const char *zUuid = db_column_text(&q, 0);
12841303
ticket_rebuild_entry(zUuid);
12851304
}
12861305
db_finalize(&q);
12871306
db_multi_exec("DROP TABLE pending_tkt");
1307
+
1308
+ db_prepare(&q, "UPDATE time_fudge SET m1=m2-2.8935e-7 WHERE m1>=m2");
1309
+ db_prepare(&u, "UPDATE time_fudge SET m2="
1310
+ "(SELECT x.m1 FROM time_fudge AS x WHERE x.mid=time_fudge.cid)");
1311
+ for(i=0; i<30; i++){
1312
+ db_step(&q);
1313
+ db_reset(&q);
1314
+ if( sqlite3_changes(g.db)==0 ) break;
1315
+ db_step(&u);
1316
+ db_reset(&u);
1317
+ }
1318
+ db_finalize(&q);
1319
+ db_finalize(&u);
1320
+ db_multi_exec(
1321
+ "UPDATE event SET mtime=(SELECT m1 FROM time_fudge WHERE mid=objid)"
1322
+ " WHERE objid IN (SELECT mid FROM time_fudge)"
1323
+ );
1324
+
12881325
db_end_transaction(0);
12891326
manifest_crosslink_busy = 0;
12901327
}
12911328
12921329
/*
12931330
--- src/manifest.c
+++ src/manifest.c
@@ -1221,10 +1221,20 @@
1221 if( (pParent->zBaseline==0)==(pChild->zBaseline==0) ){
1222 content_deltify(pid, cid, 0);
1223 }else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){
1224 content_deltify(pParent->pBaseline->rid, cid, 0);
1225 }
 
 
 
 
 
 
 
 
 
 
1226
1227 for(i=0, pChildFile=pChild->aFile; i<pChild->nFile; i++, pChildFile++){
1228 if( pChildFile->zPrior ){
1229 pParentFile = manifest_file_seek(pParent, pChildFile->zPrior);
1230 if( pParentFile ){
@@ -1267,26 +1277,53 @@
1267 */
1268 void manifest_crosslink_begin(void){
1269 assert( manifest_crosslink_busy==0 );
1270 manifest_crosslink_busy = 1;
1271 db_begin_transaction();
1272 db_multi_exec("CREATE TEMP TABLE pending_tkt(uuid TEXT UNIQUE)");
 
 
 
 
 
 
 
 
1273 }
1274
1275 /*
1276 ** Finish up a sequence of manifest_crosslink calls.
1277 */
1278 void manifest_crosslink_end(void){
1279 Stmt q;
 
1280 assert( manifest_crosslink_busy==1 );
1281 db_prepare(&q, "SELECT uuid FROM pending_tkt");
1282 while( db_step(&q)==SQLITE_ROW ){
1283 const char *zUuid = db_column_text(&q, 0);
1284 ticket_rebuild_entry(zUuid);
1285 }
1286 db_finalize(&q);
1287 db_multi_exec("DROP TABLE pending_tkt");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1288 db_end_transaction(0);
1289 manifest_crosslink_busy = 0;
1290 }
1291
1292 /*
1293
--- src/manifest.c
+++ src/manifest.c
@@ -1221,10 +1221,20 @@
1221 if( (pParent->zBaseline==0)==(pChild->zBaseline==0) ){
1222 content_deltify(pid, cid, 0);
1223 }else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){
1224 content_deltify(pParent->pBaseline->rid, cid, 0);
1225 }
1226
1227 /* Remember all children less than 2 seconds younger than their parent,
1228 ** as we might want to fudge the times for those children.
1229 */
1230 if( pChild->rDate<pParent->rDate+2.3e-5 ){
1231 db_multi_exec(
1232 "INSERT OR REPLACE INTO time_fudge VALUES(%d, %.17g, %d, %.17g);",
1233 pParent->rid, pParent->rDate, pChild->rid, pChild->rDate
1234 );
1235 }
1236
1237 for(i=0, pChildFile=pChild->aFile; i<pChild->nFile; i++, pChildFile++){
1238 if( pChildFile->zPrior ){
1239 pParentFile = manifest_file_seek(pParent, pChildFile->zPrior);
1240 if( pParentFile ){
@@ -1267,26 +1277,53 @@
1277 */
1278 void manifest_crosslink_begin(void){
1279 assert( manifest_crosslink_busy==0 );
1280 manifest_crosslink_busy = 1;
1281 db_begin_transaction();
1282 db_multi_exec(
1283 "CREATE TEMP TABLE pending_tkt(uuid TEXT UNIQUE);"
1284 "CREATE TEMP TABLE time_fudge("
1285 " mid INTEGER PRIMARY KEY,"
1286 " m1 REAL,"
1287 " cid INTEGER,"
1288 " m2 REAL"
1289 ");"
1290 );
1291 }
1292
1293 /*
1294 ** Finish up a sequence of manifest_crosslink calls.
1295 */
1296 void manifest_crosslink_end(void){
1297 Stmt q, u;
1298 int i;
1299 assert( manifest_crosslink_busy==1 );
1300 db_prepare(&q, "SELECT uuid FROM pending_tkt");
1301 while( db_step(&q)==SQLITE_ROW ){
1302 const char *zUuid = db_column_text(&q, 0);
1303 ticket_rebuild_entry(zUuid);
1304 }
1305 db_finalize(&q);
1306 db_multi_exec("DROP TABLE pending_tkt");
1307
1308 db_prepare(&q, "UPDATE time_fudge SET m1=m2-2.8935e-7 WHERE m1>=m2");
1309 db_prepare(&u, "UPDATE time_fudge SET m2="
1310 "(SELECT x.m1 FROM time_fudge AS x WHERE x.mid=time_fudge.cid)");
1311 for(i=0; i<30; i++){
1312 db_step(&q);
1313 db_reset(&q);
1314 if( sqlite3_changes(g.db)==0 ) break;
1315 db_step(&u);
1316 db_reset(&u);
1317 }
1318 db_finalize(&q);
1319 db_finalize(&u);
1320 db_multi_exec(
1321 "UPDATE event SET mtime=(SELECT m1 FROM time_fudge WHERE mid=objid)"
1322 " WHERE objid IN (SELECT mid FROM time_fudge)"
1323 );
1324
1325 db_end_transaction(0);
1326 manifest_crosslink_busy = 0;
1327 }
1328
1329 /*
1330
+7 -4
--- src/timeline.c
+++ src/timeline.c
@@ -552,11 +552,12 @@
552552
@ isleaf BOOLEAN,
553553
@ bgcolor TEXT,
554554
@ etype TEXT,
555555
@ taglist TEXT,
556556
@ tagid INTEGER,
557
- @ short TEXT
557
+ @ short TEXT,
558
+ @ sortby REAL
558559
@ )
559560
;
560561
db_multi_exec(zSql);
561562
}
562563
@@ -583,11 +584,12 @@
583584
@ event.type,
584585
@ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
585586
@ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
586587
@ AND tagxref.rid=blob.rid AND tagxref.tagtype>0),
587588
@ tagid,
588
- @ brief
589
+ @ brief,
590
+ @ event.mtime
589591
@ FROM event JOIN blob
590592
@ WHERE blob.rid=event.objid
591593
;
592594
if( zBase==0 ){
593595
zBase = mprintf(zBaseSql, TAG_BRANCH, TAG_BRANCH);
@@ -947,11 +949,11 @@
947949
}
948950
if( P("showsql") ){
949951
@ <blockquote>%h(blob_str(&sql))</blockquote>
950952
}
951953
blob_zero(&sql);
952
- db_prepare(&q, "SELECT * FROM timeline ORDER BY timestamp DESC /*scan*/");
954
+ db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
953955
@ <h2>%b(&desc)</h2>
954956
blob_reset(&desc);
955957
www_print_timeline(&q, tmFlags, 0);
956958
db_finalize(&q);
957959
style_footer();
@@ -1045,11 +1047,12 @@
10451047
@ FROM tag, tagxref
10461048
@ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
10471049
@ AND tagxref.rid=blob.rid AND tagxref.tagtype>0))
10481050
@ || ')',
10491051
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
1050
- @ (SELECT count(*) FROM plink WHERE cid=blob.rid)
1052
+ @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
1053
+ @ event.mtime
10511054
@ FROM event, blob
10521055
@ WHERE blob.rid=event.objid
10531056
;
10541057
return zBaseSql;
10551058
}
10561059
--- src/timeline.c
+++ src/timeline.c
@@ -552,11 +552,12 @@
552 @ isleaf BOOLEAN,
553 @ bgcolor TEXT,
554 @ etype TEXT,
555 @ taglist TEXT,
556 @ tagid INTEGER,
557 @ short TEXT
 
558 @ )
559 ;
560 db_multi_exec(zSql);
561 }
562
@@ -583,11 +584,12 @@
583 @ event.type,
584 @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
585 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
586 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0),
587 @ tagid,
588 @ brief
 
589 @ FROM event JOIN blob
590 @ WHERE blob.rid=event.objid
591 ;
592 if( zBase==0 ){
593 zBase = mprintf(zBaseSql, TAG_BRANCH, TAG_BRANCH);
@@ -947,11 +949,11 @@
947 }
948 if( P("showsql") ){
949 @ <blockquote>%h(blob_str(&sql))</blockquote>
950 }
951 blob_zero(&sql);
952 db_prepare(&q, "SELECT * FROM timeline ORDER BY timestamp DESC /*scan*/");
953 @ <h2>%b(&desc)</h2>
954 blob_reset(&desc);
955 www_print_timeline(&q, tmFlags, 0);
956 db_finalize(&q);
957 style_footer();
@@ -1045,11 +1047,12 @@
1045 @ FROM tag, tagxref
1046 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
1047 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0))
1048 @ || ')',
1049 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
1050 @ (SELECT count(*) FROM plink WHERE cid=blob.rid)
 
1051 @ FROM event, blob
1052 @ WHERE blob.rid=event.objid
1053 ;
1054 return zBaseSql;
1055 }
1056
--- src/timeline.c
+++ src/timeline.c
@@ -552,11 +552,12 @@
552 @ isleaf BOOLEAN,
553 @ bgcolor TEXT,
554 @ etype TEXT,
555 @ taglist TEXT,
556 @ tagid INTEGER,
557 @ short TEXT,
558 @ sortby REAL
559 @ )
560 ;
561 db_multi_exec(zSql);
562 }
563
@@ -583,11 +584,12 @@
584 @ event.type,
585 @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
586 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
587 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0),
588 @ tagid,
589 @ brief,
590 @ event.mtime
591 @ FROM event JOIN blob
592 @ WHERE blob.rid=event.objid
593 ;
594 if( zBase==0 ){
595 zBase = mprintf(zBaseSql, TAG_BRANCH, TAG_BRANCH);
@@ -947,11 +949,11 @@
949 }
950 if( P("showsql") ){
951 @ <blockquote>%h(blob_str(&sql))</blockquote>
952 }
953 blob_zero(&sql);
954 db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
955 @ <h2>%b(&desc)</h2>
956 blob_reset(&desc);
957 www_print_timeline(&q, tmFlags, 0);
958 db_finalize(&q);
959 style_footer();
@@ -1045,11 +1047,12 @@
1047 @ FROM tag, tagxref
1048 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
1049 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0))
1050 @ || ')',
1051 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
1052 @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
1053 @ event.mtime
1054 @ FROM event, blob
1055 @ WHERE blob.rid=event.objid
1056 ;
1057 return zBaseSql;
1058 }
1059

Keyboard Shortcuts

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