Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | On the /finfo page, change the check-in range query parameters from ci= and orig= into from= and to=. This gets the ci= query parameter out of the way so that it can be reused. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
299800b29d85e71e177be140af568419 |
| User & Date: | drh 2020-10-17 12:34:35.622 |
Context
|
2020-10-17
| ||
| 14:57 | Enhancements to the /finfo page so that it follows the file across name changes if the ci=HASH query parameter is used. check-in: b54d9396f9 user: drh tags: trunk | |
| 12:34 | On the /finfo page, change the check-in range query parameters from ci= and orig= into from= and to=. This gets the ci= query parameter out of the way so that it can be reused. check-in: 299800b29d user: drh tags: trunk | |
|
2020-10-15
| ||
| 14:59 | Expand the allowed date/time format for the "a=" and "b=" query parameters to the /finfo page, so that it is compatible with /timeline. check-in: 04ef2df613 user: drh tags: trunk | |
Changes
Changes to src/diff.c.
| ︙ | ︙ | |||
2481 2482 2483 2484 2485 2486 2487 |
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
clr = gradient_color(clr1, clr2, ann.nVers-1, i);
ann.aVers[i].zBgColor = mprintf("#%06x", clr);
}
@ <div id="annotation_log" style='display:%s(showLog?"block":"none");'>
if( zOrigin ){
| | | | | | | 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 |
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
clr = gradient_color(clr1, clr2, ann.nVers-1, i);
ann.aVers[i].zBgColor = mprintf("#%06x", clr);
}
@ <div id="annotation_log" style='display:%s(showLog?"block":"none");'>
if( zOrigin ){
zLink = href("%R/finfo?name=%t&from=%!S&to=%!S",zFilename,zCI,zOrigin);
}else{
zLink = href("%R/finfo?name=%t&from=%!S",zFilename,zCI);
}
@ <h2>Versions of %z(zLink)%h(zFilename)</a> analyzed:</h2>
@ <ol>
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
@ <li><span style='background-color:%s(p->zBgColor);'>%s(p->zDate)
@ check-in %z(href("%R/info/%!S",p->zMUuid))%S(p->zMUuid)</a>
@ artifact %z(href("%R/artifact/%!S",p->zFUuid))%S(p->zFUuid)</a>
@ </span>
}
@ </ol>
@ <hr />
@ </div>
if( !ann.bMoreToDo ){
assert( ann.origId==0 ); /* bMoreToDo always set for a point-to-point */
@ <h2>Origin for each line in
@ %z(href("%R/finfo?name=%h&from=%!S", zFilename, zCI))%h(zFilename)</a>
@ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>:</h2>
}else if( ann.origId>0 ){
@ <h2>Lines of
@ %z(href("%R/finfo?name=%h&from=%!S", zFilename, zCI))%h(zFilename)</a>
@ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>
@ that are changed by the sequence of edits moving toward
@ check-in %z(href("%R/info/%!S",zOrigin))%S(zOrigin)</a>:</h2>
}else{
@ <h2>Lines added by the %d(ann.nVers) most recent ancestors of
@ %z(href("%R/finfo?name=%h&from=%!S", zFilename, zCI))%h(zFilename)</a>
@ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>:</h2>
}
@ <pre>
szHash = 10;
for(i=0; i<ann.nOrig; i++){
int iVers = ann.aOrig[i].iVers;
char *z = (char*)ann.aOrig[i].z;
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
275 276 277 278 279 280 281 | ** WEBPAGE: finfo ** URL: /finfo?name=FILENAME ** ** Show the change history for a single file. ** ** Additional query parameters: ** | | | | | > | | | | | | | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
** WEBPAGE: finfo
** URL: /finfo?name=FILENAME
**
** Show the change history for a single file.
**
** Additional query parameters:
**
** a=DATETIME Only show changes after DATETIME
** b=DATETIME Only show changes before DATETIME
** m=HASH Mark this particular file version
** n=NUM Show the first NUM changes only
** name=FILENAME (Required) name of file whose history to show
** brbg Background color by branch name
** ubg Background color by user name
** from=HASH Ancestors of a particular check-in
** to=HASH If both from= and to= are supplied, only show those
** changes on the direct path between them.
** showid Show RID values for debugging
**
** DATETIME may be in any of usual formats, including "now",
** "YYYY-MM-DDTHH:MM:SS.SSS", "YYYYMMDDHHMM", and others.
*/
void finfo_page(void){
Stmt q;
const char *zFilename = PD("name","");
char zPrevDate[20];
const char *zA;
const char *zB;
int n;
int ridFrom;
int ridTo = 0;
int fnid;
Blob title;
Blob sql;
HQuery url;
GraphContext *pGraph;
int brBg = P("brbg")!=0;
int uBg = P("ubg")!=0;
|
| ︙ | ︙ | |||
338 339 340 341 342 343 344 |
zStyle = "Classic";
}else{
zStyle = "Modern";
}
url_initialize(&url, "finfo");
if( brBg ) url_add_parameter(&url, "brbg", 0);
if( uBg ) url_add_parameter(&url, "ubg", 0);
| | | | | | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
zStyle = "Classic";
}else{
zStyle = "Modern";
}
url_initialize(&url, "finfo");
if( brBg ) url_add_parameter(&url, "brbg", 0);
if( uBg ) url_add_parameter(&url, "ubg", 0);
ridFrom = name_to_rid_www("from");
zPrevDate[0] = 0;
cookie_render();
if( fnid==0 ){
@ No such file: %h(zFilename)
style_footer();
return;
}
if( g.perm.Admin ){
style_submenu_element("MLink Table", "%R/mlink?name=%t", zFilename);
}
if( ridFrom ){
if( P("to")!=0 ){
ridTo = name_to_typed_rid(P("to"),"ci");
path_shortest_stored_in_ancestor_table(ridFrom,ridTo);
}else{
compute_direct_ancestors(ridFrom);
}
}
url_add_parameter(&url, "name", zFilename);
blob_zero(&sql);
blob_append_sql(&sql,
"SELECT"
" datetime(min(event.mtime),toLocal())," /* Date of change */
|
| ︙ | ︙ | |||
391 392 393 394 395 396 397 |
url_add_parameter(&url, "a", zA);
}
if( (zB = P("b"))!=0 ){
blob_append_sql(&sql, " AND event.mtime<=%.16g",
symbolic_name_to_mtime(zB,0));
url_add_parameter(&url, "b", zB);
}
| | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
url_add_parameter(&url, "a", zA);
}
if( (zB = P("b"))!=0 ){
blob_append_sql(&sql, " AND event.mtime<=%.16g",
symbolic_name_to_mtime(zB,0));
url_add_parameter(&url, "b", zB);
}
if( ridFrom ){
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
|
| ︙ | ︙ | |||
425 426 427 428 429 430 431 |
}
zMark = P("m");
if( zMark ){
selRid = symbolic_name_to_rid(zMark, "*");
}
blob_reset(&sql);
blob_zero(&title);
| | | | | | | | | | 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 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
}
zMark = P("m");
if( zMark ){
selRid = symbolic_name_to_rid(zMark, "*");
}
blob_reset(&sql);
blob_zero(&title);
if( ridFrom ){
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ridFrom);
char *zLink = href("%R/info/%!S", zUuid);
if( ridTo ){
blob_appendf(&title, "Changes to file ");
}else if( n>0 ){
blob_appendf(&title, "First %d ancestors of file ", n);
}else{
blob_appendf(&title, "Ancestors of file ");
}
blob_appendf(&title,"%z%h</a>",
href("%R/file?name=%T&ci=%!S", zFilename, zUuid),
zFilename);
if( fShowId ) blob_appendf(&title, " (%d)", fnid);
blob_append(&title, ridTo ? " between " : " from ", -1);
blob_appendf(&title, "check-in %z%S</a>", zLink, zUuid);
if( fShowId ) blob_appendf(&title, " (%d)", ridFrom);
fossil_free(zUuid);
if( ridTo ){
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ridTo);
zLink = href("%R/info/%!S", zUuid);
blob_appendf(&title, " and check-in %z%S</a>", zLink, zUuid);
fossil_free(zUuid);
}
}else{
blob_appendf(&title, "History for ");
hyperlinked_path(zFilename, &title, 0, "tree", "", LINKPATH_FILE);
if( fShowId ) blob_appendf(&title, " (%d)", fnid);
}
if( uBg ){
blob_append(&title, " (color-coded by user)", -1);
}
@ <h2>%b(&title)</h2>
blob_reset(&title);
pGraph = graph_init();
@ <table id="timelineTable%d(iTableId)" class="timelineTable">
if( ridFrom ){
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{
|
| ︙ | ︙ | |||
585 586 587 588 589 590 591 |
hyperlink_to_user(zUser, zDate, ",");
@ branch: %z(href("%R/timeline?t=%T",zBr))%h(zBr)</a>,
if( tmFlags & (TIMELINE_COMPACT|TIMELINE_VERBOSE) ){
@ size: %d(szFile))
}else{
@ size: %d(szFile)
}
| | | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 |
hyperlink_to_user(zUser, zDate, ",");
@ branch: %z(href("%R/timeline?t=%T",zBr))%h(zBr)</a>,
if( tmFlags & (TIMELINE_COMPACT|TIMELINE_VERBOSE) ){
@ size: %d(szFile))
}else{
@ size: %d(szFile)
}
if( zUuid && ridTo==0 ){
if( nParent==0 ){
@ <b>Added</b>
}else if( pfnid ){
char *zPrevName = db_text(0,"SELECT name FROM filename WHERE fnid=%d",
pfnid);
@ <b>Renamed</b> from
@ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName)</a>
|
| ︙ | ︙ |