comparison tests/test-hgweb-filelog.t @ 31665:5e6d44511317

hgweb: handle a "linerange" request parameter in filelog command We now handle a "linerange" URL query parameter to filter filelog using a logic similar to followlines() revset. The URL syntax is: log/<rev>/<file>?linerange=<fromline>:<toline> As a result, filelog entries only consists of revision changing specified line range. The linerange information is propagated to "more"/"less" navigation links but not to numeric navigation links as this would apparently require a dedicated "revnav" class. Only update the "paper" template in this patch.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Thu, 19 Jan 2017 17:41:00 +0100
parents f36dc643ffdc
children e540846c67e0
comparison
equal deleted inserted replaced
31664:1cbeefa59343 31665:5e6d44511317
188 <div class="main"> 188 <div class="main">
189 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> 189 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
190 <h3> 190 <h3>
191 log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a> 191 log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a>
192 <span class="branchname">a-branch</span> 192 <span class="branchname">a-branch</span>
193
193 </h3> 194 </h3>
194 195
195 <form class="search" action="/log"> 196 <form class="search" action="/log">
196 197
197 <p><input name="rev" id="search1" type="text" size="30" /></p> 198 <p><input name="rev" id="search1" type="text" size="30" /></p>
309 <div class="main"> 310 <div class="main">
310 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> 311 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
311 <h3> 312 <h3>
312 log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a> 313 log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a>
313 <span class="branchname">a-branch</span> 314 <span class="branchname">a-branch</span>
315
314 </h3> 316 </h3>
315 317
316 <form class="search" action="/log"> 318 <form class="search" action="/log">
317 319
318 <p><input name="rev" id="search1" type="text" size="30" /></p> 320 <p><input name="rev" id="search1" type="text" size="30" /></p>
430 <div class="main"> 432 <div class="main">
431 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> 433 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
432 <h3> 434 <h3>
433 log a @ 1:<a href="/rev/5ed941583260">5ed941583260</a> 435 log a @ 1:<a href="/rev/5ed941583260">5ed941583260</a>
434 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 436 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span>
437
435 </h3> 438 </h3>
436 439
437 <form class="search" action="/log"> 440 <form class="search" action="/log">
438 441
439 <p><input name="rev" id="search1" type="text" size="30" /></p> 442 <p><input name="rev" id="search1" type="text" size="30" /></p>
542 <div class="main"> 545 <div class="main">
543 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> 546 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
544 <h3> 547 <h3>
545 log a @ 1:<a href="/rev/5ed941583260">5ed941583260</a> 548 log a @ 1:<a href="/rev/5ed941583260">5ed941583260</a>
546 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 549 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span>
550
547 </h3> 551 </h3>
548 552
549 <form class="search" action="/log"> 553 <form class="search" action="/log">
550 554
551 <p><input name="rev" id="search1" type="text" size="30" /></p> 555 <p><input name="rev" id="search1" type="text" size="30" /></p>
656 660
657 661
658 </body> 662 </body>
659 </html> 663 </html>
660 664
665 [1]
666
667 $ hg log -r 'followlines(c, 1:2, startrev=tip) and follow(c)'
668 changeset: 0:6563da9dcf87
669 user: test
670 date: Thu Jan 01 00:00:00 1970 +0000
671 summary: b
672
673 changeset: 7:46c1a66bd8fc
674 branch: a-branch
675 tag: tip
676 user: test
677 date: Thu Jan 01 00:00:00 1970 +0000
678 summary: change c
679
680 $ (get-with-headers.py localhost:$HGPORT 'log/tip/c?linerange=1:2')
681 200 Script output follows
682
683 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
684 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
685 <head>
686 <link rel="icon" href="/static/hgicon.png" type="image/png" />
687 <meta name="robots" content="index, nofollow" />
688 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
689 <script type="text/javascript" src="/static/mercurial.js"></script>
690
691 <title>test: c history</title>
692 <link rel="alternate" type="application/atom+xml"
693 href="/atom-log/tip/c" title="Atom feed for test:c" />
694 <link rel="alternate" type="application/rss+xml"
695 href="/rss-log/tip/c" title="RSS feed for test:c" />
696 </head>
697 <body>
698
699 <div class="container">
700 <div class="menu">
701 <div class="logo">
702 <a href="https://mercurial-scm.org/">
703 <img src="/static/hglogo.png" alt="mercurial" /></a>
704 </div>
705 <ul>
706 <li><a href="/shortlog/tip">log</a></li>
707 <li><a href="/graph/tip">graph</a></li>
708 <li><a href="/tags">tags</a></li>
709 <li><a href="/bookmarks">bookmarks</a></li>
710 <li><a href="/branches">branches</a></li>
711 </ul>
712 <ul>
713 <li><a href="/rev/tip">changeset</a></li>
714 <li><a href="/file/tip">browse</a></li>
715 </ul>
716 <ul>
717 <li><a href="/file/tip/c">file</a></li>
718 <li><a href="/diff/tip/c">diff</a></li>
719 <li><a href="/comparison/tip/c">comparison</a></li>
720 <li><a href="/annotate/tip/c">annotate</a></li>
721 <li class="active">file log</li>
722 <li><a href="/raw-file/tip/c">raw</a></li>
723 </ul>
724 <ul>
725 <li><a href="/help">help</a></li>
726 </ul>
727 <div class="atom-logo">
728 <a href="/atom-log/tip/c" title="subscribe to atom feed">
729 <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed" />
730 </a>
731 </div>
732 </div>
733
734 <div class="main">
735 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
736 <h3>
737 log c @ 7:<a href="/rev/46c1a66bd8fc">46c1a66bd8fc</a>
738 <span class="branchname">a-branch</span> <span class="tag">tip</span>
739 (following lines 1:2 <a href="/log/tip/c">back to filelog</a>)
740 </h3>
741
742 <form class="search" action="/log">
743
744 <p><input name="rev" id="search1" type="text" size="30" /></p>
745 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
746 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
747 </form>
748
749 <div class="navigate">
750 <a href="/log/tip/c?linerange=1%3A2&revcount=30">less</a>
751 <a href="/log/tip/c?linerange=1%3A2&revcount=120">more</a>
752 | </div>
753
754 <table class="bigtable">
755 <thead>
756 <tr>
757 <th class="age">age</th>
758 <th class="author">author</th>
759 <th class="description">description</th>
760 </tr>
761 </thead>
762 <tbody class="stripes2">
763 <tr>
764 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
765 <td class="author">test</td>
766 <td class="description">
767 <a href="/rev/46c1a66bd8fc">change c</a>
768 <span class="branchhead">a-branch</span> <span class="tag">tip</span>
769 </td>
770 </tr>
771
772 <tr>
773 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
774 <td class="author">test</td>
775 <td class="description">
776 <a href="/rev/6563da9dcf87">b</a>
777
778 </td>
779 </tr>
780
781
782 </tbody>
783 </table>
784
785 <div class="navigate">
786 <a href="/log/tip/c?linerange=1%3A2&revcount=30">less</a>
787 <a href="/log/tip/c?linerange=1%3A2&revcount=120">more</a>
788 |
789 </div>
790
791 </div>
792 </div>
793
794
795
796 </body>
797 </html>
798
799 $ (get-with-headers.py localhost:$HGPORT 'log/tip/c?linerange=1%3A2&revcount=1')
800 200 Script output follows
801
802 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
803 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
804 <head>
805 <link rel="icon" href="/static/hgicon.png" type="image/png" />
806 <meta name="robots" content="index, nofollow" />
807 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
808 <script type="text/javascript" src="/static/mercurial.js"></script>
809
810 <title>test: c history</title>
811 <link rel="alternate" type="application/atom+xml"
812 href="/atom-log/tip/c" title="Atom feed for test:c" />
813 <link rel="alternate" type="application/rss+xml"
814 href="/rss-log/tip/c" title="RSS feed for test:c" />
815 </head>
816 <body>
817
818 <div class="container">
819 <div class="menu">
820 <div class="logo">
821 <a href="https://mercurial-scm.org/">
822 <img src="/static/hglogo.png" alt="mercurial" /></a>
823 </div>
824 <ul>
825 <li><a href="/shortlog/tip?revcount=1">log</a></li>
826 <li><a href="/graph/tip?revcount=1">graph</a></li>
827 <li><a href="/tags?revcount=1">tags</a></li>
828 <li><a href="/bookmarks?revcount=1">bookmarks</a></li>
829 <li><a href="/branches?revcount=1">branches</a></li>
830 </ul>
831 <ul>
832 <li><a href="/rev/tip?revcount=1">changeset</a></li>
833 <li><a href="/file/tip?revcount=1">browse</a></li>
834 </ul>
835 <ul>
836 <li><a href="/file/tip/c?revcount=1">file</a></li>
837 <li><a href="/diff/tip/c?revcount=1">diff</a></li>
838 <li><a href="/comparison/tip/c?revcount=1">comparison</a></li>
839 <li><a href="/annotate/tip/c?revcount=1">annotate</a></li>
840 <li class="active">file log</li>
841 <li><a href="/raw-file/tip/c">raw</a></li>
842 </ul>
843 <ul>
844 <li><a href="/help?revcount=1">help</a></li>
845 </ul>
846 <div class="atom-logo">
847 <a href="/atom-log/tip/c" title="subscribe to atom feed">
848 <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed" />
849 </a>
850 </div>
851 </div>
852
853 <div class="main">
854 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
855 <h3>
856 log c @ 7:<a href="/rev/46c1a66bd8fc?revcount=1">46c1a66bd8fc</a>
857 <span class="branchname">a-branch</span> <span class="tag">tip</span>
858 (following lines 1:2 <a href="/log/tip/c?revcount=1">back to filelog</a>)
859 </h3>
860
861 <form class="search" action="/log">
862 <input type="hidden" name="revcount" value="1" />
863 <p><input name="rev" id="search1" type="text" size="30" /></p>
864 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
865 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
866 </form>
867
868 <div class="navigate">
869 <a href="/log/tip/c?linerange=1%3A2&revcount=1">less</a>
870 <a href="/log/tip/c?linerange=1%3A2&revcount=2">more</a>
871 | </div>
872
873 <table class="bigtable">
874 <thead>
875 <tr>
876 <th class="age">age</th>
877 <th class="author">author</th>
878 <th class="description">description</th>
879 </tr>
880 </thead>
881 <tbody class="stripes2">
882 <tr>
883 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
884 <td class="author">test</td>
885 <td class="description">
886 <a href="/rev/46c1a66bd8fc?revcount=1">change c</a>
887 <span class="branchhead">a-branch</span> <span class="tag">tip</span>
888 </td>
889 </tr>
890
891
892 </tbody>
893 </table>
894
895 <div class="navigate">
896 <a href="/log/tip/c?linerange=1%3A2&revcount=1">less</a>
897 <a href="/log/tip/c?linerange=1%3A2&revcount=2">more</a>
898 |
899 </div>
900
901 </div>
902 </div>
903
904
905
906 </body>
907 </html>
908
909 $ (get-with-headers.py localhost:$HGPORT 'log/3/a?linerange=1' --headeronly)
910 400 invalid linerange parameter
911 [1]
912 $ (get-with-headers.py localhost:$HGPORT 'log/3/a?linerange=1:a' --headeronly)
913 400 invalid linerange parameter
914 [1]
915 $ (get-with-headers.py localhost:$HGPORT 'log/3/a?linerange=1:2&linerange=3:4' --headeronly)
916 400 redundant linerange parameter
917 [1]
918 $ (get-with-headers.py localhost:$HGPORT 'log/3/a?linerange=3:2' --headeronly)
919 400 line range must be positive
920 [1]
921 $ (get-with-headers.py localhost:$HGPORT 'log/3/a?linerange=0:1' --headeronly)
922 400 fromline must be strictly positive
661 [1] 923 [1]
662 924
663 should show base link, use spartan because it shows it 925 should show base link, use spartan because it shows it
664 926
665 $ (get-with-headers.py localhost:$HGPORT 'log/tip/c?style=spartan') 927 $ (get-with-headers.py localhost:$HGPORT 'log/tip/c?style=spartan')
827 <div class="main"> 1089 <div class="main">
828 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> 1090 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
829 <h3> 1091 <h3>
830 log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a> 1092 log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a>
831 <span class="branchname">a-branch</span> 1093 <span class="branchname">a-branch</span>
1094
832 </h3> 1095 </h3>
833 1096
834 <form class="search" action="/log"> 1097 <form class="search" action="/log">
835 1098
836 <p><input name="rev" id="search1" type="text" size="30" /></p> 1099 <p><input name="rev" id="search1" type="text" size="30" /></p>