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