Fossil SCM

New design for the /brlist webpage that shows the branches in age order and shows their current status.

drh 2015-01-03 23:54 trunk
Commit 12fb5d04e37b53cb58ac66951520a2bf512d5595
+151 -38
--- src/branch.c
+++ src/branch.c
@@ -179,47 +179,67 @@
179179
180180
/* Do an autosync push, if requested */
181181
if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries", 1));
182182
}
183183
184
+#if INTERFACE
185
+/*
186
+** Allows bits in the mBplqFlags parameter to branch_prepare_list_query().
187
+*/
188
+#define BRL_CLOSED_ONLY 0x001 /* Show only closed branches */
189
+#define BRL_OPEN_ONLY 0x002 /* Show only open branches */
190
+#define BRL_BOTH 0x003 /* Show both open and closed branches */
191
+#define BRL_OPEN_CLOSED_MASK 0x003
192
+#define BRL_MTIME 0x004 /* Include lastest check-in time */
193
+#dfeine BRL_ORDERBY_MTIME 0x008 /* Sort by MTIME. (otherwise sort by name)*/
194
+
195
+#endif /* INTERFACE */
196
+
184197
/*
185198
** Prepare a query that will list branches.
186199
**
187200
** If (which<0) then the query pulls only closed branches. If
188201
** (which>0) then the query pulls all (closed and opened)
189202
** branches. Else the query pulls currently-opened branches.
190203
*/
191
-void branch_prepare_list_query(Stmt *pQuery, int which ){
192
- if( which < 0 ){
193
- db_prepare(pQuery,
194
- "SELECT value FROM tagxref"
195
- " WHERE tagid=%d AND value NOT NULL "
196
- "EXCEPT "
197
- "SELECT value FROM tagxref"
198
- " WHERE tagid=%d"
199
- " AND rid IN leaf"
200
- " AND NOT %z"
201
- " ORDER BY value COLLATE nocase /*sort*/",
202
- TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
203
- );
204
- }else if( which>0 ){
205
- db_prepare(pQuery,
206
- "SELECT DISTINCT value FROM tagxref"
207
- " WHERE tagid=%d AND value NOT NULL"
208
- " AND rid IN leaf"
209
- " ORDER BY value COLLATE nocase /*sort*/",
210
- TAG_BRANCH
211
- );
212
- }else{
213
- db_prepare(pQuery,
214
- "SELECT DISTINCT value FROM tagxref"
215
- " WHERE tagid=%d AND value NOT NULL"
216
- " AND rid IN leaf"
217
- " AND NOT %z"
218
- " ORDER BY value COLLATE nocase /*sort*/",
219
- TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
220
- );
204
+void branch_prepare_list_query(Stmt *pQuery, int brFlags){
205
+ switch( brFlags & BRL_OPEN_CLOSED_MASK ){
206
+ case BRL_CLOSED_ONLY: {
207
+ db_prepare(pQuery,
208
+ "SELECT value FROM tagxref"
209
+ " WHERE tagid=%d AND value NOT NULL "
210
+ "EXCEPT "
211
+ "SELECT value FROM tagxref"
212
+ " WHERE tagid=%d"
213
+ " AND rid IN leaf"
214
+ " AND NOT %z"
215
+ " ORDER BY value COLLATE nocase /*sort*/",
216
+ TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
217
+ );
218
+ break;
219
+ }
220
+ case BRL_BOTH: {
221
+ db_prepare(pQuery,
222
+ "SELECT DISTINCT value FROM tagxref"
223
+ " WHERE tagid=%d AND value NOT NULL"
224
+ " AND rid IN leaf"
225
+ " ORDER BY value COLLATE nocase /*sort*/",
226
+ TAG_BRANCH
227
+ );
228
+ break;
229
+ }
230
+ case BRL_OPEN_ONLY: {
231
+ db_prepare(pQuery,
232
+ "SELECT DISTINCT value FROM tagxref"
233
+ " WHERE tagid=%d AND value NOT NULL"
234
+ " AND rid IN leaf"
235
+ " AND NOT %z"
236
+ " ORDER BY value COLLATE nocase /*sort*/",
237
+ TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
238
+ );
239
+ break;
240
+ }
221241
}
222242
}
223243
224244
225245
/*
@@ -260,19 +280,20 @@
260280
branch_new();
261281
}else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){
262282
Stmt q;
263283
int vid;
264284
char *zCurrent = 0;
265
- int showAll = find_option("all","a",0)!=0;
266
- int showClosed = find_option("closed","c",0)!=0;
285
+ int brFlags = BRL_OPEN_ONLY;
286
+ if( find_option("all","a",0)!=0 ) brFlags = BRL_BOTH;
287
+ if( find_option("closed","c",0)!=0 ) brFlags = BRL_CLOSED_ONLY;
267288
268289
if( g.localOpen ){
269290
vid = db_lget_int("checkout", 0);
270291
zCurrent = db_text(0, "SELECT value FROM tagxref"
271292
" WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
272293
}
273
- branch_prepare_list_query(&q, showAll?1:(showClosed?-1:0));
294
+ branch_prepare_list_query(&q, brFlags);
274295
while( db_step(&q)==SQLITE_ROW ){
275296
const char *zBr = db_column_text(&q, 0);
276297
int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
277298
fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
278299
}
@@ -280,36 +301,128 @@
280301
}else{
281302
fossil_fatal("branch subcommand should be one of: "
282303
"new list ls");
283304
}
284305
}
306
+
307
+static char brlistQuery[] =
308
+@ SELECT
309
+@ tagxref.value,
310
+@ max(event.mtime),
311
+@ EXISTS(SELECT 1 FROM tagxref AS tx
312
+@ WHERE tx.rid=leaf.rid
313
+@ AND tx.tagid=(SELECT tagid FROM tag WHERE tagname='closed')
314
+@ AND tx.tagtype>0),
315
+@ (SELECT tagxref.value
316
+@ FROM plink CROSS JOIN tagxref
317
+@ WHERE plink.pid=leaf.rid
318
+@ AND tagxref.rid=plink.cid
319
+@ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch')
320
+@ AND tagtype>0)
321
+@ FROM leaf, tagxref, tag, event
322
+@ WHERE leaf.rid=tagxref.rid
323
+@ AND tagxref.tagid=tag.tagid
324
+@ AND tagxref.tagtype>0
325
+@ AND tag.tagname='branch'
326
+@ AND event.objid=leaf.rid
327
+@ GROUP BY 1
328
+@ ORDER BY %d DESC;
329
+;
330
+
331
+/*
332
+** This is the new-style branch-list page that shows the branch names
333
+** together with their ages (time of last check-in) and whether or not
334
+** they are closed or merged to another branch.
335
+**
336
+** Control jumps to this routine from brlist_page() (the /brlist handler)
337
+** if there are no query parameters.
338
+*/
339
+static void new_brlist_page(void){
340
+ Stmt q;
341
+ double rNow;
342
+ int orderByMtime = P("mtime")!=0;
343
+ login_check_credentials();
344
+ if( !g.perm.Read ){ login_needed(); return; }
345
+ style_header("Branches");
346
+ login_anonymous_available();
347
+
348
+ assert( orderByMtime==0 || orderByMtime==1 );
349
+ db_prepare(&q, brlistQuery/*works-like:"%d"*/, 2-orderByMtime);
350
+ rNow = db_double(0.0, "SELECT julianday('now')");
351
+ @ <div class="brlist"><table>
352
+ @ <tr>
353
+ @ <th>Branch Name</th>
354
+ @ <th>Age</th>
355
+ @ <th>Status</th>
356
+ @ </tr>
357
+ while( db_step(&q)==SQLITE_ROW ){
358
+ const char *zBranch = db_column_text(&q, 0);
359
+ double rMtime = db_column_double(&q, 1);
360
+ int isClosed = db_column_int(&q, 2);
361
+ const char *zMergeTo = db_column_text(&q, 3);
362
+ char *zAge = human_readable_age(rNow - rMtime);
363
+ if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
364
+ @ <tr>
365
+ @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a>
366
+ @ <td>%s(zAge)
367
+ fossil_free(zAge);
368
+ if( isClosed && zMergeTo ){
369
+ @ <td>closed,
370
+ }else if( isClosed ){
371
+ @ <td>closed
372
+ }else{
373
+ @ <td>
374
+ }
375
+ if( zMergeTo ){
376
+ @ merged into %z(href("%R/timeline?r=%T",zMergeTo))%h(zMergeTo)</a>
377
+ }
378
+ @ </tr>
379
+ }
380
+ @ </table></div>
381
+
382
+ db_finalize(&q);
383
+ style_footer();
384
+}
285385
286386
/*
287387
** WEBPAGE: brlist
388
+** Show a list of branches
389
+** Query parameters:
288390
**
289
-** Show a timeline of all branches
391
+** all Show all branches
392
+** closed Show only closed branches
393
+** open Show only open branches (default behavior)
394
+** colortest Show all branches with automatic color
290395
*/
291396
void brlist_page(void){
292397
Stmt q;
293398
int cnt;
294399
int showClosed = P("closed")!=0;
295400
int showAll = P("all")!=0;
401
+ int showOpen = P("open")!=0;
296402
int colorTest = P("colortest")!=0;
403
+ int brFlags = BRL_OPEN_ONLY;
297404
405
+ if( showClosed==0 && showAll==0 && showOpen==0 && colorTest==0 ){
406
+ new_brlist_page();
407
+ return;
408
+ }
298409
login_check_credentials();
299410
if( !g.perm.Read ){ login_needed(); return; }
300411
if( colorTest ){
301412
showClosed = 0;
302413
showAll = 1;
303414
}
415
+ if( showAll ) brFlags = BRL_BOTH;
416
+ if( showClosed ) brFlags = BRL_CLOSED_ONLY;
304417
305418
style_header("%s", showClosed ? "Closed Branches" :
306419
showAll ? "All Branches" : "Open Branches");
307420
style_submenu_element("Timeline", "Timeline", "brtimeline");
308421
if( showClosed ){
309422
style_submenu_element("All", "All", "brlist?all");
310
- style_submenu_element("Open","Open","brlist");
423
+ style_submenu_element("Open","Open","brlist?open");
311424
}else if( showAll ){
312425
style_submenu_element("Closed", "Closed", "brlist?closed");
313426
style_submenu_element("Open","Open","brlist");
314427
}else{
315428
style_submenu_element("All", "All", "brlist?all");
@@ -335,21 +448,21 @@
335448
@ Closed branches are fixed and do not change (unless they are first
336449
@ reopened).</li>
337450
@ </ol>
338451
style_sidebox_end();
339452
340
- branch_prepare_list_query(&q, showAll?1:(showClosed?-1:0));
453
+ branch_prepare_list_query(&q, brFlags);
341454
cnt = 0;
342455
while( db_step(&q)==SQLITE_ROW ){
343456
const char *zBr = db_column_text(&q, 0);
344457
if( cnt==0 ){
345458
if( colorTest ){
346459
@ <h2>Default background colors for all branches:</h2>
460
+ }else if( showClosed ){
461
+ @ <h2>Closed Branches:</h2>
347462
}else if( showAll ){
348463
@ <h2>All Branches:</h2>
349
- }else if( showClosed ){
350
- @ <h2>Closed Branches:</h2>
351464
}else{
352465
@ <h2>Open Branches:</h2>
353466
}
354467
@ <ul>
355468
cnt++;
356469
--- src/branch.c
+++ src/branch.c
@@ -179,47 +179,67 @@
179
180 /* Do an autosync push, if requested */
181 if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries", 1));
182 }
183
 
 
 
 
 
 
 
 
 
 
 
 
 
184 /*
185 ** Prepare a query that will list branches.
186 **
187 ** If (which<0) then the query pulls only closed branches. If
188 ** (which>0) then the query pulls all (closed and opened)
189 ** branches. Else the query pulls currently-opened branches.
190 */
191 void branch_prepare_list_query(Stmt *pQuery, int which ){
192 if( which < 0 ){
193 db_prepare(pQuery,
194 "SELECT value FROM tagxref"
195 " WHERE tagid=%d AND value NOT NULL "
196 "EXCEPT "
197 "SELECT value FROM tagxref"
198 " WHERE tagid=%d"
199 " AND rid IN leaf"
200 " AND NOT %z"
201 " ORDER BY value COLLATE nocase /*sort*/",
202 TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
203 );
204 }else if( which>0 ){
205 db_prepare(pQuery,
206 "SELECT DISTINCT value FROM tagxref"
207 " WHERE tagid=%d AND value NOT NULL"
208 " AND rid IN leaf"
209 " ORDER BY value COLLATE nocase /*sort*/",
210 TAG_BRANCH
211 );
212 }else{
213 db_prepare(pQuery,
214 "SELECT DISTINCT value FROM tagxref"
215 " WHERE tagid=%d AND value NOT NULL"
216 " AND rid IN leaf"
217 " AND NOT %z"
218 " ORDER BY value COLLATE nocase /*sort*/",
219 TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
220 );
 
 
 
 
 
 
 
221 }
222 }
223
224
225 /*
@@ -260,19 +280,20 @@
260 branch_new();
261 }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){
262 Stmt q;
263 int vid;
264 char *zCurrent = 0;
265 int showAll = find_option("all","a",0)!=0;
266 int showClosed = find_option("closed","c",0)!=0;
 
267
268 if( g.localOpen ){
269 vid = db_lget_int("checkout", 0);
270 zCurrent = db_text(0, "SELECT value FROM tagxref"
271 " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
272 }
273 branch_prepare_list_query(&q, showAll?1:(showClosed?-1:0));
274 while( db_step(&q)==SQLITE_ROW ){
275 const char *zBr = db_column_text(&q, 0);
276 int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
277 fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
278 }
@@ -280,36 +301,128 @@
280 }else{
281 fossil_fatal("branch subcommand should be one of: "
282 "new list ls");
283 }
284 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
286 /*
287 ** WEBPAGE: brlist
 
 
288 **
289 ** Show a timeline of all branches
 
 
 
290 */
291 void brlist_page(void){
292 Stmt q;
293 int cnt;
294 int showClosed = P("closed")!=0;
295 int showAll = P("all")!=0;
 
296 int colorTest = P("colortest")!=0;
 
297
 
 
 
 
298 login_check_credentials();
299 if( !g.perm.Read ){ login_needed(); return; }
300 if( colorTest ){
301 showClosed = 0;
302 showAll = 1;
303 }
 
 
304
305 style_header("%s", showClosed ? "Closed Branches" :
306 showAll ? "All Branches" : "Open Branches");
307 style_submenu_element("Timeline", "Timeline", "brtimeline");
308 if( showClosed ){
309 style_submenu_element("All", "All", "brlist?all");
310 style_submenu_element("Open","Open","brlist");
311 }else if( showAll ){
312 style_submenu_element("Closed", "Closed", "brlist?closed");
313 style_submenu_element("Open","Open","brlist");
314 }else{
315 style_submenu_element("All", "All", "brlist?all");
@@ -335,21 +448,21 @@
335 @ Closed branches are fixed and do not change (unless they are first
336 @ reopened).</li>
337 @ </ol>
338 style_sidebox_end();
339
340 branch_prepare_list_query(&q, showAll?1:(showClosed?-1:0));
341 cnt = 0;
342 while( db_step(&q)==SQLITE_ROW ){
343 const char *zBr = db_column_text(&q, 0);
344 if( cnt==0 ){
345 if( colorTest ){
346 @ <h2>Default background colors for all branches:</h2>
 
 
347 }else if( showAll ){
348 @ <h2>All Branches:</h2>
349 }else if( showClosed ){
350 @ <h2>Closed Branches:</h2>
351 }else{
352 @ <h2>Open Branches:</h2>
353 }
354 @ <ul>
355 cnt++;
356
--- src/branch.c
+++ src/branch.c
@@ -179,47 +179,67 @@
179
180 /* Do an autosync push, if requested */
181 if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries", 1));
182 }
183
184 #if INTERFACE
185 /*
186 ** Allows bits in the mBplqFlags parameter to branch_prepare_list_query().
187 */
188 #define BRL_CLOSED_ONLY 0x001 /* Show only closed branches */
189 #define BRL_OPEN_ONLY 0x002 /* Show only open branches */
190 #define BRL_BOTH 0x003 /* Show both open and closed branches */
191 #define BRL_OPEN_CLOSED_MASK 0x003
192 #define BRL_MTIME 0x004 /* Include lastest check-in time */
193 #dfeine BRL_ORDERBY_MTIME 0x008 /* Sort by MTIME. (otherwise sort by name)*/
194
195 #endif /* INTERFACE */
196
197 /*
198 ** Prepare a query that will list branches.
199 **
200 ** If (which<0) then the query pulls only closed branches. If
201 ** (which>0) then the query pulls all (closed and opened)
202 ** branches. Else the query pulls currently-opened branches.
203 */
204 void branch_prepare_list_query(Stmt *pQuery, int brFlags){
205 switch( brFlags & BRL_OPEN_CLOSED_MASK ){
206 case BRL_CLOSED_ONLY: {
207 db_prepare(pQuery,
208 "SELECT value FROM tagxref"
209 " WHERE tagid=%d AND value NOT NULL "
210 "EXCEPT "
211 "SELECT value FROM tagxref"
212 " WHERE tagid=%d"
213 " AND rid IN leaf"
214 " AND NOT %z"
215 " ORDER BY value COLLATE nocase /*sort*/",
216 TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
217 );
218 break;
219 }
220 case BRL_BOTH: {
221 db_prepare(pQuery,
222 "SELECT DISTINCT value FROM tagxref"
223 " WHERE tagid=%d AND value NOT NULL"
224 " AND rid IN leaf"
225 " ORDER BY value COLLATE nocase /*sort*/",
226 TAG_BRANCH
227 );
228 break;
229 }
230 case BRL_OPEN_ONLY: {
231 db_prepare(pQuery,
232 "SELECT DISTINCT value FROM tagxref"
233 " WHERE tagid=%d AND value NOT NULL"
234 " AND rid IN leaf"
235 " AND NOT %z"
236 " ORDER BY value COLLATE nocase /*sort*/",
237 TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
238 );
239 break;
240 }
241 }
242 }
243
244
245 /*
@@ -260,19 +280,20 @@
280 branch_new();
281 }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){
282 Stmt q;
283 int vid;
284 char *zCurrent = 0;
285 int brFlags = BRL_OPEN_ONLY;
286 if( find_option("all","a",0)!=0 ) brFlags = BRL_BOTH;
287 if( find_option("closed","c",0)!=0 ) brFlags = BRL_CLOSED_ONLY;
288
289 if( g.localOpen ){
290 vid = db_lget_int("checkout", 0);
291 zCurrent = db_text(0, "SELECT value FROM tagxref"
292 " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
293 }
294 branch_prepare_list_query(&q, brFlags);
295 while( db_step(&q)==SQLITE_ROW ){
296 const char *zBr = db_column_text(&q, 0);
297 int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
298 fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
299 }
@@ -280,36 +301,128 @@
301 }else{
302 fossil_fatal("branch subcommand should be one of: "
303 "new list ls");
304 }
305 }
306
307 static char brlistQuery[] =
308 @ SELECT
309 @ tagxref.value,
310 @ max(event.mtime),
311 @ EXISTS(SELECT 1 FROM tagxref AS tx
312 @ WHERE tx.rid=leaf.rid
313 @ AND tx.tagid=(SELECT tagid FROM tag WHERE tagname='closed')
314 @ AND tx.tagtype>0),
315 @ (SELECT tagxref.value
316 @ FROM plink CROSS JOIN tagxref
317 @ WHERE plink.pid=leaf.rid
318 @ AND tagxref.rid=plink.cid
319 @ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch')
320 @ AND tagtype>0)
321 @ FROM leaf, tagxref, tag, event
322 @ WHERE leaf.rid=tagxref.rid
323 @ AND tagxref.tagid=tag.tagid
324 @ AND tagxref.tagtype>0
325 @ AND tag.tagname='branch'
326 @ AND event.objid=leaf.rid
327 @ GROUP BY 1
328 @ ORDER BY %d DESC;
329 ;
330
331 /*
332 ** This is the new-style branch-list page that shows the branch names
333 ** together with their ages (time of last check-in) and whether or not
334 ** they are closed or merged to another branch.
335 **
336 ** Control jumps to this routine from brlist_page() (the /brlist handler)
337 ** if there are no query parameters.
338 */
339 static void new_brlist_page(void){
340 Stmt q;
341 double rNow;
342 int orderByMtime = P("mtime")!=0;
343 login_check_credentials();
344 if( !g.perm.Read ){ login_needed(); return; }
345 style_header("Branches");
346 login_anonymous_available();
347
348 assert( orderByMtime==0 || orderByMtime==1 );
349 db_prepare(&q, brlistQuery/*works-like:"%d"*/, 2-orderByMtime);
350 rNow = db_double(0.0, "SELECT julianday('now')");
351 @ <div class="brlist"><table>
352 @ <tr>
353 @ <th>Branch Name</th>
354 @ <th>Age</th>
355 @ <th>Status</th>
356 @ </tr>
357 while( db_step(&q)==SQLITE_ROW ){
358 const char *zBranch = db_column_text(&q, 0);
359 double rMtime = db_column_double(&q, 1);
360 int isClosed = db_column_int(&q, 2);
361 const char *zMergeTo = db_column_text(&q, 3);
362 char *zAge = human_readable_age(rNow - rMtime);
363 if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
364 @ <tr>
365 @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a>
366 @ <td>%s(zAge)
367 fossil_free(zAge);
368 if( isClosed && zMergeTo ){
369 @ <td>closed,
370 }else if( isClosed ){
371 @ <td>closed
372 }else{
373 @ <td>
374 }
375 if( zMergeTo ){
376 @ merged into %z(href("%R/timeline?r=%T",zMergeTo))%h(zMergeTo)</a>
377 }
378 @ </tr>
379 }
380 @ </table></div>
381
382 db_finalize(&q);
383 style_footer();
384 }
385
386 /*
387 ** WEBPAGE: brlist
388 ** Show a list of branches
389 ** Query parameters:
390 **
391 ** all Show all branches
392 ** closed Show only closed branches
393 ** open Show only open branches (default behavior)
394 ** colortest Show all branches with automatic color
395 */
396 void brlist_page(void){
397 Stmt q;
398 int cnt;
399 int showClosed = P("closed")!=0;
400 int showAll = P("all")!=0;
401 int showOpen = P("open")!=0;
402 int colorTest = P("colortest")!=0;
403 int brFlags = BRL_OPEN_ONLY;
404
405 if( showClosed==0 && showAll==0 && showOpen==0 && colorTest==0 ){
406 new_brlist_page();
407 return;
408 }
409 login_check_credentials();
410 if( !g.perm.Read ){ login_needed(); return; }
411 if( colorTest ){
412 showClosed = 0;
413 showAll = 1;
414 }
415 if( showAll ) brFlags = BRL_BOTH;
416 if( showClosed ) brFlags = BRL_CLOSED_ONLY;
417
418 style_header("%s", showClosed ? "Closed Branches" :
419 showAll ? "All Branches" : "Open Branches");
420 style_submenu_element("Timeline", "Timeline", "brtimeline");
421 if( showClosed ){
422 style_submenu_element("All", "All", "brlist?all");
423 style_submenu_element("Open","Open","brlist?open");
424 }else if( showAll ){
425 style_submenu_element("Closed", "Closed", "brlist?closed");
426 style_submenu_element("Open","Open","brlist");
427 }else{
428 style_submenu_element("All", "All", "brlist?all");
@@ -335,21 +448,21 @@
448 @ Closed branches are fixed and do not change (unless they are first
449 @ reopened).</li>
450 @ </ol>
451 style_sidebox_end();
452
453 branch_prepare_list_query(&q, brFlags);
454 cnt = 0;
455 while( db_step(&q)==SQLITE_ROW ){
456 const char *zBr = db_column_text(&q, 0);
457 if( cnt==0 ){
458 if( colorTest ){
459 @ <h2>Default background colors for all branches:</h2>
460 }else if( showClosed ){
461 @ <h2>Closed Branches:</h2>
462 }else if( showAll ){
463 @ <h2>All Branches:</h2>
 
 
464 }else{
465 @ <h2>Open Branches:</h2>
466 }
467 @ <ul>
468 cnt++;
469
--- src/json_branch.c
+++ src/json_branch.c
@@ -66,11 +66,11 @@
6666
cson_value * payV;
6767
cson_object * pay;
6868
cson_value * listV;
6969
cson_array * list;
7070
char const * range = NULL;
71
- int which = 0;
71
+ int branchListFlags = BPLQ_OPEN_ONLY;
7272
char * sawConversionError = NULL;
7373
Stmt q;
7474
if( !g.perm.Read ){
7575
json_set_err(FSL_JSON_E_DENIED,
7676
"Requires 'o' permissions.");
@@ -102,19 +102,19 @@
102102
}
103103
/* Normalize range values... */
104104
switch(*range){
105105
case 'c':
106106
range = "closed";
107
- which = -1;
107
+ branchListFlags = BRL_CLOSED_ONLY;
108108
break;
109109
case 'a':
110110
range = "all";
111
- which = 1;
111
+ branchListFlags = BRL_BOTH;
112112
break;
113113
default:
114114
range = "open";
115
- which = 0;
115
+ branchListFlags = BRL_OPEN_ONLY;
116116
break;
117117
};
118118
cson_object_set(pay,"range",json_new_string(range));
119119
120120
if( g.localOpen ){ /* add "current" property (branch name). */
@@ -128,11 +128,11 @@
128128
cson_object_set(pay,"current",json_new_string(zCurrent));
129129
}
130130
}
131131
132132
133
- branch_prepare_list_query(&q, which);
133
+ branch_prepare_list_query(&q, branchListFlags);
134134
cson_object_set(pay,"branches",listV);
135135
while((SQLITE_ROW==db_step(&q))){
136136
cson_value * v = cson_sqlite3_column_to_value(q.pStmt,0);
137137
if(v){
138138
cson_array_append(list,v);
139139
--- src/json_branch.c
+++ src/json_branch.c
@@ -66,11 +66,11 @@
66 cson_value * payV;
67 cson_object * pay;
68 cson_value * listV;
69 cson_array * list;
70 char const * range = NULL;
71 int which = 0;
72 char * sawConversionError = NULL;
73 Stmt q;
74 if( !g.perm.Read ){
75 json_set_err(FSL_JSON_E_DENIED,
76 "Requires 'o' permissions.");
@@ -102,19 +102,19 @@
102 }
103 /* Normalize range values... */
104 switch(*range){
105 case 'c':
106 range = "closed";
107 which = -1;
108 break;
109 case 'a':
110 range = "all";
111 which = 1;
112 break;
113 default:
114 range = "open";
115 which = 0;
116 break;
117 };
118 cson_object_set(pay,"range",json_new_string(range));
119
120 if( g.localOpen ){ /* add "current" property (branch name). */
@@ -128,11 +128,11 @@
128 cson_object_set(pay,"current",json_new_string(zCurrent));
129 }
130 }
131
132
133 branch_prepare_list_query(&q, which);
134 cson_object_set(pay,"branches",listV);
135 while((SQLITE_ROW==db_step(&q))){
136 cson_value * v = cson_sqlite3_column_to_value(q.pStmt,0);
137 if(v){
138 cson_array_append(list,v);
139
--- src/json_branch.c
+++ src/json_branch.c
@@ -66,11 +66,11 @@
66 cson_value * payV;
67 cson_object * pay;
68 cson_value * listV;
69 cson_array * list;
70 char const * range = NULL;
71 int branchListFlags = BPLQ_OPEN_ONLY;
72 char * sawConversionError = NULL;
73 Stmt q;
74 if( !g.perm.Read ){
75 json_set_err(FSL_JSON_E_DENIED,
76 "Requires 'o' permissions.");
@@ -102,19 +102,19 @@
102 }
103 /* Normalize range values... */
104 switch(*range){
105 case 'c':
106 range = "closed";
107 branchListFlags = BRL_CLOSED_ONLY;
108 break;
109 case 'a':
110 range = "all";
111 branchListFlags = BRL_BOTH;
112 break;
113 default:
114 range = "open";
115 branchListFlags = BRL_OPEN_ONLY;
116 break;
117 };
118 cson_object_set(pay,"range",json_new_string(range));
119
120 if( g.localOpen ){ /* add "current" property (branch name). */
@@ -128,11 +128,11 @@
128 cson_object_set(pay,"current",json_new_string(zCurrent));
129 }
130 }
131
132
133 branch_prepare_list_query(&q, branchListFlags);
134 cson_object_set(pay,"branches",listV);
135 while((SQLITE_ROW==db_step(&q))){
136 cson_value * v = cson_sqlite3_column_to_value(q.pStmt,0);
137 if(v){
138 cson_array_append(list,v);
139
--- src/style.c
+++ src/style.c
@@ -1269,10 +1269,19 @@
12691269
{ ".fileage td:nth-child(3)",
12701270
"fileage third column (the check-in comment)",
12711271
@ word-break: break-all;
12721272
@ word-wrap: break-word;
12731273
@ max-width: 50%;
1274
+ },
1275
+ { ".brlist table", "The list of branches",
1276
+ @ border-spacing: 0;
1277
+ },
1278
+ { ".brlist table th", "Branch list table headers",
1279
+ @ text-align: left;
1280
+ },
1281
+ { ".brlist table td", "Branch list table headers",
1282
+ @ padding: 0px 2em 0px 0px;
12741283
},
12751284
{ 0,
12761285
0,
12771286
0
12781287
}
12791288
--- src/style.c
+++ src/style.c
@@ -1269,10 +1269,19 @@
1269 { ".fileage td:nth-child(3)",
1270 "fileage third column (the check-in comment)",
1271 @ word-break: break-all;
1272 @ word-wrap: break-word;
1273 @ max-width: 50%;
 
 
 
 
 
 
 
 
 
1274 },
1275 { 0,
1276 0,
1277 0
1278 }
1279
--- src/style.c
+++ src/style.c
@@ -1269,10 +1269,19 @@
1269 { ".fileage td:nth-child(3)",
1270 "fileage third column (the check-in comment)",
1271 @ word-break: break-all;
1272 @ word-wrap: break-word;
1273 @ max-width: 50%;
1274 },
1275 { ".brlist table", "The list of branches",
1276 @ border-spacing: 0;
1277 },
1278 { ".brlist table th", "Branch list table headers",
1279 @ text-align: left;
1280 },
1281 { ".brlist table td", "Branch list table headers",
1282 @ padding: 0px 2em 0px 0px;
1283 },
1284 { 0,
1285 0,
1286 0
1287 }
1288

Keyboard Shortcuts

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