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

Gregory Szorc gregory.szorc at gmail.com
Sat Feb 7 01:15:41 CST 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at 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.

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):


More information about the Mercurial-devel mailing list