# HG changeset patch # User Danek Duvall # Date 2016-02-25 18:01:59 # Node ID 6d0d11731e1c9cf103703d9bbc0293b2d9893057 # Parent c16949fcb566619fa6f7f48f9be92527d9c3fa70 zeroconf: fix crash in "hg paths" when zeroconf server is up Running "hg paths" with zeroconf enabled and when a zeroconf server is up and running gives a traceback with "ValueError: rawloc must be defined". This is because zeroconf needs to wrap ui.configsuboptions(), introduced in dccbebcff075. diff --git a/hgext/zeroconf/__init__.py b/hgext/zeroconf/__init__.py --- a/hgext/zeroconf/__init__.py +++ b/hgext/zeroconf/__init__.py @@ -169,6 +169,16 @@ def configitems(orig, self, section, *ar repos += getzcpaths() return repos +def configsuboptions(orig, self, section, name, *args, **kwargs): + opt, sub = orig(self, section, name, *args, **kwargs) + if section == "paths" and name.startswith("zc-"): + # We have to find the URL in the zeroconf paths. We can't cons up any + # suboptions, so we use any that we found in the original config. + for zcname, zcurl in getzcpaths(): + if zcname == name: + return zcurl, sub + return opt, sub + def defaultdest(orig, source): for name, path in getzcpaths(): if path == source: @@ -189,5 +199,6 @@ extensions.wrapfunction(dispatch, '_runc extensions.wrapfunction(ui.ui, 'config', config) extensions.wrapfunction(ui.ui, 'configitems', configitems) +extensions.wrapfunction(ui.ui, 'configsuboptions', configsuboptions) extensions.wrapfunction(hg, 'defaultdest', defaultdest) extensions.wrapfunction(servermod, 'create_server', zc_create_server)