hgext/zeroconf/__init__.py
changeset 10342 579aae5aa549
parent 10317 192083a3e6fe
child 10993 c1b43d786889
equal deleted inserted replaced
10341:c203878e58ba 10342:579aae5aa549
    22   $ hg paths
    22   $ hg paths
    23   zc-test = http://example.com:8000/test
    23   zc-test = http://example.com:8000/test
    24 '''
    24 '''
    25 
    25 
    26 import Zeroconf, socket, time, os
    26 import Zeroconf, socket, time, os
    27 from mercurial import ui
    27 from mercurial import ui, hg, encoding
    28 from mercurial import extensions
    28 from mercurial import extensions
    29 from mercurial.hgweb import hgweb_mod
    29 from mercurial.hgweb import hgweb_mod
    30 from mercurial.hgweb import hgwebdir_mod
    30 from mercurial.hgweb import hgwebdir_mod
    31 
    31 
    32 # publish
    32 # publish
   154     repos = orig(self, section, untrusted)
   154     repos = orig(self, section, untrusted)
   155     if section == "paths":
   155     if section == "paths":
   156         repos += getzcpaths()
   156         repos += getzcpaths()
   157     return repos
   157     return repos
   158 
   158 
       
   159 def defaultdest(orig, source):
       
   160     for name, path in getzcpaths():
       
   161         if path == source:
       
   162             return name.encode(encoding.encoding)
       
   163     return orig(source)
       
   164 
   159 extensions.wrapfunction(ui.ui, 'config', config)
   165 extensions.wrapfunction(ui.ui, 'config', config)
   160 extensions.wrapfunction(ui.ui, 'configitems', configitems)
   166 extensions.wrapfunction(ui.ui, 'configitems', configitems)
       
   167 extensions.wrapfunction(hg, 'defaultdest', defaultdest)
   161 hgweb_mod.hgweb = hgwebzc
   168 hgweb_mod.hgweb = hgwebzc
   162 hgwebdir_mod.hgwebdir = hgwebdirzc
   169 hgwebdir_mod.hgwebdir = hgwebdirzc