##// END OF EJS Templates
hgweb: changenav: separate pages before and after the current position...
Nicolas Dumazet -
r10254:8d5de524 default
parent child Browse files
Show More
@@ -32,31 +32,34 b' def revnavgen(pos, pagelen, limit, nodef'
32 for f in seq(factor * 10):
32 for f in seq(factor * 10):
33 yield f
33 yield f
34
34
35 def nav(**map):
35 navbefore = []
36 l = []
36 navafter = []
37 last = 0
38 for f in seq(1, pagelen):
39 if f < pagelen or f <= last:
40 continue
41 if f > limit:
42 break
43 last = f
44 if pos + f < limit:
45 l.append(("+%d" % f, hex(nodefunc(pos + f).node())))
46 if pos - f >= 0:
47 l.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node())))
48
37
49 try:
38 last = 0
50 yield {"label": "(0)", "node": hex(nodefunc('0').node())}
39 for f in seq(1, pagelen):
40 if f < pagelen or f <= last:
41 continue
42 if f > limit:
43 break
44 last = f
45 if pos + f < limit:
46 navafter.append(("+%d" % f, hex(nodefunc(pos + f).node())))
47 if pos - f >= 0:
48 navbefore.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node())))
51
49
50 navafter.append(("tip", "tip"))
51 try:
52 navbefore.insert(0, ("(0)", hex(nodefunc('0').node())))
53 except error.RepoError:
54 pass
55
56 def gen(l):
57 def f(**map):
52 for label, node in l:
58 for label, node in l:
53 yield {"label": label, "node": node}
59 yield {"label": label, "node": node}
60 return f
54
61
55 yield {"label": "tip", "node": "tip"}
62 return (dict(before=gen(navbefore), after=gen(navafter)), )
56 except error.RepoError:
57 pass
58
59 return nav
60
63
61 def _siblings(siblings=[], hiderev=None):
64 def _siblings(siblings=[], hiderev=None):
62 siblings = [s for s in siblings if s.node() != nullid]
65 siblings = [s for s in siblings if s.node() != nullid]
@@ -23,6 +23,11 b' searchentry = ../paper/shortlogentry.tmp'
23 changeset = ../paper/changeset.tmpl
23 changeset = ../paper/changeset.tmpl
24 manifest = ../paper/manifest.tmpl
24 manifest = ../paper/manifest.tmpl
25
25
26 nav = '{before%naventry} {after%naventry}'
27 navshort = '{before%navshortentry}{after%navshortentry}'
28 navgraph = '{before%navgraphentry}{after%navgraphentry}'
29 filenav = '{before%filenaventry}{after%filenaventry}'
30
26 direntry = '
31 direntry = '
27 <tr class="fileline parity{parity}">
32 <tr class="fileline parity{parity}">
28 <td class="name">
33 <td class="name">
@@ -27,13 +27,13 b' changelog |'
27 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
27 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
28 <a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}
28 <a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}
29 <br/>
29 <br/>
30 {changenav%naventry}<br/>
30 {changenav%nav}<br/>
31 </div>
31 </div>
32
32
33 {entries%changelogentry}
33 {entries%changelogentry}
34
34
35 <div class="page_nav">
35 <div class="page_nav">
36 {changenav%naventry}<br/>
36 {changenav%nav}<br/>
37 </div>
37 </div>
38
38
39 {footer}
39 {footer}
@@ -24,7 +24,7 b' revisions |'
24 <a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> |
24 <a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> |
25 <a href="{url}rss-log/{node|short}/{file|urlescape}">rss</a>
25 <a href="{url}rss-log/{node|short}/{file|urlescape}">rss</a>
26 <br/>
26 <br/>
27 {nav%filenaventry}
27 {nav%filenav}
28 </div>
28 </div>
29
29
30 <div class="title" >{file|urlescape}</div>
30 <div class="title" >{file|urlescape}</div>
@@ -34,7 +34,7 b' revisions |'
34 </table>
34 </table>
35
35
36 <div class="page_nav">
36 <div class="page_nav">
37 {nav%filenaventry}
37 {nav%filenav}
38 </div>
38 </div>
39
39
40 {footer}
40 {footer}
@@ -29,7 +29,7 b' graph |'
29 <br/>
29 <br/>
30 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
30 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
31 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
31 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
32 | {changenav%navgraphentry}<br/>
32 | {changenav%navgraph}<br/>
33 </div>
33 </div>
34
34
35 <div class="title">&nbsp;</div>
35 <div class="title">&nbsp;</div>
@@ -115,7 +115,7 b' graph.render(data);'
115 <div class="page_nav">
115 <div class="page_nav">
116 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
116 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
117 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
117 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
118 | {changenav%navgraphentry}
118 | {changenav%navgraph}
119 </div>
119 </div>
120
120
121 {footer}
121 {footer}
@@ -34,6 +34,12 b" filenolink = '"
34 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a>
34 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a>
35 </td>
35 </td>
36 </tr>'
36 </tr>'
37
38 nav = '{before%naventry} {after%naventry}'
39 navshort = '{before%navshortentry}{after%navshortentry}'
40 navgraph = '{before%navgraphentry}{after%navgraphentry}'
41 filenav = '{before%filenaventry}{after%filenaventry}'
42
37 fileellipses = '...'
43 fileellipses = '...'
38 changelogentry = changelogentry.tmpl
44 changelogentry = changelogentry.tmpl
39 searchentry = changelogentry.tmpl
45 searchentry = changelogentry.tmpl
@@ -25,8 +25,7 b' shortlog |'
25 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
25 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
26 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
26 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
27 <a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}
27 <a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}
28 <br/>
28 <br/>{changenav%navshort}<br/>
29 {changenav%navshortentry}<br/>
30 </div>
29 </div>
31
30
32 <div class="title">&nbsp;</div>
31 <div class="title">&nbsp;</div>
@@ -35,7 +34,7 b' shortlog |'
35 </table>
34 </table>
36
35
37 <div class="page_nav">
36 <div class="page_nav">
38 {changenav%navshortentry}
37 {changenav%navshort}
39 </div>
38 </div>
40
39
41 {footer}
40 {footer}
@@ -34,7 +34,7 b''
34 </div>
34 </div>
35
35
36 <div class="page-path">
36 <div class="page-path">
37 {changenav%naventry}
37 {changenav%nav}
38 </div>
38 </div>
39
39
40 {footer}
40 {footer}
@@ -43,7 +43,7 b''
43 </table>
43 </table>
44
44
45 <div class="page-path">
45 <div class="page-path">
46 {nav%filenaventry}
46 {nav%filenav}
47 </div>
47 </div>
48
48
49 {footer}
49 {footer}
@@ -112,7 +112,7 b''
112 <div class="page-path">
112 <div class="page-path">
113 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
113 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
114 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
114 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
115 | {changenav%navgraphentry}
115 | {changenav%navgraph}
116 </div>
116 </div>
117
117
118 {footer}
118 {footer}
@@ -32,6 +32,12 b" filenolink = '"
32 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a>
32 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a>
33 </td>
33 </td>
34 </tr>'
34 </tr>'
35
36 nav = '{before%naventry} {after%naventry}'
37 navshort = '{before%navshortentry}{after%navshortentry}'
38 navgraph = '{before%navgraphentry}{after%navgraphentry}'
39 filenav = '{before%filenaventry}{after%filenaventry}'
40
35 fileellipses = '...'
41 fileellipses = '...'
36 changelogentry = changelogentry.tmpl
42 changelogentry = changelogentry.tmpl
37 searchentry = changelogentry.tmpl
43 searchentry = changelogentry.tmpl
@@ -35,7 +35,7 b''
35 </table>
35 </table>
36
36
37 <div class="page-path">
37 <div class="page-path">
38 {changenav%navshortentry}
38 {changenav%navshort}
39 </div>
39 </div>
40
40
41 {footer}
41 {footer}
@@ -46,7 +46,7 b' files, or words in the commit message</d'
46 <div class="navigate">
46 <div class="navigate">
47 <a href="{url}log/{node|short}/{file|urlescape}{lessvars%urlparameter}">less</a>
47 <a href="{url}log/{node|short}/{file|urlescape}{lessvars%urlparameter}">less</a>
48 <a href="{url}log/{node|short}/{file|urlescape}{morevars%urlparameter}">more</a>
48 <a href="{url}log/{node|short}/{file|urlescape}{morevars%urlparameter}">more</a>
49 | {nav%filenaventry}</div>
49 | {nav%filenav}</div>
50
50
51 <table class="bigtable">
51 <table class="bigtable">
52 <tr>
52 <tr>
@@ -60,7 +60,7 b' files, or words in the commit message</d'
60 <div class="navigate">
60 <div class="navigate">
61 <a href="{url}log/{node|short}/{file|urlescape}{lessvars%urlparameter}">less</a>
61 <a href="{url}log/{node|short}/{file|urlescape}{lessvars%urlparameter}">less</a>
62 <a href="{url}log/{node|short}/{file|urlescape}{morevars%urlparameter}">more</a>
62 <a href="{url}log/{node|short}/{file|urlescape}{morevars%urlparameter}">more</a>
63 | {nav%filenaventry}
63 | {nav%filenav}
64 </div>
64 </div>
65
65
66 </div>
66 </div>
@@ -40,7 +40,7 b' files, or words in the commit message</d'
40 <div class="navigate">
40 <div class="navigate">
41 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
41 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
42 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
42 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
43 | rev {rev}: {changenav%navgraphentry}
43 | rev {rev}: {changenav%navgraph}
44 </div>
44 </div>
45
45
46 <noscript><p>The revision graph only works with JavaScript-enabled browsers.</p></noscript>
46 <noscript><p>The revision graph only works with JavaScript-enabled browsers.</p></noscript>
@@ -123,7 +123,7 b' graph.render(data);'
123 <div class="navigate">
123 <div class="navigate">
124 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
124 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
125 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
125 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
126 | rev {rev}: {changenav%navgraphentry}
126 | rev {rev}: {changenav%navgraph}
127 </div>
127 </div>
128
128
129 </div>
129 </div>
@@ -23,6 +23,11 b' searchentry = shortlogentry.tmpl'
23 changeset = changeset.tmpl
23 changeset = changeset.tmpl
24 manifest = manifest.tmpl
24 manifest = manifest.tmpl
25
25
26 nav = '{before%naventry} {after%naventry}'
27 navshort = '{before%navshortentry}{after%navshortentry}'
28 navgraph = '{before%navgraphentry}{after%navgraphentry}'
29 filenav = '{before%filenaventry}{after%filenaventry}'
30
26 direntry = '
31 direntry = '
27 <tr class="fileline parity{parity}">
32 <tr class="fileline parity{parity}">
28 <td class="name">
33 <td class="name">
@@ -42,7 +42,7 b' files, or words in the commit message</d'
42 <div class="navigate">
42 <div class="navigate">
43 <a href="{url}shortlog/{rev}{lessvars%urlparameter}">less</a>
43 <a href="{url}shortlog/{rev}{lessvars%urlparameter}">less</a>
44 <a href="{url}shortlog/{rev}{morevars%urlparameter}">more</a>
44 <a href="{url}shortlog/{rev}{morevars%urlparameter}">more</a>
45 | rev {rev}: {changenav%navshortentry}
45 | rev {rev}: {changenav%navshort}
46 </div>
46 </div>
47
47
48 <table class="bigtable">
48 <table class="bigtable">
@@ -57,7 +57,7 b' files, or words in the commit message</d'
57 <div class="navigate">
57 <div class="navigate">
58 <a href="{url}shortlog/{rev}{lessvars%urlparameter}">less</a>
58 <a href="{url}shortlog/{rev}{lessvars%urlparameter}">less</a>
59 <a href="{url}shortlog/{rev}{morevars%urlparameter}">more</a>
59 <a href="{url}shortlog/{rev}{morevars%urlparameter}">more</a>
60 | rev {rev}: {changenav%navshortentry}
60 | rev {rev}: {changenav%navshort}
61 </div>
61 </div>
62
62
63 </div>
63 </div>
@@ -25,7 +25,7 b''
25 <p>
25 <p>
26 <label for="search1">search:</label>
26 <label for="search1">search:</label>
27 <input name="rev" id="search1" type="text" size="30">
27 <input name="rev" id="search1" type="text" size="30">
28 navigate: <small class="navigate">{changenav%naventry}</small>
28 navigate: <small class="navigate">{changenav%nav}</small>
29 </p>
29 </p>
30 </form>
30 </form>
31
31
@@ -36,7 +36,7 b' navigate: <small class="navigate">{chang'
36 <p>
36 <p>
37 <label for="search2">search:</label>
37 <label for="search2">search:</label>
38 <input name="rev" id="search2" type="text" size="30">
38 <input name="rev" id="search2" type="text" size="30">
39 navigate: <small class="navigate">{changenav%naventry}</small>
39 navigate: <small class="navigate">{changenav%nav}</small>
40 </p>
40 </p>
41 </form>
41 </form>
42
42
@@ -21,7 +21,7 b''
21
21
22 <h2>{file|escape} revision history</h2>
22 <h2>{file|escape} revision history</h2>
23
23
24 <p>navigate: <small class="navigate">{nav%filenaventry}</small></p>
24 <p>navigate: <small class="navigate">{nav%filenav}</small></p>
25
25
26 {entries%filelogentry}
26 {entries%filelogentry}
27
27
@@ -23,7 +23,7 b''
23 <p>
23 <p>
24 <label for="search1">search:</label>
24 <label for="search1">search:</label>
25 <input name="rev" id="search1" type="text" size="30">
25 <input name="rev" id="search1" type="text" size="30">
26 navigate: <small class="navigate">{changenav%navgraphentry}</small>
26 navigate: <small class="navigate">{changenav%navgraph}</small>
27 </p>
27 </p>
28 </form>
28 </form>
29
29
@@ -89,7 +89,7 b' graph.render(data);'
89 <p>
89 <p>
90 <label for="search1">search:</label>
90 <label for="search1">search:</label>
91 <input name="rev" id="search1" type="text" size="30">
91 <input name="rev" id="search1" type="text" size="30">
92 navigate: <small class="navigate">{changenav%navgraphentry}</small>
92 navigate: <small class="navigate">{changenav%navgraph}</small>
93 </p>
93 </p>
94 </form>
94 </form>
95
95
@@ -20,6 +20,11 b' searchentry = changelogentry.tmpl'
20 changeset = changeset.tmpl
20 changeset = changeset.tmpl
21 manifest = manifest.tmpl
21 manifest = manifest.tmpl
22
22
23 nav = '{before%naventry} {after%naventry}'
24 navshort = '{before%navshortentry}{after%navshortentry}'
25 navgraph = '{before%navgraphentry}{after%navgraphentry}'
26 filenav = '{before%filenaventry}{after%filenaventry}'
27
23 direntry = '
28 direntry = '
24 <tr class="parity{parity}">
29 <tr class="parity{parity}">
25 <td><tt>drwxr-xr-x</tt>&nbsp;
30 <td><tt>drwxr-xr-x</tt>&nbsp;
@@ -25,7 +25,7 b''
25 <p>
25 <p>
26 <label for="search1">search:</label>
26 <label for="search1">search:</label>
27 <input name="rev" id="search1" type="text" size="30">
27 <input name="rev" id="search1" type="text" size="30">
28 navigate: <small class="navigate">{changenav%navshortentry}</small>
28 navigate: <small class="navigate">{changenav%navshort}</small>
29 </p>
29 </p>
30 </form>
30 </form>
31
31
@@ -36,7 +36,7 b' navigate: <small class="navigate">{chang'
36 <p>
36 <p>
37 <label for="search2">search:</label>
37 <label for="search2">search:</label>
38 <input name="rev" id="search2" type="text" size="30">
38 <input name="rev" id="search2" type="text" size="30">
39 navigate: <small class="navigate">{changenav%navshortentry}</small>
39 navigate: <small class="navigate">{changenav%navshort}</small>
40 </p>
40 </p>
41 </form>
41 </form>
42
42
General Comments 0
You need to be logged in to leave comments. Login now