Mercurial > hg
comparison mercurial/narrowspec.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 | c8ea5c7ec99d |
children | efd0f79246e3 |
comparison
equal
deleted
inserted
replaced
39810:0b61d21f05cc | 39811:ae20f52437e9 |
---|---|
21 FILENAME = 'narrowspec' | 21 FILENAME = 'narrowspec' |
22 | 22 |
23 # Pattern prefixes that are allowed in narrow patterns. This list MUST | 23 # Pattern prefixes that are allowed in narrow patterns. This list MUST |
24 # only contain patterns that are fast and safe to evaluate. Keep in mind | 24 # only contain patterns that are fast and safe to evaluate. Keep in mind |
25 # that patterns are supplied by clients and executed on remote servers | 25 # that patterns are supplied by clients and executed on remote servers |
26 # as part of wire protocol commands. | 26 # as part of wire protocol commands. That means that changes to this |
27 # data structure influence the wire protocol and should not be taken | |
28 # lightly - especially removals. | |
27 VALID_PREFIXES = ( | 29 VALID_PREFIXES = ( |
28 b'path:', | 30 b'path:', |
29 b'rootfilesin:', | 31 b'rootfilesin:', |
30 ) | 32 ) |
31 | 33 |