##// END OF EJS Templates
Don't let ui.username override web.contact (issue900)...
Thomas Arendsen Hein -
r5779:e9f68860 default
parent child Browse files
Show More
@@ -524,7 +524,7 b' web::'
524 Example: "http://hgserver/repos/"
524 Example: "http://hgserver/repos/"
525 contact;;
525 contact;;
526 Name or email address of the person in charge of the repository.
526 Name or email address of the person in charge of the repository.
527 Default is "unknown".
527 Defaults to ui.username or $EMAIL or "unknown" if unset or empty.
528 deny_push;;
528 deny_push;;
529 Whether to deny pushing to the repository. If empty or not set,
529 Whether to deny pushing to the repository. If empty or not set,
530 push is not denied. If the special value "*", all remote users
530 push is not denied. If the special value "*", all remote users
@@ -97,3 +97,12 b' def paritygen(stripecount, offset=0):'
97 parity = 1 - parity
97 parity = 1 - parity
98 count = 0
98 count = 0
99
99
100 def get_contact(config):
101 """Return repo contact information or empty string.
102
103 web.contact is the primary source, but if that is not set, try
104 ui.username or $EMAIL as a fallback to display something useful.
105 """
106 return (config("web", "contact") or
107 config("ui", "username") or
108 os.environ.get("EMAIL") or "")
@@ -10,7 +10,7 b' import os, mimetypes, re, mimetools, cSt'
10 from mercurial.node import *
10 from mercurial.node import *
11 from mercurial import mdiff, ui, hg, util, archival, patch
11 from mercurial import mdiff, ui, hg, util, archival, patch
12 from mercurial import revlog, templater
12 from mercurial import revlog, templater
13 from common import ErrorResponse, get_mtime, style_map, paritygen
13 from common import ErrorResponse, get_mtime, style_map, paritygen, get_contact
14 from request import wsgirequest
14 from request import wsgirequest
15 import webcommands, protocol
15 import webcommands, protocol
16
16
@@ -808,9 +808,7 b' class hgweb(object):'
808
808
809 yield tmpl("summary",
809 yield tmpl("summary",
810 desc=self.config("web", "description", "unknown"),
810 desc=self.config("web", "description", "unknown"),
811 owner=(self.config("ui", "username") or # preferred
811 owner=get_contact(self.config) or "unknown",
812 self.config("web", "contact") or # deprecated
813 self.config("web", "author", "unknown")), # also
814 lastchange=cl.read(cl.tip())[2],
812 lastchange=cl.read(cl.tip())[2],
815 tags=tagentries,
813 tags=tagentries,
816 branches=branches,
814 branches=branches,
@@ -9,7 +9,8 b''
9 import os, mimetools, cStringIO
9 import os, mimetools, cStringIO
10 from mercurial.i18n import gettext as _
10 from mercurial.i18n import gettext as _
11 from mercurial import ui, hg, util, templater
11 from mercurial import ui, hg, util, templater
12 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen
12 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen, \
13 get_contact
13 from hgweb_mod import hgweb
14 from hgweb_mod import hgweb
14 from request import wsgirequest
15 from request import wsgirequest
15
16
@@ -182,9 +183,7 b' class hgwebdir(object):'
182 except OSError:
183 except OSError:
183 continue
184 continue
184
185
185 contact = (get("ui", "username") or # preferred
186 contact = get_contact(get)
186 get("web", "contact") or # deprecated
187 get("web", "author", "")) # also
188 description = get("web", "description", "")
187 description = get("web", "description", "")
189 name = get("web", "name", name)
188 name = get("web", "name", name)
190 row = dict(contact=contact or "unknown",
189 row = dict(contact=contact or "unknown",
@@ -405,6 +405,7 b' if not options.child:'
405 # the tests produce repeatable output.
405 # the tests produce repeatable output.
406 os.environ['LANG'] = os.environ['LC_ALL'] = 'C'
406 os.environ['LANG'] = os.environ['LC_ALL'] = 'C'
407 os.environ['TZ'] = 'GMT'
407 os.environ['TZ'] = 'GMT'
408 os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>"
408
409
409 TESTDIR = os.environ["TESTDIR"] = os.getcwd()
410 TESTDIR = os.environ["TESTDIR"] = os.getcwd()
410 HGTMP = os.environ['HGTMP'] = tempfile.mkdtemp('', 'hgtests.', options.tmpdir)
411 HGTMP = os.environ['HGTMP'] = tempfile.mkdtemp('', 'hgtests.', options.tmpdir)
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
General Comments 0
You need to be logged in to leave comments. Login now