changeset 27181:a9cecc7b68d3

hgweb: eliminate duck-typing to select hgweb or hgwebdir by command option Since createservice() was moved to hgweb and hgweb imports both hgweb_mod and hgwebdir_mod, we no longer have to force hgweb() function to select one of them by the type of 'o' variable. Let's be explicit! This patch does not change hgweb() function because it is the interface of existing WSGI and CGI scripts.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 31 Oct 2015 22:26:50 +0900
parents 8e7db961535a
children 71aa5a26162d
files mercurial/hgweb/__init__.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/__init__.py	Tue Dec 01 16:06:20 2015 -0800
+++ b/mercurial/hgweb/__init__.py	Sat Oct 31 22:26:50 2015 +0900
@@ -104,12 +104,12 @@
         if repo and repo.ui != baseui:
             repo.ui.setconfig("web", o, val, 'serve')
 
-    o = opts.get('web_conf') or opts.get('webdir_conf')
-    if not o:
+    webconf = opts.get('web_conf') or opts.get('webdir_conf')
+    if webconf:
+        app = hgwebdir_mod.hgwebdir(webconf, baseui=baseui)
+    else:
         if not repo:
             raise error.RepoError(_("there is no Mercurial repository"
                                     " here (.hg not found)"))
-        o = repo
-
-    app = hgweb(o, baseui=baseui)
+        app = hgweb_mod.hgweb(repo, baseui=baseui)
     return httpservice(ui, app, opts)