Patchwork [1,of,3,V3] hgweb: add a "URL breadcrumb" to the index and repository pages

login
register
mail settings
Submitter Angel Ezquerra
Date Dec. 21, 2012, 1:44 a.m.
Message ID <b21011213cfbb798edfe.1356054257@Angel-PC.localdomain>
Download mbox | patch
Permalink /patch/233/
State Superseded
Headers show

Comments

Angel Ezquerra - Dec. 21, 2012, 1:44 a.m.
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1354130486 -3600
# Node ID b21011213cfbb798edfe744aaa76db26745b5dc4
# Parent  47454b8cdde32bd33f325aae8a22226ccfc50cc7
hgweb: add a "URL breadcrumb" to the index and repository pages

The purpose of this change is to make it much easier to navigate up the
repository tree when the hg web server is used to serve more than one
repository.

A "URL breadcrumb" is a path where each of the path items can be clicked to go
to the corresponding path page.

This lets you go up the folder hierarchy very quickly. For example, when showing
the list of repositories in http://myserver/myteams/myprojects, the following
"breadcrumb" will be shown:

> Mercurial > myteams > myprojects

Clicking on "myprojects" reloads the page. Clicking on "myteams" goes up one
folder. Clicking on the leftmost "Mercurial" goes to the server root.

This "breadcrumb" also appears on all repository pages. For example on the
summary page of the repository at http://myserver/myteams/myprojects/myrepo the
following will be shown:

Mercurial > myteams > myprojects > myrepo / summary

This change has been applied to all templates that already had a link to the
main repository page (i.e. gitweb, monoblue, paper and coal) plus to the index
page of the spartan template.

In order to make the breadcumb links stand out the some of the template styles
have been customized.

Patch

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -24,6 +24,36 @@ 
     'pushkey': 'push',
 }
 
+def makebreadcrumb(url, relpath=None, sep=' > '):
+    '''Return a 'URL breadcrumb' list
+
+    A 'URL breadcrumb' is a list of URL-name pairs,
+    corresponding to each of the path items on a URL.
+    This can be used to create path navigation entries.
+    '''
+    if url and url[-1] == '/':
+        url = url[:-1]
+    if not relpath:
+        relpath = url
+    if relpath and relpath[-1] == '/':
+        relpath = relpath[:-1]
+    if relpath and relpath[0] == '/':
+        relpath = relpath[1:]
+
+    breadcrumb = []
+    urlel = url
+    pathitems = ['Mercurial'] + relpath.split('/')
+
+    for pathel in reversed(pathitems):        
+        if pathel != '/' and breadcrumb:
+            pass #pathel += sep
+        breadcrumb.append({'url': urlel, 'name': pathel})
+        urlel = os.path.dirname(urlel)
+        if not urlel:
+            break
+    return reversed(breadcrumb)
+
+
 class hgweb(object):
     def __init__(self, repo, name=None, baseui=None):
         if isinstance(repo, str):
@@ -275,6 +305,15 @@ 
 
         # create the templater
 
+        relpath = req.url
+        if relpath and relpath[-1] == '/':
+            relpath = relpath[:-1]
+        if relpath and relpath[0] == '/':
+            relpath = relpath[1:]
+        plainurl = req.url
+        if plainurl and plainurl[-1] == '/':
+            plainurl = plainurl[:-1]
+        
         tmpl = templater.templater(mapfile,
                                    defaults={"url": req.url,
                                              "logourl": logourl,
@@ -285,7 +324,8 @@ 
                                              "header": header,
                                              "footer": footer,
                                              "motd": motd,
-                                             "sessionvars": sessionvars
+                                             "sessionvars": sessionvars,
+                                             "pathdef": makebreadcrumb(req.url, req.url),
                                             })
         return tmpl
 
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -12,7 +12,7 @@ 
 from mercurial import error, encoding
 from common import ErrorResponse, get_mtime, staticfile, paritygen, \
                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
-from hgweb_mod import hgweb
+from hgweb_mod import hgweb, makebreadcrumb
 from request import wsgirequest
 import webutil
 
@@ -389,6 +389,7 @@ 
         self.updatereqenv(req.env)
 
         return tmpl("index", entries=entries, subdir=subdir,
+                    pathdef=makebreadcrumb('/' + subdir),
                     sortcolumn=sortcolumn, descending=descending,
                     **dict(sort))
 
diff --git a/mercurial/templates/coal/map b/mercurial/templates/coal/map
--- a/mercurial/templates/coal/map
+++ b/mercurial/templates/coal/map
@@ -223,3 +223,4 @@ 
 error = ../paper/error.tmpl
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
+breadcrumb = '> <a href="{url}">{name}</a> '
diff --git a/mercurial/templates/gitweb/bookmarks.tmpl b/mercurial/templates/gitweb/bookmarks.tmpl
--- a/mercurial/templates/gitweb/bookmarks.tmpl
+++ b/mercurial/templates/gitweb/bookmarks.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / bookmarks
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / bookmarks
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/branches.tmpl b/mercurial/templates/gitweb/branches.tmpl
--- a/mercurial/templates/gitweb/branches.tmpl
+++ b/mercurial/templates/gitweb/branches.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / branches
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / branches
 </div>
 
 <div class="page_nav">
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
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / changelog
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / changelog
 </div>
 
 <form action="{url}log">
diff --git a/mercurial/templates/gitweb/changeset.tmpl b/mercurial/templates/gitweb/changeset.tmpl
--- a/mercurial/templates/gitweb/changeset.tmpl
+++ b/mercurial/templates/gitweb/changeset.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / changeset
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / changeset
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/error.tmpl b/mercurial/templates/gitweb/error.tmpl
--- a/mercurial/templates/gitweb/error.tmpl
+++ b/mercurial/templates/gitweb/error.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / error
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / error
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/fileannotate.tmpl b/mercurial/templates/gitweb/fileannotate.tmpl
--- a/mercurial/templates/gitweb/fileannotate.tmpl
+++ b/mercurial/templates/gitweb/fileannotate.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / annotate
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / annotate
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/filecomparison.tmpl b/mercurial/templates/gitweb/filecomparison.tmpl
--- a/mercurial/templates/gitweb/filecomparison.tmpl
+++ b/mercurial/templates/gitweb/filecomparison.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / comparison
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / comparison
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/filediff.tmpl b/mercurial/templates/gitweb/filediff.tmpl
--- a/mercurial/templates/gitweb/filediff.tmpl
+++ b/mercurial/templates/gitweb/filediff.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / diff
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / diff
 </div>
 
 <div class="page_nav">
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
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file revisions
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / file revisions
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/filerevision.tmpl b/mercurial/templates/gitweb/filerevision.tmpl
--- a/mercurial/templates/gitweb/filerevision.tmpl
+++ b/mercurial/templates/gitweb/filerevision.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file revision
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / file revision
 </div>
 
 <div class="page_nav">
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
@@ -9,7 +9,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / graph
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / graph
 </div>
 
 <form action="{url}log">
diff --git a/mercurial/templates/gitweb/help.tmpl b/mercurial/templates/gitweb/help.tmpl
--- a/mercurial/templates/gitweb/help.tmpl
+++ b/mercurial/templates/gitweb/help.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / help
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / help
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/helptopics.tmpl b/mercurial/templates/gitweb/helptopics.tmpl
--- a/mercurial/templates/gitweb/helptopics.tmpl
+++ b/mercurial/templates/gitweb/helptopics.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / help
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / help
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/index.tmpl b/mercurial/templates/gitweb/index.tmpl
--- a/mercurial/templates/gitweb/index.tmpl
+++ b/mercurial/templates/gitweb/index.tmpl
@@ -5,7 +5,7 @@ 
 
 <div class="page_header">
     <a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
-    Repositories list
+    {pathdef%breadcrumb}
 </div>
 
 <table cellspacing="0">
diff --git a/mercurial/templates/gitweb/manifest.tmpl b/mercurial/templates/gitweb/manifest.tmpl
--- a/mercurial/templates/gitweb/manifest.tmpl
+++ b/mercurial/templates/gitweb/manifest.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / files
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / files
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -305,3 +305,4 @@ 
 index = index.tmpl
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
+breadcrumb = '> <a href="{url}">{name}</a> '
diff --git a/mercurial/templates/gitweb/search.tmpl b/mercurial/templates/gitweb/search.tmpl
--- a/mercurial/templates/gitweb/search.tmpl
+++ b/mercurial/templates/gitweb/search.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / search
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / search
 
 <form action="{url}log">
 {sessionvars%hiddenformentry}
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
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / shortlog
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / shortlog
 </div>
 
 <form action="{url}log">
diff --git a/mercurial/templates/gitweb/summary.tmpl b/mercurial/templates/gitweb/summary.tmpl
--- a/mercurial/templates/gitweb/summary.tmpl
+++ b/mercurial/templates/gitweb/summary.tmpl
@@ -8,8 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / summary
-
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / summary
 <form action="{url}log">
 {sessionvars%hiddenformentry}
 <div class="search">
diff --git a/mercurial/templates/gitweb/tags.tmpl b/mercurial/templates/gitweb/tags.tmpl
--- a/mercurial/templates/gitweb/tags.tmpl
+++ b/mercurial/templates/gitweb/tags.tmpl
@@ -8,7 +8,8 @@ 
 <body>
 
 <div class="page_header">
-<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / tags
+<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
+{pathdef%breadcrumb} / tags
 </div>
 
 <div class="page_nav">
diff --git a/mercurial/templates/monoblue/bookmarks.tmpl b/mercurial/templates/monoblue/bookmarks.tmpl
--- a/mercurial/templates/monoblue/bookmarks.tmpl
+++ b/mercurial/templates/monoblue/bookmarks.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / bookmarks</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / bookmarks</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/branches.tmpl b/mercurial/templates/monoblue/branches.tmpl
--- a/mercurial/templates/monoblue/branches.tmpl
+++ b/mercurial/templates/monoblue/branches.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / branches</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / branches</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
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
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / changelog</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / changelog</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/changeset.tmpl b/mercurial/templates/monoblue/changeset.tmpl
--- a/mercurial/templates/monoblue/changeset.tmpl
+++ b/mercurial/templates/monoblue/changeset.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / changeset</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / changeset</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/error.tmpl b/mercurial/templates/monoblue/error.tmpl
--- a/mercurial/templates/monoblue/error.tmpl
+++ b/mercurial/templates/monoblue/error.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / not found: {repo|escape}</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / not found: {repo|escape}</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/fileannotate.tmpl b/mercurial/templates/monoblue/fileannotate.tmpl
--- a/mercurial/templates/monoblue/fileannotate.tmpl
+++ b/mercurial/templates/monoblue/fileannotate.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / annotate</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / annotate</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/filecomparison.tmpl b/mercurial/templates/monoblue/filecomparison.tmpl
--- a/mercurial/templates/monoblue/filecomparison.tmpl
+++ b/mercurial/templates/monoblue/filecomparison.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file comparison</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / file comparison</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/filediff.tmpl b/mercurial/templates/monoblue/filediff.tmpl
--- a/mercurial/templates/monoblue/filediff.tmpl
+++ b/mercurial/templates/monoblue/filediff.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file diff</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / file diff</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
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
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file revisions</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / file revisions</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/filerevision.tmpl b/mercurial/templates/monoblue/filerevision.tmpl
--- a/mercurial/templates/monoblue/filerevision.tmpl
+++ b/mercurial/templates/monoblue/filerevision.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file revision</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / file revision</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
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
@@ -8,7 +8,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / graph</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / graph</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/help.tmpl b/mercurial/templates/monoblue/help.tmpl
--- a/mercurial/templates/monoblue/help.tmpl
+++ b/mercurial/templates/monoblue/help.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / help</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / help</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/helptopics.tmpl b/mercurial/templates/monoblue/helptopics.tmpl
--- a/mercurial/templates/monoblue/helptopics.tmpl
+++ b/mercurial/templates/monoblue/helptopics.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / help</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / help</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/index.tmpl b/mercurial/templates/monoblue/index.tmpl
--- a/mercurial/templates/monoblue/index.tmpl
+++ b/mercurial/templates/monoblue/index.tmpl
@@ -5,7 +5,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1>Mercurial Repositories</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb}</h1>
         <ul class="page-nav">
         </ul>
     </div>
diff --git a/mercurial/templates/monoblue/manifest.tmpl b/mercurial/templates/monoblue/manifest.tmpl
--- a/mercurial/templates/monoblue/manifest.tmpl
+++ b/mercurial/templates/monoblue/manifest.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / files</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / files</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -259,3 +259,4 @@ 
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
 graph = graph.tmpl
+breadcrumb = '> <a href="{url}">{name}</a> '
diff --git a/mercurial/templates/monoblue/notfound.tmpl b/mercurial/templates/monoblue/notfound.tmpl
--- a/mercurial/templates/monoblue/notfound.tmpl
+++ b/mercurial/templates/monoblue/notfound.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / not found: {repo|escape}</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / not found: {repo|escape}</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/search.tmpl b/mercurial/templates/monoblue/search.tmpl
--- a/mercurial/templates/monoblue/search.tmpl
+++ b/mercurial/templates/monoblue/search.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / search</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / search</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
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
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / shortlog</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / shortlog</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/summary.tmpl b/mercurial/templates/monoblue/summary.tmpl
--- a/mercurial/templates/monoblue/summary.tmpl
+++ b/mercurial/templates/monoblue/summary.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / summary</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / summary</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/monoblue/tags.tmpl b/mercurial/templates/monoblue/tags.tmpl
--- a/mercurial/templates/monoblue/tags.tmpl
+++ b/mercurial/templates/monoblue/tags.tmpl
@@ -7,7 +7,7 @@ 
 <body>
 <div id="container">
     <div class="page-header">
-        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / tags</h1>
+        <h1 class="breadcrumb">{pathdef%breadcrumb} / tags</h1>
 
         <form action="{url}log">
             {sessionvars%hiddenformentry}
diff --git a/mercurial/templates/paper/bookmarks.tmpl b/mercurial/templates/paper/bookmarks.tmpl
--- a/mercurial/templates/paper/bookmarks.tmpl
+++ b/mercurial/templates/paper/bookmarks.tmpl
@@ -32,7 +32,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>bookmarks</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/branches.tmpl b/mercurial/templates/paper/branches.tmpl
--- a/mercurial/templates/paper/branches.tmpl
+++ b/mercurial/templates/paper/branches.tmpl
@@ -32,7 +32,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>branches</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/changeset.tmpl b/mercurial/templates/paper/changeset.tmpl
--- a/mercurial/templates/paper/changeset.tmpl
+++ b/mercurial/templates/paper/changeset.tmpl
@@ -30,7 +30,7 @@ 
 
 <div class="main">
 
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag} {changesetbookmark}</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/error.tmpl b/mercurial/templates/paper/error.tmpl
--- a/mercurial/templates/paper/error.tmpl
+++ b/mercurial/templates/paper/error.tmpl
@@ -23,7 +23,7 @@ 
 
 <div class="main">
 
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>error</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/fileannotate.tmpl b/mercurial/templates/paper/fileannotate.tmpl
--- a/mercurial/templates/paper/fileannotate.tmpl
+++ b/mercurial/templates/paper/fileannotate.tmpl
@@ -36,7 +36,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>annotate {file|escape} @ {rev}:{node|short}</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/filecomparison.tmpl b/mercurial/templates/paper/filecomparison.tmpl
--- a/mercurial/templates/paper/filecomparison.tmpl
+++ b/mercurial/templates/paper/filecomparison.tmpl
@@ -35,7 +35,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>comparison {file|escape} @ {rev}:{node|short}</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/filediff.tmpl b/mercurial/templates/paper/filediff.tmpl
--- a/mercurial/templates/paper/filediff.tmpl
+++ b/mercurial/templates/paper/filediff.tmpl
@@ -35,7 +35,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>diff {file|escape} @ {rev}:{node|short}</h3>
 
 <form class="search" action="{url}log">
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
@@ -43,7 +43,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>log {file|escape}</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/filerevision.tmpl b/mercurial/templates/paper/filerevision.tmpl
--- a/mercurial/templates/paper/filerevision.tmpl
+++ b/mercurial/templates/paper/filerevision.tmpl
@@ -34,7 +34,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>view {file|escape} @ {rev}:{node|short}</h3>
 
 <form class="search" action="{url}log">
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
@@ -37,7 +37,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>graph</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/help.tmpl b/mercurial/templates/paper/help.tmpl
--- a/mercurial/templates/paper/help.tmpl
+++ b/mercurial/templates/paper/help.tmpl
@@ -26,7 +26,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>Help: {topic}</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/helptopics.tmpl b/mercurial/templates/paper/helptopics.tmpl
--- a/mercurial/templates/paper/helptopics.tmpl
+++ b/mercurial/templates/paper/helptopics.tmpl
@@ -26,7 +26,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <form class="search" action="{url}log">
 {sessionvars%hiddenformentry}
 <p><input name="rev" id="search1" type="text" size="30" /></p>
diff --git a/mercurial/templates/paper/index.tmpl b/mercurial/templates/paper/index.tmpl
--- a/mercurial/templates/paper/index.tmpl
+++ b/mercurial/templates/paper/index.tmpl
@@ -9,7 +9,7 @@ 
 <img src="{staticurl}{logoimg}" width=75 height=90 border=0 alt="mercurial" /></a>
 </div>
 <div class="main">
-<h2>Mercurial Repositories</h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 
 <table class="bigtable">
     <tr>
diff --git a/mercurial/templates/paper/manifest.tmpl b/mercurial/templates/paper/manifest.tmpl
--- a/mercurial/templates/paper/manifest.tmpl
+++ b/mercurial/templates/paper/manifest.tmpl
@@ -29,7 +29,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>directory {path|escape} @ {rev}:{node|short} {tags%changelogtag}</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -231,3 +231,4 @@ 
 error = error.tmpl
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
+breadcrumb = '> <a href="{url}">{name}</a> '
diff --git a/mercurial/templates/paper/search.tmpl b/mercurial/templates/paper/search.tmpl
--- a/mercurial/templates/paper/search.tmpl
+++ b/mercurial/templates/paper/search.tmpl
@@ -20,7 +20,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>searching for '{query|escape}'</h3>
 
 <form class="search" action="{url}log">
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
@@ -39,7 +39,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>log</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/paper/tags.tmpl b/mercurial/templates/paper/tags.tmpl
--- a/mercurial/templates/paper/tags.tmpl
+++ b/mercurial/templates/paper/tags.tmpl
@@ -31,7 +31,7 @@ 
 </div>
 
 <div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h2 class="breadcrumb">{pathdef%breadcrumb}</h2>
 <h3>tags</h3>
 
 <form class="search" action="{url}log">
diff --git a/mercurial/templates/spartan/index.tmpl b/mercurial/templates/spartan/index.tmpl
--- a/mercurial/templates/spartan/index.tmpl
+++ b/mercurial/templates/spartan/index.tmpl
@@ -3,7 +3,7 @@ 
 </head>
 <body>
 
-<h2>Mercurial Repositories</h2>
+<h2>{pathdef%breadcrumb}</h2>
 
 <table>
     <tr>
diff --git a/mercurial/templates/spartan/map b/mercurial/templates/spartan/map
--- a/mercurial/templates/spartan/map
+++ b/mercurial/templates/spartan/map
@@ -181,3 +181,4 @@ 
 error = error.tmpl
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
+breadcrumb = '> <a href="{url}">{name}</a> '
diff --git a/mercurial/templates/static/style-coal.css b/mercurial/templates/static/style-coal.css
--- a/mercurial/templates/static/style-coal.css
+++ b/mercurial/templates/static/style-coal.css
@@ -323,3 +323,11 @@ 
 .block {
     border-top: 1px solid #999;
 }
+
+.breadcrumb {
+    color: gray;
+}
+
+.breadcrumb a {
+    color: blue;
+}
diff --git a/mercurial/templates/static/style-monoblue.css b/mercurial/templates/static/style-monoblue.css
--- a/mercurial/templates/static/style-monoblue.css
+++ b/mercurial/templates/static/style-monoblue.css
@@ -506,3 +506,7 @@ 
     border-top: 1px solid #999;
 }
 /** end of comparison **/
+
+.breadcrumb a:hover {
+    text-decoration:underline;
+}
diff --git a/mercurial/templates/static/style-paper.css b/mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css
+++ b/mercurial/templates/static/style-paper.css
@@ -318,3 +318,11 @@ 
 .block {
     border-top: 1px solid #999;
 }
+
+.breadcrumb {
+    color: gray;
+}
+
+.breadcrumb a {
+    color: blue;
+}