Fossil SCM

When running a bisect, show the span between the two extremes and the number of steps remaining after each step.

drh 2018-11-07 12:04 trunk
Commit b45dd1c7b5baa34e14179bb46de144cc04affd0f296b49c0c3e2aa33bcba26fb
2 files changed +3 +10
--- src/bisect.c
+++ src/bisect.c
@@ -385,15 +385,18 @@
385385
bisect_path();
386386
pMid = path_midpoint();
387387
if( pMid==0 ){
388388
fossil_print("bisect complete\n");
389389
}else{
390
+ int nSpan = path_length();
391
+ int nStep = path_search_depth();
390392
g.argv[1] = "update";
391393
g.argv[2] = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pMid->rid);
392394
g.argc = 3;
393395
g.fNoSync = 1;
394396
update_cmd();
397
+ fossil_print("span: %d steps-remaining: %d\n", nSpan, nStep);
395398
}
396399
397400
if( strncmp(zDisplay,"chart",m)==0 ){
398401
bisect_chart(1);
399402
}else if( strncmp(zDisplay, "log", m)==0 ){
400403
--- src/bisect.c
+++ src/bisect.c
@@ -385,15 +385,18 @@
385 bisect_path();
386 pMid = path_midpoint();
387 if( pMid==0 ){
388 fossil_print("bisect complete\n");
389 }else{
 
 
390 g.argv[1] = "update";
391 g.argv[2] = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pMid->rid);
392 g.argc = 3;
393 g.fNoSync = 1;
394 update_cmd();
 
395 }
396
397 if( strncmp(zDisplay,"chart",m)==0 ){
398 bisect_chart(1);
399 }else if( strncmp(zDisplay, "log", m)==0 ){
400
--- src/bisect.c
+++ src/bisect.c
@@ -385,15 +385,18 @@
385 bisect_path();
386 pMid = path_midpoint();
387 if( pMid==0 ){
388 fossil_print("bisect complete\n");
389 }else{
390 int nSpan = path_length();
391 int nStep = path_search_depth();
392 g.argv[1] = "update";
393 g.argv[2] = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pMid->rid);
394 g.argc = 3;
395 g.fNoSync = 1;
396 update_cmd();
397 fossil_print("span: %d steps-remaining: %d\n", nSpan, nStep);
398 }
399
400 if( strncmp(zDisplay,"chart",m)==0 ){
401 bisect_chart(1);
402 }else if( strncmp(zDisplay, "log", m)==0 ){
403
+10
--- src/path.c
+++ src/path.c
@@ -192,10 +192,20 @@
192192
int i;
193193
if( path.nStep<2 ) return 0;
194194
for(p=path.pEnd, i=0; p && i<path.nStep/2; p=p->pFrom, i++){}
195195
return p;
196196
}
197
+
198
+/*
199
+** Return an estimate of the number of comparisons remaining in order
200
+** to bisect path. This is based on the log2() of path.nStep.
201
+*/
202
+int path_search_depth(void){
203
+ int i, j;
204
+ for(i=0, j=1; j<path.nStep; i++, j+=j){}
205
+ return i;
206
+}
197207
198208
/*
199209
** Compute the shortest path between two check-ins and then transfer
200210
** that path into the "ancestor" table. This is a utility used by
201211
** both /annotate and /finfo. See also: compute_direct_ancestors().
202212
--- src/path.c
+++ src/path.c
@@ -192,10 +192,20 @@
192 int i;
193 if( path.nStep<2 ) return 0;
194 for(p=path.pEnd, i=0; p && i<path.nStep/2; p=p->pFrom, i++){}
195 return p;
196 }
 
 
 
 
 
 
 
 
 
 
197
198 /*
199 ** Compute the shortest path between two check-ins and then transfer
200 ** that path into the "ancestor" table. This is a utility used by
201 ** both /annotate and /finfo. See also: compute_direct_ancestors().
202
--- src/path.c
+++ src/path.c
@@ -192,10 +192,20 @@
192 int i;
193 if( path.nStep<2 ) return 0;
194 for(p=path.pEnd, i=0; p && i<path.nStep/2; p=p->pFrom, i++){}
195 return p;
196 }
197
198 /*
199 ** Return an estimate of the number of comparisons remaining in order
200 ** to bisect path. This is based on the log2() of path.nStep.
201 */
202 int path_search_depth(void){
203 int i, j;
204 for(i=0, j=1; j<path.nStep; i++, j+=j){}
205 return i;
206 }
207
208 /*
209 ** Compute the shortest path between two check-ins and then transfer
210 ** that path into the "ancestor" table. This is a utility used by
211 ** both /annotate and /finfo. See also: compute_direct_ancestors().
212

Keyboard Shortcuts

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