Show More
@@ -524,7 +524,7 b' web::' | |||
|
524 | 524 | Example: "http://hgserver/repos/" |
|
525 | 525 | contact;; |
|
526 | 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 | 528 | deny_push;; |
|
529 | 529 | Whether to deny pushing to the repository. If empty or not set, |
|
530 | 530 | push is not denied. If the special value "*", all remote users |
@@ -97,3 +97,12 b' def paritygen(stripecount, offset=0):' | |||
|
97 | 97 | parity = 1 - parity |
|
98 | 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 | 10 | from mercurial.node import * |
|
11 | 11 | from mercurial import mdiff, ui, hg, util, archival, patch |
|
12 | 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 | 14 | from request import wsgirequest |
|
15 | 15 | import webcommands, protocol |
|
16 | 16 | |
@@ -808,9 +808,7 b' class hgweb(object):' | |||
|
808 | 808 | |
|
809 | 809 | yield tmpl("summary", |
|
810 | 810 | desc=self.config("web", "description", "unknown"), |
|
811 |
owner=(self.config |
|
|
812 | self.config("web", "contact") or # deprecated | |
|
813 | self.config("web", "author", "unknown")), # also | |
|
811 | owner=get_contact(self.config) or "unknown", | |
|
814 | 812 | lastchange=cl.read(cl.tip())[2], |
|
815 | 813 | tags=tagentries, |
|
816 | 814 | branches=branches, |
@@ -9,7 +9,8 b'' | |||
|
9 | 9 | import os, mimetools, cStringIO |
|
10 | 10 | from mercurial.i18n import gettext as _ |
|
11 | 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 | 14 | from hgweb_mod import hgweb |
|
14 | 15 | from request import wsgirequest |
|
15 | 16 | |
@@ -182,9 +183,7 b' class hgwebdir(object):' | |||
|
182 | 183 | except OSError: |
|
183 | 184 | continue |
|
184 | 185 | |
|
185 | contact = (get("ui", "username") or # preferred | |
|
186 | get("web", "contact") or # deprecated | |
|
187 | get("web", "author", "")) # also | |
|
186 | contact = get_contact(get) | |
|
188 | 187 | description = get("web", "description", "") |
|
189 | 188 | name = get("web", "name", name) |
|
190 | 189 | row = dict(contact=contact or "unknown", |
@@ -405,6 +405,7 b' if not options.child:' | |||
|
405 | 405 | # the tests produce repeatable output. |
|
406 | 406 | os.environ['LANG'] = os.environ['LC_ALL'] = 'C' |
|
407 | 407 | os.environ['TZ'] = 'GMT' |
|
408 | os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>" | |
|
408 | 409 | |
|
409 | 410 | TESTDIR = os.environ["TESTDIR"] = os.getcwd() |
|
410 | 411 | HGTMP = os.environ['HGTMP'] = tempfile.mkdtemp('', 'hgtests.', options.tmpdir) |
|
1 | NO CONTENT: modified file, binary diff hidden |
General Comments 0
You need to be logged in to leave comments.
Login now