~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/help_topics.py

Help topics can now be loaded from files (based on Ian's patch, adapted to proper support various windows installers).

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
rendering on the screen naturally.
34
34
"""
35
35
 
36
 
from bzrlib import registry
 
36
import sys
 
37
 
 
38
import bzrlib
 
39
from bzrlib import (
 
40
    osutils,
 
41
    registry,
 
42
    )
37
43
 
38
44
 
39
45
# Section identifiers (map topics to the right place in the manual)
128
134
    return ''.join(out)
129
135
 
130
136
 
 
137
def _load_from_file(topic_name):
 
138
    """Load help from a file.
 
139
 
 
140
    The help is already expected to be in ReStructuredText format.
 
141
    """
 
142
    base = osutils.dirname(bzrlib.__file__)
 
143
    if getattr(sys, 'frozen', None):    # bzr.exe
 
144
        base = osutils.abspath(osutils.pathjoin(base,'..','..'))
 
145
    filename = osutils.pathjoin(base, 'help', topic_name+".txt")
 
146
    return open(filename, 'rU').read()
 
147
 
 
148
 
131
149
def _help_on_revisionspec(name):
132
150
    """Generate the help for revision specs."""
133
151
    import re
607
625
topic_registry.register('files', _files,
608
626
                        'Information on configuration and log files')
609
627
 
 
628
# Load some of the help topics from files
 
629
topic_registry.register('authentication', _load_from_file,
 
630
                        'Information on configuring authentication')
 
631
topic_registry.register('configuration', _load_from_file,
 
632
                        'Details on the configuration settings available')
 
633
topic_registry.register('conflicts', _load_from_file,
 
634
                        'Types of conflicts and what to do about them')
 
635
topic_registry.register('hooks', _load_from_file,
 
636
                        'Points at which custom processing can be added')
 
637
 
610
638
 
611
639
# Register concept topics.
612
640
# Note that we might choose to remove these from the online help in the