##// END OF EJS Templates
commands: use minirst parser when displaying help
Martin Geisler -
r9157:9261667e default
parent child Browse files
Show More
@@ -19,6 +19,7 b' def convert(ui, src, dest=None, revmapfi'
19 19 """convert a foreign SCM repository to a Mercurial one.
20 20
21 21 Accepted source formats [identifiers]:
22
22 23 - Mercurial [hg]
23 24 - CVS [cvs]
24 25 - Darcs [darcs]
@@ -30,6 +31,7 b' def convert(ui, src, dest=None, revmapfi'
30 31 - Perforce [p4]
31 32
32 33 Accepted destination formats [identifiers]:
34
33 35 - Mercurial [hg]
34 36 - Subversion [svn] (history on branches is not preserved)
35 37
@@ -45,19 +47,21 b' def convert(ui, src, dest=None, revmapfi'
45 47 uses --sourcesort to preserve original revision numbers order. Sort modes
46 48 have the following effects:
47 49
48 --branchsort: convert from parent to child revision when possible, which
49 means branches are usually converted one after the other. It generates
50 more compact repositories.
51 --datesort: sort revisions by date. Converted repositories have
52 good-looking changelogs but are often an order of magnitude larger than
53 the same ones generated by --branchsort.
54 --sourcesort: try to preserve source revisions order, only supported by
50 --branchsort convert from parent to child revision when possible, which
51 means branches are usually converted one after the other. It
52 generates more compact repositories.
53
54 --datesort sort revisions by date. Converted repositories have
55 good-looking changelogs but are often an order of magnitude
56 larger than the same ones generated by --branchsort.
57
58 --sourcesort try to preserve source revisions order, only supported by
55 59 Mercurial sources.
56 60
57 61 If <REVMAP> isn't given, it will be put in a default location
58 62 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that
59 63 maps each source commit ID to the destination ID for that revision, like
60 so:
64 so::
61 65
62 66 <source ID> <destination ID>
63 67
@@ -72,7 +76,7 b' def convert(ui, src, dest=None, revmapfi'
72 76
73 77 The filemap is a file that allows filtering and remapping of files and
74 78 directories. Comment lines start with '#'. Each line can contain one of
75 the following directives:
79 the following directives::
76 80
77 81 include path/to/file
78 82
@@ -134,7 +138,7 b' def convert(ui, src, dest=None, revmapfi'
134 138 Because CVS does not have changesets, it is necessary to collect
135 139 individual commits to CVS and merge them into changesets. CVS source uses
136 140 its internal changeset merging code by default but can be configured to
137 call the external 'cvsps' program by setting:
141 call the external 'cvsps' program by setting::
138 142
139 143 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
140 144
@@ -142,7 +146,7 b' def convert(ui, src, dest=None, revmapfi'
142 146
143 147 The options shown are the defaults.
144 148
145 Internal cvsps is selected by setting
149 Internal cvsps is selected by setting ::
146 150
147 151 --config convert.cvsps=builtin
148 152
@@ -38,7 +38,7 b' or for archive distribution.'
38 38 Configuration is done in the [keyword] and [keywordmaps] sections of hgrc
39 39 files.
40 40
41 Example:
41 Example::
42 42
43 43 [keyword]
44 44 # expand keywords in every python file except those matching "x*"
@@ -14,7 +14,7 b' patches (subset of known patches).'
14 14 Known patches are represented as patch files in the .hg/patches directory.
15 15 Applied patches are both patch files and changesets.
16 16
17 Common tasks (use "hg help command" for more details):
17 Common tasks (use "hg help command" for more details)::
18 18
19 19 prepare repository to work with patches qinit
20 20 create new patch qnew
@@ -10,7 +10,7 b''
10 10 Subscriptions can be managed through a hgrc file. Default mode is to print
11 11 messages to stdout, for testing and configuring.
12 12
13 To use, configure the notify extension and enable it in hgrc like this:
13 To use, configure the notify extension and enable it in hgrc like this::
14 14
15 15 [extensions]
16 16 hgext.notify =
@@ -24,11 +24,11 b' To use, configure the notify extension a'
24 24 [notify]
25 25 # config items go here
26 26
27 Required configuration items:
27 Required configuration items::
28 28
29 29 config = /path/to/file # file containing subscriptions
30 30
31 Optional configuration items:
31 Optional configuration items::
32 32
33 33 test = True # print messages to stdout for testing
34 34 strip = 3 # number of slashes to strip for url paths
@@ -50,6 +50,8 b' Optional configuration items:'
50 50 The notify config file has same format as a regular hgrc file. It has two
51 51 sections so you can express subscriptions in whatever way is handier for you.
52 52
53 ::
54
53 55 [usersubs]
54 56 # key is subscriber email, value is ","-separated list of glob patterns
55 57 user@host = pattern
@@ -364,7 +364,7 b' def record(ui, repo, *pats, **opts):'
364 364
365 365 You will be prompted for whether to record changes to each modified file,
366 366 and for files with multiple changes, for each change to use. For each
367 query, the following responses are possible:
367 query, the following responses are possible::
368 368
369 369 y - record this change
370 370 n - skip this change
@@ -14,6 +14,7 b' import patch, help, mdiff, url, encoding'
14 14 import archival, changegroup, cmdutil, sshserver, hbisect
15 15 from hgweb import server
16 16 import merge as merge_
17 import minirst
17 18
18 19 # Commands start here, listed alphabetically
19 20
@@ -133,7 +134,7 b' def archive(ui, repo, dest, **opts):'
133 134 By default, the revision used is the parent of the working directory; use
134 135 -r/--rev to specify a different revision.
135 136
136 To specify the type of archive to create, use -t/--type. Valid types are:
137 To specify the type of archive to create, use -t/--type. Valid types are::
137 138
138 139 "files" (default): a directory full of files
139 140 "tar": tar archive, uncompressed
@@ -550,7 +551,7 b' def cat(ui, repo, file1, *pats, **opts):'
550 551
551 552 Output may be to a file, in which case the name of the file is given using
552 553 a format string. The formatting rules are the same as for the export
553 command, with the following additions:
554 command, with the following additions::
554 555
555 556 %s basename of file being printed
556 557 %d dirname of file being printed, or '.' if in repository root
@@ -600,7 +601,7 b' def clone(ui, source, dest=None, **opts)'
600 601 cases, use the --pull option to avoid hardlinking.
601 602
602 603 In some cases, you can clone repositories and checked out files using full
603 hardlinks with
604 hardlinks with ::
604 605
605 606 $ cp -al REPO REPOCLONE
606 607
@@ -1095,7 +1096,7 b' def export(ui, repo, *changesets, **opts'
1095 1096 it will compare the merge changeset against its first parent only.
1096 1097
1097 1098 Output may be to a file, in which case the name of the file is given using
1098 a format string. The formatting rules are as follows:
1099 a format string. The formatting rules are as follows::
1099 1100
1100 1101 %% literal "%" character
1101 1102 %H changeset hash (40 bytes of hexadecimal)
@@ -1397,6 +1398,7 b' def help_(ui, name=None, with_version=Fa'
1397 1398 Given a topic, extension, or command name, print help for that topic.
1398 1399 """
1399 1400 option_lists = []
1401 textwidth = util.termwidth() - 2
1400 1402
1401 1403 def addglobalopts(aliases):
1402 1404 if ui.verbose:
@@ -1449,7 +1451,7 b' def help_(ui, name=None, with_version=Fa'
1449 1451 doc = _("(no help text available)")
1450 1452 if ui.quiet:
1451 1453 doc = doc.splitlines()[0]
1452 ui.write("\n%s\n" % doc.rstrip())
1454 ui.write("\n%s\n" % minirst.format(doc, textwidth))
1453 1455
1454 1456 if not ui.quiet:
1455 1457 # options
@@ -1498,7 +1500,9 b' def help_(ui, name=None, with_version=Fa'
1498 1500
1499 1501 if name != 'shortlist':
1500 1502 exts, maxlength = extensions.enabled()
1501 ui.write(help.listexts(_('enabled extensions:'), exts, maxlength))
1503 text = help.listexts(_('enabled extensions:'), exts, maxlength)
1504 if text:
1505 ui.write("\n%s\n" % minirst.format(text, textwidth))
1502 1506
1503 1507 if not ui.quiet:
1504 1508 addglobalopts(True)
@@ -1516,8 +1520,8 b' def help_(ui, name=None, with_version=Fa'
1516 1520 if hasattr(doc, '__call__'):
1517 1521 doc = doc()
1518 1522
1519 ui.write("%s\n" % header)
1520 ui.write("%s\n" % doc.rstrip())
1523 ui.write("%s\n\n" % header)
1524 ui.write("%s\n" % minirst.format(doc, textwidth))
1521 1525
1522 1526 def helpext(name):
1523 1527 try:
@@ -1526,12 +1530,11 b' def help_(ui, name=None, with_version=Fa'
1526 1530 raise error.UnknownCommand(name)
1527 1531
1528 1532 doc = gettext(mod.__doc__) or _('no help text available')
1529 doc = doc.splitlines()
1530 ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0]))
1531 for d in doc[1:]:
1532 ui.write(d, '\n')
1533
1534 ui.status('\n')
1533 head, tail = doc.split('\n', 1)
1534 ui.write(_('%s extension - %s\n\n') % (name.split('.')[-1], head))
1535 if tail:
1536 ui.write(minirst.format(tail, textwidth))
1537 ui.status('\n\n')
1535 1538
1536 1539 try:
1537 1540 ct = mod.cmdtable
@@ -2329,7 +2332,7 b' def remove(ui, repo, *pats, **opts):'
2329 2332 The following table details the behavior of remove for different file
2330 2333 states (columns) and option combinations (rows). The file states are Added
2331 2334 [A], Clean [C], Modified [M] and Missing [!] (as reported by hg status).
2332 The actions are Warn, Remove (from branch) and Delete (from disk).
2335 The actions are Warn, Remove (from branch) and Delete (from disk)::
2333 2336
2334 2337 A C M !
2335 2338 none W RD W R
@@ -2410,7 +2413,8 b' def resolve(ui, repo, *pats, **opts):'
2410 2413 whether or not files are resolved. All files must be marked as resolved
2411 2414 before a commit is permitted.
2412 2415
2413 The codes used to show the status of files are:
2416 The codes used to show the status of files are::
2417
2414 2418 U = unresolved
2415 2419 R = resolved
2416 2420 """
@@ -2675,7 +2679,7 b' def rollback(ui, repo):'
2675 2679 Transactions are used to encapsulate the effects of all commands that
2676 2680 create new changesets or propagate existing changesets into a repository.
2677 2681 For example, the following commands are transactional, and their effects
2678 can be rolled back:
2682 can be rolled back::
2679 2683
2680 2684 commit
2681 2685 import
@@ -2783,7 +2787,8 b' def status(ui, repo, *pats, **opts):'
2783 2787 If one revision is given, it is used as the base revision. If two
2784 2788 revisions are given, the differences between them are shown.
2785 2789
2786 The codes used to show the status of files are:
2790 The codes used to show the status of files are::
2791
2787 2792 M = modified
2788 2793 A = added
2789 2794 R = removed
@@ -43,9 +43,10 b' def listexts(header, exts, maxlength):'
43 43 '''return a text listing of the given extensions'''
44 44 if not exts:
45 45 return ''
46 result = '\n%s\n\n' % header
46 # TODO: literal block is wrong, should be a field list or a simple table.
47 result = '\n%s\n\n ::\n\n' % header
47 48 for name, desc in sorted(exts.iteritems()):
48 desc = util.wrap(desc, maxlength + 4)
49 desc = util.wrap(desc, maxlength + 5)
49 50 result += ' %s %s\n' % (name.ljust(maxlength), desc)
50 51 return result
51 52
@@ -63,18 +64,18 b' def extshelp():'
63 64 to activate extensions as needed.
64 65
65 66 To enable the "foo" extension, either shipped with Mercurial or in the
66 Python search path, create an entry for it in your hgrc, like this:
67 Python search path, create an entry for it in your hgrc, like this::
67 68
68 69 [extensions]
69 70 foo =
70 71
71 You may also specify the full path to an extension:
72 You may also specify the full path to an extension::
72 73
73 74 [extensions]
74 75 myfeature = ~/.hgext/myfeature.py
75 76
76 77 To explicitly disable an extension enabled in an hgrc of broader scope,
77 prepend its path with !:
78 prepend its path with !::
78 79
79 80 [extensions]
80 81 # disabling extension bar residing in /path/to/extension/bar.py
@@ -95,10 +96,11 b' helptable = ('
95 96 (["dates"], _("Date Formats"),
96 97 _(r'''
97 98 Some commands allow the user to specify a date, e.g.:
98 * backout, commit, import, tag: Specify the commit date.
99 * log, revert, update: Select revision(s) by date.
100 99
101 Many date formats are valid. Here are some examples:
100 - backout, commit, import, tag: Specify the commit date.
101 - log, revert, update: Select revision(s) by date.
102
103 Many date formats are valid. Here are some examples::
102 104
103 105 "Wed Dec 6 13:18:29 2006" (local timezone assumed)
104 106 "Dec 6 13:18 -0600" (year assumed, time offset provided)
@@ -123,7 +125,7 b' helptable = ('
123 125 offset of the local timezone, in seconds west of UTC (negative if the
124 126 timezone is east of UTC).
125 127
126 The log command also accepts date ranges:
128 The log command also accepts date ranges::
127 129
128 130 "<{datetime}" - at or before a given date/time
129 131 ">{datetime}" - on or after a given date/time
@@ -155,23 +157,23 b' helptable = ('
155 157 To use a Perl/Python regular expression, start a name with "re:". Regexp
156 158 pattern matching is anchored at the root of the repository.
157 159
158 Plain examples:
160 Plain examples::
159 161
160 162 path:foo/bar a name bar in a directory named foo in the root of
161 163 the repository
162 164 path:path:name a file or directory named "path:name"
163 165
164 Glob examples:
166 Glob examples::
165 167
166 168 glob:*.c any name ending in ".c" in the current directory
167 169 *.c any name ending in ".c" in the current directory
168 **.c any name ending in ".c" in any subdirectory of the current
169 directory including itself.
170 **.c any name ending in ".c" in any subdirectory of the
171 current directory including itself.
170 172 foo/*.c any name ending in ".c" in the directory foo
171 173 foo/**.c any name ending in ".c" in any subdirectory of foo
172 174 including itself.
173 175
174 Regexp examples:
176 Regexp examples::
175 177
176 178 re:.*\.c$ any name ending in ".c", anywhere in the repository
177 179
@@ -179,76 +181,77 b' helptable = ('
179 181
180 182 (['environment', 'env'], _('Environment Variables'),
181 183 _(r'''
182 HG::
184 HG
183 185 Path to the 'hg' executable, automatically passed when running hooks,
184 186 extensions or external tools. If unset or empty, this is the hg
185 187 executable's name if it's frozen, or an executable named 'hg' (with
186 188 %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on Windows) is
187 189 searched.
188 190
189 HGEDITOR::
191 HGEDITOR
190 192 This is the name of the editor to run when committing. See EDITOR.
191 193
192 194 (deprecated, use .hgrc)
193 195
194 HGENCODING::
196 HGENCODING
195 197 This overrides the default locale setting detected by Mercurial. This
196 198 setting is used to convert data including usernames, changeset
197 199 descriptions, tag names, and branches. This setting can be overridden with
198 200 the --encoding command-line option.
199 201
200 HGENCODINGMODE::
202 HGENCODINGMODE
201 203 This sets Mercurial's behavior for handling unknown characters while
202 204 transcoding user input. The default is "strict", which causes Mercurial to
203 205 abort if it can't map a character. Other settings include "replace", which
204 206 replaces unknown characters, and "ignore", which drops them. This setting
205 207 can be overridden with the --encodingmode command-line option.
206 208
207 HGMERGE::
209 HGMERGE
208 210 An executable to use for resolving merge conflicts. The program will be
209 211 executed with three arguments: local file, remote file, ancestor file.
210 212
211 213 (deprecated, use .hgrc)
212 214
213 HGRCPATH::
215 HGRCPATH
214 216 A list of files or directories to search for hgrc files. Item separator is
215 217 ":" on Unix, ";" on Windows. If HGRCPATH is not set, platform default
216 218 search path is used. If empty, only the .hg/hgrc from the current
217 219 repository is read.
218 220
219 221 For each element in HGRCPATH:
220 * if it's a directory, all files ending with .rc are added
221 * otherwise, the file itself will be added
222 222
223 HGUSER::
223 - if it's a directory, all files ending with .rc are added
224 - otherwise, the file itself will be added
225
226 HGUSER
224 227 This is the string used as the author of a commit. If not set, available
225 228 values will be considered in this order:
226 229
227 * HGUSER (deprecated)
228 * hgrc files from the HGRCPATH
229 * EMAIL
230 * interactive prompt
231 * LOGNAME (with '@hostname' appended)
230 - HGUSER (deprecated)
231 - hgrc files from the HGRCPATH
232 - EMAIL
233 - interactive prompt
234 - LOGNAME (with '@hostname' appended)
232 235
233 236 (deprecated, use .hgrc)
234 237
235 EMAIL::
238 EMAIL
236 239 May be used as the author of a commit; see HGUSER.
237 240
238 LOGNAME::
241 LOGNAME
239 242 May be used as the author of a commit; see HGUSER.
240 243
241 VISUAL::
244 VISUAL
242 245 This is the name of the editor to use when committing. See EDITOR.
243 246
244 EDITOR::
247 EDITOR
245 248 Sometimes Mercurial needs to open a text file in an editor for a user to
246 249 modify, for example when writing commit messages. The editor it uses is
247 250 determined by looking at the environment variables HGEDITOR, VISUAL and
248 251 EDITOR, in that order. The first non-empty one is chosen. If all of them
249 252 are empty, the editor defaults to 'vi'.
250 253
251 PYTHONPATH::
254 PYTHONPATH
252 255 This is used by Python to find imported modules and may need to be set
253 256 appropriately if this Mercurial is not installed system-wide.
254 257 ''')),
@@ -431,7 +434,7 b' PYTHONPATH::'
431 434
432 435 (['urls'], _('URL Paths'),
433 436 _(r'''
434 Valid URLs are of the form:
437 Valid URLs are of the form::
435 438
436 439 local/filesystem/path[#revision]
437 440 file://local/filesystem/path[#revision]
@@ -450,22 +453,28 b' PYTHONPATH::'
450 453 server.
451 454
452 455 Some notes about using SSH with Mercurial:
456
453 457 - SSH requires an accessible shell account on the destination machine and
454 458 a copy of hg in the remote path or specified with as remotecmd.
455 459 - path is relative to the remote user's home directory by default. Use an
456 extra slash at the start of a path to specify an absolute path:
460 extra slash at the start of a path to specify an absolute path::
461
457 462 ssh://example.com//tmp/repository
463
458 464 - Mercurial doesn't use its own compression via SSH; the right thing to do
459 is to configure it in your ~/.ssh/config, e.g.:
465 is to configure it in your ~/.ssh/config, e.g.::
466
460 467 Host *.mylocalnetwork.example.com
461 468 Compression no
462 469 Host *
463 470 Compression yes
471
464 472 Alternatively specify "ssh -C" as your ssh command in your hgrc or with
465 473 the --ssh command line option.
466 474
467 475 These URLs can all be stored in your hgrc with path aliases under the
468 [paths] section like so:
476 [paths] section like so::
477
469 478 [paths]
470 479 alias1 = URL1
471 480 alias2 = URL2
@@ -3,6 +3,7 b' hg convert [OPTION]... SOURCE [DEST [REV'
3 3 convert a foreign SCM repository to a Mercurial one.
4 4
5 5 Accepted source formats [identifiers]:
6
6 7 - Mercurial [hg]
7 8 - CVS [cvs]
8 9 - Darcs [darcs]
@@ -14,6 +15,7 b' convert a foreign SCM repository to a Me'
14 15 - Perforce [p4]
15 16
16 17 Accepted destination formats [identifiers]:
18
17 19 - Mercurial [hg]
18 20 - Subversion [svn] (history on branches is not preserved)
19 21
@@ -29,13 +31,13 b' convert a foreign SCM repository to a Me'
29 31 uses --sourcesort to preserve original revision numbers order. Sort modes
30 32 have the following effects:
31 33
32 --branchsort: convert from parent to child revision when possible, which
33 means branches are usually converted one after the other. It generates
34 more compact repositories.
35 --datesort: sort revisions by date. Converted repositories have
36 good-looking changelogs but are often an order of magnitude larger than
37 the same ones generated by --branchsort.
38 --sourcesort: try to preserve source revisions order, only supported by
34 --branchsort convert from parent to child revision when possible, which
35 means branches are usually converted one after the other. It
36 generates more compact repositories.
37 --datesort sort revisions by date. Converted repositories have good-
38 looking changelogs but are often an order of magnitude
39 larger than the same ones generated by --branchsort.
40 --sourcesort try to preserve source revisions order, only supported by
39 41 Mercurial sources.
40 42
41 43 If <REVMAP> isn't given, it will be put in a default location
@@ -267,6 +267,7 b' show changed files in the working direct'
267 267 revisions are given, the differences between them are shown.
268 268
269 269 The codes used to show the status of files are:
270
270 271 M = modified
271 272 A = added
272 273 R = removed
General Comments 0
You need to be logged in to leave comments. Login now