Patchwork [03,of,22,hgweb-help] webcommands: move help import into help command handler

login
register
mail settings
Submitter Gregory Szorc
Date Feb. 7, 2015, 7:15 a.m.
Message ID <186cd0c34a7ae2c02a60.1423293341@gps-mbp.local>
Download mbox | patch
Permalink /patch/7741/
State Accepted
Headers show

Comments

Gregory Szorc - Feb. 7, 2015, 7:15 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1423291668 28800
#      Fri Feb 06 22:47:48 2015 -0800
# Node ID 186cd0c34a7ae2c02a608445aaaa95e92f224ada
# Parent  5774d23ab70fd91d51c34af1e2082455e2fa96d3
webcommands: move help import into help command handler

A subsequent patch will introduce an import cycle between mercurial.help
and mercurial.hgweb.webcommands. Break the cycle by moving the import of
mercurial.help into the web command that actually needs it.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -12,9 +12,8 @@  from mercurial.node import short, hex
 from mercurial import util
 from common import paritygen, staticfile, get_contact, ErrorResponse
 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
 from mercurial import graphmod, patch
-from mercurial import help as helpmod
 from mercurial import scmutil
 from mercurial.i18n import _
 from mercurial.error import ParseError, RepoLookupError, Abort
 from mercurial import revset
@@ -1085,8 +1084,9 @@  def _getdoc(e):
 
 @webcommand('help')
 def help(web, req, tmpl):
     from mercurial import commands # avoid cycle
+    from mercurial import help as helpmod # avoid cycle
 
     topicname = req.form.get('node', [None])[0]
     if not topicname:
         def topics(**map):