[PATCH 2 of 2] zeroconf: fix crash in "hg paths" when zeroconf server is up
Augie Fackler
raf at durin42.com
Thu Feb 25 15:12:12 EST 2016
On Thu, Feb 25, 2016 at 10:11:21AM -0800, danek.duvall at oracle.com wrote:
> # HG changeset patch
> # User Danek Duvall <danek.duvall at oracle.com>
> # Date 1456423319 28800
> # Thu Feb 25 10:01:59 2016 -0800
> # Node ID 67d9ae798d19f92155bd58a9dfe5d9081e5203f5
> # Parent e996712094de22f8cc783b630baebed49d50fe57
> zeroconf: fix crash in "hg paths" when zeroconf server is up
Queued these, thanks!
>
> 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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list