\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@szdZddlmZddlZddlZddlZddlmZddlm Z m Z m Z m Z m ZddlmZdZdadad Zd Zd Zd efd YZdZdZdZdZdZdZe j e dee j ej dee j ej dee j ej dee j e dee j ededS(sdiscover and advertise repositories on the local network Zeroconf-enabled repositories will be announced in a network without the need to configure a server or a service. They can be discovered without knowing their actual IP address. To allow other people to discover your repository using run :hg:`serve` in your repository:: $ cd test $ hg serve You can discover Zeroconf-enabled repositories by running :hg:`paths`:: $ hg paths zc-test = http://example.com:8000/test i(tabsolute_importNi(tZeroconf(tdispatchtencodingt extensionsthgtui(tserversships-with-hg-corecC@sy=tjtjtj}|jd|jd}|SWntjk rSnXyItjtjdd}d|krd}n|jds|SWn#tj tj fk rd}nXy=tjtjtj}|jd |jd}|SWntjk rnX|S( Ns1.0.0.1iit:s 127.0.0.1s127.i(s1.0.0.1i(s1.0.0.1i( tsockettAF_INETt SOCK_DGRAMtconnectt getsocknameterrort gethostbyaddrt gethostnamet startswithtgaierrortherror(tstiptdumbip((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytgetip6s.     cC@s,tsCt}|jdr"dStj|atj|antjjdd}|d}d||f}tj d|dd|d |d i|d 6d |d 6dtdddd}tj |tj d|dd|d |d i|d 6d |d 6dtdddd}tj |dS(Ns127.t.is.locals%s-%ss_http._tcp.local.s._http._tcp.local.Rtportt propertiest descriptiont/tpathtaddresstweighttprioritys_hg._tcp.local.s._hg._tcp.local.( RRRR t inet_atontlocalipRRtsplitt ServiceInfotregisterService(tnametdescRRRthostnamethosttsvc((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytpublishUs2         c C@s|||}|j}y |j}Wntk r|jj}|jp_tjj|j}|j j dddj d}|j j dd} | s|} nWdQXt || ||nX|j j dddj dd} x|D]\}}|j j } | jtjj|ddtjj|}| |j d}| j dd} | sp|} nt || ||qW|S(NtwebtprefixtRRs.hgthgrc(RtrepostAttributeErrort _obtainrepotreponametosRtbasenametrootRtconfigtstripR+tcopyt readconfigtjoin( t create_serverRtappthttpdRR0trepoR&RR'R-tu((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pytzc_create_serverws.   !% tlistenercB@s#eZdZdZdZRS(cC@s i|_dS(N(tfound(tself((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyt__init__scC@s,t||jkr(|jt|=ndS(N(treprRC(RDRttypeR&((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/__init__.pyt removeServicescC@s#|j|||jt|s4   (  "