Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix the "Leaves" computation on the vinfo web page. Improvements to the vinfo web page. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
4ac16995e8d85ec769b3b5ad36118222 |
| User & Date: | drh 2007-08-19 11:06:53.000 |
Context
|
2007-08-23
| ||
| 19:52 | Add separate "clone" permissions. Previously, one needed "History" premission in order to clone. But sometimes we want to grant clone without granting history. ... (check-in: 22c1ac41d4 user: drh tags: trunk) | |
|
2007-08-19
| ||
| 11:06 | Fix the "Leaves" computation on the vinfo web page. Improvements to the vinfo web page. ... (check-in: 4ac16995e8 user: drh tags: trunk) | |
|
2007-08-18
| ||
| 11:42 | Added options to the "timeline" CLI command. Additional help comments. ... (check-in: 6607844a01 user: drh tags: trunk) | |
Changes
Changes to src/info.c.
| ︙ | ︙ | |||
107 108 109 110 111 112 113 | } } /* ** Show information about descendents of a version. Do this recursively ** to a depth of N. Return true if descendents are shown and false if not. */ | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
}
}
/*
** Show information about descendents of a version. Do this recursively
** to a depth of N. Return true if descendents are shown and false if not.
*/
static int showDescendents(int pid, int depth, const char *zTitle){
Stmt q;
int cnt = 0;
db_prepare(&q,
"SELECT plink.cid, blob.uuid, datetime(plink.mtime, 'localtime'),"
" event.user, event.comment"
" FROM plink, blob, event"
" WHERE plink.pid=%d"
|
| ︙ | ︙ | |||
129 130 131 132 133 134 135 136 137 138 139 140 141 |
int cid = db_column_int(&q, 0);
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
const char *zCom = db_column_text(&q, 4);
cnt++;
if( cnt==1 ){
@ <ul>
}
@ <li>
hyperlink_to_uuid(zUuid);
@ %s(zCom) (by %s(zUser) on %s(zDate))
if( depth ){
| > > > | > | < > > > > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > < | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
int cid = db_column_int(&q, 0);
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
const char *zCom = db_column_text(&q, 4);
cnt++;
if( cnt==1 ){
if( zTitle ){
@ <h2>%s(zTitle)</h2>
}
@ <ul>
}
@ <li>
hyperlink_to_uuid(zUuid);
@ %s(zCom) (by %s(zUser) on %s(zDate))
if( depth ){
n = showDescendents(cid, depth-1, 0);
}else{
n = db_int(0, "SELECT 1 FROM plink WHERE pid=%d", cid);
}
if( n==0 ){
db_multi_exec("DELETE FROM leaves WHERE rid=%d", cid);
@ <b>leaf</b>
}
}
if( cnt ){
@ </ul>
}
return cnt;
}
/*
** Show information about ancestors of a version. Do this recursively
** to a depth of N. Return true if ancestors are shown and false if not.
*/
static void showAncestors(int pid, int depth, const char *zTitle){
Stmt q;
int cnt = 0;
db_prepare(&q,
"SELECT plink.pid, blob.uuid, datetime(event.mtime, 'localtime'),"
" event.user, event.comment"
" FROM plink, blob, event"
" WHERE plink.cid=%d"
" AND blob.rid=plink.pid"
" AND event.objid=plink.pid"
" ORDER BY event.mtime DESC",
pid
);
while( db_step(&q)==SQLITE_ROW ){
int cid = db_column_int(&q, 0);
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
const char *zCom = db_column_text(&q, 4);
cnt++;
if( cnt==1 ){
if( zTitle ){
@ <h2>%s(zTitle)</h2>
}
@ <ul>
}
@ <li>
hyperlink_to_uuid(zUuid);
@ %s(zCom) (by %s(zUser) on %s(zDate))
if( depth ){
showAncestors(cid, depth-1, 0);
}
}
if( cnt ){
@ </ul>
}
}
/*
** Show information about versions mentioned in the "leaves" table.
*/
static void showLeaves(void){
Stmt q;
int cnt = 0;
db_prepare(&q,
"SELECT blob.uuid, datetime(event.mtime, 'localtime'),"
" event.user, event.comment"
" FROM leaves, plink, blob, event"
" WHERE plink.cid=leaves.rid"
" AND blob.rid=leaves.rid"
" AND event.objid=leaves.rid"
" AND +generation>0"
" ORDER BY event.mtime DESC"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
const char *zDate = db_column_text(&q, 1);
const char *zUser = db_column_text(&q, 2);
const char *zCom = db_column_text(&q, 3);
cnt++;
if( cnt==1 ){
@ <h2>Leaves</h2>
@ <ul>
}
@ <li>
hyperlink_to_uuid(zUuid);
@ %s(zCom) (by %s(zUser) on %s(zDate))
}
if( cnt ){
@ </ul>
}
}
/*
** WEBPAGE: vinfo
**
** Return information about a version. The version number is contained
** in g.zExtra.
*/
void vinfo_page(void){
Stmt q;
int rid;
int isLeaf;
login_check_credentials();
if( !g.okHistory ){ login_needed(); return; }
style_header("Version Information");
rid = name_to_rid(g.zExtra);
if( rid==0 ){
@ No such object: %h(g.argv[2])
|
| ︙ | ︙ | |||
223 224 225 226 227 228 229 230 231 232 |
@ <h2>Version %s(zUuid)</h2>
@ <ul>
@ <li><b>Date:</b> %s(db_column_text(&q, 1))</li>
@ <li><b>User:</b> %s(db_column_text(&q, 2))</li>
@ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li>
@ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li>
@ <li><a href="%s(g.zBaseURL)/zip/%s(zUuid).zip">ZIP archive</a></li>
@ </ul>
}
db_finalize(&q);
| > > > > < < < < < < < < < < | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
@ <h2>Version %s(zUuid)</h2>
@ <ul>
@ <li><b>Date:</b> %s(db_column_text(&q, 1))</li>
@ <li><b>User:</b> %s(db_column_text(&q, 2))</li>
@ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li>
@ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li>
@ <li><a href="%s(g.zBaseURL)/zip/%s(zUuid).zip">ZIP archive</a></li>
@ <li><a href="%s(g.zBaseURL)/fview/%d(rid)">manifest</a></li>
if( g.okSetup ){
@ <li><b>Record ID:</b> %d(rid)</li>
}
@ </ul>
}
db_finalize(&q);
@ <p><h2>Changes:</h2>
@ <ul>
db_prepare(&q,
"SELECT name, pid, fid"
" FROM mlink, filename"
" WHERE mid=%d"
" AND filename.fnid=mlink.fnid",
|
| ︙ | ︙ | |||
260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
@ <b>Added:</b>
}else{
@ <b>Deleted:</b>
}
@ <a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a></li>
}
@ </ul>
style_footer();
}
/*
** WEBPAGE: finfo
**
** Show the complete change history for a single file. The name
| > > > > | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
@ <b>Added:</b>
}else{
@ <b>Deleted:</b>
}
@ <a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a></li>
}
@ </ul>
compute_leaves(rid);
showDescendents(rid, 2, "Descendents");
showLeaves();
showAncestors(rid, 2, "Ancestors");
style_footer();
}
/*
** WEBPAGE: finfo
**
** Show the complete change history for a single file. The name
|
| ︙ | ︙ |