Fossil SCM

The "Branches" menu option shows only open branches. Closed branches are accessible from a hyperlink.

drh 2010-08-15 19:57 trunk
Commit 518439507ada48fe5e50ef0f6b4c45d0e311a367
1 file changed +40 -45
+40 -45
--- src/branch.c
+++ src/branch.c
@@ -215,73 +215,68 @@
215215
** Show a timeline of all branches
216216
*/
217217
void brlist_page(void){
218218
Stmt q;
219219
int cnt;
220
+ int showClosed = P("closed")!=0;
220221
221222
login_check_credentials();
222223
if( !g.okRead ){ login_needed(); return; }
223224
224
- style_header("Branches");
225
+ style_header(showClosed ? "Closed Branches" : "Open Branches");
225226
style_submenu_element("Timeline", "Timeline", "brtimeline");
227
+ if( showClosed ){
228
+ style_submenu_element("Open","Open","brlist");
229
+ }else{
230
+ style_submenu_element("Closed","Closed","brlist?closed");
231
+ }
226232
login_anonymous_available();
227233
compute_leaves(0, 1);
228234
style_sidebox_begin("Nomenclature:", "33%");
229235
@ <ol>
230
- @ <li> An <b>open branch</b> is a branch that has one or
236
+ @ <li> An <a href="brlist">open branch</a> is a branch that has one or
231237
@ more <a href="leaves">open leaves.</a>
232238
@ The presence of open leaves presumably means
233239
@ that the branch is still being extended with new check-ins.</li>
234
- @ <li> A <b>closed branch</b> is a branch with only
240
+ @ <li> A <a href="brlist?closed">closed branch</a> is a branch with only
235241
@ <a href="leaves?closed">closed leaves</a>.
236242
@ Closed branches are fixed and do not change (unless they are first
237243
@ reopened)</li>
238244
@ </ol>
239245
style_sidebox_end();
240246
241
- db_prepare(&q,
242
- "SELECT DISTINCT value FROM tagxref"
243
- " WHERE tagid=%d AND value NOT NULL"
244
- " AND rid IN leaves"
245
- " ORDER BY value /*sort*/",
246
- TAG_BRANCH
247
- );
248
- cnt = 0;
249
- while( db_step(&q)==SQLITE_ROW ){
250
- const char *zBr = db_column_text(&q, 0);
251
- if( cnt==0 ){
252
- @ <h2>Open Branches:</h2>
253
- @ <ul>
254
- cnt++;
255
- }
256
- if( g.okHistory ){
257
- @ <li><a href="%s(g.zBaseURL)/timeline?r=%T(zBr)">%h(zBr)</a></li>
258
- }else{
259
- @ <li><b>%h(zBr)</b></li>
260
- }
261
- }
262
- db_finalize(&q);
263
- if( cnt ){
264
- @ </ul>
265
- }
266
- cnt = 0;
267
- db_prepare(&q,
268
- "SELECT value FROM tagxref"
269
- " WHERE tagid=%d AND value NOT NULL"
270
- " EXCEPT "
271
- "SELECT value FROM tagxref"
272
- " WHERE tagid=%d AND value NOT NULL"
273
- " AND rid IN leaves"
274
- " ORDER BY value /*sort*/",
275
- TAG_BRANCH, TAG_BRANCH
276
- );
277
- while( db_step(&q)==SQLITE_ROW ){
278
- const char *zBr = db_column_text(&q, 0);
279
- if( cnt==0 ){
280
- @ <h2>Closed Branches:</h2>
281
- @ <ul>
282
- cnt++;
247
+ cnt = 0;
248
+ if( !showClosed ){
249
+ db_prepare(&q,
250
+ "SELECT DISTINCT value FROM tagxref"
251
+ " WHERE tagid=%d AND value NOT NULL"
252
+ " AND rid IN leaves"
253
+ " ORDER BY value /*sort*/",
254
+ TAG_BRANCH
255
+ );
256
+ }else{
257
+ db_prepare(&q,
258
+ "SELECT value FROM tagxref"
259
+ " WHERE tagid=%d AND value NOT NULL"
260
+ " EXCEPT "
261
+ "SELECT value FROM tagxref"
262
+ " WHERE tagid=%d AND value NOT NULL"
263
+ " AND rid IN leaves"
264
+ " ORDER BY value /*sort*/",
265
+ TAG_BRANCH, TAG_BRANCH
266
+ );
267
+ }
268
+ while( db_step(&q)==SQLITE_ROW ){
269
+ const char *zBr = db_column_text(&q, 0);
270
+ if( cnt==0 ){
271
+ if( showClosed ){
272
+ @ <h2>Closed Branches:</h2>
273
+ }else{
274
+ @ <h2>Open Branches:</h2>
275
+ }
276
+ @ <ul>
277
+ cnt++;
283278
}
284279
if( g.okHistory ){
285280
@ <li><a href="%s(g.zBaseURL)/timeline?r=%T(zBr)">%h(zBr)</a></li>
286281
}else{
287282
@ <li><b>%h(zBr)</b></li>
288283
--- src/branch.c
+++ src/branch.c
@@ -215,73 +215,68 @@
215 ** Show a timeline of all branches
216 */
217 void brlist_page(void){
218 Stmt q;
219 int cnt;
 
220
221 login_check_credentials();
222 if( !g.okRead ){ login_needed(); return; }
223
224 style_header("Branches");
225 style_submenu_element("Timeline", "Timeline", "brtimeline");
 
 
 
 
 
226 login_anonymous_available();
227 compute_leaves(0, 1);
228 style_sidebox_begin("Nomenclature:", "33%");
229 @ <ol>
230 @ <li> An <b>open branch</b> is a branch that has one or
231 @ more <a href="leaves">open leaves.</a>
232 @ The presence of open leaves presumably means
233 @ that the branch is still being extended with new check-ins.</li>
234 @ <li> A <b>closed branch</b> is a branch with only
235 @ <a href="leaves?closed">closed leaves</a>.
236 @ Closed branches are fixed and do not change (unless they are first
237 @ reopened)</li>
238 @ </ol>
239 style_sidebox_end();
240
241 db_prepare(&q,
242 "SELECT DISTINCT value FROM tagxref"
243 " WHERE tagid=%d AND value NOT NULL"
244 " AND rid IN leaves"
245 " ORDER BY value /*sort*/",
246 TAG_BRANCH
247 );
248 cnt = 0;
249 while( db_step(&q)==SQLITE_ROW ){
250 const char *zBr = db_column_text(&q, 0);
251 if( cnt==0 ){
252 @ <h2>Open Branches:</h2>
253 @ <ul>
254 cnt++;
255 }
256 if( g.okHistory ){
257 @ <li><a href="%s(g.zBaseURL)/timeline?r=%T(zBr)">%h(zBr)</a></li>
258 }else{
259 @ <li><b>%h(zBr)</b></li>
260 }
261 }
262 db_finalize(&q);
263 if( cnt ){
264 @ </ul>
265 }
266 cnt = 0;
267 db_prepare(&q,
268 "SELECT value FROM tagxref"
269 " WHERE tagid=%d AND value NOT NULL"
270 " EXCEPT "
271 "SELECT value FROM tagxref"
272 " WHERE tagid=%d AND value NOT NULL"
273 " AND rid IN leaves"
274 " ORDER BY value /*sort*/",
275 TAG_BRANCH, TAG_BRANCH
276 );
277 while( db_step(&q)==SQLITE_ROW ){
278 const char *zBr = db_column_text(&q, 0);
279 if( cnt==0 ){
280 @ <h2>Closed Branches:</h2>
281 @ <ul>
282 cnt++;
283 }
284 if( g.okHistory ){
285 @ <li><a href="%s(g.zBaseURL)/timeline?r=%T(zBr)">%h(zBr)</a></li>
286 }else{
287 @ <li><b>%h(zBr)</b></li>
288
--- src/branch.c
+++ src/branch.c
@@ -215,73 +215,68 @@
215 ** Show a timeline of all branches
216 */
217 void brlist_page(void){
218 Stmt q;
219 int cnt;
220 int showClosed = P("closed")!=0;
221
222 login_check_credentials();
223 if( !g.okRead ){ login_needed(); return; }
224
225 style_header(showClosed ? "Closed Branches" : "Open Branches");
226 style_submenu_element("Timeline", "Timeline", "brtimeline");
227 if( showClosed ){
228 style_submenu_element("Open","Open","brlist");
229 }else{
230 style_submenu_element("Closed","Closed","brlist?closed");
231 }
232 login_anonymous_available();
233 compute_leaves(0, 1);
234 style_sidebox_begin("Nomenclature:", "33%");
235 @ <ol>
236 @ <li> An <a href="brlist">open branch</a> is a branch that has one or
237 @ more <a href="leaves">open leaves.</a>
238 @ The presence of open leaves presumably means
239 @ that the branch is still being extended with new check-ins.</li>
240 @ <li> A <a href="brlist?closed">closed branch</a> is a branch with only
241 @ <a href="leaves?closed">closed leaves</a>.
242 @ Closed branches are fixed and do not change (unless they are first
243 @ reopened)</li>
244 @ </ol>
245 style_sidebox_end();
246
247 cnt = 0;
248 if( !showClosed ){
249 db_prepare(&q,
250 "SELECT DISTINCT value FROM tagxref"
251 " WHERE tagid=%d AND value NOT NULL"
252 " AND rid IN leaves"
253 " ORDER BY value /*sort*/",
254 TAG_BRANCH
255 );
256 }else{
257 db_prepare(&q,
258 "SELECT value FROM tagxref"
259 " WHERE tagid=%d AND value NOT NULL"
260 " EXCEPT "
261 "SELECT value FROM tagxref"
262 " WHERE tagid=%d AND value NOT NULL"
263 " AND rid IN leaves"
264 " ORDER BY value /*sort*/",
265 TAG_BRANCH, TAG_BRANCH
266 );
267 }
268 while( db_step(&q)==SQLITE_ROW ){
269 const char *zBr = db_column_text(&q, 0);
270 if( cnt==0 ){
271 if( showClosed ){
272 @ <h2>Closed Branches:</h2>
273 }else{
274 @ <h2>Open Branches:</h2>
275 }
276 @ <ul>
277 cnt++;
 
 
 
 
 
 
 
 
 
 
 
278 }
279 if( g.okHistory ){
280 @ <li><a href="%s(g.zBaseURL)/timeline?r=%T(zBr)">%h(zBr)</a></li>
281 }else{
282 @ <li><b>%h(zBr)</b></li>
283

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button