##// END OF EJS Templates
hgweb: add a "patch" query parameter to filelog command...
Denis Laxalde -
r31661:f36dc643 default
parent child Browse files
Show More
@@ -973,6 +973,10 def filelog(web, req, tmpl):
973 973 morevars = copy.copy(tmpl.defaults['sessionvars'])
974 974 morevars['revcount'] = revcount * 2
975 975
976 patch = 'patch' in req.form
977 if patch:
978 lessvars['patch'] = morevars['patch'] = req.form['patch'][0]
979
976 980 count = fctx.filerev() + 1
977 981 start = max(0, count - revcount) # first rev on this page
978 982 end = min(count, start + revcount) # last rev on this page
@@ -981,12 +985,27 def filelog(web, req, tmpl):
981 985 repo = web.repo
982 986 revs = fctx.filelog().revs(start, end - 1)
983 987 entries = []
988
989 diffstyle = web.config('web', 'style', 'paper')
990 if 'style' in req.form:
991 diffstyle = req.form['style'][0]
992
993 def diff(fctx):
994 ctx = fctx.changectx()
995 basectx = ctx.p1()
996 path = fctx.path()
997 return webutil.diffs(web, tmpl, ctx, basectx, [path], diffstyle)
998
984 999 for i in revs:
985 1000 iterfctx = fctx.filectx(i)
1001 diffs = None
1002 if patch:
1003 diffs = diff(iterfctx)
986 1004 entries.append(dict(
987 1005 parity=next(parity),
988 1006 filerev=i,
989 1007 file=f,
1008 diff=diffs,
990 1009 rename=webutil.renamelink(iterfctx),
991 1010 **webutil.commonentry(repo, iterfctx)))
992 1011 entries.reverse()
@@ -1000,6 +1019,7 def filelog(web, req, tmpl):
1000 1019 nav=nav,
1001 1020 symrev=webutil.symrevorshortnode(req, fctx),
1002 1021 entries=entries,
1022 patch=patch,
1003 1023 latestentry=latestentry,
1004 1024 revcount=revcount,
1005 1025 morevars=morevars,
@@ -6,3 +6,4
6 6 {inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}{rename%filelogrename}
7 7 </td>
8 8 </tr>
9 {if(patch, '<tr><td colspan="3">{diff}</td></tr>')}
@@ -221,6 +221,7 tip - two revisions
221 221 <span class="branchname">a-branch</span>
222 222 </td>
223 223 </tr>
224
224 225 <tr>
225 226 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
226 227 <td class="author">test</td>
@@ -229,6 +230,7 tip - two revisions
229 230 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span>
230 231 </td>
231 232 </tr>
233
232 234
233 235 </tbody>
234 236 </table>
@@ -340,6 +342,7 second version - two revisions
340 342 <span class="branchname">a-branch</span>
341 343 </td>
342 344 </tr>
345
343 346 <tr>
344 347 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
345 348 <td class="author">test</td>
@@ -348,6 +351,7 second version - two revisions
348 351 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span>
349 352 </td>
350 353 </tr>
354
351 355
352 356 </tbody>
353 357 </table>
@@ -459,6 +463,7 first deleted - one revision
459 463 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span>
460 464 </td>
461 465 </tr>
466
462 467
463 468 </tbody>
464 469 </table>
@@ -570,6 +575,7 first version - one revision
570 575 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span>
571 576 </td>
572 577 </tr>
578
573 579
574 580 </tbody>
575 581 </table>
@@ -762,6 +768,135 should show base link, use spartan becau
762 768 </html>
763 769
764 770
771 filelog with patch
772
773 $ (get-with-headers.py localhost:$HGPORT 'log/4/a?patch=1')
774 200 Script output follows
775
776 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
777 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
778 <head>
779 <link rel="icon" href="/static/hgicon.png" type="image/png" />
780 <meta name="robots" content="index, nofollow" />
781 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
782 <script type="text/javascript" src="/static/mercurial.js"></script>
783
784 <title>test: a history</title>
785 <link rel="alternate" type="application/atom+xml"
786 href="/atom-log/tip/a" title="Atom feed for test:a" />
787 <link rel="alternate" type="application/rss+xml"
788 href="/rss-log/tip/a" title="RSS feed for test:a" />
789 </head>
790 <body>
791
792 <div class="container">
793 <div class="menu">
794 <div class="logo">
795 <a href="https://mercurial-scm.org/">
796 <img src="/static/hglogo.png" alt="mercurial" /></a>
797 </div>
798 <ul>
799 <li><a href="/shortlog/4">log</a></li>
800 <li><a href="/graph/4">graph</a></li>
801 <li><a href="/tags">tags</a></li>
802 <li><a href="/bookmarks">bookmarks</a></li>
803 <li><a href="/branches">branches</a></li>
804 </ul>
805 <ul>
806 <li><a href="/rev/4">changeset</a></li>
807 <li><a href="/file/4">browse</a></li>
808 </ul>
809 <ul>
810 <li><a href="/file/4/a">file</a></li>
811 <li><a href="/diff/4/a">diff</a></li>
812 <li><a href="/comparison/4/a">comparison</a></li>
813 <li><a href="/annotate/4/a">annotate</a></li>
814 <li class="active">file log</li>
815 <li><a href="/raw-file/4/a">raw</a></li>
816 </ul>
817 <ul>
818 <li><a href="/help">help</a></li>
819 </ul>
820 <div class="atom-logo">
821 <a href="/atom-log/tip/a" title="subscribe to atom feed">
822 <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed" />
823 </a>
824 </div>
825 </div>
826
827 <div class="main">
828 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
829 <h3>
830 log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a>
831 <span class="branchname">a-branch</span>
832 </h3>
833
834 <form class="search" action="/log">
835
836 <p><input name="rev" id="search1" type="text" size="30" /></p>
837 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
838 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
839 </form>
840
841 <div class="navigate">
842 <a href="/log/4/a?patch=1&revcount=30">less</a>
843 <a href="/log/4/a?patch=1&revcount=120">more</a>
844 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
845
846 <table class="bigtable">
847 <thead>
848 <tr>
849 <th class="age">age</th>
850 <th class="author">author</th>
851 <th class="description">description</th>
852 </tr>
853 </thead>
854 <tbody class="stripes2">
855 <tr>
856 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
857 <td class="author">test</td>
858 <td class="description">
859 <a href="/rev/3f41bc784e7e">second a</a>
860 <span class="branchname">a-branch</span>
861 </td>
862 </tr>
863 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
864 <span id="l1.1" class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.1"></a>
865 <span id="l1.2" class="plusline">+++ b/a Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.2"></a>
866 <span id="l1.3" class="atline">@@ -0,0 +1,1 @@</span><a href="#l1.3"></a>
867 <span id="l1.4" class="plusline">+b</span><a href="#l1.4"></a></pre></div></td></tr>
868 <tr>
869 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
870 <td class="author">test</td>
871 <td class="description">
872 <a href="/rev/5ed941583260">first a</a>
873 <span class="tag">a-tag</span> <span class="tag">a-bookmark</span>
874 </td>
875 </tr>
876 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
877 <span id="l1.1" class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.1"></a>
878 <span id="l1.2" class="plusline">+++ b/a Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.2"></a>
879 <span id="l1.3" class="atline">@@ -0,0 +1,1 @@</span><a href="#l1.3"></a>
880 <span id="l1.4" class="plusline">+a</span><a href="#l1.4"></a></pre></div></td></tr>
881
882 </tbody>
883 </table>
884
885 <div class="navigate">
886 <a href="/log/4/a?patch=1&revcount=30">less</a>
887 <a href="/log/4/a?patch=1&revcount=120">more</a>
888 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a>
889 </div>
890
891 </div>
892 </div>
893
894
895
896 </body>
897 </html>
898
899
765 900 rss log
766 901
767 902 $ (get-with-headers.py localhost:$HGPORT 'rss-log/tip/a')
General Comments 0
You need to be logged in to leave comments. Login now