mercurial/bundle2.py
changeset 35790 c1b9eb15a51c
parent 35788 b116a66bcc44
child 35792 1d118f9f4f57
--- a/mercurial/bundle2.py	Mon Jan 22 12:19:45 2018 -0800
+++ b/mercurial/bundle2.py	Mon Jan 22 12:21:15 2018 -0800
@@ -1519,8 +1519,20 @@
         caps['checkheads'] = ('related',)
     if 'phases' in repo.ui.configlist('devel', 'legacy.exchange'):
         caps.pop('phases')
-    if not repo.ui.configbool('experimental', 'bundle2.stream'):
-        caps.pop('stream')
+
+    # Don't advertise stream clone support in server mode if not configured.
+    if role == 'server':
+        streamsupported = repo.ui.configbool('server', 'uncompressed',
+                                             untrusted=True)
+        featuresupported = repo.ui.configbool('experimental', 'bundle2.stream')
+
+        if not streamsupported or not featuresupported:
+            caps.pop('stream')
+    # role == 'client'
+    else:
+        if not repo.ui.configbool('experimental', 'bundle2.stream'):
+            caps.pop('stream')
+
     return caps
 
 def bundle2caps(remote):