comparison mercurial/hgweb/hgweb_mod.py @ 50436:4077d6222cf1

hgweb: add support to explicitly access hidden changesets This changeset adds a "global" `access-hidden` argument to hgweb. This argument lift the "hidden" filtering. This means the request has access to hidden (eg: obsolete) changesets. Secret changesets remains filtered. This feature has multiple applications. The first main use case is to allow the hgweb interface to display more obsolescence related data, such as the Anton Shestakov work to add `obslog` support to hgweb. The second foreseen usecase is support for a `--remote-hidden` argument to `hg pull` and `hg clone`. This flag will make it possible to retrieve hidden (typically obsolete) changeset under some conditions. This is useful when digging up obsolescence history or when doing full mirroring. More on this feature coming in later changesets. To avoid exposing information by mistake, access to this feature is currently controlled with the `experimental.server.allow-hidden-access` config option. The option works the same way as `web.allow-push`. The current default is to not allow any hidden access. However we might change it before the feature stop being experimental.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 13 Apr 2019 01:17:56 +0200
parents fda5a4b853ab
children 3b642b384b14
comparison
equal deleted inserted replaced
50435:3973b1dc3ee3 50436:4077d6222cf1
37 util, 37 util,
38 wireprotoserver, 38 wireprotoserver,
39 ) 39 )
40 40
41 from . import ( 41 from . import (
42 common,
42 request as requestmod, 43 request as requestmod,
43 webcommands, 44 webcommands,
44 webutil, 45 webutil,
45 wsgicgi, 46 wsgicgi,
46 ) 47 )
121 def __init__(self, app, repo, req, res): 122 def __init__(self, app, repo, req, res):
122 self.repo = repo 123 self.repo = repo
123 self.reponame = app.reponame 124 self.reponame = app.reponame
124 self.req = req 125 self.req = req
125 self.res = res 126 self.res = res
127
128 # Only works if the filter actually support being upgraded to show
129 # visible changesets
130 current_filter = repo.filtername
131 if (
132 common.hashiddenaccess(repo, req)
133 and current_filter is not None
134 and current_filter + b'.hidden' in repoview.filtertable
135 ):
136 self.repo = self.repo.filtered(repo.filtername + b'.hidden')
126 137
127 self.maxchanges = self.configint(b'web', b'maxchanges') 138 self.maxchanges = self.configint(b'web', b'maxchanges')
128 self.stripecount = self.configint(b'web', b'stripes') 139 self.stripecount = self.configint(b'web', b'stripes')
129 self.maxshortchanges = self.configint(b'web', b'maxshortchanges') 140 self.maxshortchanges = self.configint(b'web', b'maxshortchanges')
130 self.maxfiles = self.configint(b'web', b'maxfiles') 141 self.maxfiles = self.configint(b'web', b'maxfiles')