diff mercurial/hgweb/common.py @ 5779:e9f68860d5ed

Don't let ui.username override web.contact (issue900) 4603eef60237 introduced using ui.username before web.contact, but this was never documented and might cause commit accidents. - Drop web.author (deprecated since 2005) - Try ui.username or $EMAIL as a fallback to display something useful. - Update docs for the fallbacks.
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 01 Jan 2008 17:07:15 +0100
parents 0145f9afb0e7
children c301f15c965a
line wrap: on
line diff
--- a/mercurial/hgweb/common.py	Tue Jan 01 11:19:15 2008 +0100
+++ b/mercurial/hgweb/common.py	Tue Jan 01 17:07:15 2008 +0100
@@ -97,3 +97,12 @@
             parity = 1 - parity
             count = 0
 
+def get_contact(config):
+    """Return repo contact information or empty string.
+
+    web.contact is the primary source, but if that is not set, try
+    ui.username or $EMAIL as a fallback to display something useful.
+    """
+    return (config("web", "contact") or
+            config("ui", "username") or
+            os.environ.get("EMAIL") or "")