changeset 34245:a6c18628dff1

configitems: register the 'web.description' config
author Boris Feld <boris.feld@octobus.net>
date Fri, 30 Jun 2017 03:45:43 +0200
parents 131f8cd2c2b4
children 344fd1fe237b
files hgext/zeroconf/__init__.py mercurial/configitems.py mercurial/hgweb/hgwebdir_mod.py mercurial/hgweb/webcommands.py
diffstat 4 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/zeroconf/__init__.py	Fri Jun 30 03:45:42 2017 +0200
+++ b/hgext/zeroconf/__init__.py	Fri Jun 30 03:45:43 2017 +0200
@@ -127,7 +127,9 @@
         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 @@
             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
 
--- a/mercurial/configitems.py	Fri Jun 30 03:45:42 2017 +0200
+++ b/mercurial/configitems.py	Fri Jun 30 03:45:43 2017 +0200
@@ -615,6 +615,9 @@
 coreconfigitem('web', 'descend',
     default=True,
 )
+coreconfigitem('web', 'description',
+    default="",
+)
 coreconfigitem('worker', 'backgroundclose',
     default=dynamicdefault,
 )
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Jun 30 03:45:42 2017 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Fri Jun 30 03:45:43 2017 +0200
@@ -428,7 +428,7 @@
                     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",
--- a/mercurial/hgweb/webcommands.py	Fri Jun 30 03:45:42 2017 +0200
+++ b/mercurial/hgweb/webcommands.py	Fri Jun 30 03:45:43 2017 +0200
@@ -719,8 +719,11 @@
     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,