diff mercurial/hgweb/hgwebdir_mod.py @ 25426:5f3666da6910 stable

hgwebdir: don't allow the hidden parent of a subrepo to show as a directory Previously, if a subrepo parent had 'web.hidden=True' set, neither the parent nor child had a repository entry. However, the directory entry for the parent would be listed (it wouldn't have the fancy 'web.name' if configured), and that link went to the repo's summary page, effectively making it not hidden. This simply disables the directory processing if a valid repository is present. Whether or not the subrepo should be hidden is debatable, but this leaves that behavior unchanged (i.e. it stays hidden).
author Matt Harbison <mharbison@attotech.com>
date Mon, 01 Jun 2015 18:06:20 -0400
parents 78e8890cfb4b
children d0c7ffc4c8bc
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Wed Jun 03 14:29:11 2015 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Mon Jun 01 18:06:20 2015 -0400
@@ -292,6 +292,12 @@
                         # remove name parts plus accompanying slash
                         path = path[:-len(discarded) - 1]
 
+                        try:
+                            r = hg.repository(self.ui, path)
+                            directory = False
+                        except (IOError, error.RepoError):
+                            pass
+
                 parts = [name]
                 if 'PATH_INFO' in req.env:
                     parts.insert(0, req.env['PATH_INFO'].rstrip('/'))