Overview
SHA1 Hash: | 042a08b564579fbfe4526af43164c379eb2d73c6 |
---|---|
Date: | 2009-01-22 01:10:41 |
User: | drh |
Comment: | 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. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/descendants.c from [20b63066bd] to [cba21fd744].
@@ -61,60 +61,111 @@ ** closeMode==2. */ void compute_leaves(int iBase, int closeMode){ Bag seen; /* Descendants seen */ Bag pending; /* Unpropagated descendants */ - Stmt q; /* Query to find children of a check-in */ + 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 + ** it is empty. + */ db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS leaves(" " rid INTEGER PRIMARY KEY" ");" "DELETE FROM leaves;" ); - bag_init(&seen); - bag_init(&pending); + + /* We are checking all descendants of iBase. If iBase==0, then + ** change iBase to be the root of the entire check-in hierarchy. + */ if( iBase<=0 ){ iBase = db_int(0, "SELECT objid FROM event WHERE type='ci'" " ORDER BY mtime LIMIT 1"); if( iBase==0 ) return; } + + /* Initialize the bags. */ + bag_init(&seen); + bag_init(&pending); bag_insert(&pending, iBase); - db_prepare(&q, "SELECT cid FROM plink WHERE pid=:rid"); + + /* 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. + */ db_prepare(&isBr, "SELECT 1 FROM tagxref WHERE rid=:rid AND tagid=%d AND tagtype=1", TAG_NEWBRANCH ); + + /* This statement inserts check-in :rid into the LEAVES table. + */ db_prepare(&ins, "INSERT OR IGNORE INTO leaves VALUES(:rid)"); + while( bag_count(&pending) ){ int rid = bag_first(&pending); int cnt = 0; bag_remove(&pending, rid); - db_bind_int(&q, ":rid", rid); - while( db_step(&q)==SQLITE_ROW ){ - int cid = db_column_int(&q, 0); + db_bind_int(&q1, ":rid", rid); + while( db_step(&q1)==SQLITE_ROW ){ + int cid = db_column_int(&q1, 0); if( bag_insert(&seen, cid) ){ bag_insert(&pending, cid); } db_bind_int(&isBr, ":rid", cid); if( db_step(&isBr)==SQLITE_DONE ){ cnt++; } db_reset(&isBr); } - db_reset(&q); + 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 ){ db_bind_int(&ins, ":rid", rid); db_step(&ins); db_reset(&ins); } } db_finalize(&ins); db_finalize(&isBr); - db_finalize(&q); + db_finalize(&q2); + db_finalize(&q1); bag_clear(&pending); bag_clear(&seen); if( closeMode==1 ){ db_multi_exec( "DELETE FROM leaves WHERE rid IN"
Modified src/info.c from [b49f2b6028] to [e618e31047].
@@ -272,14 +272,14 @@ int cnt = 0; db_prepare(&q, "SELECT tag.tagid, tagname, " " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," " value, datetime(tagxref.mtime,'localtime'), tagtype," - " (SELECT uuid FROM blob WHERE rid=tagxref.origid)" + " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)" " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid" " WHERE tagxref.rid=%d AND tagname NOT GLOB '%s'" - " ORDER BY tagname", rid, rid, zNotGlob + " ORDER BY tagname", rid, rid, rid, zNotGlob ); while( db_step(&q)==SQLITE_ROW ){ const char *zTagname = db_column_text(&q, 1); const char *zSrcUuid = db_column_text(&q, 2); const char *zValue = db_column_text(&q, 3); @@ -292,11 +292,11 @@ @ <ul> } @ <li> @ <b>%h(zTagname)</b> if( tagtype==0 ){ - @ <i>cancelled. + @ <i>cancelled }else if( zValue ){ @ = %h(zValue)<i> }else { @ <i> } @@ -307,11 +307,15 @@ }else{ @ propagates to descendants } } if( zSrcUuid && zSrcUuid[0] ){ - @ added by + if( tagtype==0 ){ + @ by + }else{ + @ added by + } hyperlink_to_uuid(zSrcUuid); @ on %s(zDate) } @ </i> }
Modified src/tag.c from [fb6da1128f] to [abb9a54f9e].
@@ -173,13 +173,13 @@ if( rc==SQLITE_ROW ){ /* Another entry that is more recent already exists. Do nothing */ return; } db_prepare(&s, - "REPLACE INTO tagxref(tagid,tagtype,srcId,value,mtime,rid)" - " VALUES(%d,%d,%d,%Q,:mtime,%d)", - tagid, tagtype, srcId, zValue, rid + "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)" + " VALUES(%d,%d,%d,%d,%Q,:mtime,%d)", + tagid, tagtype, srcId, rid, zValue, rid ); db_bind_double(&s, ":mtime", mtime); db_step(&s); db_finalize(&s); if( tagtype==0 ){