592
"""Environment Variables
594
=================== =======================================================================
595
BZRPATH Path where bzr is to look for shell plugin external commands.
596
BZR_EMAIL E-Mail address of the user. Overrides EMAIL.
597
EMAIL E-Mail address of the user.
598
BZR_EDITOR Editor for editing commit messages. Overrides EDITOR.
599
EDITOR Editor for editing commit messages.
600
BZR_PLUGIN_PATH Paths where bzr should look for plugins.
601
BZR_DISABLE_PLUGINS Plugins that bzr should not load.
602
BZR_PLUGINS_AT Plugins to load from a directory not in BZR_PLUGIN_PATH.
603
BZR_HOME Directory holding .bazaar config dir. Overrides HOME.
604
BZR_HOME (Win32) Directory holding bazaar config dir. Overrides APPDATA and HOME.
605
BZR_REMOTE_PATH Full name of remote 'bzr' command (for bzr+ssh:// URLs).
606
BZR_SSH Path to SSH client, or one of paramiko, openssh, sshcorp, plink.
607
BZR_LOG Location of .bzr.log (use '/dev/null' to suppress log).
608
BZR_LOG (Win32) Location of .bzr.log (use 'NUL' to suppress log).
609
BZR_COLUMNS Override implicit terminal width.
610
BZR_CONCURRENCY Number of processes that can be run concurrently (selftest).
611
BZR_PROGRESS_BAR Override the progress display. Values are 'none', 'dots', or 'tty'.
612
BZR_PDB Control whether to launch a debugger on error.
613
BZR_SIGQUIT_PDB Control whether SIGQUIT behaves normally or invokes a breakin debugger.
614
=================== =======================================================================
598
known_env_variables = [
599
("BZRPATH", "Path where bzr is to look for shell plugin external commands."),
600
("BZR_EMAIL", "E-Mail address of the user. Overrides EMAIL."),
601
("EMAIL", "E-Mail address of the user."),
602
("BZR_EDITOR", "Editor for editing commit messages. Overrides EDITOR."),
603
("EDITOR", "Editor for editing commit messages."),
604
("BZR_PLUGIN_PATH", "Paths where bzr should look for plugins."),
605
("BZR_DISABLE_PLUGINS", "Plugins that bzr should not load."),
606
("BZR_PLUGINS_AT", "Plugins to load from a directory not in BZR_PLUGIN_PATH."),
607
("BZR_HOME", "Directory holding .bazaar config dir. Overrides HOME."),
608
("BZR_HOME (Win32)", "Directory holding bazaar config dir. Overrides APPDATA and HOME."),
609
("BZR_REMOTE_PATH", "Full name of remote 'bzr' command (for bzr+ssh:// URLs)."),
610
("BZR_SSH", "Path to SSH client, or one of paramiko, openssh, sshcorp, plink or lsh."),
611
("BZR_LOG", "Location of .bzr.log (use '/dev/null' to suppress log)."),
612
("BZR_LOG (Win32)", "Location of .bzr.log (use 'NUL' to suppress log)."),
613
("BZR_COLUMNS", "Override implicit terminal width."),
614
("BZR_CONCURRENCY", "Number of processes that can be run concurrently (selftest)"),
615
("BZR_PROGRESS_BAR", "Override the progress display. Values are 'none' or 'text'."),
616
("BZR_PDB", "Control whether to launch a debugger on error."),
617
("BZR_SIGQUIT_PDB", "Control whether SIGQUIT behaves normally or invokes a breakin debugger."),
618
("BZR_TEXTUI_INPUT", "Force console input mode for prompts to line-based (instead of char-based)."),
621
def _env_variables(topic):
623
ret = ["Environment Variables\n\n"
624
"See bzr help configuration for more details.\n\n"]
625
max_key_len = max([len(k[0]) for k in known_env_variables])
626
desc_len = (80 - max_key_len - 2)
627
ret.append("=" * max_key_len + " " + "=" * desc_len + "\n")
628
for k, desc in known_env_variables:
629
ret.append(k + (max_key_len + 1 - len(k)) * " ")
630
ret.append("\n".join(textwrap.wrap(
631
desc, width=desc_len, subsequent_indent=" " * (max_key_len + 1))))
633
ret += "=" * max_key_len + " " + "=" * desc_len + "\n"
726
744
topic_registry.register('basic', _basic_help, "Basic commands", SECT_HIDDEN)
727
745
topic_registry.register('topics', _help_on_topics, "Topics list", SECT_HIDDEN)
728
746
def get_current_formats_topic(topic):
729
from bzrlib import bzrdir
747
from bzrlib import controldir
730
748
return "Current Storage Formats\n\n" + \
731
bzrdir.format_registry.help_topic(topic)
749
controldir.format_registry.help_topic(topic)
732
750
def get_other_formats_topic(topic):
733
from bzrlib import bzrdir
751
from bzrlib import controldir
734
752
return "Other Storage Formats\n\n" + \
735
bzrdir.format_registry.help_topic(topic)
753
controldir.format_registry.help_topic(topic)
736
754
topic_registry.register('current-formats', get_current_formats_topic,
737
755
'Current storage formats')
738
756
topic_registry.register('other-formats', get_other_formats_topic,
768
789
'Types of conflicts and what to do about them')
769
790
topic_registry.register('debug-flags', _load_from_file,
770
791
'Options to show or record debug information')
771
topic_registry.register('location-alias', _load_from_file,
772
'Aliases for remembered locations')
773
792
topic_registry.register('log-formats', _load_from_file,
774
793
'Details on the logging formats available')
794
topic_registry.register('url-special-chars', _load_from_file,
795
'Special character handling in URLs')
777
798
# Register concept topics.
859
889
returned instead of plain text.
861
891
result = topic_registry.get_detail(self.topic)
862
# there is code duplicated here and in bzrlib/plugin.py's
863
# matching Topic code. This should probably be factored in
864
# to a helper function and a common base class.
865
if additional_see_also is not None:
866
see_also = sorted(set(additional_see_also))
870
result += '\n:See also: '
871
result += ', '.join(see_also)
892
result += _format_see_also(additional_see_also)
874
894
result = help_as_plain_text(result)
896
result = i18n.gettext_per_paragraph(result)
877
899
def get_help_topic(self):
892
914
elif line.endswith('::'):
894
916
# Map :doc:`xxx-help` to ``bzr help xxx``
895
line = re.sub(":doc:`(.+)-help`", r'``bzr help \1``', line)
917
line = re.sub(":doc:`(.+?)-help`", r'``bzr help \1``', line)
896
918
result.append(line)
897
919
return "\n".join(result) + "\n"
922
class ConfigOptionHelpIndex(object):
923
"""A help index that returns help topics for config options."""
926
self.prefix = 'configuration/'
928
def get_topics(self, topic):
929
"""Search for topic in the registered config options.
931
:param topic: A topic to search for.
932
:return: A list which is either empty or contains a single
937
elif topic.startswith(self.prefix):
938
topic = topic[len(self.prefix):]
939
if topic in config.option_registry:
940
return [config.option_registry.get(topic)]