# HG changeset patch # User Boris Feld # Date 2017-06-30 01:45:43 # Node ID a6c18628dff1fe928cabe9cecc7f83834528ffa1 # Parent 131f8cd2c2b4a97f4b787d2b16221b30c60e4232 configitems: register the 'web.description' config diff --git a/hgext/zeroconf/__init__.py b/hgext/zeroconf/__init__.py --- a/hgext/zeroconf/__init__.py +++ b/hgext/zeroconf/__init__.py @@ -127,7 +127,9 @@ def zc_create_server(create_server, ui, with app._obtainrepo() as repo: name = app.reponame or os.path.basename(repo.root) path = repo.ui.config("web", "prefix", "").strip('/') - desc = repo.ui.config("web", "description", name) + desc = repo.ui.config("web", "description") + if not desc: + desc = name publish(name, desc, path, port) else: # webdir @@ -137,7 +139,9 @@ def zc_create_server(create_server, ui, u.readconfig(os.path.join(path, '.hg', 'hgrc')) name = os.path.basename(repo) path = (prefix + repo).strip('/') - desc = u.config('web', 'description', name) + desc = u.config('web', 'description') + if not desc: + desc = name publish(name, desc, path, port) return httpd diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -615,6 +615,9 @@ coreconfigitem('web', 'deny_read', coreconfigitem('web', 'descend', default=True, ) +coreconfigitem('web', 'description', + default="", +) coreconfigitem('worker', 'backgroundclose', default=dynamicdefault, ) diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -428,7 +428,7 @@ class hgwebdir(object): continue contact = get_contact(get) - description = get("web", "description", "") + description = get("web", "description") seenrepos.add(name) name = get("web", "name", name) row = {'contact': contact or "unknown", diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -719,8 +719,11 @@ def summary(web, req, tmpl): start = max(0, count - web.maxchanges) end = min(count, start + web.maxchanges) + desc = web.config("web", "description") + if not desc: + desc = 'unknown' return tmpl("summary", - desc=web.config("web", "description", "unknown"), + desc=desc, owner=get_contact(web.config) or "unknown", lastchange=tip.date(), tags=tagentries,