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