D7376: help: create packages for the help text

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Thu Nov 14 03:02:17 UTC 2019


mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  These files need to be loaded as resources with PyOxidizer, instead of using
  filesystem representations.  AFAICT, the resource loading mechanisms only work
  for the named package given to it, and can't reach into a subdirectory.
  
  While here, the `help` directory is renamed to `helptext`.  Without this, trying
  to load external help text crashed in mercurial/help.py when importing `.i18n`,
  saying there's no `mercurial.help.i18n` module.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7376

AFFECTED FILES
  mercurial/help.py
  mercurial/help/bundlespec.txt
  mercurial/help/color.txt
  mercurial/help/common.txt
  mercurial/help/config.txt
  mercurial/help/dates.txt
  mercurial/help/deprecated.txt
  mercurial/help/diffs.txt
  mercurial/help/environment.txt
  mercurial/help/extensions.txt
  mercurial/help/filesets.txt
  mercurial/help/flags.txt
  mercurial/help/glossary.txt
  mercurial/help/hg-ssh.8.txt
  mercurial/help/hg.1.txt
  mercurial/help/hgignore.5.txt
  mercurial/help/hgignore.txt
  mercurial/help/hgrc.5.txt
  mercurial/help/hgweb.txt
  mercurial/help/internals/bundle2.txt
  mercurial/help/internals/bundles.txt
  mercurial/help/internals/cbor.txt
  mercurial/help/internals/censor.txt
  mercurial/help/internals/changegroups.txt
  mercurial/help/internals/config.txt
  mercurial/help/internals/extensions.txt
  mercurial/help/internals/linelog.txt
  mercurial/help/internals/mergestate.txt
  mercurial/help/internals/requirements.txt
  mercurial/help/internals/revlogs.txt
  mercurial/help/internals/wireprotocol.txt
  mercurial/help/internals/wireprotocolrpc.txt
  mercurial/help/internals/wireprotocolv2.txt
  mercurial/help/merge-tools.txt
  mercurial/help/pager.txt
  mercurial/help/patterns.txt
  mercurial/help/phases.txt
  mercurial/help/revisions.txt
  mercurial/help/scripting.txt
  mercurial/help/subrepos.txt
  mercurial/help/templates.txt
  mercurial/help/urls.txt
  mercurial/helptext/__init__.py
  mercurial/helptext/bundlespec.txt
  mercurial/helptext/color.txt
  mercurial/helptext/common.txt
  mercurial/helptext/config.txt
  mercurial/helptext/dates.txt
  mercurial/helptext/deprecated.txt
  mercurial/helptext/diffs.txt
  mercurial/helptext/environment.txt
  mercurial/helptext/extensions.txt
  mercurial/helptext/filesets.txt
  mercurial/helptext/flags.txt
  mercurial/helptext/glossary.txt
  mercurial/helptext/hg-ssh.8.txt
  mercurial/helptext/hg.1.txt
  mercurial/helptext/hgignore.5.txt
  mercurial/helptext/hgignore.txt
  mercurial/helptext/hgrc.5.txt
  mercurial/helptext/hgweb.txt
  mercurial/helptext/internals/__init__.py
  mercurial/helptext/internals/bundle2.txt
  mercurial/helptext/internals/bundles.txt
  mercurial/helptext/internals/cbor.txt
  mercurial/helptext/internals/censor.txt
  mercurial/helptext/internals/changegroups.txt
  mercurial/helptext/internals/config.txt
  mercurial/helptext/internals/extensions.txt
  mercurial/helptext/internals/linelog.txt
  mercurial/helptext/internals/mergestate.txt
  mercurial/helptext/internals/requirements.txt
  mercurial/helptext/internals/revlogs.txt
  mercurial/helptext/internals/wireprotocol.txt
  mercurial/helptext/internals/wireprotocolrpc.txt
  mercurial/helptext/internals/wireprotocolv2.txt
  mercurial/helptext/merge-tools.txt
  mercurial/helptext/pager.txt
  mercurial/helptext/patterns.txt
  mercurial/helptext/phases.txt
  mercurial/helptext/revisions.txt
  mercurial/helptext/scripting.txt
  mercurial/helptext/subrepos.txt
  mercurial/helptext/templates.txt
  mercurial/helptext/urls.txt
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1191,6 +1191,8 @@
     'mercurial',
     'mercurial.cext',
     'mercurial.cffi',
+    'mercurial.helptext',
+    'mercurial.helptext.internals',
     'mercurial.hgweb',
     'mercurial.interfaces',
     'mercurial.pure',
@@ -1535,11 +1537,15 @@
 packagedata = {
     'mercurial': [
         'locale/*/LC_MESSAGES/hg.mo',
-        'help/*.txt',
-        'help/internals/*.txt',
         'default.d/*.rc',
         'dummycert.pem',
-    ]
+    ],
+    'mercurial.helptext': [
+        '*.txt',
+    ],
+    'mercurial.helptext.internals': [
+       '*.txt',
+    ],
 }
 
 
diff --git a/mercurial/help/urls.txt b/mercurial/helptext/urls.txt
rename from mercurial/help/urls.txt
rename to mercurial/helptext/urls.txt
diff --git a/mercurial/help/templates.txt b/mercurial/helptext/templates.txt
rename from mercurial/help/templates.txt
rename to mercurial/helptext/templates.txt
diff --git a/mercurial/help/subrepos.txt b/mercurial/helptext/subrepos.txt
rename from mercurial/help/subrepos.txt
rename to mercurial/helptext/subrepos.txt
diff --git a/mercurial/help/scripting.txt b/mercurial/helptext/scripting.txt
rename from mercurial/help/scripting.txt
rename to mercurial/helptext/scripting.txt
diff --git a/mercurial/help/revisions.txt b/mercurial/helptext/revisions.txt
rename from mercurial/help/revisions.txt
rename to mercurial/helptext/revisions.txt
diff --git a/mercurial/help/phases.txt b/mercurial/helptext/phases.txt
rename from mercurial/help/phases.txt
rename to mercurial/helptext/phases.txt
diff --git a/mercurial/help/patterns.txt b/mercurial/helptext/patterns.txt
rename from mercurial/help/patterns.txt
rename to mercurial/helptext/patterns.txt
diff --git a/mercurial/help/pager.txt b/mercurial/helptext/pager.txt
rename from mercurial/help/pager.txt
rename to mercurial/helptext/pager.txt
diff --git a/mercurial/help/merge-tools.txt b/mercurial/helptext/merge-tools.txt
rename from mercurial/help/merge-tools.txt
rename to mercurial/helptext/merge-tools.txt
diff --git a/mercurial/help/internals/wireprotocolv2.txt b/mercurial/helptext/internals/wireprotocolv2.txt
rename from mercurial/help/internals/wireprotocolv2.txt
rename to mercurial/helptext/internals/wireprotocolv2.txt
diff --git a/mercurial/help/internals/wireprotocolrpc.txt b/mercurial/helptext/internals/wireprotocolrpc.txt
rename from mercurial/help/internals/wireprotocolrpc.txt
rename to mercurial/helptext/internals/wireprotocolrpc.txt
diff --git a/mercurial/help/internals/wireprotocol.txt b/mercurial/helptext/internals/wireprotocol.txt
rename from mercurial/help/internals/wireprotocol.txt
rename to mercurial/helptext/internals/wireprotocol.txt
diff --git a/mercurial/help/internals/revlogs.txt b/mercurial/helptext/internals/revlogs.txt
rename from mercurial/help/internals/revlogs.txt
rename to mercurial/helptext/internals/revlogs.txt
diff --git a/mercurial/help/internals/requirements.txt b/mercurial/helptext/internals/requirements.txt
rename from mercurial/help/internals/requirements.txt
rename to mercurial/helptext/internals/requirements.txt
diff --git a/mercurial/help/internals/mergestate.txt b/mercurial/helptext/internals/mergestate.txt
rename from mercurial/help/internals/mergestate.txt
rename to mercurial/helptext/internals/mergestate.txt
diff --git a/mercurial/help/internals/linelog.txt b/mercurial/helptext/internals/linelog.txt
rename from mercurial/help/internals/linelog.txt
rename to mercurial/helptext/internals/linelog.txt
diff --git a/mercurial/help/internals/extensions.txt b/mercurial/helptext/internals/extensions.txt
rename from mercurial/help/internals/extensions.txt
rename to mercurial/helptext/internals/extensions.txt
diff --git a/mercurial/help/internals/config.txt b/mercurial/helptext/internals/config.txt
rename from mercurial/help/internals/config.txt
rename to mercurial/helptext/internals/config.txt
diff --git a/mercurial/help/internals/changegroups.txt b/mercurial/helptext/internals/changegroups.txt
rename from mercurial/help/internals/changegroups.txt
rename to mercurial/helptext/internals/changegroups.txt
diff --git a/mercurial/help/internals/censor.txt b/mercurial/helptext/internals/censor.txt
rename from mercurial/help/internals/censor.txt
rename to mercurial/helptext/internals/censor.txt
diff --git a/mercurial/help/internals/cbor.txt b/mercurial/helptext/internals/cbor.txt
rename from mercurial/help/internals/cbor.txt
rename to mercurial/helptext/internals/cbor.txt
diff --git a/mercurial/help/internals/bundles.txt b/mercurial/helptext/internals/bundles.txt
rename from mercurial/help/internals/bundles.txt
rename to mercurial/helptext/internals/bundles.txt
diff --git a/mercurial/help/internals/bundle2.txt b/mercurial/helptext/internals/bundle2.txt
rename from mercurial/help/internals/bundle2.txt
rename to mercurial/helptext/internals/bundle2.txt
diff --git a/mercurial/helptext/internals/__init__.py b/mercurial/helptext/internals/__init__.py
new file mode 100644
--- /dev/null
+++ b/mercurial/helptext/internals/__init__.py
@@ -0,0 +1,4 @@
+from __future__ import absolute_import
+import pkgutil
+
+__path__ = pkgutil.extend_path(__path__, __name__)
diff --git a/mercurial/help/hgweb.txt b/mercurial/helptext/hgweb.txt
rename from mercurial/help/hgweb.txt
rename to mercurial/helptext/hgweb.txt
diff --git a/mercurial/help/hgrc.5.txt b/mercurial/helptext/hgrc.5.txt
rename from mercurial/help/hgrc.5.txt
rename to mercurial/helptext/hgrc.5.txt
diff --git a/mercurial/help/hgignore.txt b/mercurial/helptext/hgignore.txt
rename from mercurial/help/hgignore.txt
rename to mercurial/helptext/hgignore.txt
diff --git a/mercurial/help/hgignore.5.txt b/mercurial/helptext/hgignore.5.txt
rename from mercurial/help/hgignore.5.txt
rename to mercurial/helptext/hgignore.5.txt
diff --git a/mercurial/help/hg.1.txt b/mercurial/helptext/hg.1.txt
rename from mercurial/help/hg.1.txt
rename to mercurial/helptext/hg.1.txt
diff --git a/mercurial/help/hg-ssh.8.txt b/mercurial/helptext/hg-ssh.8.txt
rename from mercurial/help/hg-ssh.8.txt
rename to mercurial/helptext/hg-ssh.8.txt
diff --git a/mercurial/help/glossary.txt b/mercurial/helptext/glossary.txt
rename from mercurial/help/glossary.txt
rename to mercurial/helptext/glossary.txt
diff --git a/mercurial/help/flags.txt b/mercurial/helptext/flags.txt
rename from mercurial/help/flags.txt
rename to mercurial/helptext/flags.txt
diff --git a/mercurial/help/filesets.txt b/mercurial/helptext/filesets.txt
rename from mercurial/help/filesets.txt
rename to mercurial/helptext/filesets.txt
diff --git a/mercurial/help/extensions.txt b/mercurial/helptext/extensions.txt
rename from mercurial/help/extensions.txt
rename to mercurial/helptext/extensions.txt
diff --git a/mercurial/help/environment.txt b/mercurial/helptext/environment.txt
rename from mercurial/help/environment.txt
rename to mercurial/helptext/environment.txt
diff --git a/mercurial/help/diffs.txt b/mercurial/helptext/diffs.txt
rename from mercurial/help/diffs.txt
rename to mercurial/helptext/diffs.txt
diff --git a/mercurial/help/deprecated.txt b/mercurial/helptext/deprecated.txt
rename from mercurial/help/deprecated.txt
rename to mercurial/helptext/deprecated.txt
diff --git a/mercurial/help/dates.txt b/mercurial/helptext/dates.txt
rename from mercurial/help/dates.txt
rename to mercurial/helptext/dates.txt
diff --git a/mercurial/help/config.txt b/mercurial/helptext/config.txt
rename from mercurial/help/config.txt
rename to mercurial/helptext/config.txt
diff --git a/mercurial/help/common.txt b/mercurial/helptext/common.txt
rename from mercurial/help/common.txt
rename to mercurial/helptext/common.txt
diff --git a/mercurial/help/color.txt b/mercurial/helptext/color.txt
rename from mercurial/help/color.txt
rename to mercurial/helptext/color.txt
diff --git a/mercurial/help/bundlespec.txt b/mercurial/helptext/bundlespec.txt
rename from mercurial/help/bundlespec.txt
rename to mercurial/helptext/bundlespec.txt
diff --git a/mercurial/helptext/__init__.py b/mercurial/helptext/__init__.py
new file mode 100644
--- /dev/null
+++ b/mercurial/helptext/__init__.py
@@ -0,0 +1,4 @@
+from __future__ import absolute_import
+import pkgutil
+
+__path__ = pkgutil.extend_path(__path__, __name__)
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -311,7 +311,7 @@
     """Return a delayed loader for help/topic.txt."""
 
     def loader(ui):
-        docdir = os.path.join(util.datapath, b'help')
+        docdir = os.path.join(util.datapath, b'helptext')
         if subdir:
             docdir = os.path.join(docdir, subdir)
         path = os.path.join(docdir, topic + b".txt")



To: mharbison72, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list