Fossil SCM

Fix the is_a_leaf() function so that it correctly identifies nodes as leaves if they have no non-merge children in the same branch.

drh 2011-04-22 13:49 trunk
Commit 0a89d03cf658ecb54d63f22e872b569d6edba51c
1 file changed +2 -1
+2 -1
--- src/checkin.c
+++ src/checkin.c
@@ -468,11 +468,11 @@
468468
}
469469
}
470470
471471
/*
472472
** Return true if the check-in with RID=rid is a leaf.
473
-** A leaf has no children in the same branch.
473
+** A leaf has no primary children in the same branch.
474474
*/
475475
int is_a_leaf(int rid){
476476
int rc;
477477
static const char zSql[] =
478478
@ SELECT 1 FROM plink
@@ -479,10 +479,11 @@
479479
@ WHERE pid=%d
480480
@ AND coalesce((SELECT value FROM tagxref
481481
@ WHERE tagid=%d AND rid=plink.pid), 'trunk')
482482
@ =coalesce((SELECT value FROM tagxref
483483
@ WHERE tagid=%d AND rid=plink.cid), 'trunk')
484
+ @ AND isprim
484485
;
485486
rc = db_int(0, zSql, rid, TAG_BRANCH, TAG_BRANCH);
486487
return rc==0;
487488
}
488489
489490
--- src/checkin.c
+++ src/checkin.c
@@ -468,11 +468,11 @@
468 }
469 }
470
471 /*
472 ** Return true if the check-in with RID=rid is a leaf.
473 ** A leaf has no children in the same branch.
474 */
475 int is_a_leaf(int rid){
476 int rc;
477 static const char zSql[] =
478 @ SELECT 1 FROM plink
@@ -479,10 +479,11 @@
479 @ WHERE pid=%d
480 @ AND coalesce((SELECT value FROM tagxref
481 @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
482 @ =coalesce((SELECT value FROM tagxref
483 @ WHERE tagid=%d AND rid=plink.cid), 'trunk')
 
484 ;
485 rc = db_int(0, zSql, rid, TAG_BRANCH, TAG_BRANCH);
486 return rc==0;
487 }
488
489
--- src/checkin.c
+++ src/checkin.c
@@ -468,11 +468,11 @@
468 }
469 }
470
471 /*
472 ** Return true if the check-in with RID=rid is a leaf.
473 ** A leaf has no primary children in the same branch.
474 */
475 int is_a_leaf(int rid){
476 int rc;
477 static const char zSql[] =
478 @ SELECT 1 FROM plink
@@ -479,10 +479,11 @@
479 @ WHERE pid=%d
480 @ AND coalesce((SELECT value FROM tagxref
481 @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
482 @ =coalesce((SELECT value FROM tagxref
483 @ WHERE tagid=%d AND rid=plink.cid), 'trunk')
484 @ AND isprim
485 ;
486 rc = db_int(0, zSql, rid, TAG_BRANCH, TAG_BRANCH);
487 return rc==0;
488 }
489
490

Keyboard Shortcuts

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