# HG changeset patch # User Yuya Nishihara # Date 1446298010 -32400 # Node ID a9cecc7b68d377badf83c4e6b0f4bcd6a33010a3 # Parent 8e7db961535aa88781d60807d8144efb460b9e79 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. diff -r 8e7db961535a -r a9cecc7b68d3 mercurial/hgweb/__init__.py --- 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)