# HG changeset patch # User Alexander Schremmer # Date 1145745069 -7200 # Node ID 9383ba6b069ab6f2dac33ba6ad3192c7fe450392 # Parent 150cdd6c3c90fb7fd0db0f5b41f39a22a79005f9 Added hgwebdir support to hg serve. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2566,7 +2566,7 @@ def serve(ui, repo, **opts): r = repo.addchangegroup(fin) respond(str(r)) - optlist = "name templates style address port ipv6 accesslog errorlog" + optlist = "name templates style address port ipv6 accesslog errorlog webdir_conf" for o in optlist.split(): if opts[o]: ui.setconfig("web", o, opts[o]) @@ -3127,6 +3127,7 @@ table = { ('a', 'address', '', _('address to use')), ('n', 'name', '', _('name to show in web pages (default: working dir)')), + ('D', 'webdir-conf', '', _('name of the webdir config file (serve more than one repo)')), ('', 'pid-file', '', _('name of file to write process ID to')), ('', 'stdio', None, _('for remote clients')), ('t', 'templates', '', _('web templates to use')), diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -888,6 +888,7 @@ def create_server(repo): 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) @@ -974,7 +975,13 @@ def create_server(repo): req = hgrequest(self.rfile, self.wfile, env) self.send_response(200, "Script output follows") - hgweb(repo.__class__(repo.ui, repo.origroot)).run(req) + + if webdir_conf: + hgwebobj = hgwebdir(hgwebdir_conf) + else: + hgwebobj = hgweb(repo.__class__(repo.ui, repo.origroot)) + hgwebobj.run(req) + if use_ipv6: return IPv6HTTPServer((address, port), hgwebhandler)