##// END OF EJS Templates
help: more improvements for the extensions topic...
Cédric Duval -
r8879:d0a3eadf default
parent child Browse files
Show More
@@ -1485,8 +1485,7 def help_(ui, name=None, with_version=Fa
1485 1485
1486 1486 if name != 'shortlist':
1487 1487 exts, maxlength = extensions.enabled()
1488 ui.write(help.extensionslisting(_('enabled extensions:'),
1489 exts, maxlength))
1488 ui.write(help.listexts(_('enabled extensions:'), exts, maxlength))
1490 1489
1491 1490 if not ui.quiet:
1492 1491 addglobalopts(True)
@@ -9,11 +9,11 from i18n import _
9 9 import extensions
10 10
11 11
12 # loosely inspired by pydoc.source_synopsis()
13 # rewritten to handle ''' as well as """
14 # and to return the whole text instead of just the synopsis
15 12 def moduledoc(file):
16 '''Return the top python documentation for the given file'''
13 '''return the top-level python documentation for the given file
14
15 Loosely inspired by pydoc.source_synopsis(), but rewritten to handle \'''
16 as well as """ and to return the whole text instead of just the synopsis'''
17 17 result = []
18 18
19 19 line = file.readline()
@@ -39,44 +39,42 def moduledoc(file):
39 39
40 40 return ''.join(result)
41 41
42 def extensionslisting(header, exts, maxlength):
43 '''Return a text listing of the given extensions'''
44 result = ''
45
46 if exts:
47 result += '\n%s\n\n' % header
42 def listexts(header, exts, maxlength):
43 '''return a text listing of the given extensions'''
44 if not exts:
45 return ''
46 result = '\n%s\n\n' % header
48 47 for name, desc in sorted(exts.iteritems()):
49 48 result += ' %s %s\n' % (name.ljust(maxlength), desc)
50
51 49 return result
52 50
53 def topicextensions():
51 def extshelp():
54 52 doc = _(r'''
55 53 Mercurial has a mechanism for adding new features through the
56 54 use of extensions. Extensions may bring new commands, or new
57 hooks, or change some behaviors of Mercurial.
55 hooks, or change Mercurial's behavior.
58 56
59 57 Extensions are not loaded by default for a variety of reasons,
60 they may be meant for an advanced usage or provide potentially
61 dangerous commands (eg. mq or rebase allow to rewrite history),
62 they might not be yet ready for prime-time, or they may alter
63 some usual behaviors of stock Mercurial. It is thus up to the
64 user to activate the extensions as needed.
58 they may be meant for advanced users or provide potentially
59 dangerous commands (e.g. mq and rebase allow history to be
60 rewritten), they might not be ready for prime-time yet, or
61 they may alter Mercurial's behavior. It is thus up to the user
62 to activate extensions as desired.
65 63
66 To enable an extension "foo" which is either shipped with
67 Mercurial or in the Python search path, create an entry for
68 it in your hgrc, like this:
64 To enable the "foo" extension, either shipped with Mercurial
65 or in the Python search path, create an entry for it in your
66 hgrc, like this:
69 67
70 68 [extensions]
71 69 foo =
72 70
73 You may also specify the full path where an extension resides:
71 You may also specify the full path to an extension:
74 72
75 73 [extensions]
76 74 myfeature = ~/.hgext/myfeature.py
77 75
78 To explicitly disable an extension which is enabled in an hgrc
79 of broader scope, prepend its path with !:
76 To explicitly disable an extension enabled in an hgrc of broader
77 scope, prepend its path with !:
80 78
81 79 [extensions]
82 80 # disabling extension bar residing in /ext/path
@@ -86,10 +84,10 def topicextensions():
86 84 ''')
87 85
88 86 exts, maxlength = extensions.enabled()
89 doc += extensionslisting(_('enabled extensions:'), exts, maxlength)
87 doc += listexts(_('enabled extensions:'), exts, maxlength)
90 88
91 89 exts, maxlength = extensions.disabled()
92 doc += extensionslisting(_('non-enabled extensions:'), exts, maxlength)
90 doc += listexts(_('disabled extensions:'), exts, maxlength)
93 91
94 92 return doc
95 93
@@ -504,5 +502,5 PYTHONPATH::
504 502 The push command will look for a path named 'default-push', and
505 503 prefer it over 'default' if both are defined.
506 504 ''')),
507 (["extensions"], _("Using additional features"), topicextensions),
505 (["extensions"], _("Using additional features"), extshelp),
508 506 )
General Comments 0
You need to be logged in to leave comments. Login now