##// END OF EJS Templates
Convert changenav bar from revisions to hashes (closes issue189)
Brendan Cully -
r3422:0eba7e76 default
parent child Browse files
Show More
@@ -28,7 +28,7 def _up(p):
28 return "/"
28 return "/"
29 return up + "/"
29 return up + "/"
30
30
31 def revnavgen(pos, pagelen, limit):
31 def revnavgen(pos, pagelen, limit, nodefunc):
32 def seq(factor, limit=None):
32 def seq(factor, limit=None):
33 if limit:
33 if limit:
34 yield limit
34 yield limit
@@ -50,16 +50,16 def revnavgen(pos, pagelen, limit):
50 break
50 break
51 last = f
51 last = f
52 if pos + f < limit:
52 if pos + f < limit:
53 l.append(("+%d" % f, pos + f))
53 l.append(("+%d" % f, hex(nodefunc(pos + f).node())))
54 if pos - f >= 0:
54 if pos - f >= 0:
55 l.insert(0, ("-%d" % f, pos - f))
55 l.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node())))
56
56
57 yield {"label": "(0)", "rev": 0}
57 yield {"label": "(0)", "node": hex(nodefunc(0).node())}
58
58
59 for label, rev in l:
59 for label, node in l:
60 yield {"label": label, "rev": rev}
60 yield {"label": label, "node": node}
61
61
62 yield {"label": "tip", "rev": "tip"}
62 yield {"label": "tip", "node": hex(nodefunc('-1').node())}
63
63
64 return nav
64 return nav
65
65
@@ -215,7 +215,7 class hgweb(object):
215 end = min(count, start + maxchanges)
215 end = min(count, start + maxchanges)
216 pos = end - 1
216 pos = end - 1
217
217
218 changenav = revnavgen(pos, maxchanges, count)
218 changenav = revnavgen(pos, maxchanges, count, self.repo.changectx)
219
219
220 yield self.t(shortlog and 'shortlog' or 'changelog',
220 yield self.t(shortlog and 'shortlog' or 'changelog',
221 changenav=changenav,
221 changenav=changenav,
@@ -338,7 +338,8 class hgweb(object):
338 for e in l:
338 for e in l:
339 yield e
339 yield e
340
340
341 nav = revnavgen(pos, pagelen, count)
341 nodefunc = lambda x: fctx.filectx(fileid=x)
342 nav = revnavgen(pos, pagelen, count, nodefunc)
342 yield self.t("filelog", file=f, node=hex(fctx.node()), nav=nav,
343 yield self.t("filelog", file=f, node=hex(fctx.node()), nav=nav,
343 entries=entries)
344 entries=entries)
344
345
@@ -5,9 +5,9 search = search.tmpl
5 changelog = changelog.tmpl
5 changelog = changelog.tmpl
6 summary = summary.tmpl
6 summary = summary.tmpl
7 error = error.tmpl
7 error = error.tmpl
8 naventry = '<a href="#url#log/#rev#{sessionvars%urlparameter}">#label|escape#</a> '
8 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
9 navshortentry = '<a href="#url#shortlog/#rev#{sessionvars%urlparameter}">#label|escape#</a> '
9 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
10 filenaventry = '<a href="{url}log/{rev}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
10 filenaventry = '<a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
11 filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
11 filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
12 filenodelink = '<tr class="parity#parity#"><td><a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">#file|escape#</a></td><td></td><td class="link"><a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">file</a> | <a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}">annotate</a> | <a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">diff</a> | <a href="#url#log/#node|short#/#file|urlescape#{sessionvars%urlparameter}">revisions</a></td></tr>'
12 filenodelink = '<tr class="parity#parity#"><td><a class="list" href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">#file|escape#</a></td><td></td><td class="link"><a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">file</a> | <a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}">annotate</a> | <a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">diff</a> | <a href="#url#log/#node|short#/#file|urlescape#{sessionvars%urlparameter}">revisions</a></td></tr>'
13 fileellipses = '...'
13 fileellipses = '...'
@@ -5,9 +5,9 search = search.tmpl
5 changelog = changelog.tmpl
5 changelog = changelog.tmpl
6 shortlog = shortlog.tmpl
6 shortlog = shortlog.tmpl
7 shortlogentry = shortlogentry.tmpl
7 shortlogentry = shortlogentry.tmpl
8 naventry = '<a href="#url#log/#rev#{sessionvars%urlparameter}">#label|escape#</a> '
8 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
9 navshortentry = '<a href="#url#shortlog/#rev#{sessionvars%urlparameter}">#label|escape#</a> '
9 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
10 filenaventry = '<a href="{url}log/{rev}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
10 filenaventry = '<a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> '
11 filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
11 filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
12 filenodelink = '<a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
12 filenodelink = '<a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> '
13 fileellipses = '...'
13 fileellipses = '...'
@@ -5,8 +5,8 search = search.tmpl
5 changelog = changelog.tmpl
5 changelog = changelog.tmpl
6 shortlog = shortlog.tmpl
6 shortlog = shortlog.tmpl
7 shortlogentry = shortlogentry.tmpl
7 shortlogentry = shortlogentry.tmpl
8 naventry = '<a href="?cl=#rev#">#label|escape#</a> '
8 naventry = '<a href="?cl={node|short}">{label|escape}</a> '
9 navshortentry = '<a href="?sl=#rev#">#label|escape#</a> '
9 navshortentry = '<a href="?sl={node|short}">{label|escape}</a> '
10 filedifflink = '<a href="?fd=#node|short#;file=#file|urlescape#">#file|escape#</a> '
10 filedifflink = '<a href="?fd=#node|short#;file=#file|urlescape#">#file|escape#</a> '
11 filenodelink = '<a href="?f=#node|short#;file=#file|urlescape#">#file|escape#</a> '
11 filenodelink = '<a href="?f=#node|short#;file=#file|urlescape#">#file|escape#</a> '
12 fileellipses = '...'
12 fileellipses = '...'
General Comments 0
You need to be logged in to leave comments. Login now