[PATCH STABLE V2] zeroconf: use port from server instead of picking port from config (issue3746)
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sun Dec 30 16:54:14 CST 2012
On 30 déc. 2012, at 23:00, Benoit Boissinot wrote:
> -class hgwebdirzc(hgwebdir_mod.hgwebdir):
> - def __init__(self, conf, baseui=None):
> - super(hgwebdirzc, self).__init__(conf, baseui=baseui)
> - prefix = self.ui.config("web", "prefix", "").strip('/') + '/'
> - for repo, path in self.repos:
> - u = self.ui.copy()
> + try:
> + repos = app.repos
> + except AttributeError:
> + # single repo
> + name = app.reponame or os.path.basename(app.repo.root)
> + path = app.repo.ui.config("web", "prefix", "").strip('/')
> + desc = app.repo.ui.config("web", "description", name)
> + publish(name, desc, path, port)
> + else:
> + # webdir
> + prefix = app.ui.config("web", "prefix", "").strip('/') + '/'
> + for repo, path in repos:
> + u = app.ui.copy()
> u.readconfig(os.path.join(path, '.hg', 'hgrc'))
> name = os.path.basename(repo)
> path = (prefix + repo).strip('/')
> desc = u.config('web', 'description', name)
> - publish(name, desc, path,
> - util.getport(u.config("web", "port", 8000)))
> + publish(name, desc, path, port)
> + return httpd
It seems like you could factorise single repos vs multi repo case for improved clarity.
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list