diff mercurial/wireprotov2server.py @ 37657:23c4ddda7bbe

wireproto: expose repository formats via capabilities Servers need to expose their set of repository storage requirements in order to facilitate streaming clones (clients need to know if they are capable of reading the raw storage files that the server exposes). Differential Revision: https://phab.mercurial-scm.org/D3335
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 13 Apr 2018 12:50:47 -0700
parents b2fa1591fb44
children 89a16704114c
line wrap: on
line diff
--- a/mercurial/wireprotov2server.py	Fri Apr 13 12:49:47 2018 -0700
+++ b/mercurial/wireprotov2server.py	Fri Apr 13 12:50:47 2018 -0700
@@ -19,6 +19,7 @@
     encoding,
     error,
     pycompat,
+    streamclone,
     util,
     wireproto,
     wireprotoframing,
@@ -394,6 +395,10 @@
             'permissions': [entry.permission],
         }
 
+    if streamclone.allowservergeneration(repo):
+        caps['rawrepoformats'] = sorted(repo.requirements &
+                                        repo.supportedformats)
+
     return proto.addcapabilities(repo, caps)
 
 def wireprotocommand(*args, **kwargs):