changeset 11004:7bb10d3dbcd6

hgweb: unify hgweb calls in serve
author Matt Mackall <mpm@selenic.com>
date Mon, 26 Apr 2010 11:03:40 -0500
parents aca9a7cf2c9a
children c9b4e9431af7
files mercurial/commands.py
diffstat 1 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Apr 26 11:03:40 2010 -0500
+++ b/mercurial/commands.py	Mon Apr 26 11:03:40 2010 -0500
@@ -11,8 +11,7 @@
 import os, re, sys, difflib, time, tempfile
 import hg, util, revlog, bundlerepo, extensions, copies, error
 import patch, help, mdiff, url, encoding, templatekw
-import archival, changegroup, cmdutil, sshserver, hbisect
-from hgweb import server, hgweb_mod, hgwebdir_mod
+import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
 import merge as mergemod
 import minirst
 
@@ -2939,18 +2938,18 @@
             repo.ui.setconfig("web", o, val)
 
     o = opts.get('web_conf') or opts.get('webdir_conf')
-    if o:
-        app = hgwebdir_mod.hgwebdir(o, baseui=ui)
-    elif repo is not None:
-        app = hgweb_mod.hgweb(hg.repository(repo.ui, repo.root))
-    else:
-        raise error.RepoError(_("There is no Mercurial repository"
-                                " here (.hg not found)"))
+    if not o:
+        if not repo:
+            raise error.RepoError(_("There is no Mercurial repository"
+                                    " here (.hg not found)"))
+        o = repo.root
+
+    app = hgweb.hgweb(o, baseui=ui)
 
     class service(object):
         def init(self):
             util.set_signal_handler()
-            self.httpd = server.create_server(ui, app)
+            self.httpd = hgweb.server.create_server(ui, app)
 
             if opts['port'] and not ui.verbose:
                 return