Fossil SCM
Fix the /finfo page to do a better job of showing later deletions of files that are deleted more than once.
Commit
bf8e4377a9cab88a2c3918f2a4207ef141b5be8d
Parent
7478f9974c6320e…
1 file changed
+12
-2
+12
-2
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -358,12 +358,21 @@ | ||
| 358 | 358 | } |
| 359 | 359 | if( (zB = P("b"))!=0 ){ |
| 360 | 360 | blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zB); |
| 361 | 361 | url_add_parameter(&url, "b", zB); |
| 362 | 362 | } |
| 363 | + /* We only want each version of a file to appear on the graph once, | |
| 364 | + ** at its earliest appearance. All the other times that it gets merged | |
| 365 | + ** into this or that branch can be ignored. An exception is for when | |
| 366 | + ** files are deleted (when they have mlink.fid==0). If the same file | |
| 367 | + ** is deleted in multiple places, we want to show each deletion, so | |
| 368 | + ** use a "fake fid" which is derived from the parent-fid for grouping. | |
| 369 | + ** The same fake-fid must be used on the graph. | |
| 370 | + */ | |
| 363 | 371 | blob_append_sql(&sql, |
| 364 | - " GROUP BY mlink.fid" | |
| 372 | + " GROUP BY" | |
| 373 | + " CASE WHEN mlink.fid>0 THEN mlink.fid ELSE mlink.pid+1000000000 END" | |
| 365 | 374 | " ORDER BY event.mtime DESC /*sort*/" |
| 366 | 375 | ); |
| 367 | 376 | if( (n = atoi(PD("n","0")))>0 ){ |
| 368 | 377 | blob_append_sql(&sql, " LIMIT %d", n); |
| 369 | 378 | url_add_parameter(&url, "n", P("n")); |
| @@ -432,11 +441,12 @@ | ||
| 432 | 441 | if( uBg ){ |
| 433 | 442 | zBgClr = hash_color(zUser); |
| 434 | 443 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 435 | 444 | zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); |
| 436 | 445 | } |
| 437 | - gidx = graph_add_row(pGraph, frid, nParent, aParent, zBr, zBgClr, | |
| 446 | + gidx = graph_add_row(pGraph, frid>0 ? frid : fpid+1000000000, | |
| 447 | + nParent, aParent, zBr, zBgClr, | |
| 438 | 448 | zUuid, 0); |
| 439 | 449 | if( strncmp(zDate, zPrevDate, 10) ){ |
| 440 | 450 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 441 | 451 | @ <tr><td> |
| 442 | 452 | @ <div class="divider">%s(zPrevDate)</div> |
| 443 | 453 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -358,12 +358,21 @@ | |
| 358 | } |
| 359 | if( (zB = P("b"))!=0 ){ |
| 360 | blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zB); |
| 361 | url_add_parameter(&url, "b", zB); |
| 362 | } |
| 363 | blob_append_sql(&sql, |
| 364 | " GROUP BY mlink.fid" |
| 365 | " ORDER BY event.mtime DESC /*sort*/" |
| 366 | ); |
| 367 | if( (n = atoi(PD("n","0")))>0 ){ |
| 368 | blob_append_sql(&sql, " LIMIT %d", n); |
| 369 | url_add_parameter(&url, "n", P("n")); |
| @@ -432,11 +441,12 @@ | |
| 432 | if( uBg ){ |
| 433 | zBgClr = hash_color(zUser); |
| 434 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 435 | zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); |
| 436 | } |
| 437 | gidx = graph_add_row(pGraph, frid, nParent, aParent, zBr, zBgClr, |
| 438 | zUuid, 0); |
| 439 | if( strncmp(zDate, zPrevDate, 10) ){ |
| 440 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 441 | @ <tr><td> |
| 442 | @ <div class="divider">%s(zPrevDate)</div> |
| 443 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -358,12 +358,21 @@ | |
| 358 | } |
| 359 | if( (zB = P("b"))!=0 ){ |
| 360 | blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zB); |
| 361 | url_add_parameter(&url, "b", zB); |
| 362 | } |
| 363 | /* We only want each version of a file to appear on the graph once, |
| 364 | ** at its earliest appearance. All the other times that it gets merged |
| 365 | ** into this or that branch can be ignored. An exception is for when |
| 366 | ** files are deleted (when they have mlink.fid==0). If the same file |
| 367 | ** is deleted in multiple places, we want to show each deletion, so |
| 368 | ** use a "fake fid" which is derived from the parent-fid for grouping. |
| 369 | ** The same fake-fid must be used on the graph. |
| 370 | */ |
| 371 | blob_append_sql(&sql, |
| 372 | " GROUP BY" |
| 373 | " CASE WHEN mlink.fid>0 THEN mlink.fid ELSE mlink.pid+1000000000 END" |
| 374 | " ORDER BY event.mtime DESC /*sort*/" |
| 375 | ); |
| 376 | if( (n = atoi(PD("n","0")))>0 ){ |
| 377 | blob_append_sql(&sql, " LIMIT %d", n); |
| 378 | url_add_parameter(&url, "n", P("n")); |
| @@ -432,11 +441,12 @@ | |
| 441 | if( uBg ){ |
| 442 | zBgClr = hash_color(zUser); |
| 443 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 444 | zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); |
| 445 | } |
| 446 | gidx = graph_add_row(pGraph, frid>0 ? frid : fpid+1000000000, |
| 447 | nParent, aParent, zBr, zBgClr, |
| 448 | zUuid, 0); |
| 449 | if( strncmp(zDate, zPrevDate, 10) ){ |
| 450 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 451 | @ <tr><td> |
| 452 | @ <div class="divider">%s(zPrevDate)</div> |
| 453 |