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 @@ -292,6 +292,12 @@ class hgwebdir(object): # 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('/')) diff --git a/tests/test-hgwebdir.t b/tests/test-hgwebdir.t --- a/tests/test-hgwebdir.t +++ b/tests/test-hgwebdir.t @@ -944,6 +944,25 @@ Test collapse = True Test intermediate directories +Hide the subrepo parent + + $ cp $root/notrepo/f/.hg/hgrc $root/notrepo/f/.hg/hgrc.bak + $ cat >> $root/notrepo/f/.hg/hgrc << EOF + > [web] + > hidden = True + > EOF + + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/?style=raw' + 200 Script output follows + + + /rcoll/notrepo/e/ + /rcoll/notrepo/e/e2/ + + +Subrepo parent not hidden + $ mv $root/notrepo/f/.hg/hgrc.bak $root/notrepo/f/.hg/hgrc + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/?style=raw' 200 Script output follows