comparison mercurial/wireprotov2server.py @ 41840:d6569f1e9b37

server: allow customizing the default repo filter hgweb has the (undocument) configuration option web.view that allows restricting visible revisions to immutable. This is useful for serving the same storage as publishing and non-publishing repo. Add the new server.view option to serve the same purpose by changing the default behavior of `getdispatchrepo`. Drop the hard-coded 'served' filter in the batch handler of v1 of the wire proto, this is a left-over from the days before `getdispatchrepo` existed. Differential Revision: https://phab.mercurial-scm.org/D5946
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 12 Feb 2019 19:08:17 +0100
parents e82288a9556c
children da643cadec90
comparison
equal deleted inserted replaced
41839:38de3300414f 41840:d6569f1e9b37
340 else: 340 else:
341 raise error.ProgrammingError('unhandled event from reactor: %s' % 341 raise error.ProgrammingError('unhandled event from reactor: %s' %
342 action) 342 action)
343 343
344 def getdispatchrepo(repo, proto, command): 344 def getdispatchrepo(repo, proto, command):
345 return repo.filtered('served') 345 viewconfig = repo.ui.config('server', 'view')
346 return repo.filtered(viewconfig)
346 347
347 def dispatch(repo, proto, command, redirect): 348 def dispatch(repo, proto, command, redirect):
348 """Run a wire protocol command. 349 """Run a wire protocol command.
349 350
350 Returns an iterable of objects that will be sent to the client. 351 Returns an iterable of objects that will be sent to the client.