[PATCH 13 of 23] configitems: register the 'web.description' config

Boris Feld boris.feld at octobus.net
Sat Sep 16 14:28:20 EDT 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1498787143 -7200
#      ven. juin 30 03:45:43 2017 +0200
# Node ID a51b26e8d3406c73676f14127bb637cd7fde357d
# Parent  b62bd50736bf55e36d167ff2a00f24ac27c61fd5
# EXP-Topic config.register.web
configitems: register the 'web.description' config

diff -r b62bd50736bf -r a51b26e8d340 hgext/zeroconf/__init__.py
--- a/hgext/zeroconf/__init__.py	ven. juin 30 03:45:42 2017 +0200
+++ b/hgext/zeroconf/__init__.py	ven. juin 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
 
diff -r b62bd50736bf -r a51b26e8d340 mercurial/configitems.py
--- a/mercurial/configitems.py	ven. juin 30 03:45:42 2017 +0200
+++ b/mercurial/configitems.py	ven. juin 30 03:45:43 2017 +0200
@@ -615,6 +615,9 @@
 coreconfigitem('web', 'descend',
     default=True,
 )
+coreconfigitem('web', 'description',
+    default="",
+)
 coreconfigitem('worker', 'backgroundclose',
     default=dynamicdefault,
 )
diff -r b62bd50736bf -r a51b26e8d340 mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	ven. juin 30 03:45:42 2017 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	ven. juin 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",
diff -r b62bd50736bf -r a51b26e8d340 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	ven. juin 30 03:45:42 2017 +0200
+++ b/mercurial/hgweb/webcommands.py	ven. juin 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,


More information about the Mercurial-devel mailing list