# HG changeset patch # User Benoit Boissinot # Date 1186606801 -7200 # Node ID 06154aff2b1af2b9478b948625f167124053b538 # Parent f94dbc6c7eaf295569c2a88d9ce0b1dbf4f3ecca# Parent c80af96943aabda438ee4de8b1fb185f49a407c1 merge with -stable diff --git a/hgext/mq.py b/hgext/mq.py diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2466,7 +2466,7 @@ def serve(ui, repo, **opts): 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"): diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -203,13 +203,29 @@ def create_server(ui, repo): 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: diff --git a/tests/test-archive b/tests/test-archive diff --git a/tests/test-archive.out b/tests/test-archive.out diff --git a/tests/test-mq b/tests/test-mq diff --git a/tests/test-mq.out b/tests/test-mq.out