Differences From:
File
src/timeline.c
part of check-in
[fbbd0318bd]
- Display a list of symbolic tags associated with each check-in on the
timeline.
by
drh on
2009-01-20 00:27:37.
[view]
To:
File
src/timeline.c
part of check-in
[b6e22e62cf]
- Attempting to rationalize the tagging and branching logic. The "branch"
command has been resurrected and appears to work now. The "tag branch"
command has been removed. Special tags "newbranch" and "closed" used to
manage branches. New changes are not well-tested - use with caution.
You must "rebuild" when upgrading through this version.
by
drh on
2009-01-20 16:51:19.
[view]
@@ -76,8 +76,28 @@
}
}
/*
+** Count the number of non-branch children for the given check-in.
+** A non-branch child is a child that omits the "newbranch" tag.
+*/
+int count_nonbranch_children(int pid){
+ int nNonBranch;
+
+ nNonBranch = db_int(0,
+ "SELECT count(*) FROM plink"
+ " WHERE pid=%d"
+ " AND NOT EXISTS(SELECT 1 FROM tagxref"
+ " WHERE tagid=%d"
+ " AND rid=cid"
+ " AND tagtype>0"
+ " )",
+ pid, TAG_NEWBRANCH
+ );
+ return nNonBranch;
+}
+
+/*
** Output a timeline in the web format given a query. The query
** should return these columns:
**
** 0. rid
@@ -146,9 +166,13 @@
if( nParent>1 ){
@ <b>Merge</b>
}
if( nPChild>1 ){
- @ <b>Fork</b>
+ if( count_nonbranch_children(rid)>1 ){
+ @ <b>Fork</b>
+ }else{
+ @ <b>Branch</b>
+ }
}
if( isLeaf ){
@ <b>Leaf</b>
}
@@ -548,8 +572,9 @@
zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
}
while( db_step(q)==SQLITE_ROW && nLine<=mxLine ){
+ int rid = db_column_int(q, 0);
const char *zId = db_column_text(q, 1);
const char *zDate = db_column_text(q, 2);
const char *zCom = db_column_text(q, 3);
int nChild = db_column_int(q, 4);
@@ -572,9 +597,15 @@
sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* ");
n = strlen(zPrefix);
}
if( nChild>1 ){
- sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* ");
+ const char *zBrType;
+ if( count_nonbranch_children(rid)>1 ){
+ zBrType = "*FORK* ";
+ }else{
+ zBrType = "*BRANCH* ";
+ }
+ sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], zBrType);
n = strlen(zPrefix);
}
if( zCurrentUuid && strcmp(zCurrentUuid,zId)==0 ){
sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* ");