Overview
SHA1 Hash: | afcdc7ec979a27421ed8d03760eb7740fa11ba5c |
---|---|
Date: | 2007-08-01 12:49:41 |
User: | drh |
Comment: | Add the "leaves" webpage and the "branches" CLI command. We need to work on the nomenclature. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/descendents.c from [ba7454a9cf] to [ccfb04b45c].
@@ -65,11 +65,12 @@ } /* ** COMMAND: leaves ** -** Find all leaf versions +** Find all leaf descendents of the current version or of the +** specified version. */ void leaves_cmd(void){ Stmt q; int base; @@ -88,6 +89,60 @@ " AND event.objid=leaves.rid" " ORDER BY event.mtime DESC" ); print_timeline(&q, 20); db_finalize(&q); +} + +/* +** COMMAND: branches +** +** Find leaves of all branches. +*/ +void branches_cmd(void){ + Stmt q; + int base; + + db_must_be_within_tree(); + if( g.argc==2 ){ + base = db_lget_int("checkout", 0); + }else{ + base = name_to_rid(g.argv[2]); + } + if( base==0 ) return; + db_prepare(&q, + "SELECT blob.uuid, datetime(event.mtime,'localtime'), event.comment" + " FROM blob, event" + " WHERE blob.rid IN" + " (SELECT cid FROM plink EXCEPT SELECT pid FROM plink)" + " AND event.objid=blob.rid" + " ORDER BY event.mtime DESC" + ); + print_timeline(&q, 20); + db_finalize(&q); +} + +/* +** WEBPAGE: leaves +** +** Find leaves of all branches. +*/ +void branches_page(void){ + Stmt q; + + login_check_credentials(); + if( !g.okRead ){ login_needed(); return; } + + style_header("Leaves"); + db_prepare(&q, + "SELECT blob.uuid, datetime(event.mtime,'localtime')," + " event.comment, event.user" + " FROM blob, event" + " WHERE blob.rid IN" + " (SELECT cid FROM plink EXCEPT SELECT pid FROM plink)" + " AND event.objid=blob.rid" + " ORDER BY event.mtime DESC" + ); + www_print_timeline(&q); + db_finalize(&q); + style_footer(); }
Modified src/style.c from [9a943b5a17] to [7dcde67735].
@@ -85,10 +85,11 @@ @ <small>logged in as %h(g.zLogin)</small> } @ </td><td valign="top" align="right"> @ <a href="%s(g.zBaseURL)/index">Home</a> if( g.okRead ){ + @ | <a href="%s(g.zBaseURL)/leaves">Leaves</a> @ | <a href="%s(g.zBaseURL)/timeline">Timeline</a> } if( g.okRdWiki ){ @ | <a href="%s(g.zBaseURL)/wiki">Wiki</a> }
Modified src/timeline.c from [ccb6f43a3a] to [346b9fb48c].
@@ -51,34 +51,25 @@ @ <a href="%s(g.zBaseURL)/diff?v1=%s(zV1)&v2=%s(zV2)">[diff]</a> } } } - /* -** WEBPAGE: timeline +** Output a timeline in the web format given a query. The query +** should return 4 columns: +** +** 0. UUID +** 1. Date/Time +** 2. Comment string +** 3. User */ -void page_timeline(void){ - Stmt q; - char zPrevDate[20]; - - /* To view the timeline, must have permission to read project data. - */ - login_check_credentials(); - if( !g.okRead ){ login_needed(); return; } - - style_header("Timeline"); +void www_print_timeline(Stmt *pQuery){ + char zPrevDate[20]; zPrevDate[0] = 0; - db_prepare(&q, - "SELECT uuid, datetime(event.mtime,'localtime'), comment, user" - " FROM event, blob" - " WHERE event.type='ci' AND blob.rid=event.objid" - " ORDER BY event.mtime DESC" - ); @ <table cellspacing=0 border=0 cellpadding=0> - while( db_step(&q)==SQLITE_ROW ){ - const char *zDate = db_column_text(&q, 1); + while( db_step(pQuery)==SQLITE_ROW ){ + const char *zDate = db_column_text(pQuery, 1); if( memcmp(zDate, zPrevDate, 10) ){ sprintf(zPrevDate, "%.10s", zDate); @ <tr><td colspan=3> @ <table cellpadding=2 border=0> @ <tr><td bgcolor="#a0b5f4" class="border1"> @@ -89,15 +80,38 @@ @ </td></tr> } @ <tr><td valign="top">%s(&zDate[11])</td> @ <td width="20"></td> @ <td valign="top" align="left"> - hyperlink_to_uuid(db_column_text(&q,0)); - @ %h(db_column_text(&q,2)) (by %h(db_column_text(&q,3)))</td> + hyperlink_to_uuid(db_column_text(pQuery,0)); + @ %h(db_column_text(pQuery,2)) (by %h(db_column_text(pQuery,3)))</td> } - db_finalize(&q); @ </table> +} + + + +/* +** WEBPAGE: timeline +*/ +void page_timeline(void){ + Stmt q; + + /* To view the timeline, must have permission to read project data. + */ + login_check_credentials(); + if( !g.okRead ){ login_needed(); return; } + + style_header("Timeline"); + db_prepare(&q, + "SELECT uuid, datetime(event.mtime,'localtime'), comment, user" + " FROM event, blob" + " WHERE event.type='ci' AND blob.rid=event.objid" + " ORDER BY event.mtime DESC" + ); + www_print_timeline(&q); + db_finalize(&q); style_footer(); } /* ** The input query q selects various records. Print a human-readable ** summary of those records.