Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Enhance the /finfo webpage so that when it is showing the ancestors of a particular check-in, it only shows direct ancestors, the same as the /annotate and /blame pages. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f8db2c7489ad5babd360d3d6721b3cd9 |
User & Date: | drh 2015-12-13 02:11:20 |
Context
2015-12-13
| ||
02:55 | Add the /doc/trunk/www/blame.wiki document briefly describing the algorithm used to compute "blame" in Fossil. ... (check-in: 91af24e6 user: drh tags: trunk) | |
02:11 | Enhance the /finfo webpage so that when it is showing the ancestors of a particular check-in, it only shows direct ancestors, the same as the /annotate and /blame pages. ... (check-in: f8db2c74 user: drh tags: trunk) | |
01:37 | Fix typo on the TH1 extension commands page. Also, for now, remove the 'todo' section. ... (check-in: dfa8efc5 user: mistachkin tags: trunk) | |
Changes
Changes to src/finfo.c.
︙ | ︙ | |||
297 298 299 300 301 302 303 | const char *zFilename; char zPrevDate[20]; const char *zA; const char *zB; int n; int baseCheckin; int fnid; | < > < < | < < < | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | const char *zFilename; char zPrevDate[20]; const char *zA; const char *zB; int n; int baseCheckin; int fnid; Blob title; Blob sql; HQuery url; GraphContext *pGraph; int brBg = P("brbg")!=0; int uBg = P("ubg")!=0; int fDebug = atoi(PD("debug","0")); int fShowId = P("showid")!=0; Stmt qparent; login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } style_header("File History"); login_anonymous_available(); url_initialize(&url, "finfo"); if( brBg ) url_add_parameter(&url, "brbg", 0); if( uBg ) url_add_parameter(&url, "ubg", 0); baseCheckin = name_to_rid_www("ci"); zPrevDate[0] = 0; zFilename = PD("name",""); fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); if( fnid==0 ){ @ No such file: %h(zFilename) style_footer(); return; } if( baseCheckin ){ compute_direct_ancestors(baseCheckin); } url_add_parameter(&url, "name", zFilename); blob_zero(&sql); blob_append_sql(&sql, "SELECT" " datetime(min(event.mtime)%s)," /* Date of change */ " coalesce(event.ecomment, event.comment)," /* Check-in comment */ |
︙ | ︙ | |||
361 362 363 364 365 366 367 | blob_append_sql(&sql, " AND event.mtime>=julianday('%q')", zA); url_add_parameter(&url, "a", zA); } if( (zB = P("b"))!=0 ){ blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zB); url_add_parameter(&url, "b", zB); } | > > > > > > | | | | | | | | | | | < | > > > > > | > | > > > > > > > > > > > > > > < < < < < < < < | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | blob_append_sql(&sql, " AND event.mtime>=julianday('%q')", zA); url_add_parameter(&url, "a", zA); } if( (zB = P("b"))!=0 ){ blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zB); url_add_parameter(&url, "b", zB); } if( baseCheckin ){ blob_append_sql(&sql, " AND mlink.mid IN (SELECT rid FROM ancestor)" " GROUP BY mlink.fid" ); }else{ /* We only want each version of a file to appear on the graph once, ** at its earliest appearance. All the other times that it gets merged ** into this or that branch can be ignored. An exception is for when ** files are deleted (when they have mlink.fid==0). If the same file ** is deleted in multiple places, we want to show each deletion, so ** use a "fake fid" which is derived from the parent-fid for grouping. ** The same fake-fid must be used on the graph. */ blob_append_sql(&sql, " GROUP BY" " CASE WHEN mlink.fid>0 THEN mlink.fid ELSE mlink.pid+1000000000 END" ); } blob_append_sql(&sql, " ORDER BY event.mtime DESC /*sort*/"); if( (n = atoi(PD("n","0")))>0 ){ blob_append_sql(&sql, " LIMIT %d", n); url_add_parameter(&url, "n", P("n")); } db_prepare(&q, "%s", blob_sql_text(&sql)); if( P("showsql")!=0 ){ @ <p>SQL: %h(blob_str(&sql))</p> } blob_reset(&sql); blob_zero(&title); if( baseCheckin ){ char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", baseCheckin); char *zLink = href("%R/info/%!S", zUuid); if( n>0 ){ blob_appendf(&title, "First %d ancestors of file ", n); }else{ blob_appendf(&title, "Ancestors of file "); } blob_appendf(&title,"<a href='%R/finfo?name=%T'>%h</a>", zFilename, zFilename); if( fShowId ) blob_appendf(&title, " (%d)", fnid); blob_appendf(&title, " from check-in %z%S</a>", zLink, zUuid); if( fShowId ) blob_appendf(&title, " (%d)", baseCheckin); fossil_free(zUuid); }else{ blob_appendf(&title, "History of files named "); hyperlinked_path(zFilename, &title, 0, "tree", ""); if( fShowId ) blob_appendf(&title, " (%d)", fnid); } @ <h2>%b(&title)</h2> blob_reset(&title); pGraph = graph_init(); @ <table id="timelineTable" class="timelineTable"> if( baseCheckin ){ db_prepare(&qparent, "SELECT DISTINCT pid FROM mlink" " WHERE fid=:fid AND mid=:mid AND pid>0 AND fnid=:fnid" " AND pmid IN (SELECT rid FROM ancestor)" " ORDER BY isaux /*sort*/" ); }else{ db_prepare(&qparent, "SELECT DISTINCT pid FROM mlink" " WHERE fid=:fid AND mid=:mid AND pid>0 AND fnid=:fnid" " ORDER BY isaux /*sort*/" ); } while( db_step(&q)==SQLITE_ROW ){ const char *zDate = db_column_text(&q, 0); const char *zCom = db_column_text(&q, 1); const char *zUser = db_column_text(&q, 2); int fpid = db_column_int(&q, 3); int frid = db_column_int(&q, 4); const char *zPUuid = db_column_text(&q, 5); const char *zUuid = db_column_text(&q, 6); const char *zCkin = db_column_text(&q,7); const char *zBgClr = db_column_text(&q, 8); const char *zBr = db_column_text(&q, 9); int fmid = db_column_int(&q, 10); int pfnid = db_column_int(&q, 11); int gidx; char zTime[10]; int nParent = 0; int aParent[GR_MAX_RAIL]; db_bind_int(&qparent, ":fid", frid); db_bind_int(&qparent, ":mid", fmid); db_bind_int(&qparent, ":fnid", fnid); while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){ aParent[nParent] = db_column_int(&qparent, 0); nParent++; } db_reset(&qparent); if( zBr==0 ) zBr = "trunk"; if( uBg ){ zBgClr = hash_color(zUser); }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
︙ | ︙ | |||
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | zAncLink = href("%R/finfo?name=%T&ci=%!S&debug=1",zFilename,zCkin); @ %z(zAncLink)[ancestry]</a> } tag_private_status(frid); @ </td></tr> } db_finalize(&q); if( pGraph ){ graph_finish(pGraph, 1); if( pGraph->nErr ){ graph_free(pGraph); pGraph = 0; }else{ @ <tr class="timelineBottom"><td></td><td></td><td></td></tr> } } @ </table> timeline_output_graph_javascript(pGraph, 0, 1); style_footer(); } | > | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | zAncLink = href("%R/finfo?name=%T&ci=%!S&debug=1",zFilename,zCkin); @ %z(zAncLink)[ancestry]</a> } tag_private_status(frid); @ </td></tr> } db_finalize(&q); db_finalize(&qparent); if( pGraph ){ graph_finish(pGraph, 1); if( pGraph->nErr ){ graph_free(pGraph); pGraph = 0; }else{ @ <tr class="timelineBottom"><td></td><td></td><td></td></tr> } } @ </table> timeline_output_graph_javascript(pGraph, 0, 1); style_footer(); } |