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

login
register
mail settings
Submitter Yuya Nishihara
Date Dec. 2, 2015, 1:20 p.m.
Message ID <1c8e143227acb790fa37.1449062456@mimosa>
Download mbox | patch
Permalink /patch/11743/
State Accepted
Headers show

Comments

Yuya Nishihara - Dec. 2, 2015, 1:20 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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: