Check-in [9659ed66f8]
Not logged in
Overview

SHA1 Hash:9659ed66f83f895246b4f128e1dca1c6d5736cc0
Date: 2009-01-23 23:57:11
User: drh
Comment: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.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/branch.c from [806b04e089] to [f230ea602b].

@@ -220,32 +220,70 @@
 **
 ** 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">
   @ <script>