[PATCH 2 of 3] hgweb: make sure command options are set to all ui objects

Yuya Nishihara yuya at tcha.org
Wed Dec 2 07:20:56 CST 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1448080092 -32400
#      Sat Nov 21 13:28:12 2015 +0900
# Node ID 1c8e143227acb790fa37fd262a49ec396c494039
# Parent  59dc6fb040b82000ee643cad376a46b93b68c6fe
hgweb: make sure command options are set to all ui objects

Before this patch, it was unclear why the httpservice object could read the
server options (e.g. --port) from 'ui'. It just worked because repo.ui is ui.

diff --git a/mercurial/hgweb/__init__.py b/mercurial/hgweb/__init__.py
--- a/mercurial/hgweb/__init__.py
+++ b/mercurial/hgweb/__init__.py
@@ -90,8 +90,10 @@ def createservice(ui, repo, opts):
     if opts.get('port'):
         opts['port'] = util.getport(opts.get('port'))
 
+    alluis = set([ui])
     if repo:
         baseui = repo.baseui
+        alluis.update([repo.baseui, repo.ui])
     else:
         baseui = ui
     optlist = ("name templates style address port prefix ipv6"
@@ -100,9 +102,8 @@ def createservice(ui, repo, opts):
         val = opts.get(o, '')
         if val in (None, ''): # should check against default options instead
             continue
-        baseui.setconfig("web", o, val, 'serve')
-        if repo and repo.ui != baseui:
-            repo.ui.setconfig("web", o, val, 'serve')
+        for u in alluis:
+            u.setconfig("web", o, val, 'serve')
 
     webconf = opts.get('web_conf') or opts.get('webdir_conf')
     if webconf:


More information about the Mercurial-devel mailing list