diff 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
line wrap: on
line diff
--- a/mercurial/wireprotov2server.py	Thu Aug 30 17:43:47 2018 -0700
+++ b/mercurial/wireprotov2server.py	Mon Sep 17 09:49:28 2018 -0700
@@ -20,6 +20,7 @@
     discovery,
     encoding,
     error,
+    narrowspec,
     pycompat,
     streamclone,
     util,
@@ -429,6 +430,7 @@
         'commands': {},
         'compression': compression,
         'framingmediatypes': [FRAMINGTYPE],
+        'pathfilterprefixes': set(narrowspec.VALID_PREFIXES),
     }
 
     # TODO expose available changesetdata fields.