[PATCH 5 of 8 techdocs] help: add "internals" topic

Gregory Szorc gregory.szorc at gmail.com
Sun Dec 13 13:46:58 CST 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1450031703 28800
#      Sun Dec 13 10:35:03 2015 -0800
# Node ID 6c8bf9fa1a76c06aba2c554486c77f1c2a56788f
# Parent  ce51bf17fdc7482e8fa82ea4fb7042d976a5a1df
help: add "internals" topic

We introduce the "internals" help topic, which renders an index of
available sub-topics. The sub-topics themselves are still not
reachable via the help system.

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -156,16 +156,31 @@ def loaddoc(topic, subdir=None):
         path = os.path.join(docdir, topic + ".txt")
         doc = gettext(util.readfile(path))
         for rewriter in helphooks.get(topic, []):
             doc = rewriter(ui, topic, doc)
         return doc
 
     return loader
 
+internalstable = sorted([
+    (['bundles'], _('container for exchange of repository data'),
+     loaddoc('bundles', subdir='internals')),
+    (['changegroups'], _('representation of revlog data'),
+     loaddoc('changegroups', subdir='internals')),
+])
+
+def internalshelp(ui):
+    """Generate the index for the "internals" topic."""
+    lines = []
+    for names, header, doc in internalstable:
+        lines.append(' :%s: %s' % (names[0], header))
+
+    return '\n'.join(lines)
+
 helptable = sorted([
     (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
     (["dates"], _("Date Formats"), loaddoc('dates')),
     (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
     (['environment', 'env'], _('Environment Variables'),
      loaddoc('environment')),
     (['revisions', 'revs'], _('Specifying Single Revisions'),
      loaddoc('revisions')),
@@ -182,16 +197,18 @@ helptable = sorted([
     (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
     (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
     (["glossary"], _("Glossary"), loaddoc('glossary')),
     (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
      loaddoc('hgignore')),
     (["phases"], _("Working with Phases"), loaddoc('phases')),
     (['scripting'], _('Using Mercurial from scripts and automation'),
      loaddoc('scripting')),
+    (['internals'], _("Technical implementation topics"),
+     internalshelp),
 ])
 
 # Map topics to lists of callable taking the current topic help and
 # returning the updated version
 helphooks = {}
 
 def addtopichook(topic, rewriter):
     helphooks.setdefault(topic, []).append(rewriter)
diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t
--- a/tests/test-globalopts.t
+++ b/tests/test-globalopts.t
@@ -344,16 +344,17 @@ Testing -h/--help:
    dates         Date Formats
    diffs         Diff Formats
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
+   internals     Technical implementation topics
    merge-tools   Merge Tools
    multirevs     Specifying Multiple Revisions
    patterns      File Name Patterns
    phases        Working with Phases
    revisions     Specifying Single Revisions
    revsets       Specifying Revision Sets
    scripting     Using Mercurial from scripts and automation
    subrepos      Subrepositories
@@ -426,16 +427,17 @@ Testing -h/--help:
    dates         Date Formats
    diffs         Diff Formats
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
+   internals     Technical implementation topics
    merge-tools   Merge Tools
    multirevs     Specifying Multiple Revisions
    patterns      File Name Patterns
    phases        Working with Phases
    revisions     Specifying Single Revisions
    revsets       Specifying Revision Sets
    scripting     Using Mercurial from scripts and automation
    subrepos      Subrepositories
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -106,16 +106,17 @@ Short help:
    dates         Date Formats
    diffs         Diff Formats
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
+   internals     Technical implementation topics
    merge-tools   Merge Tools
    multirevs     Specifying Multiple Revisions
    patterns      File Name Patterns
    phases        Working with Phases
    revisions     Specifying Single Revisions
    revsets       Specifying Revision Sets
    scripting     Using Mercurial from scripts and automation
    subrepos      Subrepositories
@@ -182,16 +183,17 @@ Short help:
    dates         Date Formats
    diffs         Diff Formats
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
+   internals     Technical implementation topics
    merge-tools   Merge Tools
    multirevs     Specifying Multiple Revisions
    patterns      File Name Patterns
    phases        Working with Phases
    revisions     Specifying Single Revisions
    revsets       Specifying Revision Sets
    scripting     Using Mercurial from scripts and automation
    subrepos      Subrepositories
@@ -768,16 +770,17 @@ Test that default list of commands omits
    dates         Date Formats
    diffs         Diff Formats
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
+   internals     Technical implementation topics
    merge-tools   Merge Tools
    multirevs     Specifying Multiple Revisions
    patterns      File Name Patterns
    phases        Working with Phases
    revisions     Specifying Single Revisions
    revsets       Specifying Revision Sets
    scripting     Using Mercurial from scripts and automation
    subrepos      Subrepositories
@@ -857,16 +860,24 @@ Test list of internal help commands
    debugsuccessorssets
                  show set of successors for revision
    debugwalk     show how files match on given patterns
    debugwireargs
                  (no help text available)
   
   (use "hg help -v debug" to show built-in aliases and global options)
 
+internals topic renders index of available sub-topics
+
+  $ hg help internals
+  Technical implementation topics
+  """""""""""""""""""""""""""""""
+  
+       bundles       container for exchange of repository data
+       changegroups  representation of revlog data
 
 Test list of commands with command with no help text
 
   $ hg help helpext
   helpext extension - no help text available
   
   list of commands:
   
@@ -1525,16 +1536,23 @@ Dish up an empty repo; serve it cold.
   <tr><td>
   <a href="/help/hgweb">
   hgweb
   </a>
   </td><td>
   Configuring hgweb
   </td></tr>
   <tr><td>
+  <a href="/help/internals">
+  internals
+  </a>
+  </td><td>
+  Technical implementation topics
+  </td></tr>
+  <tr><td>
   <a href="/help/merge-tools">
   merge-tools
   </a>
   </td><td>
   Merge Tools
   </td></tr>
   <tr><td>
   <a href="/help/multirevs">
diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t
--- a/tests/test-hgweb-json.t
+++ b/tests/test-hgweb-json.t
@@ -1057,16 +1057,20 @@ help/ shows help topics
         "summary": "Syntax for Mercurial Ignore Files",
         "topic": "hgignore"
       },
       {
         "summary": "Configuring hgweb",
         "topic": "hgweb"
       },
       {
+        "summary": "Technical implementation topics",
+        "topic": "internals"
+      },
+      {
         "summary": "Merge Tools",
         "topic": "merge-tools"
       },
       {
         "summary": "Specifying Multiple Revisions",
         "topic": "multirevs"
       },
       {


More information about the Mercurial-devel mailing list