mercurial/hgweb/__init__.py
changeset 27184 64187e9a5659
parent 27182 71aa5a26162d
child 30508 9195bc4cb816
--- a/mercurial/hgweb/__init__.py	Tue Nov 17 16:42:52 2015 -0600
+++ b/mercurial/hgweb/__init__.py	Sat Oct 31 22:50:03 2015 +0900
@@ -96,6 +96,16 @@
         alluis.update([repo.baseui, repo.ui])
     else:
         baseui = ui
+    webconf = opts.get('web_conf') or opts.get('webdir_conf')
+    if webconf:
+        # load server settings (e.g. web.port) to "copied" ui, which allows
+        # hgwebdir to reload webconf cleanly
+        servui = ui.copy()
+        servui.readconfig(webconf, sections=['web'])
+        alluis.add(servui)
+    else:
+        servui = ui
+
     optlist = ("name templates style address port prefix ipv6"
                " accesslog errorlog certificate encoding")
     for o in optlist.split():
@@ -105,7 +115,6 @@
         for u in alluis:
             u.setconfig("web", o, val, 'serve')
 
-    webconf = opts.get('web_conf') or opts.get('webdir_conf')
     if webconf:
         app = hgwebdir_mod.hgwebdir(webconf, baseui=baseui)
     else:
@@ -113,4 +122,4 @@
             raise error.RepoError(_("there is no Mercurial repository"
                                     " here (.hg not found)"))
         app = hgweb_mod.hgweb(repo, baseui=baseui)
-    return httpservice(ui, app, opts)
+    return httpservice(servui, app, opts)