configitems: register the 'web.description' config
authorBoris Feld <boris.feld@octobus.net>
Fri, 30 Jun 2017 03:45:43 +0200
changeset 34238 a6c18628dff1
parent 34237 131f8cd2c2b4
child 34239 344fd1fe237b
configitems: register the 'web.description' config
hgext/zeroconf/__init__.py
mercurial/configitems.py
mercurial/hgweb/hgwebdir_mod.py
mercurial/hgweb/webcommands.py
--- 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,