Differences From:
File
src/branch.c
part of check-in
[a12cb216b7]
- Reenable the "Tags" menu item, but make it go to the new "taglist" page.
Also add separate "tagtimeline" page and separate "brlist" into "brlist"
and "brtimeline".
by
drh on
2009-01-22 13:08:42.
[view]
To:
File
src/branch.c
part of check-in
[9659ed66f8]
- Make the distinction between open and closed branches. An open branch
is a branch with one or more open leaves. Show open and closed branches
separately on the "Branches" webpage.
by
drh on
2009-01-23 23:57:11.
[view]
@@ -221,30 +221,68 @@
** Show a timeline of all branches
*/
void brlist_page(void){
Stmt q;
+ int cnt;
login_check_credentials();
if( !g.okRead ){ login_needed(); return; }
style_header("Branches");
style_submenu_element("Timeline", "Timeline", "brtimeline");
login_anonymous_available();
- @ <h2>Branches:</h2>
- @ <ul>
+ compute_leaves(0, 1);
db_prepare(&q,
"SELECT DISTINCT value FROM tagxref"
- " WHERE tagid=%d AND srcid!=0 AND value NOT NULL"
+ " WHERE tagid=%d AND value NOT NULL"
+ " AND rid IN leaves"
" ORDER BY value",
TAG_BRANCH
);
+ cnt = 0;
+ while( db_step(&q)==SQLITE_ROW ){
+ const char *zBr = db_column_text(&q, 0);
+ if( cnt==0 ){
+ @ <h2>Open Branches:</h2>
+ @ <ul>
+ cnt++;
+ }
+ if( g.okHistory ){
+ @ <li><a href="%s(g.zBaseURL)/timeline?t=%T(zBr)">%h(zBr)</a></li>
+ }else{
+ @ <li><b>%h(zBr)</b></li>
+ }
+ }
+ db_finalize(&q);
+ if( cnt ){
+ @ </ul>
+ }
+ cnt = 0;
+ db_prepare(&q,
+ "SELECT value FROM tagxref"
+ " WHERE tagid=%d AND value NOT NULL"
+ " EXCEPT "
+ "SELECT value FROM tagxref"
+ " WHERE tagid=%d AND value NOT NULL"
+ " AND rid IN leaves"
+ " ORDER BY value",
+ TAG_BRANCH, TAG_BRANCH
+ );
while( db_step(&q)==SQLITE_ROW ){
const char *zBr = db_column_text(&q, 0);
+ if( cnt==0 ){
+ @ <h2>Closed Branches:</h2>
+ @ <ul>
+ cnt++;
+ }
if( g.okHistory ){
@ <li><a href="%s(g.zBaseURL)/timeline?t=%T(zBr)">%h(zBr)</a></li>
}else{
@ <li><b>%h(zBr)</b></li>
}
+ }
+ if( cnt ){
+ @ </ul>
}
db_finalize(&q);
@ </ul>
@ <br clear="both">