Fossil SCM
Enhance the /test-rename-list page to show only distinct rename operations by default, with an option to show them all with the all=1 query parameter.
Commit
98fe1d88f31916379a4ff6899b303d1130ea5db8d1deaa88dd2fbc6034a1a28c
Parent
58a6410206b2721…
1 file changed
+27
-3
+27
-3
| --- src/path.c | ||
| +++ src/path.c | ||
| @@ -561,10 +561,28 @@ | ||
| 561 | 561 | @ AND event.objid=mlink.mid |
| 562 | 562 | @ AND event.type='ci' |
| 563 | 563 | @ AND blob.rid=mlink.mid |
| 564 | 564 | @ ORDER BY 1 DESC, 2; |
| 565 | 565 | ; |
| 566 | + | |
| 567 | +/* Query to extract distinct rename operations */ | |
| 568 | +static const char zDistinctRenameQuery[] = | |
| 569 | +@ SELECT | |
| 570 | +@ min(datetime(event.mtime)), | |
| 571 | +@ F.name AS old_name, | |
| 572 | +@ T.name AS new_name, | |
| 573 | +@ blob.uuid | |
| 574 | +@ FROM mlink, filename F, filename T, event, blob | |
| 575 | +@ WHERE coalesce(mlink.pfnid,0)!=0 AND mlink.pfnid!=mlink.fnid | |
| 576 | +@ AND F.fnid=mlink.pfnid | |
| 577 | +@ AND T.fnid=mlink.fnid | |
| 578 | +@ AND event.objid=mlink.mid | |
| 579 | +@ AND event.type='ci' | |
| 580 | +@ AND blob.rid=mlink.mid | |
| 581 | +@ GROUP BY 2, 3 | |
| 582 | +@ ORDER BY 1 DESC, 2; | |
| 583 | +; | |
| 566 | 584 | |
| 567 | 585 | /* |
| 568 | 586 | ** WEBPAGE: test-rename-list |
| 569 | 587 | ** |
| 570 | 588 | ** Print a list of all file rename operations throughout history. |
| @@ -574,18 +592,24 @@ | ||
| 574 | 592 | void test_rename_list_page(void){ |
| 575 | 593 | Stmt q; |
| 576 | 594 | |
| 577 | 595 | login_check_credentials(); |
| 578 | 596 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 579 | - style_header("List Of File Name Changes"); | |
| 580 | - @ <h3>NB: Experimental Page</h3> | |
| 597 | + if( P("all")!=0 ){ | |
| 598 | + style_header("List Of All File Name Changes"); | |
| 599 | + db_prepare(&q, "%s", zRenameQuery/*safe-for-%s*/); | |
| 600 | + style_submenu_element("Distinct", "%R/test-rename-list"); | |
| 601 | + }else{ | |
| 602 | + style_header("List Of Distinct File Name Changes"); | |
| 603 | + db_prepare(&q, "%s", zDistinctRenameQuery/*safe-for-%s*/); | |
| 604 | + style_submenu_element("All", "%R/test-rename-list?all"); | |
| 605 | + } | |
| 581 | 606 | @ <table border="1" width="100%%"> |
| 582 | 607 | @ <tr><th>Date & Time</th> |
| 583 | 608 | @ <th>Old Name</th> |
| 584 | 609 | @ <th>New Name</th> |
| 585 | 610 | @ <th>Check-in</th></tr> |
| 586 | - db_prepare(&q, "%s", zRenameQuery/*safe-for-%s*/); | |
| 587 | 611 | while( db_step(&q)==SQLITE_ROW ){ |
| 588 | 612 | const char *zDate = db_column_text(&q, 0); |
| 589 | 613 | const char *zOld = db_column_text(&q, 1); |
| 590 | 614 | const char *zNew = db_column_text(&q, 2); |
| 591 | 615 | const char *zUuid = db_column_text(&q, 3); |
| 592 | 616 |
| --- src/path.c | |
| +++ src/path.c | |
| @@ -561,10 +561,28 @@ | |
| 561 | @ AND event.objid=mlink.mid |
| 562 | @ AND event.type='ci' |
| 563 | @ AND blob.rid=mlink.mid |
| 564 | @ ORDER BY 1 DESC, 2; |
| 565 | ; |
| 566 | |
| 567 | /* |
| 568 | ** WEBPAGE: test-rename-list |
| 569 | ** |
| 570 | ** Print a list of all file rename operations throughout history. |
| @@ -574,18 +592,24 @@ | |
| 574 | void test_rename_list_page(void){ |
| 575 | Stmt q; |
| 576 | |
| 577 | login_check_credentials(); |
| 578 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 579 | style_header("List Of File Name Changes"); |
| 580 | @ <h3>NB: Experimental Page</h3> |
| 581 | @ <table border="1" width="100%%"> |
| 582 | @ <tr><th>Date & Time</th> |
| 583 | @ <th>Old Name</th> |
| 584 | @ <th>New Name</th> |
| 585 | @ <th>Check-in</th></tr> |
| 586 | db_prepare(&q, "%s", zRenameQuery/*safe-for-%s*/); |
| 587 | while( db_step(&q)==SQLITE_ROW ){ |
| 588 | const char *zDate = db_column_text(&q, 0); |
| 589 | const char *zOld = db_column_text(&q, 1); |
| 590 | const char *zNew = db_column_text(&q, 2); |
| 591 | const char *zUuid = db_column_text(&q, 3); |
| 592 |
| --- src/path.c | |
| +++ src/path.c | |
| @@ -561,10 +561,28 @@ | |
| 561 | @ AND event.objid=mlink.mid |
| 562 | @ AND event.type='ci' |
| 563 | @ AND blob.rid=mlink.mid |
| 564 | @ ORDER BY 1 DESC, 2; |
| 565 | ; |
| 566 | |
| 567 | /* Query to extract distinct rename operations */ |
| 568 | static const char zDistinctRenameQuery[] = |
| 569 | @ SELECT |
| 570 | @ min(datetime(event.mtime)), |
| 571 | @ F.name AS old_name, |
| 572 | @ T.name AS new_name, |
| 573 | @ blob.uuid |
| 574 | @ FROM mlink, filename F, filename T, event, blob |
| 575 | @ WHERE coalesce(mlink.pfnid,0)!=0 AND mlink.pfnid!=mlink.fnid |
| 576 | @ AND F.fnid=mlink.pfnid |
| 577 | @ AND T.fnid=mlink.fnid |
| 578 | @ AND event.objid=mlink.mid |
| 579 | @ AND event.type='ci' |
| 580 | @ AND blob.rid=mlink.mid |
| 581 | @ GROUP BY 2, 3 |
| 582 | @ ORDER BY 1 DESC, 2; |
| 583 | ; |
| 584 | |
| 585 | /* |
| 586 | ** WEBPAGE: test-rename-list |
| 587 | ** |
| 588 | ** Print a list of all file rename operations throughout history. |
| @@ -574,18 +592,24 @@ | |
| 592 | void test_rename_list_page(void){ |
| 593 | Stmt q; |
| 594 | |
| 595 | login_check_credentials(); |
| 596 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 597 | if( P("all")!=0 ){ |
| 598 | style_header("List Of All File Name Changes"); |
| 599 | db_prepare(&q, "%s", zRenameQuery/*safe-for-%s*/); |
| 600 | style_submenu_element("Distinct", "%R/test-rename-list"); |
| 601 | }else{ |
| 602 | style_header("List Of Distinct File Name Changes"); |
| 603 | db_prepare(&q, "%s", zDistinctRenameQuery/*safe-for-%s*/); |
| 604 | style_submenu_element("All", "%R/test-rename-list?all"); |
| 605 | } |
| 606 | @ <table border="1" width="100%%"> |
| 607 | @ <tr><th>Date & Time</th> |
| 608 | @ <th>Old Name</th> |
| 609 | @ <th>New Name</th> |
| 610 | @ <th>Check-in</th></tr> |
| 611 | while( db_step(&q)==SQLITE_ROW ){ |
| 612 | const char *zDate = db_column_text(&q, 0); |
| 613 | const char *zOld = db_column_text(&q, 1); |
| 614 | const char *zNew = db_column_text(&q, 2); |
| 615 | const char *zUuid = db_column_text(&q, 3); |
| 616 |