changeset 2122:9383ba6b069a

Added hgwebdir support to hg serve.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Sun, 23 Apr 2006 00:31:09 +0200
parents 150cdd6c3c90
children c0729a7f6f8a
files mercurial/commands.py mercurial/hgweb.py
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Apr 23 00:27:46 2006 +0200
+++ b/mercurial/commands.py	Sun Apr 23 00:31:09 2006 +0200
@@ -2566,7 +2566,7 @@
                 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 @@
           ('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')),
--- a/mercurial/hgweb.py	Sun Apr 23 00:27:46 2006 +0200
+++ b/mercurial/hgweb.py	Sun Apr 23 00:31:09 2006 +0200
@@ -888,6 +888,7 @@
     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 @@
 
             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)