mercurial/help.py
changeset 22633 92b54547ac5d
parent 22367 c5df4af17110
child 22637 149141c3a25f
equal deleted inserted replaced
22632:db15bb2d6323 22633:92b54547ac5d
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from i18n import gettext, _
     8 from i18n import gettext, _
     9 import itertools, sys, os
     9 import itertools, os
    10 import error
    10 import error
    11 import extensions, revset, fileset, templatekw, templatefilters, filemerge
    11 import extensions, revset, fileset, templatekw, templatefilters, filemerge
    12 import encoding, util, minirst
    12 import encoding, util, minirst
    13 import cmdutil
    13 import cmdutil
    14 
    14 
   127 
   127 
   128 def loaddoc(topic):
   128 def loaddoc(topic):
   129     """Return a delayed loader for help/topic.txt."""
   129     """Return a delayed loader for help/topic.txt."""
   130 
   130 
   131     def loader():
   131     def loader():
   132         if util.mainfrozen():
       
   133             module = sys.executable
       
   134         else:
       
   135             module = __file__
       
   136         base = os.path.dirname(module)
       
   137 
       
   138         for dir in ('.', '..'):
   132         for dir in ('.', '..'):
   139             docdir = os.path.join(base, dir, 'help')
   133             docdir = os.path.join(util.datapath, dir, 'help')
   140             if os.path.isdir(docdir):
   134             if os.path.isdir(docdir):
   141                 break
   135                 break
   142 
   136 
   143         path = os.path.join(docdir, topic + ".txt")
   137         path = os.path.join(docdir, topic + ".txt")
   144         doc = gettext(util.readfile(path))
   138         doc = gettext(util.readfile(path))