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,7 +24,7 @@ perms = { 'pushkey': 'push', } -def makebreadcrumb(url): +def makebreadcrumb(url, prefix=''): '''Return a 'URL breadcrumb' list A 'URL breadcrumb' is a list of URL-name pairs, @@ -33,6 +33,8 @@ def makebreadcrumb(url): ''' if url.endswith('/'): url = url[:-1] + if prefix: + url = '/' + prefix + url relpath = url if relpath.startswith('/'): relpath = relpath[1:] 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 @@ -133,6 +133,12 @@ class hgwebdir(object): if self.stripecount: self.stripecount = int(self.stripecount) self._baseurl = self.ui.config('web', 'baseurl') + prefix = self.ui.config('web', 'prefix', '') + if prefix.startswith('/'): + prefix = prefix[1:] + if prefix.endswith('/'): + prefix = prefix[:-1] + self.prefix = prefix self.lastrefresh = time.time() def run(self): @@ -395,7 +401,7 @@ class hgwebdir(object): self.updatereqenv(req.env) return tmpl("index", entries=entries, subdir=subdir, - pathdef=makebreadcrumb('/' + subdir), + pathdef=makebreadcrumb('/' + subdir, self.prefix), sortcolumn=sortcolumn, descending=descending, **dict(sort))