changeset 5148:06154aff2b1a

merge with -stable
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 08 Aug 2007 23:00:01 +0200
parents f94dbc6c7eaf (diff) c80af96943aa (current diff)
children 1a028bdaddce
files contrib/mercurial.spec hgext/mq.py mercurial/commands.py mercurial/hgweb/server.py tests/test-alias tests/test-archive tests/test-children tests/test-convert tests/test-imerge tests/test-mq tests/test-mq.out tests/test-record
diffstat 2 files changed, 24 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Aug 08 12:27:20 2007 +0200
+++ b/mercurial/commands.py	Wed Aug 08 23:00:01 2007 +0200
@@ -2466,7 +2466,7 @@
     for o in optlist.split():
         if opts[o]:
             parentui.setconfig("web", o, str(opts[o]))
-            if repo.ui != parentui:
+            if (repo is not None) and (repo.ui != parentui):
                 repo.ui.setconfig("web", o, str(opts[o]))
 
     if repo is None and not ui.config("web", "webdir_conf"):
--- a/mercurial/hgweb/server.py	Wed Aug 08 12:27:20 2007 +0200
+++ b/mercurial/hgweb/server.py	Wed Aug 08 23:00:01 2007 +0200
@@ -203,13 +203,29 @@
             return open(opt, 'w')
         return default
 
-    address = repo.ui.config("web", "address", "")
-    port = int(repo.ui.config("web", "port", 8000))
-    use_ipv6 = repo.ui.configbool("web", "ipv6")
-    webdir_conf = repo.ui.config("web", "webdir_conf")
-    ssl_cert = repo.ui.config("web", "certificate")
-    accesslog = openlog(repo.ui.config("web", "accesslog", "-"), sys.stdout)
-    errorlog = openlog(repo.ui.config("web", "errorlog", "-"), sys.stderr)
+    def create_getconfig(section, *uis): # uis are least significant to most
+        def getconfig(var, default=None):
+            val = default
+            for u in uis:
+                val = u.config(section, var, val)
+            return val
+        def getconfigbool(var, default=None):
+            val = default
+            for u in uis:
+                val = u.configbool(section, var, val)
+        return (getconfig, getconfigbool)
+
+    if repo is None:
+        getconfig, getconfigbool = create_getconfig("web", ui)
+    else:
+        getconfig, getconfigbool = create_getconfig("web", ui, repo.ui)
+    address = getconfig("address", "")
+    port = int(getconfig("port", 8000))
+    use_ipv6 = getconfigbool("ipv6")
+    webdir_conf = getconfig("webdir_conf")
+    ssl_cert = getconfig("certificate")
+    accesslog = openlog(getconfig("accesslog", "-"), sys.stdout)
+    errorlog = openlog(getconfig("errorlog", "-"), sys.stderr)
 
     if use_threads:
         try: