changeset 27375:c4a062d090ee

help: teach loaddoc to load from a different directory The help system currently only supports showing help topics from a single directory. We'll need to teach it to show results from different directories in order to show the internals topics. The first step is to teach loaddoc() to load documentation from a sub-directory.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 13 Dec 2015 10:45:27 -0800
parents 7a70ae647e54
children fc810d950278
files mercurial/help.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help.py	Sun Dec 13 11:34:04 2015 -0800
+++ b/mercurial/help.py	Sun Dec 13 10:45:27 2015 -0800
@@ -146,11 +146,13 @@
                 results['extensioncommands'].append((cmdname, cmddoc))
     return results
 
-def loaddoc(topic):
+def loaddoc(topic, subdir=None):
     """Return a delayed loader for help/topic.txt."""
 
     def loader(ui):
         docdir = os.path.join(util.datapath, 'help')
+        if subdir:
+            docdir = os.path.join(docdir, subdir)
         path = os.path.join(docdir, topic + ".txt")
         doc = gettext(util.readfile(path))
         for rewriter in helphooks.get(topic, []):