comparison mercurial/wireprotov2server.py @ 39811:ae20f52437e9

wireprotov2: advertise recognized path filter prefixes While the wire protocol doesn't yet support it, we'll eventually have commands that accept narrow patterns to specify the set of files relevant to a command. For security and performance reasons, only specific filter types are allowed. This commit teaches the server to advertise the set of allowed filter types. By doing so, clients can e.g. validate user-specified patterns against the server's abilities without having to send a command to retrieve data. Having the data in the capabilities data structure will also serve as a check against unwanted BC. Differential Revision: https://phab.mercurial-scm.org/D4616
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 17 Sep 2018 09:49:28 -0700
parents 0b61d21f05cc
children 8e7e822e85ec
comparison
equal deleted inserted replaced
39810:0b61d21f05cc 39811:ae20f52437e9
18 changegroup, 18 changegroup,
19 dagop, 19 dagop,
20 discovery, 20 discovery,
21 encoding, 21 encoding,
22 error, 22 error,
23 narrowspec,
23 pycompat, 24 pycompat,
24 streamclone, 25 streamclone,
25 util, 26 util,
26 wireprotoframing, 27 wireprotoframing,
27 wireprototypes, 28 wireprototypes,
427 428
428 caps = { 429 caps = {
429 'commands': {}, 430 'commands': {},
430 'compression': compression, 431 'compression': compression,
431 'framingmediatypes': [FRAMINGTYPE], 432 'framingmediatypes': [FRAMINGTYPE],
433 'pathfilterprefixes': set(narrowspec.VALID_PREFIXES),
432 } 434 }
433 435
434 # TODO expose available changesetdata fields. 436 # TODO expose available changesetdata fields.
435 437
436 for command, entry in COMMANDS.items(): 438 for command, entry in COMMANDS.items():