Fossil SCM

Enhance the /timeline "bisect" and "bid" views so that they shows all unresolved checkins in between the innermost good and bad checkins.

drh 2020-07-09 17:42 trunk
Commit 8a0fd6fb5c19a3def7965422ac38b0787211496207b2e4d5882e020ea94e8341
2 files changed +27 -4 +1 -1
+27 -4
--- src/bisect.c
+++ src/bisect.c
@@ -177,10 +177,12 @@
177177
int bisect_create_bilog_table(int iCurrent, const char *zDesc){
178178
char *zLog;
179179
Blob log, id;
180180
Stmt q;
181181
int cnt = 0;
182
+ int lastGood = -1;
183
+ int lastBad = -1;
182184
183185
if( zDesc!=0 ){
184186
blob_init(&log, 0, 0);
185187
while( zDesc[0]=='y' || zDesc[0]=='n' ){
186188
int i;
@@ -204,30 +206,51 @@
204206
zLog = db_lget("bisect-log","");
205207
blob_init(&log, zLog, -1);
206208
}
207209
db_multi_exec(
208210
"CREATE TEMP TABLE bilog("
209
- " seq INTEGER PRIMARY KEY," /* Sequence of events */
211
+ " rid INTEGER PRIMARY KEY," /* Sequence of events */
210212
" stat TEXT," /* Type of occurrence */
211
- " rid INTEGER UNIQUE" /* Check-in number */
213
+ " seq INTEGER UNIQUE" /* Check-in number */
212214
");"
213215
);
214216
db_prepare(&q, "INSERT OR IGNORE INTO bilog(seq,stat,rid)"
215217
" VALUES(:seq,:stat,:rid)");
216218
while( blob_token(&log, &id) ){
217219
int rid = atoi(blob_str(&id));
218220
db_bind_int(&q, ":seq", ++cnt);
219
- db_bind_text(&q, ":stat", rid>0 ? "GOOD" : "BAD");
220
- db_bind_int(&q, ":rid", rid>=0 ? rid : -rid);
221
+ if( rid>0 ){
222
+ db_bind_text(&q, ":stat","GOOD");
223
+ db_bind_int(&q, ":rid", rid);
224
+ lastGood = rid;
225
+ }else{
226
+ db_bind_text(&q, ":stat", "BAD");
227
+ db_bind_int(&q, ":rid", -rid);
228
+ lastBad = -rid;
229
+ }
221230
db_step(&q);
222231
db_reset(&q);
223232
}
224233
if( iCurrent>0 ){
225234
db_bind_int(&q, ":seq", ++cnt);
226235
db_bind_text(&q, ":stat", "CURRENT");
227236
db_bind_int(&q, ":rid", iCurrent);
228237
db_step(&q);
238
+ db_reset(&q);
239
+ }
240
+ if( lastGood>0 && lastBad>0 ){
241
+ PathNode *p;
242
+ p = path_shortest(lastGood, lastBad, bisect_option("direct-only"),0);
243
+ while( p ){
244
+ db_bind_null(&q, ":seq");
245
+ db_bind_null(&q, ":stat");
246
+ db_bind_int(&q, ":rid", p->rid);
247
+ db_step(&q);
248
+ db_reset(&q);
249
+ p = p->u.pTo;
250
+ }
251
+ path_reset();
229252
}
230253
db_finalize(&q);
231254
return 1;
232255
}
233256
234257
--- src/bisect.c
+++ src/bisect.c
@@ -177,10 +177,12 @@
177 int bisect_create_bilog_table(int iCurrent, const char *zDesc){
178 char *zLog;
179 Blob log, id;
180 Stmt q;
181 int cnt = 0;
 
 
182
183 if( zDesc!=0 ){
184 blob_init(&log, 0, 0);
185 while( zDesc[0]=='y' || zDesc[0]=='n' ){
186 int i;
@@ -204,30 +206,51 @@
204 zLog = db_lget("bisect-log","");
205 blob_init(&log, zLog, -1);
206 }
207 db_multi_exec(
208 "CREATE TEMP TABLE bilog("
209 " seq INTEGER PRIMARY KEY," /* Sequence of events */
210 " stat TEXT," /* Type of occurrence */
211 " rid INTEGER UNIQUE" /* Check-in number */
212 ");"
213 );
214 db_prepare(&q, "INSERT OR IGNORE INTO bilog(seq,stat,rid)"
215 " VALUES(:seq,:stat,:rid)");
216 while( blob_token(&log, &id) ){
217 int rid = atoi(blob_str(&id));
218 db_bind_int(&q, ":seq", ++cnt);
219 db_bind_text(&q, ":stat", rid>0 ? "GOOD" : "BAD");
220 db_bind_int(&q, ":rid", rid>=0 ? rid : -rid);
 
 
 
 
 
 
 
221 db_step(&q);
222 db_reset(&q);
223 }
224 if( iCurrent>0 ){
225 db_bind_int(&q, ":seq", ++cnt);
226 db_bind_text(&q, ":stat", "CURRENT");
227 db_bind_int(&q, ":rid", iCurrent);
228 db_step(&q);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229 }
230 db_finalize(&q);
231 return 1;
232 }
233
234
--- src/bisect.c
+++ src/bisect.c
@@ -177,10 +177,12 @@
177 int bisect_create_bilog_table(int iCurrent, const char *zDesc){
178 char *zLog;
179 Blob log, id;
180 Stmt q;
181 int cnt = 0;
182 int lastGood = -1;
183 int lastBad = -1;
184
185 if( zDesc!=0 ){
186 blob_init(&log, 0, 0);
187 while( zDesc[0]=='y' || zDesc[0]=='n' ){
188 int i;
@@ -204,30 +206,51 @@
206 zLog = db_lget("bisect-log","");
207 blob_init(&log, zLog, -1);
208 }
209 db_multi_exec(
210 "CREATE TEMP TABLE bilog("
211 " rid INTEGER PRIMARY KEY," /* Sequence of events */
212 " stat TEXT," /* Type of occurrence */
213 " seq INTEGER UNIQUE" /* Check-in number */
214 ");"
215 );
216 db_prepare(&q, "INSERT OR IGNORE INTO bilog(seq,stat,rid)"
217 " VALUES(:seq,:stat,:rid)");
218 while( blob_token(&log, &id) ){
219 int rid = atoi(blob_str(&id));
220 db_bind_int(&q, ":seq", ++cnt);
221 if( rid>0 ){
222 db_bind_text(&q, ":stat","GOOD");
223 db_bind_int(&q, ":rid", rid);
224 lastGood = rid;
225 }else{
226 db_bind_text(&q, ":stat", "BAD");
227 db_bind_int(&q, ":rid", -rid);
228 lastBad = -rid;
229 }
230 db_step(&q);
231 db_reset(&q);
232 }
233 if( iCurrent>0 ){
234 db_bind_int(&q, ":seq", ++cnt);
235 db_bind_text(&q, ":stat", "CURRENT");
236 db_bind_int(&q, ":rid", iCurrent);
237 db_step(&q);
238 db_reset(&q);
239 }
240 if( lastGood>0 && lastBad>0 ){
241 PathNode *p;
242 p = path_shortest(lastGood, lastBad, bisect_option("direct-only"),0);
243 while( p ){
244 db_bind_null(&q, ":seq");
245 db_bind_null(&q, ":stat");
246 db_bind_int(&q, ":rid", p->rid);
247 db_step(&q);
248 db_reset(&q);
249 p = p->u.pTo;
250 }
251 path_reset();
252 }
253 db_finalize(&q);
254 return 1;
255 }
256
257
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -516,11 +516,11 @@
516516
@ <span class="modpending">(Awaiting Moderator Approval)</span>
517517
}
518518
if( (tmFlags & TIMELINE_BISECT)!=0 && zType[0]=='c' ){
519519
static Stmt bisectQuery;
520520
db_static_prepare(&bisectQuery,
521
- "SELECT seq, stat FROM bilog WHERE rid=:rid");
521
+ "SELECT seq, stat FROM bilog WHERE rid=:rid AND seq");
522522
db_bind_int(&bisectQuery, ":rid", rid);
523523
if( db_step(&bisectQuery)==SQLITE_ROW ){
524524
@ <b>%s(db_column_text(&bisectQuery,1))</b>
525525
@ (%d(db_column_int(&bisectQuery,0)))
526526
}
527527
--- src/timeline.c
+++ src/timeline.c
@@ -516,11 +516,11 @@
516 @ <span class="modpending">(Awaiting Moderator Approval)</span>
517 }
518 if( (tmFlags & TIMELINE_BISECT)!=0 && zType[0]=='c' ){
519 static Stmt bisectQuery;
520 db_static_prepare(&bisectQuery,
521 "SELECT seq, stat FROM bilog WHERE rid=:rid");
522 db_bind_int(&bisectQuery, ":rid", rid);
523 if( db_step(&bisectQuery)==SQLITE_ROW ){
524 @ <b>%s(db_column_text(&bisectQuery,1))</b>
525 @ (%d(db_column_int(&bisectQuery,0)))
526 }
527
--- src/timeline.c
+++ src/timeline.c
@@ -516,11 +516,11 @@
516 @ <span class="modpending">(Awaiting Moderator Approval)</span>
517 }
518 if( (tmFlags & TIMELINE_BISECT)!=0 && zType[0]=='c' ){
519 static Stmt bisectQuery;
520 db_static_prepare(&bisectQuery,
521 "SELECT seq, stat FROM bilog WHERE rid=:rid AND seq");
522 db_bind_int(&bisectQuery, ":rid", rid);
523 if( db_step(&bisectQuery)==SQLITE_ROW ){
524 @ <b>%s(db_column_text(&bisectQuery,1))</b>
525 @ (%d(db_column_int(&bisectQuery,0)))
526 }
527

Keyboard Shortcuts

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