hgweb: unify hgweb calls in serve
authorMatt Mackall <mpm@selenic.com>
Mon, 26 Apr 2010 11:03:40 -0500
changeset 11004 7bb10d3dbcd6
parent 11003 aca9a7cf2c9a
child 11005 c9b4e9431af7
hgweb: unify hgweb calls in serve
mercurial/commands.py
--- 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