Differences From:
File
src/descendants.c
part of check-in
[042a08b564]
- Improved messages in the "tags and properties" section of the vinfo page.
Distinguish between a merge between forks and a merge between branches.
A merge from forks, closes the fork, but not a merge from a branch.
by
drh on
2009-01-22 01:10:41.
[view]
To:
File
src/descendants.c
part of check-in
[faf09dc7ae]
- Define a "leaf" as a check-in with no children in the same branch. The
is_a_leaf() function does some complicated SQL to figure this out.
by
drh on
2009-01-22 01:53:04.
[view]
@@ -63,9 +63,8 @@
void compute_leaves(int iBase, int closeMode){
Bag seen; /* Descendants seen */
Bag pending; /* Unpropagated descendants */
Stmt q1; /* Query to find children of a check-in */
- Stmt q2; /* Query to detect if a merge is across branches */
Stmt isBr; /* Query to check to see if a check-in starts a new branch */
Stmt ins; /* INSERT statement for a new record */
/* Create the LEAVES table if it does not already exist. Make sure
@@ -93,30 +92,8 @@
bag_insert(&pending, iBase);
/* This query returns all non-merge children of check-in :rid */
db_prepare(&q1, "SELECT cid FROM plink WHERE pid=:rid AND isprim");
-
- /* This query returns all merge children of check-in :rid where
- ** the child and parent are on same branch. The child and
- ** parent are assumed to be on same branch if they have
- ** the same set of propagated symbolic tags.
- */
- db_prepare(&q2,
- "SELECT cid FROM plink"
- " WHERE pid=:rid AND NOT isprim"
- " AND (SELECT group_concat(x) FROM ("
- " SELECT tag.tagid AS x FROM tagxref, tag"
- " WHERE tagxref.rid=:rid AND tagxref.tagtype=2"
- " AND tag.tagid=tagxref.tagid AND tagxref.srcid=0"
- " AND tag.tagname GLOB 'sym-*'"
- " ORDER BY 1))"
- " == (SELECT group_concat(x) FROM ("
- " SELECT tag.tagid AS x FROM tagxref, tag"
- " WHERE tagxref.rid=plink.cid AND tagxref.tagtype=2"
- " AND tag.tagid=tagxref.tagid AND tagxref.srcid=0"
- " AND tag.tagname GLOB 'sym-*'"
- " ORDER BY 1))"
- );
/* This query returns a single row if check-in :rid is the first
** check-in of a new branch. In other words, it returns a row if
** check-in :rid has the 'newbranch' tag.
@@ -146,14 +123,10 @@
}
db_reset(&isBr);
}
db_reset(&q1);
- if( cnt==0 ){
- db_bind_int(&q2, ":rid", rid);
- if( db_step(&q2)==SQLITE_ROW ){
- cnt++;
- }
- db_reset(&q2);
+ if( cnt==0 && !is_a_leaf(rid) ){
+ cnt++;
}
if( cnt==0 ){
db_bind_int(&ins, ":rid", rid);
db_step(&ins);
@@ -161,9 +134,8 @@
}
}
db_finalize(&ins);
db_finalize(&isBr);
- db_finalize(&q2);
db_finalize(&q1);
bag_clear(&pending);
bag_clear(&seen);
if( closeMode==1 ){