Mercurial > hg
changeset 3422:0eba7e76cd02
Convert changenav bar from revisions to hashes (closes issue189)
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 16 Oct 2006 11:02:11 -0700 |
parents | 5207cf649abe |
children | a2179e78d18b |
files | mercurial/hgweb/hgweb_mod.py templates/gitweb/map templates/map templates/old/map |
diffstat | 4 files changed, 18 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Mon Oct 16 12:56:41 2006 +0200 +++ b/mercurial/hgweb/hgweb_mod.py Mon Oct 16 11:02:11 2006 -0700 @@ -28,7 +28,7 @@ return "/" return up + "/" -def revnavgen(pos, pagelen, limit): +def revnavgen(pos, pagelen, limit, nodefunc): def seq(factor, limit=None): if limit: yield limit @@ -50,16 +50,16 @@ break last = f if pos + f < limit: - l.append(("+%d" % f, pos + f)) + l.append(("+%d" % f, hex(nodefunc(pos + f).node()))) if pos - f >= 0: - l.insert(0, ("-%d" % f, pos - f)) + l.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node()))) - yield {"label": "(0)", "rev": 0} + yield {"label": "(0)", "node": hex(nodefunc(0).node())} - for label, rev in l: - yield {"label": label, "rev": rev} + for label, node in l: + yield {"label": label, "node": node} - yield {"label": "tip", "rev": "tip"} + yield {"label": "tip", "node": hex(nodefunc('-1').node())} return nav @@ -215,7 +215,7 @@ end = min(count, start + maxchanges) pos = end - 1 - changenav = revnavgen(pos, maxchanges, count) + changenav = revnavgen(pos, maxchanges, count, self.repo.changectx) yield self.t(shortlog and 'shortlog' or 'changelog', changenav=changenav, @@ -338,7 +338,8 @@ for e in l: yield e - nav = revnavgen(pos, pagelen, count) + nodefunc = lambda x: fctx.filectx(fileid=x) + nav = revnavgen(pos, pagelen, count, nodefunc) yield self.t("filelog", file=f, node=hex(fctx.node()), nav=nav, entries=entries)
--- a/templates/gitweb/map Mon Oct 16 12:56:41 2006 +0200 +++ b/templates/gitweb/map Mon Oct 16 11:02:11 2006 -0700 @@ -5,9 +5,9 @@ changelog = changelog.tmpl summary = summary.tmpl error = error.tmpl -naventry = '<a href="#url#log/#rev#{sessionvars%urlparameter}">#label|escape#</a> ' -navshortentry = '<a href="#url#shortlog/#rev#{sessionvars%urlparameter}">#label|escape#</a> ' -filenaventry = '<a href="{url}log/{rev}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> ' +naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> ' +navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> ' +filenaventry = '<a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> ' filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> ' 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>' fileellipses = '...'
--- a/templates/map Mon Oct 16 12:56:41 2006 +0200 +++ b/templates/map Mon Oct 16 11:02:11 2006 -0700 @@ -5,9 +5,9 @@ changelog = changelog.tmpl shortlog = shortlog.tmpl shortlogentry = shortlogentry.tmpl -naventry = '<a href="#url#log/#rev#{sessionvars%urlparameter}">#label|escape#</a> ' -navshortentry = '<a href="#url#shortlog/#rev#{sessionvars%urlparameter}">#label|escape#</a> ' -filenaventry = '<a href="{url}log/{rev}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> ' +naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> ' +navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> ' +filenaventry = '<a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a> ' filedifflink = '<a href="#url#diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> ' filenodelink = '<a href="#url#file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">#file|escape#</a> ' fileellipses = '...'
--- a/templates/old/map Mon Oct 16 12:56:41 2006 +0200 +++ b/templates/old/map Mon Oct 16 11:02:11 2006 -0700 @@ -5,8 +5,8 @@ changelog = changelog.tmpl shortlog = shortlog.tmpl shortlogentry = shortlogentry.tmpl -naventry = '<a href="?cl=#rev#">#label|escape#</a> ' -navshortentry = '<a href="?sl=#rev#">#label|escape#</a> ' +naventry = '<a href="?cl={node|short}">{label|escape}</a> ' +navshortentry = '<a href="?sl={node|short}">{label|escape}</a> ' filedifflink = '<a href="?fd=#node|short#;file=#file|urlescape#">#file|escape#</a> ' filenodelink = '<a href="?f=#node|short#;file=#file|urlescape#">#file|escape#</a> ' fileellipses = '...'