Fossil SCM
Added the vdiff webpage with links from vinfo.
Commit
9df32e280830decdb65206f9276b60bb81e14aed
Parent
86c8768475f6eb0…
1 file changed
+62
+62
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -220,10 +220,11 @@ | ||
| 220 | 220 | @ <h2>Version %s(db_column_text(&q,0))</h2> |
| 221 | 221 | @ <ul> |
| 222 | 222 | @ <li><b>Date:</b> %s(db_column_text(&q, 1))</li> |
| 223 | 223 | @ <li><b>User:</b> %s(db_column_text(&q, 2))</li> |
| 224 | 224 | @ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li> |
| 225 | + @ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li> | |
| 225 | 226 | @ </ul> |
| 226 | 227 | } |
| 227 | 228 | db_finalize(&q); |
| 228 | 229 | @ <p><h2>Descendents:</h2> |
| 229 | 230 | n = showDescendents(rid, 2); |
| @@ -310,10 +311,71 @@ | ||
| 310 | 311 | db_finalize(&q); |
| 311 | 312 | @ </table> |
| 312 | 313 | style_footer(); |
| 313 | 314 | } |
| 314 | 315 | |
| 316 | + | |
| 317 | +/* | |
| 318 | +** Append the difference between two RIDs to the output | |
| 319 | +*/ | |
| 320 | +static void append_diff(int fromid, int toid){ | |
| 321 | + Blob from, to, out; | |
| 322 | + content_get(fromid, &from); | |
| 323 | + content_get(toid, &to); | |
| 324 | + blob_zero(&out); | |
| 325 | + unified_diff(&from, &to, 5, &out); | |
| 326 | + @ %h(blob_str(&out)) | |
| 327 | + blob_reset(&from); | |
| 328 | + blob_reset(&to); | |
| 329 | + blob_reset(&out); | |
| 330 | +} | |
| 331 | + | |
| 332 | +/* | |
| 333 | +** WEBPAGE: vdiff | |
| 334 | +** | |
| 335 | +** Show all differences for a particular check-in specified by g.zExtra | |
| 336 | +*/ | |
| 337 | +void vdiff_page(void){ | |
| 338 | + int rid, i; | |
| 339 | + Stmt q; | |
| 340 | + Manifest m; | |
| 341 | + Blob mfile, file; | |
| 342 | + char *zUuid; | |
| 343 | + | |
| 344 | + login_check_credentials(); | |
| 345 | + if( !g.okHistory ){ login_needed(); return; } | |
| 346 | + style_header("Version Diff"); | |
| 347 | + | |
| 348 | + rid = name_to_rid(g.zExtra); | |
| 349 | + if( rid==0 ){ | |
| 350 | + cgi_redirect("index"); | |
| 351 | + } | |
| 352 | + db_prepare(&q, | |
| 353 | + "SELECT pid, fid, name" | |
| 354 | + " FROM mlink, filename" | |
| 355 | + " WHERE mlink.mid=%d" | |
| 356 | + " AND filename.fnid=mlink.fnid" | |
| 357 | + " ORDER BY name", | |
| 358 | + rid | |
| 359 | + ); | |
| 360 | + zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); | |
| 361 | + @ <h2>All Changes In Version | |
| 362 | + hyperlink_to_uuid(zUuid); | |
| 363 | + @ </h2> | |
| 364 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 365 | + int pid = db_column_int(&q,0); | |
| 366 | + int fid = db_column_int(&q,1); | |
| 367 | + const char *zName = db_column_text(&q,2); | |
| 368 | + @ <p><a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a></p> | |
| 369 | + @ <blockquote><pre> | |
| 370 | + append_diff(pid, fid); | |
| 371 | + @ </pre></blockquote> | |
| 372 | + } | |
| 373 | + db_finalize(&q); | |
| 374 | + style_footer(); | |
| 375 | +} | |
| 376 | + | |
| 315 | 377 | |
| 316 | 378 | |
| 317 | 379 | #if 0 |
| 318 | 380 | /* |
| 319 | 381 | ** WEB PAGE: diff |
| 320 | 382 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -220,10 +220,11 @@ | |
| 220 | @ <h2>Version %s(db_column_text(&q,0))</h2> |
| 221 | @ <ul> |
| 222 | @ <li><b>Date:</b> %s(db_column_text(&q, 1))</li> |
| 223 | @ <li><b>User:</b> %s(db_column_text(&q, 2))</li> |
| 224 | @ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li> |
| 225 | @ </ul> |
| 226 | } |
| 227 | db_finalize(&q); |
| 228 | @ <p><h2>Descendents:</h2> |
| 229 | n = showDescendents(rid, 2); |
| @@ -310,10 +311,71 @@ | |
| 310 | db_finalize(&q); |
| 311 | @ </table> |
| 312 | style_footer(); |
| 313 | } |
| 314 | |
| 315 | |
| 316 | |
| 317 | #if 0 |
| 318 | /* |
| 319 | ** WEB PAGE: diff |
| 320 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -220,10 +220,11 @@ | |
| 220 | @ <h2>Version %s(db_column_text(&q,0))</h2> |
| 221 | @ <ul> |
| 222 | @ <li><b>Date:</b> %s(db_column_text(&q, 1))</li> |
| 223 | @ <li><b>User:</b> %s(db_column_text(&q, 2))</li> |
| 224 | @ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li> |
| 225 | @ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li> |
| 226 | @ </ul> |
| 227 | } |
| 228 | db_finalize(&q); |
| 229 | @ <p><h2>Descendents:</h2> |
| 230 | n = showDescendents(rid, 2); |
| @@ -310,10 +311,71 @@ | |
| 311 | db_finalize(&q); |
| 312 | @ </table> |
| 313 | style_footer(); |
| 314 | } |
| 315 | |
| 316 | |
| 317 | /* |
| 318 | ** Append the difference between two RIDs to the output |
| 319 | */ |
| 320 | static void append_diff(int fromid, int toid){ |
| 321 | Blob from, to, out; |
| 322 | content_get(fromid, &from); |
| 323 | content_get(toid, &to); |
| 324 | blob_zero(&out); |
| 325 | unified_diff(&from, &to, 5, &out); |
| 326 | @ %h(blob_str(&out)) |
| 327 | blob_reset(&from); |
| 328 | blob_reset(&to); |
| 329 | blob_reset(&out); |
| 330 | } |
| 331 | |
| 332 | /* |
| 333 | ** WEBPAGE: vdiff |
| 334 | ** |
| 335 | ** Show all differences for a particular check-in specified by g.zExtra |
| 336 | */ |
| 337 | void vdiff_page(void){ |
| 338 | int rid, i; |
| 339 | Stmt q; |
| 340 | Manifest m; |
| 341 | Blob mfile, file; |
| 342 | char *zUuid; |
| 343 | |
| 344 | login_check_credentials(); |
| 345 | if( !g.okHistory ){ login_needed(); return; } |
| 346 | style_header("Version Diff"); |
| 347 | |
| 348 | rid = name_to_rid(g.zExtra); |
| 349 | if( rid==0 ){ |
| 350 | cgi_redirect("index"); |
| 351 | } |
| 352 | db_prepare(&q, |
| 353 | "SELECT pid, fid, name" |
| 354 | " FROM mlink, filename" |
| 355 | " WHERE mlink.mid=%d" |
| 356 | " AND filename.fnid=mlink.fnid" |
| 357 | " ORDER BY name", |
| 358 | rid |
| 359 | ); |
| 360 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 361 | @ <h2>All Changes In Version |
| 362 | hyperlink_to_uuid(zUuid); |
| 363 | @ </h2> |
| 364 | while( db_step(&q)==SQLITE_ROW ){ |
| 365 | int pid = db_column_int(&q,0); |
| 366 | int fid = db_column_int(&q,1); |
| 367 | const char *zName = db_column_text(&q,2); |
| 368 | @ <p><a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a></p> |
| 369 | @ <blockquote><pre> |
| 370 | append_diff(pid, fid); |
| 371 | @ </pre></blockquote> |
| 372 | } |
| 373 | db_finalize(&q); |
| 374 | style_footer(); |
| 375 | } |
| 376 | |
| 377 | |
| 378 | |
| 379 | #if 0 |
| 380 | /* |
| 381 | ** WEB PAGE: diff |
| 382 |