# HG changeset patch # User Alexis S. L. Carvalho # Date 1184194576 10800 # Node ID 9858477ed74cce9dc8f4069f9453a1bda0e13ba1 # Parent 439e2f2fde42f184ed964712e5bc30b1f488883d serve: respect settings from .hg/hgrc create_server was looking only at the root ui object, ignoring any settings from .hg/hgrc. To keep respecting command-line arguments, commands.serve must also call repo.ui.setconfig. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2457,6 +2457,8 @@ def serve(ui, repo, **opts): for o in optlist.split(): if opts[o]: parentui.setconfig("web", o, str(opts[o])) + if repo.ui != parentui: + repo.ui.setconfig("web", o, str(opts[o])) if repo is None and not ui.config("web", "webdir_conf"): raise hg.RepoError(_("There is no Mercurial repository here" diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -172,12 +172,12 @@ def create_server(ui, repo): return open(opt, 'w') return default - address = ui.config("web", "address", "") - port = int(ui.config("web", "port", 8000)) - use_ipv6 = ui.configbool("web", "ipv6") - webdir_conf = ui.config("web", "webdir_conf") - accesslog = openlog(ui.config("web", "accesslog", "-"), sys.stdout) - errorlog = openlog(ui.config("web", "errorlog", "-"), sys.stderr) + 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") + accesslog = openlog(repo.ui.config("web", "accesslog", "-"), sys.stdout) + errorlog = openlog(repo.ui.config("web", "errorlog", "-"), sys.stderr) if use_threads: try: diff --git a/tests/test-serve b/tests/test-serve --- a/tests/test-serve +++ b/tests/test-serve @@ -3,9 +3,15 @@ hg init test cd test +echo '[web]' > .hg/hgrc +echo 'accesslog = access.log' >> .hg/hgrc + echo % Without -v hg serve -a localhost -p 20063 -d --pid-file=hg.pid cat hg.pid >> "$DAEMON_PIDS" +if [ -f access.log ]; then + echo 'access log created - .hg/hgrc respected' +fi echo % With -v hg serve -a localhost -p 20064 -d --pid-file=hg.pid -v diff --git a/tests/test-serve.out b/tests/test-serve.out --- a/tests/test-serve.out +++ b/tests/test-serve.out @@ -1,3 +1,4 @@ % Without -v +access log created - .hg/hgrc respected % With -v listening at http://localhost:20064/