changeset 6563:bdc8978232de

topic: copy experimental.tns-default-pull-namespaces to remote peer ui This is required to be able to reach this config option when it's set in a hgrc as opposed to be given with the --config CLI flag.
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 09 Oct 2023 15:06:26 -0300
parents 703911d39f7a
children 2d3771d61068
files hgext3rd/topic/discovery.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py	Sat Sep 30 13:59:18 2023 -0300
+++ b/hgext3rd/topic/discovery.py	Mon Oct 09 15:06:26 2023 -0300
@@ -354,6 +354,17 @@
         # to do the conversion
         return orig(self, rev, **kwargs)
 
+def wraphgremoteui(orig, src, opts):
+    """hg.remoteui() that copies tns-related config options to peer ui"""
+    dst = orig(src, opts)
+    if util.safehasattr(src, 'baseui'):  # looks like a repository
+        src = src.ui
+    # we need to copy topic namespaces from local config to peer ui, since it
+    # needs to be accessible for peer command executors
+    namespaces = src.configlist(b'experimental', b'tns-default-pull-namespaces', [b'*'])
+    dst.setconfig(b'experimental', b'tns-default-pull-namespaces', namespaces, b'copied')
+    return dst
+
 def modsetup(ui):
     """run at uisetup time to install all destinations wrapping"""
     extensions.wrapfunction(discovery, '_headssummary', _headssummary)
@@ -378,3 +389,4 @@
         bundle2.parthandlermapping[b'check:updated-heads'] = bundle2.handlecheckupdatedheads
     extensions.wrapfunction(exchange, '_pushb2phases', _pushb2phases)
     exchange.b2partsgenmapping[b'phase'] = exchange._pushb2phases
+    extensions.wrapfunction(hg, 'remoteui', wraphgremoteui)