diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -32,31 +32,34 @@ def revnavgen(pos, pagelen, limit, nodef for f in seq(factor * 10): yield f - def nav(**map): - l = [] - last = 0 - for f in seq(1, pagelen): - if f < pagelen or f <= last: - continue - if f > limit: - break - last = f - if pos + f < limit: - l.append(("+%d" % f, hex(nodefunc(pos + f).node()))) - if pos - f >= 0: - l.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node()))) + navbefore = [] + navafter = [] - try: - yield {"label": "(0)", "node": hex(nodefunc('0').node())} + last = 0 + for f in seq(1, pagelen): + if f < pagelen or f <= last: + continue + if f > limit: + break + last = f + if pos + f < limit: + navafter.append(("+%d" % f, hex(nodefunc(pos + f).node()))) + if pos - f >= 0: + navbefore.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node()))) + navafter.append(("tip", "tip")) + try: + navbefore.insert(0, ("(0)", hex(nodefunc('0').node()))) + except error.RepoError: + pass + + def gen(l): + def f(**map): for label, node in l: yield {"label": label, "node": node} + return f - yield {"label": "tip", "node": "tip"} - except error.RepoError: - pass - - return nav + return (dict(before=gen(navbefore), after=gen(navafter)), ) def _siblings(siblings=[], hiderev=None): siblings = [s for s in siblings if s.node() != nullid] diff --git a/mercurial/templates/coal/map b/mercurial/templates/coal/map --- a/mercurial/templates/coal/map +++ b/mercurial/templates/coal/map @@ -23,6 +23,11 @@ searchentry = ../paper/shortlogentry.tmp changeset = ../paper/changeset.tmpl manifest = ../paper/manifest.tmpl +nav = '{before%naventry} {after%naventry}' +navshort = '{before%navshortentry}{after%navshortentry}' +navgraph = '{before%navgraphentry}{after%navgraphentry}' +filenav = '{before%filenaventry}{after%filenaventry}' + direntry = ' diff --git a/mercurial/templates/gitweb/changelog.tmpl b/mercurial/templates/gitweb/changelog.tmpl --- a/mercurial/templates/gitweb/changelog.tmpl +++ b/mercurial/templates/gitweb/changelog.tmpl @@ -27,13 +27,13 @@ changelog | branches | files{archives%archiveentry}
-{changenav%naventry}
+{changenav%nav}
{entries%changelogentry} {footer} diff --git a/mercurial/templates/gitweb/filelog.tmpl b/mercurial/templates/gitweb/filelog.tmpl --- a/mercurial/templates/gitweb/filelog.tmpl +++ b/mercurial/templates/gitweb/filelog.tmpl @@ -24,7 +24,7 @@ revisions | diff | rss
-{nav%filenaventry} +{nav%filenav}
{file|urlescape}
@@ -34,7 +34,7 @@ revisions | {footer} diff --git a/mercurial/templates/gitweb/graph.tmpl b/mercurial/templates/gitweb/graph.tmpl --- a/mercurial/templates/gitweb/graph.tmpl +++ b/mercurial/templates/gitweb/graph.tmpl @@ -29,7 +29,7 @@ graph |
less more -| {changenav%navgraphentry}
+| {changenav%navgraph}
 
@@ -115,7 +115,7 @@ graph.render(data); {footer} diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map --- a/mercurial/templates/gitweb/map +++ b/mercurial/templates/gitweb/map @@ -34,6 +34,12 @@ filenolink = ' revisions ' + +nav = '{before%naventry} {after%naventry}' +navshort = '{before%navshortentry}{after%navshortentry}' +navgraph = '{before%navgraphentry}{after%navgraphentry}' +filenav = '{before%filenaventry}{after%filenaventry}' + fileellipses = '...' changelogentry = changelogentry.tmpl searchentry = changelogentry.tmpl diff --git a/mercurial/templates/gitweb/shortlog.tmpl b/mercurial/templates/gitweb/shortlog.tmpl --- a/mercurial/templates/gitweb/shortlog.tmpl +++ b/mercurial/templates/gitweb/shortlog.tmpl @@ -25,8 +25,7 @@ shortlog | tags | branches | files{archives%archiveentry} -
-{changenav%navshortentry}
+
{changenav%navshort}
 
@@ -35,7 +34,7 @@ shortlog | {footer} diff --git a/mercurial/templates/monoblue/changelog.tmpl b/mercurial/templates/monoblue/changelog.tmpl --- a/mercurial/templates/monoblue/changelog.tmpl +++ b/mercurial/templates/monoblue/changelog.tmpl @@ -34,7 +34,7 @@
-{changenav%naventry} +{changenav%nav}
{footer} diff --git a/mercurial/templates/monoblue/filelog.tmpl b/mercurial/templates/monoblue/filelog.tmpl --- a/mercurial/templates/monoblue/filelog.tmpl +++ b/mercurial/templates/monoblue/filelog.tmpl @@ -43,7 +43,7 @@
- {nav%filenaventry} + {nav%filenav}
{footer} diff --git a/mercurial/templates/monoblue/graph.tmpl b/mercurial/templates/monoblue/graph.tmpl --- a/mercurial/templates/monoblue/graph.tmpl +++ b/mercurial/templates/monoblue/graph.tmpl @@ -112,7 +112,7 @@
less more - | {changenav%navgraphentry} + | {changenav%navgraph}
{footer} diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map --- a/mercurial/templates/monoblue/map +++ b/mercurial/templates/monoblue/map @@ -32,6 +32,12 @@ filenolink = ' revisions ' + +nav = '{before%naventry} {after%naventry}' +navshort = '{before%navshortentry}{after%navshortentry}' +navgraph = '{before%navgraphentry}{after%navgraphentry}' +filenav = '{before%filenaventry}{after%filenaventry}' + fileellipses = '...' changelogentry = changelogentry.tmpl searchentry = changelogentry.tmpl diff --git a/mercurial/templates/monoblue/shortlog.tmpl b/mercurial/templates/monoblue/shortlog.tmpl --- a/mercurial/templates/monoblue/shortlog.tmpl +++ b/mercurial/templates/monoblue/shortlog.tmpl @@ -35,7 +35,7 @@
-{changenav%navshortentry} + {changenav%navshort}
{footer} diff --git a/mercurial/templates/paper/filelog.tmpl b/mercurial/templates/paper/filelog.tmpl --- a/mercurial/templates/paper/filelog.tmpl +++ b/mercurial/templates/paper/filelog.tmpl @@ -46,7 +46,7 @@ files, or words in the commit message less more -| {nav%filenaventry} +| {nav%filenav} @@ -60,7 +60,7 @@ files, or words in the commit messagelessmore -| {nav%filenaventry} +| {nav%filenav} diff --git a/mercurial/templates/paper/graph.tmpl b/mercurial/templates/paper/graph.tmpl --- a/mercurial/templates/paper/graph.tmpl +++ b/mercurial/templates/paper/graph.tmpl @@ -40,7 +40,7 @@ files, or words in the commit messagelessmore -| rev {rev}: {changenav%navgraphentry} +| rev {rev}: {changenav%navgraph} @@ -123,7 +123,7 @@ graph.render(data); diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map --- a/mercurial/templates/paper/map +++ b/mercurial/templates/paper/map @@ -23,6 +23,11 @@ searchentry = shortlogentry.tmpl changeset = changeset.tmpl manifest = manifest.tmpl +nav = '{before%naventry} {after%naventry}' +navshort = '{before%navshortentry}{after%navshortentry}' +navgraph = '{before%navgraphentry}{after%navgraphentry}' +filenav = '{before%filenaventry}{after%filenaventry}' + direntry = '
diff --git a/mercurial/templates/paper/shortlog.tmpl b/mercurial/templates/paper/shortlog.tmpl --- a/mercurial/templates/paper/shortlog.tmpl +++ b/mercurial/templates/paper/shortlog.tmpl @@ -42,7 +42,7 @@ files, or words in the commit message less more -| rev {rev}: {changenav%navshortentry} +| rev {rev}: {changenav%navshort} @@ -57,7 +57,7 @@ files, or words in the commit messagelessmore -| rev {rev}: {changenav%navshortentry} +| rev {rev}: {changenav%navshort} diff --git a/mercurial/templates/spartan/changelog.tmpl b/mercurial/templates/spartan/changelog.tmpl --- a/mercurial/templates/spartan/changelog.tmpl +++ b/mercurial/templates/spartan/changelog.tmpl @@ -25,7 +25,7 @@

-navigate: {changenav%naventry} +navigate: {changenav%nav}

@@ -36,7 +36,7 @@ navigate: {chang

-navigate: {changenav%naventry} +navigate: {changenav%nav}

diff --git a/mercurial/templates/spartan/filelog.tmpl b/mercurial/templates/spartan/filelog.tmpl --- a/mercurial/templates/spartan/filelog.tmpl +++ b/mercurial/templates/spartan/filelog.tmpl @@ -21,7 +21,7 @@

{file|escape} revision history

-

navigate: {nav%filenaventry}

+

navigate: {nav%filenav}

{entries%filelogentry} diff --git a/mercurial/templates/spartan/graph.tmpl b/mercurial/templates/spartan/graph.tmpl --- a/mercurial/templates/spartan/graph.tmpl +++ b/mercurial/templates/spartan/graph.tmpl @@ -23,7 +23,7 @@

-navigate: {changenav%navgraphentry} +navigate: {changenav%navgraph}

@@ -89,7 +89,7 @@ graph.render(data);

-navigate: {changenav%navgraphentry} +navigate: {changenav%navgraph}

diff --git a/mercurial/templates/spartan/map b/mercurial/templates/spartan/map --- a/mercurial/templates/spartan/map +++ b/mercurial/templates/spartan/map @@ -20,6 +20,11 @@ searchentry = changelogentry.tmpl changeset = changeset.tmpl manifest = manifest.tmpl +nav = '{before%naventry} {after%naventry}' +navshort = '{before%navshortentry}{after%navshortentry}' +navgraph = '{before%navgraphentry}{after%navgraphentry}' +filenav = '{before%filenaventry}{after%filenaventry}' + direntry = '
drwxr-xr-x  diff --git a/mercurial/templates/spartan/shortlog.tmpl b/mercurial/templates/spartan/shortlog.tmpl --- a/mercurial/templates/spartan/shortlog.tmpl +++ b/mercurial/templates/spartan/shortlog.tmpl @@ -25,7 +25,7 @@

-navigate: {changenav%navshortentry} +navigate: {changenav%navshort}

@@ -36,7 +36,7 @@ navigate: {chang

-navigate: {changenav%navshortentry} +navigate: {changenav%navshort}