D5805: zeroconf: port to Python 3

Yuya Nishihara yuya at tcha.org
Sat Feb 2 21:20:33 EST 2019


>      # advertise to browsers
>      svc = Zeroconf.ServiceInfo('_http._tcp.local.',
> -                               name + '._http._tcp.local.',
> +                               pycompat.bytestr(name + r'._http._tcp.local.'),
>                                 server = host,
>                                 port = port,
> -                               properties = {'description': desc,
> -                                             'path': "/" + path},
> +                               properties = {
> +                                   'description': pycompat.bytestr(desc),
> +                                   'path': pycompat.bytestr(r"/" + path)},
>                                 address = localip, weight = 0, priority = 0)
>      server.registerService(svc)
>  
>      # advertise to Mercurial clients
>      svc = Zeroconf.ServiceInfo('_hg._tcp.local.',
> -                               name + '._hg._tcp.local.',
> +                               pycompat.bytestr(name + r'._hg._tcp.local.'),
>                                 server = host,
>                                 port = port,
> -                               properties = {'description': desc,
> -                                             'path': "/" + path},
> +                               properties = {
> +                                   'description': pycompat.bytestr(desc),
> +                                   'path': pycompat.bytestr(r"/" + path)},
>                                 address = localip, weight = 0, priority = 0)

I think `path` and `desc` are bytes since they come from `ui.config()`.


More information about the Mercurial-devel mailing list