##// END OF EJS Templates
minirst: don't generate TH elements for the first row in table...
Dan Villiom Podlaski Christiansen -
r18749:8aa053b9 default
parent child Browse files
Show More
@@ -1,689 +1,686 b''
1 1 # minirst.py - minimal reStructuredText parser
2 2 #
3 3 # Copyright 2009, 2010 Matt Mackall <mpm@selenic.com> and others
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 """simplified reStructuredText parser.
9 9
10 10 This parser knows just enough about reStructuredText to parse the
11 11 Mercurial docstrings.
12 12
13 13 It cheats in a major way: nested blocks are not really nested. They
14 14 are just indented blocks that look like they are nested. This relies
15 15 on the user to keep the right indentation for the blocks.
16 16
17 17 Remember to update http://mercurial.selenic.com/wiki/HelpStyleGuide
18 18 when adding support for new constructs.
19 19 """
20 20
21 21 import re
22 22 import util, encoding
23 23 from i18n import _
24 24
25 25 def section(s):
26 26 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
27 27
28 28 def subsection(s):
29 29 return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s))
30 30
31 31 def subsubsection(s):
32 32 return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))
33 33
34 34 def subsubsubsection(s):
35 35 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
36 36
37 37 def replace(text, substs):
38 38 '''
39 39 Apply a list of (find, replace) pairs to a text.
40 40
41 41 >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
42 42 'Foo Bar'
43 43 >>> encoding.encoding = 'latin1'
44 44 >>> replace('\\x81\\\\', [('\\\\', '/')])
45 45 '\\x81/'
46 46 >>> encoding.encoding = 'shiftjis'
47 47 >>> replace('\\x81\\\\', [('\\\\', '/')])
48 48 '\\x81\\\\'
49 49 '''
50 50
51 51 # some character encodings (cp932 for Japanese, at least) use
52 52 # ASCII characters other than control/alphabet/digit as a part of
53 53 # multi-bytes characters, so direct replacing with such characters
54 54 # on strings in local encoding causes invalid byte sequences.
55 55 utext = text.decode(encoding.encoding)
56 56 for f, t in substs:
57 57 utext = utext.replace(f, t)
58 58 return utext.encode(encoding.encoding)
59 59
60 60 _blockre = re.compile(r"\n(?:\s*\n)+")
61 61
62 62 def findblocks(text):
63 63 """Find continuous blocks of lines in text.
64 64
65 65 Returns a list of dictionaries representing the blocks. Each block
66 66 has an 'indent' field and a 'lines' field.
67 67 """
68 68 blocks = []
69 69 for b in _blockre.split(text.lstrip('\n').rstrip()):
70 70 lines = b.splitlines()
71 71 if lines:
72 72 indent = min((len(l) - len(l.lstrip())) for l in lines)
73 73 lines = [l[indent:] for l in lines]
74 74 blocks.append(dict(indent=indent, lines=lines))
75 75 return blocks
76 76
77 77 def findliteralblocks(blocks):
78 78 """Finds literal blocks and adds a 'type' field to the blocks.
79 79
80 80 Literal blocks are given the type 'literal', all other blocks are
81 81 given type the 'paragraph'.
82 82 """
83 83 i = 0
84 84 while i < len(blocks):
85 85 # Searching for a block that looks like this:
86 86 #
87 87 # +------------------------------+
88 88 # | paragraph |
89 89 # | (ends with "::") |
90 90 # +------------------------------+
91 91 # +---------------------------+
92 92 # | indented literal block |
93 93 # +---------------------------+
94 94 blocks[i]['type'] = 'paragraph'
95 95 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
96 96 indent = blocks[i]['indent']
97 97 adjustment = blocks[i + 1]['indent'] - indent
98 98
99 99 if blocks[i]['lines'] == ['::']:
100 100 # Expanded form: remove block
101 101 del blocks[i]
102 102 i -= 1
103 103 elif blocks[i]['lines'][-1].endswith(' ::'):
104 104 # Partially minimized form: remove space and both
105 105 # colons.
106 106 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
107 107 else:
108 108 # Fully minimized form: remove just one colon.
109 109 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
110 110
111 111 # List items are formatted with a hanging indent. We must
112 112 # correct for this here while we still have the original
113 113 # information on the indentation of the subsequent literal
114 114 # blocks available.
115 115 m = _bulletre.match(blocks[i]['lines'][0])
116 116 if m:
117 117 indent += m.end()
118 118 adjustment -= m.end()
119 119
120 120 # Mark the following indented blocks.
121 121 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
122 122 blocks[i + 1]['type'] = 'literal'
123 123 blocks[i + 1]['indent'] -= adjustment
124 124 i += 1
125 125 i += 1
126 126 return blocks
127 127
128 128 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
129 129 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
130 130 r'((.*) +)(.*)$')
131 131 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
132 132 _definitionre = re.compile(r'[^ ]')
133 133 _tablere = re.compile(r'(=+\s+)*=+')
134 134
135 135 def splitparagraphs(blocks):
136 136 """Split paragraphs into lists."""
137 137 # Tuples with (list type, item regexp, single line items?). Order
138 138 # matters: definition lists has the least specific regexp and must
139 139 # come last.
140 140 listtypes = [('bullet', _bulletre, True),
141 141 ('option', _optionre, True),
142 142 ('field', _fieldre, True),
143 143 ('definition', _definitionre, False)]
144 144
145 145 def match(lines, i, itemre, singleline):
146 146 """Does itemre match an item at line i?
147 147
148 148 A list item can be followed by an indented line or another list
149 149 item (but only if singleline is True).
150 150 """
151 151 line1 = lines[i]
152 152 line2 = i + 1 < len(lines) and lines[i + 1] or ''
153 153 if not itemre.match(line1):
154 154 return False
155 155 if singleline:
156 156 return line2 == '' or line2[0] == ' ' or itemre.match(line2)
157 157 else:
158 158 return line2.startswith(' ')
159 159
160 160 i = 0
161 161 while i < len(blocks):
162 162 if blocks[i]['type'] == 'paragraph':
163 163 lines = blocks[i]['lines']
164 164 for type, itemre, singleline in listtypes:
165 165 if match(lines, 0, itemre, singleline):
166 166 items = []
167 167 for j, line in enumerate(lines):
168 168 if match(lines, j, itemre, singleline):
169 169 items.append(dict(type=type, lines=[],
170 170 indent=blocks[i]['indent']))
171 171 items[-1]['lines'].append(line)
172 172 blocks[i:i + 1] = items
173 173 break
174 174 i += 1
175 175 return blocks
176 176
177 177 _fieldwidth = 14
178 178
179 179 def updatefieldlists(blocks):
180 180 """Find key for field lists."""
181 181 i = 0
182 182 while i < len(blocks):
183 183 if blocks[i]['type'] != 'field':
184 184 i += 1
185 185 continue
186 186
187 187 j = i
188 188 while j < len(blocks) and blocks[j]['type'] == 'field':
189 189 m = _fieldre.match(blocks[j]['lines'][0])
190 190 key, rest = m.groups()
191 191 blocks[j]['lines'][0] = rest
192 192 blocks[j]['key'] = key
193 193 j += 1
194 194
195 195 i = j + 1
196 196
197 197 return blocks
198 198
199 199 def updateoptionlists(blocks):
200 200 i = 0
201 201 while i < len(blocks):
202 202 if blocks[i]['type'] != 'option':
203 203 i += 1
204 204 continue
205 205
206 206 optstrwidth = 0
207 207 j = i
208 208 while j < len(blocks) and blocks[j]['type'] == 'option':
209 209 m = _optionre.match(blocks[j]['lines'][0])
210 210
211 211 shortoption = m.group(2)
212 212 group3 = m.group(3)
213 213 longoption = group3[2:].strip()
214 214 desc = m.group(6).strip()
215 215 longoptionarg = m.group(5).strip()
216 216 blocks[j]['lines'][0] = desc
217 217
218 218 noshortop = ''
219 219 if not shortoption:
220 220 noshortop = ' '
221 221
222 222 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
223 223 ("%s--%s %s") % (noshortop, longoption,
224 224 longoptionarg))
225 225 opt = opt.rstrip()
226 226 blocks[j]['optstr'] = opt
227 227 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
228 228 j += 1
229 229
230 230 for block in blocks[i:j]:
231 231 block['optstrwidth'] = optstrwidth
232 232 i = j + 1
233 233 return blocks
234 234
235 235 def prunecontainers(blocks, keep):
236 236 """Prune unwanted containers.
237 237
238 238 The blocks must have a 'type' field, i.e., they should have been
239 239 run through findliteralblocks first.
240 240 """
241 241 pruned = []
242 242 i = 0
243 243 while i + 1 < len(blocks):
244 244 # Searching for a block that looks like this:
245 245 #
246 246 # +-------+---------------------------+
247 247 # | ".. container ::" type |
248 248 # +---+ |
249 249 # | blocks |
250 250 # +-------------------------------+
251 251 if (blocks[i]['type'] == 'paragraph' and
252 252 blocks[i]['lines'][0].startswith('.. container::')):
253 253 indent = blocks[i]['indent']
254 254 adjustment = blocks[i + 1]['indent'] - indent
255 255 containertype = blocks[i]['lines'][0][15:]
256 256 prune = containertype not in keep
257 257 if prune:
258 258 pruned.append(containertype)
259 259
260 260 # Always delete "..container:: type" block
261 261 del blocks[i]
262 262 j = i
263 263 i -= 1
264 264 while j < len(blocks) and blocks[j]['indent'] > indent:
265 265 if prune:
266 266 del blocks[j]
267 267 else:
268 268 blocks[j]['indent'] -= adjustment
269 269 j += 1
270 270 i += 1
271 271 return blocks, pruned
272 272
273 273 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
274 274
275 275 def findtables(blocks):
276 276 '''Find simple tables
277 277
278 278 Only simple one-line table elements are supported
279 279 '''
280 280
281 281 for block in blocks:
282 282 # Searching for a block that looks like this:
283 283 #
284 284 # === ==== ===
285 285 # A B C
286 286 # === ==== === <- optional
287 287 # 1 2 3
288 288 # x y z
289 289 # === ==== ===
290 290 if (block['type'] == 'paragraph' and
291 291 len(block['lines']) > 2 and
292 292 _tablere.match(block['lines'][0]) and
293 293 block['lines'][0] == block['lines'][-1]):
294 294 block['type'] = 'table'
295 295 block['header'] = False
296 296 div = block['lines'][0]
297 297
298 298 # column markers are ASCII so we can calculate column
299 299 # position in bytes
300 300 columns = [x for x in xrange(len(div))
301 301 if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
302 302 rows = []
303 303 for l in block['lines'][1:-1]:
304 304 if l == div:
305 305 block['header'] = True
306 306 continue
307 307 row = []
308 308 # we measure columns not in bytes or characters but in
309 309 # colwidth which makes things tricky
310 310 pos = columns[0] # leading whitespace is bytes
311 311 for n, start in enumerate(columns):
312 312 if n + 1 < len(columns):
313 313 width = columns[n + 1] - start
314 314 v = encoding.getcols(l, pos, width) # gather columns
315 315 pos += len(v) # calculate byte position of end
316 316 row.append(v.strip())
317 317 else:
318 318 row.append(l[pos:].strip())
319 319 rows.append(row)
320 320
321 321 block['table'] = rows
322 322
323 323 return blocks
324 324
325 325 def findsections(blocks):
326 326 """Finds sections.
327 327
328 328 The blocks must have a 'type' field, i.e., they should have been
329 329 run through findliteralblocks first.
330 330 """
331 331 for block in blocks:
332 332 # Searching for a block that looks like this:
333 333 #
334 334 # +------------------------------+
335 335 # | Section title |
336 336 # | ------------- |
337 337 # +------------------------------+
338 338 if (block['type'] == 'paragraph' and
339 339 len(block['lines']) == 2 and
340 340 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
341 341 _sectionre.match(block['lines'][1])):
342 342 block['underline'] = block['lines'][1][0]
343 343 block['type'] = 'section'
344 344 del block['lines'][1]
345 345 return blocks
346 346
347 347 def inlineliterals(blocks):
348 348 substs = [('``', '"')]
349 349 for b in blocks:
350 350 if b['type'] in ('paragraph', 'section'):
351 351 b['lines'] = [replace(l, substs) for l in b['lines']]
352 352 return blocks
353 353
354 354 def hgrole(blocks):
355 355 substs = [(':hg:`', '"hg '), ('`', '"')]
356 356 for b in blocks:
357 357 if b['type'] in ('paragraph', 'section'):
358 358 # Turn :hg:`command` into "hg command". This also works
359 359 # when there is a line break in the command and relies on
360 360 # the fact that we have no stray back-quotes in the input
361 361 # (run the blocks through inlineliterals first).
362 362 b['lines'] = [replace(l, substs) for l in b['lines']]
363 363 return blocks
364 364
365 365 def addmargins(blocks):
366 366 """Adds empty blocks for vertical spacing.
367 367
368 368 This groups bullets, options, and definitions together with no vertical
369 369 space between them, and adds an empty block between all other blocks.
370 370 """
371 371 i = 1
372 372 while i < len(blocks):
373 373 if (blocks[i]['type'] == blocks[i - 1]['type'] and
374 374 blocks[i]['type'] in ('bullet', 'option', 'field')):
375 375 i += 1
376 376 else:
377 377 blocks.insert(i, dict(lines=[''], indent=0, type='margin'))
378 378 i += 2
379 379 return blocks
380 380
381 381 def prunecomments(blocks):
382 382 """Remove comments."""
383 383 i = 0
384 384 while i < len(blocks):
385 385 b = blocks[i]
386 386 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
387 387 b['lines'] == ['..']):
388 388 del blocks[i]
389 389 if i < len(blocks) and blocks[i]['type'] == 'margin':
390 390 del blocks[i]
391 391 else:
392 392 i += 1
393 393 return blocks
394 394
395 395 _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
396 396 r"error|hint|important|note|tip|warning)::",
397 397 flags=re.IGNORECASE)
398 398
399 399 def findadmonitions(blocks):
400 400 """
401 401 Makes the type of the block an admonition block if
402 402 the first line is an admonition directive
403 403 """
404 404 i = 0
405 405 while i < len(blocks):
406 406 m = _admonitionre.match(blocks[i]['lines'][0])
407 407 if m:
408 408 blocks[i]['type'] = 'admonition'
409 409 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
410 410
411 411 firstline = blocks[i]['lines'][0][m.end() + 1:]
412 412 if firstline:
413 413 blocks[i]['lines'].insert(1, ' ' + firstline)
414 414
415 415 blocks[i]['admonitiontitle'] = admonitiontitle
416 416 del blocks[i]['lines'][0]
417 417 i = i + 1
418 418 return blocks
419 419
420 420 _admonitiontitles = {'attention': _('Attention:'),
421 421 'caution': _('Caution:'),
422 422 'danger': _('!Danger!') ,
423 423 'error': _('Error:'),
424 424 'hint': _('Hint:'),
425 425 'important': _('Important:'),
426 426 'note': _('Note:'),
427 427 'tip': _('Tip:'),
428 428 'warning': _('Warning!')}
429 429
430 430 def formatoption(block, width):
431 431 desc = ' '.join(map(str.strip, block['lines']))
432 432 colwidth = encoding.colwidth(block['optstr'])
433 433 usablewidth = width - 1
434 434 hanging = block['optstrwidth']
435 435 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
436 436 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
437 437 return ' %s\n' % (util.wrap(desc, usablewidth,
438 438 initindent=initindent,
439 439 hangindent=hangindent))
440 440
441 441 def formatblock(block, width):
442 442 """Format a block according to width."""
443 443 if width <= 0:
444 444 width = 78
445 445 indent = ' ' * block['indent']
446 446 if block['type'] == 'admonition':
447 447 admonition = _admonitiontitles[block['admonitiontitle']]
448 448 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
449 449
450 450 defindent = indent + hang * ' '
451 451 text = ' '.join(map(str.strip, block['lines']))
452 452 return '%s\n%s\n' % (indent + admonition,
453 453 util.wrap(text, width=width,
454 454 initindent=defindent,
455 455 hangindent=defindent))
456 456 if block['type'] == 'margin':
457 457 return '\n'
458 458 if block['type'] == 'literal':
459 459 indent += ' '
460 460 return indent + ('\n' + indent).join(block['lines']) + '\n'
461 461 if block['type'] == 'section':
462 462 underline = encoding.colwidth(block['lines'][0]) * block['underline']
463 463 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
464 464 if block['type'] == 'table':
465 465 table = block['table']
466 466 # compute column widths
467 467 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
468 468 text = ''
469 469 span = sum(widths) + len(widths) - 1
470 470 indent = ' ' * block['indent']
471 471 hang = ' ' * (len(indent) + span - widths[-1])
472 472
473 473 for row in table:
474 474 l = []
475 475 for w, v in zip(widths, row):
476 476 pad = ' ' * (w - encoding.colwidth(v))
477 477 l.append(v + pad)
478 478 l = ' '.join(l)
479 479 l = util.wrap(l, width=width, initindent=indent, hangindent=hang)
480 480 if not text and block['header']:
481 481 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
482 482 else:
483 483 text += l + "\n"
484 484 return text
485 485 if block['type'] == 'definition':
486 486 term = indent + block['lines'][0]
487 487 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
488 488 defindent = indent + hang * ' '
489 489 text = ' '.join(map(str.strip, block['lines'][1:]))
490 490 return '%s\n%s\n' % (term, util.wrap(text, width=width,
491 491 initindent=defindent,
492 492 hangindent=defindent))
493 493 subindent = indent
494 494 if block['type'] == 'bullet':
495 495 if block['lines'][0].startswith('| '):
496 496 # Remove bullet for line blocks and add no extra
497 497 # indention.
498 498 block['lines'][0] = block['lines'][0][2:]
499 499 else:
500 500 m = _bulletre.match(block['lines'][0])
501 501 subindent = indent + m.end() * ' '
502 502 elif block['type'] == 'field':
503 503 key = block['key']
504 504 subindent = indent + _fieldwidth * ' '
505 505 if len(key) + 2 > _fieldwidth:
506 506 # key too large, use full line width
507 507 key = key.ljust(width)
508 508 else:
509 509 # key fits within field width
510 510 key = key.ljust(_fieldwidth)
511 511 block['lines'][0] = key + block['lines'][0]
512 512 elif block['type'] == 'option':
513 513 return formatoption(block, width)
514 514
515 515 text = ' '.join(map(str.strip, block['lines']))
516 516 return util.wrap(text, width=width,
517 517 initindent=indent,
518 518 hangindent=subindent) + '\n'
519 519
520 520 def formathtml(blocks):
521 521 """Format RST blocks as HTML"""
522 522
523 523 out = []
524 524 headernest = ''
525 525 listnest = []
526 526
527 527 def openlist(start, level):
528 528 if not listnest or listnest[-1][0] != start:
529 529 listnest.append((start, level))
530 530 out.append('<%s>\n' % start)
531 531
532 532 blocks = [b for b in blocks if b['type'] != 'margin']
533 533
534 534 for pos, b in enumerate(blocks):
535 535 btype = b['type']
536 536 level = b['indent']
537 537 lines = b['lines']
538 538
539 539 if btype == 'admonition':
540 540 admonition = _admonitiontitles[b['admonitiontitle']]
541 541 text = ' '.join(map(str.strip, lines))
542 542 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
543 543 elif btype == 'paragraph':
544 544 out.append('<p>\n%s\n</p>\n' % '\n'.join(lines))
545 545 elif btype == 'margin':
546 546 pass
547 547 elif btype == 'literal':
548 548 out.append('<pre>\n%s\n</pre>\n' % '\n'.join(lines))
549 549 elif btype == 'section':
550 550 i = b['underline']
551 551 if i not in headernest:
552 552 headernest += i
553 553 level = headernest.index(i) + 1
554 554 out.append('<h%d>%s</h%d>\n' % (level, lines[0], level))
555 555 elif btype == 'table':
556 556 table = b['table']
557 557 t = []
558 558 for row in table:
559 559 l = []
560 560 for v in zip(row):
561 if not t:
562 l.append('<th>%s</th>' % v)
563 else:
564 l.append('<td>%s</td>' % v)
561 l.append('<td>%s</td>' % v)
565 562 t.append(' <tr>%s</tr>\n' % ''.join(l))
566 563 out.append('<table>\n%s</table>\n' % ''.join(t))
567 564 elif btype == 'definition':
568 565 openlist('dl', level)
569 566 term = lines[0]
570 567 text = ' '.join(map(str.strip, lines[1:]))
571 568 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
572 569 elif btype == 'bullet':
573 570 bullet, head = lines[0].split(' ', 1)
574 571 if bullet == '-':
575 572 openlist('ul', level)
576 573 else:
577 574 openlist('ol', level)
578 575 out.append(' <li> %s\n' % ' '.join([head] + lines[1:]))
579 576 elif btype == 'field':
580 577 openlist('dl', level)
581 578 key = b['key']
582 579 text = ' '.join(map(str.strip, lines))
583 580 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
584 581 elif btype == 'option':
585 582 openlist('dl', level)
586 583 opt = b['optstr']
587 584 desc = ' '.join(map(str.strip, lines))
588 585 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
589 586
590 587 # close lists if indent level of next block is lower
591 588 if listnest:
592 589 start, level = listnest[-1]
593 590 if pos == len(blocks) - 1:
594 591 out.append('</%s>\n' % start)
595 592 listnest.pop()
596 593 else:
597 594 nb = blocks[pos + 1]
598 595 ni = nb['indent']
599 596 if (ni < level or
600 597 (ni == level and
601 598 nb['type'] not in 'definition bullet field option')):
602 599 out.append('</%s>\n' % start)
603 600 listnest.pop()
604 601
605 602 return ''.join(out)
606 603
607 604 def parse(text, indent=0, keep=None):
608 605 """Parse text into a list of blocks"""
609 606 pruned = []
610 607 blocks = findblocks(text)
611 608 for b in blocks:
612 609 b['indent'] += indent
613 610 blocks = findliteralblocks(blocks)
614 611 blocks = findtables(blocks)
615 612 blocks, pruned = prunecontainers(blocks, keep or [])
616 613 blocks = findsections(blocks)
617 614 blocks = inlineliterals(blocks)
618 615 blocks = hgrole(blocks)
619 616 blocks = splitparagraphs(blocks)
620 617 blocks = updatefieldlists(blocks)
621 618 blocks = updateoptionlists(blocks)
622 619 blocks = addmargins(blocks)
623 620 blocks = prunecomments(blocks)
624 621 blocks = findadmonitions(blocks)
625 622 return blocks, pruned
626 623
627 624 def formatblocks(blocks, width):
628 625 text = ''.join(formatblock(b, width) for b in blocks)
629 626 return text
630 627
631 628 def format(text, width=80, indent=0, keep=None, style='plain'):
632 629 """Parse and format the text according to width."""
633 630 blocks, pruned = parse(text, indent, keep or [])
634 631 if style == 'html':
635 632 text = formathtml(blocks)
636 633 else:
637 634 text = ''.join(formatblock(b, width) for b in blocks)
638 635 if keep is None:
639 636 return text
640 637 else:
641 638 return text, pruned
642 639
643 640 def getsections(blocks):
644 641 '''return a list of (section name, nesting level, blocks) tuples'''
645 642 nest = ""
646 643 level = 0
647 644 secs = []
648 645 for b in blocks:
649 646 if b['type'] == 'section':
650 647 i = b['underline']
651 648 if i not in nest:
652 649 nest += i
653 650 level = nest.index(i) + 1
654 651 nest = nest[:level]
655 652 secs.append((b['lines'][0], level, [b]))
656 653 else:
657 654 if not secs:
658 655 # add an initial empty section
659 656 secs = [('', 0, [])]
660 657 secs[-1][2].append(b)
661 658 return secs
662 659
663 660 def decorateblocks(blocks, width):
664 661 '''generate a list of (section name, line text) pairs for search'''
665 662 lines = []
666 663 for s in getsections(blocks):
667 664 section = s[0]
668 665 text = formatblocks(s[2], width)
669 666 lines.append([(section, l) for l in text.splitlines(True)])
670 667 return lines
671 668
672 669 def maketable(data, indent=0, header=False):
673 670 '''Generate an RST table for the given table data as a list of lines'''
674 671
675 672 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
676 673 indent = ' ' * indent
677 674 div = indent + ' '.join('=' * w for w in widths) + '\n'
678 675
679 676 out = [div]
680 677 for row in data:
681 678 l = []
682 679 for w, v in zip(widths, row):
683 680 pad = ' ' * (w - encoding.colwidth(v))
684 681 l.append(v + pad)
685 682 out.append(indent + ' '.join(l) + "\n")
686 683 if header and len(data) > 1:
687 684 out.insert(2, div)
688 685 out.append(div)
689 686 return out
@@ -1,1787 +1,1787 b''
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge working directory with another revision
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 use "hg help" for the full list of commands or "hg -v" for details
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge working directory with another revision
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 $ hg help
48 48 Mercurial Distributed SCM
49 49
50 50 list of commands:
51 51
52 52 add add the specified files on the next commit
53 53 addremove add all new files, delete all missing files
54 54 annotate show changeset information by line for each file
55 55 archive create an unversioned archive of a repository revision
56 56 backout reverse effect of earlier changeset
57 57 bisect subdivision search of changesets
58 58 bookmarks track a line of development with movable markers
59 59 branch set or show the current branch name
60 60 branches list repository named branches
61 61 bundle create a changegroup file
62 62 cat output the current or given revision of files
63 63 clone make a copy of an existing repository
64 64 commit commit the specified files or all outstanding changes
65 65 copy mark files as copied for the next commit
66 66 diff diff repository (or selected files)
67 67 export dump the header and diffs for one or more changesets
68 68 forget forget the specified files on the next commit
69 69 graft copy changes from other branches onto the current branch
70 70 grep search for a pattern in specified files and revisions
71 71 heads show current repository heads or show branch heads
72 72 help show help for a given topic or a help overview
73 73 identify identify the working copy or specified revision
74 74 import import an ordered set of patches
75 75 incoming show new changesets found in source
76 76 init create a new repository in the given directory
77 77 locate locate files matching specific patterns
78 78 log show revision history of entire repository or files
79 79 manifest output the current or given revision of the project manifest
80 80 merge merge working directory with another revision
81 81 outgoing show changesets not found in the destination
82 82 parents show the parents of the working directory or revision
83 83 paths show aliases for remote repositories
84 84 phase set or show the current phase name
85 85 pull pull changes from the specified source
86 86 push push changes to the specified destination
87 87 recover roll back an interrupted transaction
88 88 remove remove the specified files on the next commit
89 89 rename rename files; equivalent of copy + remove
90 90 resolve redo merges or set/view the merge status of files
91 91 revert restore files to their checkout state
92 92 rollback roll back the last transaction (dangerous)
93 93 root print the root (top) of the current working directory
94 94 serve start stand-alone webserver
95 95 showconfig show combined config settings from all hgrc files
96 96 status show changed files in the working directory
97 97 summary summarize working directory state
98 98 tag add one or more tags for the current or given revision
99 99 tags list repository tags
100 100 tip show the tip revision
101 101 unbundle apply one or more changegroup files
102 102 update update working directory (or switch revisions)
103 103 verify verify the integrity of the repository
104 104 version output version and copyright information
105 105
106 106 additional help topics:
107 107
108 108 config Configuration Files
109 109 dates Date Formats
110 110 diffs Diff Formats
111 111 environment Environment Variables
112 112 extensions Using Additional Features
113 113 filesets Specifying File Sets
114 114 glossary Glossary
115 115 hgignore Syntax for Mercurial Ignore Files
116 116 hgweb Configuring hgweb
117 117 merge-tools Merge Tools
118 118 multirevs Specifying Multiple Revisions
119 119 patterns File Name Patterns
120 120 phases Working with Phases
121 121 revisions Specifying Single Revisions
122 122 revsets Specifying Revision Sets
123 123 subrepos Subrepositories
124 124 templating Template Usage
125 125 urls URL Paths
126 126
127 127 use "hg -v help" to show builtin aliases and global options
128 128
129 129 $ hg -q help
130 130 add add the specified files on the next commit
131 131 addremove add all new files, delete all missing files
132 132 annotate show changeset information by line for each file
133 133 archive create an unversioned archive of a repository revision
134 134 backout reverse effect of earlier changeset
135 135 bisect subdivision search of changesets
136 136 bookmarks track a line of development with movable markers
137 137 branch set or show the current branch name
138 138 branches list repository named branches
139 139 bundle create a changegroup file
140 140 cat output the current or given revision of files
141 141 clone make a copy of an existing repository
142 142 commit commit the specified files or all outstanding changes
143 143 copy mark files as copied for the next commit
144 144 diff diff repository (or selected files)
145 145 export dump the header and diffs for one or more changesets
146 146 forget forget the specified files on the next commit
147 147 graft copy changes from other branches onto the current branch
148 148 grep search for a pattern in specified files and revisions
149 149 heads show current repository heads or show branch heads
150 150 help show help for a given topic or a help overview
151 151 identify identify the working copy or specified revision
152 152 import import an ordered set of patches
153 153 incoming show new changesets found in source
154 154 init create a new repository in the given directory
155 155 locate locate files matching specific patterns
156 156 log show revision history of entire repository or files
157 157 manifest output the current or given revision of the project manifest
158 158 merge merge working directory with another revision
159 159 outgoing show changesets not found in the destination
160 160 parents show the parents of the working directory or revision
161 161 paths show aliases for remote repositories
162 162 phase set or show the current phase name
163 163 pull pull changes from the specified source
164 164 push push changes to the specified destination
165 165 recover roll back an interrupted transaction
166 166 remove remove the specified files on the next commit
167 167 rename rename files; equivalent of copy + remove
168 168 resolve redo merges or set/view the merge status of files
169 169 revert restore files to their checkout state
170 170 rollback roll back the last transaction (dangerous)
171 171 root print the root (top) of the current working directory
172 172 serve start stand-alone webserver
173 173 showconfig show combined config settings from all hgrc files
174 174 status show changed files in the working directory
175 175 summary summarize working directory state
176 176 tag add one or more tags for the current or given revision
177 177 tags list repository tags
178 178 tip show the tip revision
179 179 unbundle apply one or more changegroup files
180 180 update update working directory (or switch revisions)
181 181 verify verify the integrity of the repository
182 182 version output version and copyright information
183 183
184 184 additional help topics:
185 185
186 186 config Configuration Files
187 187 dates Date Formats
188 188 diffs Diff Formats
189 189 environment Environment Variables
190 190 extensions Using Additional Features
191 191 filesets Specifying File Sets
192 192 glossary Glossary
193 193 hgignore Syntax for Mercurial Ignore Files
194 194 hgweb Configuring hgweb
195 195 merge-tools Merge Tools
196 196 multirevs Specifying Multiple Revisions
197 197 patterns File Name Patterns
198 198 phases Working with Phases
199 199 revisions Specifying Single Revisions
200 200 revsets Specifying Revision Sets
201 201 subrepos Subrepositories
202 202 templating Template Usage
203 203 urls URL Paths
204 204
205 205 Test short command list with verbose option
206 206
207 207 $ hg -v help shortlist
208 208 Mercurial Distributed SCM
209 209
210 210 basic commands:
211 211
212 212 add add the specified files on the next commit
213 213 annotate, blame
214 214 show changeset information by line for each file
215 215 clone make a copy of an existing repository
216 216 commit, ci commit the specified files or all outstanding changes
217 217 diff diff repository (or selected files)
218 218 export dump the header and diffs for one or more changesets
219 219 forget forget the specified files on the next commit
220 220 init create a new repository in the given directory
221 221 log, history show revision history of entire repository or files
222 222 merge merge working directory with another revision
223 223 pull pull changes from the specified source
224 224 push push changes to the specified destination
225 225 remove, rm remove the specified files on the next commit
226 226 serve start stand-alone webserver
227 227 status, st show changed files in the working directory
228 228 summary, sum summarize working directory state
229 229 update, up, checkout, co
230 230 update working directory (or switch revisions)
231 231
232 232 global options:
233 233
234 234 -R --repository REPO repository root directory or name of overlay bundle
235 235 file
236 236 --cwd DIR change working directory
237 237 -y --noninteractive do not prompt, automatically pick the first choice for
238 238 all prompts
239 239 -q --quiet suppress output
240 240 -v --verbose enable additional output
241 241 --config CONFIG [+] set/override config option (use 'section.name=value')
242 242 --debug enable debugging output
243 243 --debugger start debugger
244 244 --encoding ENCODE set the charset encoding (default: ascii)
245 245 --encodingmode MODE set the charset encoding mode (default: strict)
246 246 --traceback always print a traceback on exception
247 247 --time time how long the command takes
248 248 --profile print command execution profile
249 249 --version output version information and exit
250 250 -h --help display help and exit
251 251 --hidden consider hidden changesets
252 252
253 253 [+] marked option can be specified multiple times
254 254
255 255 use "hg help" for the full list of commands
256 256
257 257 $ hg add -h
258 258 hg add [OPTION]... [FILE]...
259 259
260 260 add the specified files on the next commit
261 261
262 262 Schedule files to be version controlled and added to the repository.
263 263
264 264 The files will be added to the repository at the next commit. To undo an
265 265 add before that, see "hg forget".
266 266
267 267 If no names are given, add all files to the repository.
268 268
269 269 Returns 0 if all files are successfully added.
270 270
271 271 options:
272 272
273 273 -I --include PATTERN [+] include names matching the given patterns
274 274 -X --exclude PATTERN [+] exclude names matching the given patterns
275 275 -S --subrepos recurse into subrepositories
276 276 -n --dry-run do not perform actions, just print output
277 277
278 278 [+] marked option can be specified multiple times
279 279
280 280 use "hg -v help add" to show more complete help and the global options
281 281
282 282 Verbose help for add
283 283
284 284 $ hg add -hv
285 285 hg add [OPTION]... [FILE]...
286 286
287 287 add the specified files on the next commit
288 288
289 289 Schedule files to be version controlled and added to the repository.
290 290
291 291 The files will be added to the repository at the next commit. To undo an
292 292 add before that, see "hg forget".
293 293
294 294 If no names are given, add all files to the repository.
295 295
296 296 An example showing how new (unknown) files are added automatically by "hg
297 297 add":
298 298
299 299 $ ls
300 300 foo.c
301 301 $ hg status
302 302 ? foo.c
303 303 $ hg add
304 304 adding foo.c
305 305 $ hg status
306 306 A foo.c
307 307
308 308 Returns 0 if all files are successfully added.
309 309
310 310 options:
311 311
312 312 -I --include PATTERN [+] include names matching the given patterns
313 313 -X --exclude PATTERN [+] exclude names matching the given patterns
314 314 -S --subrepos recurse into subrepositories
315 315 -n --dry-run do not perform actions, just print output
316 316
317 317 [+] marked option can be specified multiple times
318 318
319 319 global options:
320 320
321 321 -R --repository REPO repository root directory or name of overlay bundle
322 322 file
323 323 --cwd DIR change working directory
324 324 -y --noninteractive do not prompt, automatically pick the first choice for
325 325 all prompts
326 326 -q --quiet suppress output
327 327 -v --verbose enable additional output
328 328 --config CONFIG [+] set/override config option (use 'section.name=value')
329 329 --debug enable debugging output
330 330 --debugger start debugger
331 331 --encoding ENCODE set the charset encoding (default: ascii)
332 332 --encodingmode MODE set the charset encoding mode (default: strict)
333 333 --traceback always print a traceback on exception
334 334 --time time how long the command takes
335 335 --profile print command execution profile
336 336 --version output version information and exit
337 337 -h --help display help and exit
338 338 --hidden consider hidden changesets
339 339
340 340 [+] marked option can be specified multiple times
341 341
342 342 Test help option with version option
343 343
344 344 $ hg add -h --version
345 345 Mercurial Distributed SCM (version *) (glob)
346 346 (see http://mercurial.selenic.com for more information)
347 347
348 348 Copyright (C) 2005-2012 Matt Mackall and others
349 349 This is free software; see the source for copying conditions. There is NO
350 350 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
351 351
352 352 $ hg add --skjdfks
353 353 hg add: option --skjdfks not recognized
354 354 hg add [OPTION]... [FILE]...
355 355
356 356 add the specified files on the next commit
357 357
358 358 options:
359 359
360 360 -I --include PATTERN [+] include names matching the given patterns
361 361 -X --exclude PATTERN [+] exclude names matching the given patterns
362 362 -S --subrepos recurse into subrepositories
363 363 -n --dry-run do not perform actions, just print output
364 364
365 365 [+] marked option can be specified multiple times
366 366
367 367 use "hg help add" to show the full help text
368 368 [255]
369 369
370 370 Test ambiguous command help
371 371
372 372 $ hg help ad
373 373 list of commands:
374 374
375 375 add add the specified files on the next commit
376 376 addremove add all new files, delete all missing files
377 377
378 378 use "hg -v help ad" to show builtin aliases and global options
379 379
380 380 Test command without options
381 381
382 382 $ hg help verify
383 383 hg verify
384 384
385 385 verify the integrity of the repository
386 386
387 387 Verify the integrity of the current repository.
388 388
389 389 This will perform an extensive check of the repository's integrity,
390 390 validating the hashes and checksums of each entry in the changelog,
391 391 manifest, and tracked files, as well as the integrity of their crosslinks
392 392 and indices.
393 393
394 394 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
395 395 information about recovery from corruption of the repository.
396 396
397 397 Returns 0 on success, 1 if errors are encountered.
398 398
399 399 use "hg -v help verify" to show the global options
400 400
401 401 $ hg help diff
402 402 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
403 403
404 404 diff repository (or selected files)
405 405
406 406 Show differences between revisions for the specified files.
407 407
408 408 Differences between files are shown using the unified diff format.
409 409
410 410 Note:
411 411 diff may generate unexpected results for merges, as it will default to
412 412 comparing against the working directory's first parent changeset if no
413 413 revisions are specified.
414 414
415 415 When two revision arguments are given, then changes are shown between
416 416 those revisions. If only one revision is specified then that revision is
417 417 compared to the working directory, and, when no revisions are specified,
418 418 the working directory files are compared to its parent.
419 419
420 420 Alternatively you can specify -c/--change with a revision to see the
421 421 changes in that changeset relative to its first parent.
422 422
423 423 Without the -a/--text option, diff will avoid generating diffs of files it
424 424 detects as binary. With -a, diff will generate a diff anyway, probably
425 425 with undesirable results.
426 426
427 427 Use the -g/--git option to generate diffs in the git extended diff format.
428 428 For more information, read "hg help diffs".
429 429
430 430 Returns 0 on success.
431 431
432 432 options:
433 433
434 434 -r --rev REV [+] revision
435 435 -c --change REV change made by revision
436 436 -a --text treat all files as text
437 437 -g --git use git extended diff format
438 438 --nodates omit dates from diff headers
439 439 -p --show-function show which function each change is in
440 440 --reverse produce a diff that undoes the changes
441 441 -w --ignore-all-space ignore white space when comparing lines
442 442 -b --ignore-space-change ignore changes in the amount of white space
443 443 -B --ignore-blank-lines ignore changes whose lines are all blank
444 444 -U --unified NUM number of lines of context to show
445 445 --stat output diffstat-style summary of changes
446 446 -I --include PATTERN [+] include names matching the given patterns
447 447 -X --exclude PATTERN [+] exclude names matching the given patterns
448 448 -S --subrepos recurse into subrepositories
449 449
450 450 [+] marked option can be specified multiple times
451 451
452 452 use "hg -v help diff" to show more complete help and the global options
453 453
454 454 $ hg help status
455 455 hg status [OPTION]... [FILE]...
456 456
457 457 aliases: st
458 458
459 459 show changed files in the working directory
460 460
461 461 Show status of files in the repository. If names are given, only files
462 462 that match are shown. Files that are clean or ignored or the source of a
463 463 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
464 464 -C/--copies or -A/--all are given. Unless options described with "show
465 465 only ..." are given, the options -mardu are used.
466 466
467 467 Option -q/--quiet hides untracked (unknown and ignored) files unless
468 468 explicitly requested with -u/--unknown or -i/--ignored.
469 469
470 470 Note:
471 471 status may appear to disagree with diff if permissions have changed or
472 472 a merge has occurred. The standard diff format does not report
473 473 permission changes and diff only reports changes relative to one merge
474 474 parent.
475 475
476 476 If one revision is given, it is used as the base revision. If two
477 477 revisions are given, the differences between them are shown. The --change
478 478 option can also be used as a shortcut to list the changed files of a
479 479 revision from its first parent.
480 480
481 481 The codes used to show the status of files are:
482 482
483 483 M = modified
484 484 A = added
485 485 R = removed
486 486 C = clean
487 487 ! = missing (deleted by non-hg command, but still tracked)
488 488 ? = not tracked
489 489 I = ignored
490 490 = origin of the previous file listed as A (added)
491 491
492 492 Returns 0 on success.
493 493
494 494 options:
495 495
496 496 -A --all show status of all files
497 497 -m --modified show only modified files
498 498 -a --added show only added files
499 499 -r --removed show only removed files
500 500 -d --deleted show only deleted (but tracked) files
501 501 -c --clean show only files without changes
502 502 -u --unknown show only unknown (not tracked) files
503 503 -i --ignored show only ignored files
504 504 -n --no-status hide status prefix
505 505 -C --copies show source of copied files
506 506 -0 --print0 end filenames with NUL, for use with xargs
507 507 --rev REV [+] show difference from revision
508 508 --change REV list the changed files of a revision
509 509 -I --include PATTERN [+] include names matching the given patterns
510 510 -X --exclude PATTERN [+] exclude names matching the given patterns
511 511 -S --subrepos recurse into subrepositories
512 512
513 513 [+] marked option can be specified multiple times
514 514
515 515 use "hg -v help status" to show more complete help and the global options
516 516
517 517 $ hg -q help status
518 518 hg status [OPTION]... [FILE]...
519 519
520 520 show changed files in the working directory
521 521
522 522 $ hg help foo
523 523 hg: unknown command 'foo'
524 524 Mercurial Distributed SCM
525 525
526 526 basic commands:
527 527
528 528 add add the specified files on the next commit
529 529 annotate show changeset information by line for each file
530 530 clone make a copy of an existing repository
531 531 commit commit the specified files or all outstanding changes
532 532 diff diff repository (or selected files)
533 533 export dump the header and diffs for one or more changesets
534 534 forget forget the specified files on the next commit
535 535 init create a new repository in the given directory
536 536 log show revision history of entire repository or files
537 537 merge merge working directory with another revision
538 538 pull pull changes from the specified source
539 539 push push changes to the specified destination
540 540 remove remove the specified files on the next commit
541 541 serve start stand-alone webserver
542 542 status show changed files in the working directory
543 543 summary summarize working directory state
544 544 update update working directory (or switch revisions)
545 545
546 546 use "hg help" for the full list of commands or "hg -v" for details
547 547 [255]
548 548
549 549 $ hg skjdfks
550 550 hg: unknown command 'skjdfks'
551 551 Mercurial Distributed SCM
552 552
553 553 basic commands:
554 554
555 555 add add the specified files on the next commit
556 556 annotate show changeset information by line for each file
557 557 clone make a copy of an existing repository
558 558 commit commit the specified files or all outstanding changes
559 559 diff diff repository (or selected files)
560 560 export dump the header and diffs for one or more changesets
561 561 forget forget the specified files on the next commit
562 562 init create a new repository in the given directory
563 563 log show revision history of entire repository or files
564 564 merge merge working directory with another revision
565 565 pull pull changes from the specified source
566 566 push push changes to the specified destination
567 567 remove remove the specified files on the next commit
568 568 serve start stand-alone webserver
569 569 status show changed files in the working directory
570 570 summary summarize working directory state
571 571 update update working directory (or switch revisions)
572 572
573 573 use "hg help" for the full list of commands or "hg -v" for details
574 574 [255]
575 575
576 576 $ cat > helpext.py <<EOF
577 577 > import os
578 578 > from mercurial import commands
579 579 >
580 580 > def nohelp(ui, *args, **kwargs):
581 581 > pass
582 582 >
583 583 > cmdtable = {
584 584 > "nohelp": (nohelp, [], "hg nohelp"),
585 585 > }
586 586 >
587 587 > commands.norepo += ' nohelp'
588 588 > EOF
589 589 $ echo '[extensions]' >> $HGRCPATH
590 590 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
591 591
592 592 Test command with no help text
593 593
594 594 $ hg help nohelp
595 595 hg nohelp
596 596
597 597 (no help text available)
598 598
599 599 use "hg -v help nohelp" to show the global options
600 600
601 601 $ hg help -k nohelp
602 602 Commands:
603 603
604 604 nohelp hg nohelp
605 605
606 606 Extension Commands:
607 607
608 608 nohelp (no help text available)
609 609
610 610 Test that default list of commands omits extension commands
611 611
612 612 $ hg help
613 613 Mercurial Distributed SCM
614 614
615 615 list of commands:
616 616
617 617 add add the specified files on the next commit
618 618 addremove add all new files, delete all missing files
619 619 annotate show changeset information by line for each file
620 620 archive create an unversioned archive of a repository revision
621 621 backout reverse effect of earlier changeset
622 622 bisect subdivision search of changesets
623 623 bookmarks track a line of development with movable markers
624 624 branch set or show the current branch name
625 625 branches list repository named branches
626 626 bundle create a changegroup file
627 627 cat output the current or given revision of files
628 628 clone make a copy of an existing repository
629 629 commit commit the specified files or all outstanding changes
630 630 copy mark files as copied for the next commit
631 631 diff diff repository (or selected files)
632 632 export dump the header and diffs for one or more changesets
633 633 forget forget the specified files on the next commit
634 634 graft copy changes from other branches onto the current branch
635 635 grep search for a pattern in specified files and revisions
636 636 heads show current repository heads or show branch heads
637 637 help show help for a given topic or a help overview
638 638 identify identify the working copy or specified revision
639 639 import import an ordered set of patches
640 640 incoming show new changesets found in source
641 641 init create a new repository in the given directory
642 642 locate locate files matching specific patterns
643 643 log show revision history of entire repository or files
644 644 manifest output the current or given revision of the project manifest
645 645 merge merge working directory with another revision
646 646 outgoing show changesets not found in the destination
647 647 parents show the parents of the working directory or revision
648 648 paths show aliases for remote repositories
649 649 phase set or show the current phase name
650 650 pull pull changes from the specified source
651 651 push push changes to the specified destination
652 652 recover roll back an interrupted transaction
653 653 remove remove the specified files on the next commit
654 654 rename rename files; equivalent of copy + remove
655 655 resolve redo merges or set/view the merge status of files
656 656 revert restore files to their checkout state
657 657 rollback roll back the last transaction (dangerous)
658 658 root print the root (top) of the current working directory
659 659 serve start stand-alone webserver
660 660 showconfig show combined config settings from all hgrc files
661 661 status show changed files in the working directory
662 662 summary summarize working directory state
663 663 tag add one or more tags for the current or given revision
664 664 tags list repository tags
665 665 tip show the tip revision
666 666 unbundle apply one or more changegroup files
667 667 update update working directory (or switch revisions)
668 668 verify verify the integrity of the repository
669 669 version output version and copyright information
670 670
671 671 enabled extensions:
672 672
673 673 helpext (no help text available)
674 674
675 675 additional help topics:
676 676
677 677 config Configuration Files
678 678 dates Date Formats
679 679 diffs Diff Formats
680 680 environment Environment Variables
681 681 extensions Using Additional Features
682 682 filesets Specifying File Sets
683 683 glossary Glossary
684 684 hgignore Syntax for Mercurial Ignore Files
685 685 hgweb Configuring hgweb
686 686 merge-tools Merge Tools
687 687 multirevs Specifying Multiple Revisions
688 688 patterns File Name Patterns
689 689 phases Working with Phases
690 690 revisions Specifying Single Revisions
691 691 revsets Specifying Revision Sets
692 692 subrepos Subrepositories
693 693 templating Template Usage
694 694 urls URL Paths
695 695
696 696 use "hg -v help" to show builtin aliases and global options
697 697
698 698
699 699
700 700 Test list of commands with command with no help text
701 701
702 702 $ hg help helpext
703 703 helpext extension - no help text available
704 704
705 705 list of commands:
706 706
707 707 nohelp (no help text available)
708 708
709 709 use "hg -v help helpext" to show builtin aliases and global options
710 710
711 711 Test a help topic
712 712
713 713 $ hg help revs
714 714 Specifying Single Revisions
715 715 """""""""""""""""""""""""""
716 716
717 717 Mercurial supports several ways to specify individual revisions.
718 718
719 719 A plain integer is treated as a revision number. Negative integers are
720 720 treated as sequential offsets from the tip, with -1 denoting the tip, -2
721 721 denoting the revision prior to the tip, and so forth.
722 722
723 723 A 40-digit hexadecimal string is treated as a unique revision identifier.
724 724
725 725 A hexadecimal string less than 40 characters long is treated as a unique
726 726 revision identifier and is referred to as a short-form identifier. A
727 727 short-form identifier is only valid if it is the prefix of exactly one
728 728 full-length identifier.
729 729
730 730 Any other string is treated as a bookmark, tag, or branch name. A bookmark
731 731 is a movable pointer to a revision. A tag is a permanent name associated
732 732 with a revision. A branch name denotes the tipmost revision of that
733 733 branch. Bookmark, tag, and branch names must not contain the ":"
734 734 character.
735 735
736 736 The reserved name "tip" always identifies the most recent revision.
737 737
738 738 The reserved name "null" indicates the null revision. This is the revision
739 739 of an empty repository, and the parent of revision 0.
740 740
741 741 The reserved name "." indicates the working directory parent. If no
742 742 working directory is checked out, it is equivalent to null. If an
743 743 uncommitted merge is in progress, "." is the revision of the first parent.
744 744
745 745 Test templating help
746 746
747 747 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
748 748 desc String. The text of the changeset description.
749 749 diffstat String. Statistics of changes with the following format:
750 750 firstline Any text. Returns the first line of text.
751 751 nonempty Any text. Returns '(none)' if the string is empty.
752 752
753 753 Test help hooks
754 754
755 755 $ cat > helphook1.py <<EOF
756 756 > from mercurial import help
757 757 >
758 758 > def rewrite(topic, doc):
759 759 > return doc + '\nhelphook1\n'
760 760 >
761 761 > def extsetup(ui):
762 762 > help.addtopichook('revsets', rewrite)
763 763 > EOF
764 764 $ cat > helphook2.py <<EOF
765 765 > from mercurial import help
766 766 >
767 767 > def rewrite(topic, doc):
768 768 > return doc + '\nhelphook2\n'
769 769 >
770 770 > def extsetup(ui):
771 771 > help.addtopichook('revsets', rewrite)
772 772 > EOF
773 773 $ echo '[extensions]' >> $HGRCPATH
774 774 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
775 775 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
776 776 $ hg help revsets | grep helphook
777 777 helphook1
778 778 helphook2
779 779
780 780 Test keyword search help
781 781
782 782 $ hg help -k clone
783 783 Topics:
784 784
785 785 config Configuration Files
786 786 extensions Using Additional Features
787 787 glossary Glossary
788 788 phases Working with Phases
789 789 subrepos Subrepositories
790 790 urls URL Paths
791 791
792 792 Commands:
793 793
794 794 bookmarks track a line of development with movable markers
795 795 clone make a copy of an existing repository
796 796 paths show aliases for remote repositories
797 797 update update working directory (or switch revisions)
798 798
799 799 Extensions:
800 800
801 801 relink recreates hardlinks between repository clones
802 802
803 803 Extension Commands:
804 804
805 805 qclone clone main and patch repository at same time
806 806
807 807 Test omit indicating for help
808 808
809 809 $ cat > addverboseitems.py <<EOF
810 810 > '''extension to test omit indicating.
811 811 >
812 812 > This paragraph is never omitted (for extension)
813 813 >
814 814 > .. container:: verbose
815 815 >
816 816 > This paragraph is omitted,
817 817 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
818 818 >
819 819 > This paragraph is never omitted, too (for extension)
820 820 > '''
821 821 >
822 822 > from mercurial import help, commands
823 823 > testtopic = """This paragraph is never omitted (for topic).
824 824 >
825 825 > .. container:: verbose
826 826 >
827 827 > This paragraph is omitted,
828 828 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
829 829 >
830 830 > This paragraph is never omitted, too (for topic)
831 831 > """
832 832 > def extsetup(ui):
833 833 > help.helptable.append((["topic-containing-verbose"],
834 834 > "This is the topic to test omit indicating.",
835 835 > lambda : testtopic))
836 836 > EOF
837 837 $ echo '[extensions]' >> $HGRCPATH
838 838 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
839 839 $ hg help addverboseitems
840 840 addverboseitems extension - extension to test omit indicating.
841 841
842 842 This paragraph is never omitted (for extension)
843 843
844 844 This paragraph is never omitted, too (for extension)
845 845
846 846 use "hg help -v addverboseitems" to show more complete help
847 847
848 848 no commands defined
849 849 $ hg help -v addverboseitems
850 850 addverboseitems extension - extension to test omit indicating.
851 851
852 852 This paragraph is never omitted (for extension)
853 853
854 854 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
855 855
856 856 This paragraph is never omitted, too (for extension)
857 857
858 858 no commands defined
859 859 $ hg help topic-containing-verbose
860 860 This is the topic to test omit indicating.
861 861 """"""""""""""""""""""""""""""""""""""""""
862 862
863 863 This paragraph is never omitted (for topic).
864 864
865 865 This paragraph is never omitted, too (for topic)
866 866
867 867 use "hg help -v topic-containing-verbose" to show more complete help
868 868 $ hg help -v topic-containing-verbose
869 869 This is the topic to test omit indicating.
870 870 """"""""""""""""""""""""""""""""""""""""""
871 871
872 872 This paragraph is never omitted (for topic).
873 873
874 874 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
875 875
876 876 This paragraph is never omitted, too (for topic)
877 877
878 878 Test usage of section marks in help documents
879 879
880 880 $ cd "$TESTDIR"/../doc
881 881 $ python check-seclevel.py
882 882 $ cd $TESTTMP
883 883
884 884 #if serve
885 885
886 886 Test the help pages in hgweb.
887 887
888 888 Dish up an empty repo; serve it cold.
889 889
890 890 $ hg init "$TESTTMP/test"
891 891 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
892 892 $ cat hg.pid >> $DAEMON_PIDS
893 893
894 894 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
895 895 200 Script output follows
896 896
897 897 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
898 898 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
899 899 <head>
900 900 <link rel="icon" href="/static/hgicon.png" type="image/png" />
901 901 <meta name="robots" content="index, nofollow" />
902 902 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
903 903 <script type="text/javascript" src="/static/mercurial.js"></script>
904 904
905 905 <title>Help: Index</title>
906 906 </head>
907 907 <body>
908 908
909 909 <div class="container">
910 910 <div class="menu">
911 911 <div class="logo">
912 912 <a href="http://mercurial.selenic.com/">
913 913 <img src="/static/hglogo.png" alt="mercurial" /></a>
914 914 </div>
915 915 <ul>
916 916 <li><a href="/shortlog">log</a></li>
917 917 <li><a href="/graph">graph</a></li>
918 918 <li><a href="/tags">tags</a></li>
919 919 <li><a href="/bookmarks">bookmarks</a></li>
920 920 <li><a href="/branches">branches</a></li>
921 921 </ul>
922 922 <ul>
923 923 <li class="active">help</li>
924 924 </ul>
925 925 </div>
926 926
927 927 <div class="main">
928 928 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
929 929 <form class="search" action="/log">
930 930
931 931 <p><input name="rev" id="search1" type="text" size="30" /></p>
932 932 <div id="hint">find changesets by author, revision,
933 933 files, or words in the commit message</div>
934 934 </form>
935 935 <table class="bigtable">
936 936 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
937 937
938 938 <tr><td>
939 939 <a href="/help/config">
940 940 config
941 941 </a>
942 942 </td><td>
943 943 Configuration Files
944 944 </td></tr>
945 945 <tr><td>
946 946 <a href="/help/dates">
947 947 dates
948 948 </a>
949 949 </td><td>
950 950 Date Formats
951 951 </td></tr>
952 952 <tr><td>
953 953 <a href="/help/diffs">
954 954 diffs
955 955 </a>
956 956 </td><td>
957 957 Diff Formats
958 958 </td></tr>
959 959 <tr><td>
960 960 <a href="/help/environment">
961 961 environment
962 962 </a>
963 963 </td><td>
964 964 Environment Variables
965 965 </td></tr>
966 966 <tr><td>
967 967 <a href="/help/extensions">
968 968 extensions
969 969 </a>
970 970 </td><td>
971 971 Using Additional Features
972 972 </td></tr>
973 973 <tr><td>
974 974 <a href="/help/filesets">
975 975 filesets
976 976 </a>
977 977 </td><td>
978 978 Specifying File Sets
979 979 </td></tr>
980 980 <tr><td>
981 981 <a href="/help/glossary">
982 982 glossary
983 983 </a>
984 984 </td><td>
985 985 Glossary
986 986 </td></tr>
987 987 <tr><td>
988 988 <a href="/help/hgignore">
989 989 hgignore
990 990 </a>
991 991 </td><td>
992 992 Syntax for Mercurial Ignore Files
993 993 </td></tr>
994 994 <tr><td>
995 995 <a href="/help/hgweb">
996 996 hgweb
997 997 </a>
998 998 </td><td>
999 999 Configuring hgweb
1000 1000 </td></tr>
1001 1001 <tr><td>
1002 1002 <a href="/help/merge-tools">
1003 1003 merge-tools
1004 1004 </a>
1005 1005 </td><td>
1006 1006 Merge Tools
1007 1007 </td></tr>
1008 1008 <tr><td>
1009 1009 <a href="/help/multirevs">
1010 1010 multirevs
1011 1011 </a>
1012 1012 </td><td>
1013 1013 Specifying Multiple Revisions
1014 1014 </td></tr>
1015 1015 <tr><td>
1016 1016 <a href="/help/patterns">
1017 1017 patterns
1018 1018 </a>
1019 1019 </td><td>
1020 1020 File Name Patterns
1021 1021 </td></tr>
1022 1022 <tr><td>
1023 1023 <a href="/help/phases">
1024 1024 phases
1025 1025 </a>
1026 1026 </td><td>
1027 1027 Working with Phases
1028 1028 </td></tr>
1029 1029 <tr><td>
1030 1030 <a href="/help/revisions">
1031 1031 revisions
1032 1032 </a>
1033 1033 </td><td>
1034 1034 Specifying Single Revisions
1035 1035 </td></tr>
1036 1036 <tr><td>
1037 1037 <a href="/help/revsets">
1038 1038 revsets
1039 1039 </a>
1040 1040 </td><td>
1041 1041 Specifying Revision Sets
1042 1042 </td></tr>
1043 1043 <tr><td>
1044 1044 <a href="/help/subrepos">
1045 1045 subrepos
1046 1046 </a>
1047 1047 </td><td>
1048 1048 Subrepositories
1049 1049 </td></tr>
1050 1050 <tr><td>
1051 1051 <a href="/help/templating">
1052 1052 templating
1053 1053 </a>
1054 1054 </td><td>
1055 1055 Template Usage
1056 1056 </td></tr>
1057 1057 <tr><td>
1058 1058 <a href="/help/urls">
1059 1059 urls
1060 1060 </a>
1061 1061 </td><td>
1062 1062 URL Paths
1063 1063 </td></tr>
1064 1064 <tr><td>
1065 1065 <a href="/help/topic-containing-verbose">
1066 1066 topic-containing-verbose
1067 1067 </a>
1068 1068 </td><td>
1069 1069 This is the topic to test omit indicating.
1070 1070 </td></tr>
1071 1071
1072 1072 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1073 1073
1074 1074 <tr><td>
1075 1075 <a href="/help/add">
1076 1076 add
1077 1077 </a>
1078 1078 </td><td>
1079 1079 add the specified files on the next commit
1080 1080 </td></tr>
1081 1081 <tr><td>
1082 1082 <a href="/help/annotate">
1083 1083 annotate
1084 1084 </a>
1085 1085 </td><td>
1086 1086 show changeset information by line for each file
1087 1087 </td></tr>
1088 1088 <tr><td>
1089 1089 <a href="/help/clone">
1090 1090 clone
1091 1091 </a>
1092 1092 </td><td>
1093 1093 make a copy of an existing repository
1094 1094 </td></tr>
1095 1095 <tr><td>
1096 1096 <a href="/help/commit">
1097 1097 commit
1098 1098 </a>
1099 1099 </td><td>
1100 1100 commit the specified files or all outstanding changes
1101 1101 </td></tr>
1102 1102 <tr><td>
1103 1103 <a href="/help/diff">
1104 1104 diff
1105 1105 </a>
1106 1106 </td><td>
1107 1107 diff repository (or selected files)
1108 1108 </td></tr>
1109 1109 <tr><td>
1110 1110 <a href="/help/export">
1111 1111 export
1112 1112 </a>
1113 1113 </td><td>
1114 1114 dump the header and diffs for one or more changesets
1115 1115 </td></tr>
1116 1116 <tr><td>
1117 1117 <a href="/help/forget">
1118 1118 forget
1119 1119 </a>
1120 1120 </td><td>
1121 1121 forget the specified files on the next commit
1122 1122 </td></tr>
1123 1123 <tr><td>
1124 1124 <a href="/help/init">
1125 1125 init
1126 1126 </a>
1127 1127 </td><td>
1128 1128 create a new repository in the given directory
1129 1129 </td></tr>
1130 1130 <tr><td>
1131 1131 <a href="/help/log">
1132 1132 log
1133 1133 </a>
1134 1134 </td><td>
1135 1135 show revision history of entire repository or files
1136 1136 </td></tr>
1137 1137 <tr><td>
1138 1138 <a href="/help/merge">
1139 1139 merge
1140 1140 </a>
1141 1141 </td><td>
1142 1142 merge working directory with another revision
1143 1143 </td></tr>
1144 1144 <tr><td>
1145 1145 <a href="/help/pull">
1146 1146 pull
1147 1147 </a>
1148 1148 </td><td>
1149 1149 pull changes from the specified source
1150 1150 </td></tr>
1151 1151 <tr><td>
1152 1152 <a href="/help/push">
1153 1153 push
1154 1154 </a>
1155 1155 </td><td>
1156 1156 push changes to the specified destination
1157 1157 </td></tr>
1158 1158 <tr><td>
1159 1159 <a href="/help/remove">
1160 1160 remove
1161 1161 </a>
1162 1162 </td><td>
1163 1163 remove the specified files on the next commit
1164 1164 </td></tr>
1165 1165 <tr><td>
1166 1166 <a href="/help/serve">
1167 1167 serve
1168 1168 </a>
1169 1169 </td><td>
1170 1170 start stand-alone webserver
1171 1171 </td></tr>
1172 1172 <tr><td>
1173 1173 <a href="/help/status">
1174 1174 status
1175 1175 </a>
1176 1176 </td><td>
1177 1177 show changed files in the working directory
1178 1178 </td></tr>
1179 1179 <tr><td>
1180 1180 <a href="/help/summary">
1181 1181 summary
1182 1182 </a>
1183 1183 </td><td>
1184 1184 summarize working directory state
1185 1185 </td></tr>
1186 1186 <tr><td>
1187 1187 <a href="/help/update">
1188 1188 update
1189 1189 </a>
1190 1190 </td><td>
1191 1191 update working directory (or switch revisions)
1192 1192 </td></tr>
1193 1193
1194 1194 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1195 1195
1196 1196 <tr><td>
1197 1197 <a href="/help/addremove">
1198 1198 addremove
1199 1199 </a>
1200 1200 </td><td>
1201 1201 add all new files, delete all missing files
1202 1202 </td></tr>
1203 1203 <tr><td>
1204 1204 <a href="/help/archive">
1205 1205 archive
1206 1206 </a>
1207 1207 </td><td>
1208 1208 create an unversioned archive of a repository revision
1209 1209 </td></tr>
1210 1210 <tr><td>
1211 1211 <a href="/help/backout">
1212 1212 backout
1213 1213 </a>
1214 1214 </td><td>
1215 1215 reverse effect of earlier changeset
1216 1216 </td></tr>
1217 1217 <tr><td>
1218 1218 <a href="/help/bisect">
1219 1219 bisect
1220 1220 </a>
1221 1221 </td><td>
1222 1222 subdivision search of changesets
1223 1223 </td></tr>
1224 1224 <tr><td>
1225 1225 <a href="/help/bookmarks">
1226 1226 bookmarks
1227 1227 </a>
1228 1228 </td><td>
1229 1229 track a line of development with movable markers
1230 1230 </td></tr>
1231 1231 <tr><td>
1232 1232 <a href="/help/branch">
1233 1233 branch
1234 1234 </a>
1235 1235 </td><td>
1236 1236 set or show the current branch name
1237 1237 </td></tr>
1238 1238 <tr><td>
1239 1239 <a href="/help/branches">
1240 1240 branches
1241 1241 </a>
1242 1242 </td><td>
1243 1243 list repository named branches
1244 1244 </td></tr>
1245 1245 <tr><td>
1246 1246 <a href="/help/bundle">
1247 1247 bundle
1248 1248 </a>
1249 1249 </td><td>
1250 1250 create a changegroup file
1251 1251 </td></tr>
1252 1252 <tr><td>
1253 1253 <a href="/help/cat">
1254 1254 cat
1255 1255 </a>
1256 1256 </td><td>
1257 1257 output the current or given revision of files
1258 1258 </td></tr>
1259 1259 <tr><td>
1260 1260 <a href="/help/copy">
1261 1261 copy
1262 1262 </a>
1263 1263 </td><td>
1264 1264 mark files as copied for the next commit
1265 1265 </td></tr>
1266 1266 <tr><td>
1267 1267 <a href="/help/graft">
1268 1268 graft
1269 1269 </a>
1270 1270 </td><td>
1271 1271 copy changes from other branches onto the current branch
1272 1272 </td></tr>
1273 1273 <tr><td>
1274 1274 <a href="/help/grep">
1275 1275 grep
1276 1276 </a>
1277 1277 </td><td>
1278 1278 search for a pattern in specified files and revisions
1279 1279 </td></tr>
1280 1280 <tr><td>
1281 1281 <a href="/help/heads">
1282 1282 heads
1283 1283 </a>
1284 1284 </td><td>
1285 1285 show current repository heads or show branch heads
1286 1286 </td></tr>
1287 1287 <tr><td>
1288 1288 <a href="/help/help">
1289 1289 help
1290 1290 </a>
1291 1291 </td><td>
1292 1292 show help for a given topic or a help overview
1293 1293 </td></tr>
1294 1294 <tr><td>
1295 1295 <a href="/help/identify">
1296 1296 identify
1297 1297 </a>
1298 1298 </td><td>
1299 1299 identify the working copy or specified revision
1300 1300 </td></tr>
1301 1301 <tr><td>
1302 1302 <a href="/help/import">
1303 1303 import
1304 1304 </a>
1305 1305 </td><td>
1306 1306 import an ordered set of patches
1307 1307 </td></tr>
1308 1308 <tr><td>
1309 1309 <a href="/help/incoming">
1310 1310 incoming
1311 1311 </a>
1312 1312 </td><td>
1313 1313 show new changesets found in source
1314 1314 </td></tr>
1315 1315 <tr><td>
1316 1316 <a href="/help/locate">
1317 1317 locate
1318 1318 </a>
1319 1319 </td><td>
1320 1320 locate files matching specific patterns
1321 1321 </td></tr>
1322 1322 <tr><td>
1323 1323 <a href="/help/manifest">
1324 1324 manifest
1325 1325 </a>
1326 1326 </td><td>
1327 1327 output the current or given revision of the project manifest
1328 1328 </td></tr>
1329 1329 <tr><td>
1330 1330 <a href="/help/nohelp">
1331 1331 nohelp
1332 1332 </a>
1333 1333 </td><td>
1334 1334 (no help text available)
1335 1335 </td></tr>
1336 1336 <tr><td>
1337 1337 <a href="/help/outgoing">
1338 1338 outgoing
1339 1339 </a>
1340 1340 </td><td>
1341 1341 show changesets not found in the destination
1342 1342 </td></tr>
1343 1343 <tr><td>
1344 1344 <a href="/help/parents">
1345 1345 parents
1346 1346 </a>
1347 1347 </td><td>
1348 1348 show the parents of the working directory or revision
1349 1349 </td></tr>
1350 1350 <tr><td>
1351 1351 <a href="/help/paths">
1352 1352 paths
1353 1353 </a>
1354 1354 </td><td>
1355 1355 show aliases for remote repositories
1356 1356 </td></tr>
1357 1357 <tr><td>
1358 1358 <a href="/help/phase">
1359 1359 phase
1360 1360 </a>
1361 1361 </td><td>
1362 1362 set or show the current phase name
1363 1363 </td></tr>
1364 1364 <tr><td>
1365 1365 <a href="/help/recover">
1366 1366 recover
1367 1367 </a>
1368 1368 </td><td>
1369 1369 roll back an interrupted transaction
1370 1370 </td></tr>
1371 1371 <tr><td>
1372 1372 <a href="/help/rename">
1373 1373 rename
1374 1374 </a>
1375 1375 </td><td>
1376 1376 rename files; equivalent of copy + remove
1377 1377 </td></tr>
1378 1378 <tr><td>
1379 1379 <a href="/help/resolve">
1380 1380 resolve
1381 1381 </a>
1382 1382 </td><td>
1383 1383 redo merges or set/view the merge status of files
1384 1384 </td></tr>
1385 1385 <tr><td>
1386 1386 <a href="/help/revert">
1387 1387 revert
1388 1388 </a>
1389 1389 </td><td>
1390 1390 restore files to their checkout state
1391 1391 </td></tr>
1392 1392 <tr><td>
1393 1393 <a href="/help/rollback">
1394 1394 rollback
1395 1395 </a>
1396 1396 </td><td>
1397 1397 roll back the last transaction (dangerous)
1398 1398 </td></tr>
1399 1399 <tr><td>
1400 1400 <a href="/help/root">
1401 1401 root
1402 1402 </a>
1403 1403 </td><td>
1404 1404 print the root (top) of the current working directory
1405 1405 </td></tr>
1406 1406 <tr><td>
1407 1407 <a href="/help/showconfig">
1408 1408 showconfig
1409 1409 </a>
1410 1410 </td><td>
1411 1411 show combined config settings from all hgrc files
1412 1412 </td></tr>
1413 1413 <tr><td>
1414 1414 <a href="/help/tag">
1415 1415 tag
1416 1416 </a>
1417 1417 </td><td>
1418 1418 add one or more tags for the current or given revision
1419 1419 </td></tr>
1420 1420 <tr><td>
1421 1421 <a href="/help/tags">
1422 1422 tags
1423 1423 </a>
1424 1424 </td><td>
1425 1425 list repository tags
1426 1426 </td></tr>
1427 1427 <tr><td>
1428 1428 <a href="/help/tip">
1429 1429 tip
1430 1430 </a>
1431 1431 </td><td>
1432 1432 show the tip revision
1433 1433 </td></tr>
1434 1434 <tr><td>
1435 1435 <a href="/help/unbundle">
1436 1436 unbundle
1437 1437 </a>
1438 1438 </td><td>
1439 1439 apply one or more changegroup files
1440 1440 </td></tr>
1441 1441 <tr><td>
1442 1442 <a href="/help/verify">
1443 1443 verify
1444 1444 </a>
1445 1445 </td><td>
1446 1446 verify the integrity of the repository
1447 1447 </td></tr>
1448 1448 <tr><td>
1449 1449 <a href="/help/version">
1450 1450 version
1451 1451 </a>
1452 1452 </td><td>
1453 1453 output version and copyright information
1454 1454 </td></tr>
1455 1455 </table>
1456 1456 </div>
1457 1457 </div>
1458 1458
1459 1459 <script type="text/javascript">process_dates()</script>
1460 1460
1461 1461
1462 1462 </body>
1463 1463 </html>
1464 1464
1465 1465
1466 1466 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1467 1467 200 Script output follows
1468 1468
1469 1469 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1470 1470 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1471 1471 <head>
1472 1472 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1473 1473 <meta name="robots" content="index, nofollow" />
1474 1474 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1475 1475 <script type="text/javascript" src="/static/mercurial.js"></script>
1476 1476
1477 1477 <title>Help: add</title>
1478 1478 </head>
1479 1479 <body>
1480 1480
1481 1481 <div class="container">
1482 1482 <div class="menu">
1483 1483 <div class="logo">
1484 1484 <a href="http://mercurial.selenic.com/">
1485 1485 <img src="/static/hglogo.png" alt="mercurial" /></a>
1486 1486 </div>
1487 1487 <ul>
1488 1488 <li><a href="/shortlog">log</a></li>
1489 1489 <li><a href="/graph">graph</a></li>
1490 1490 <li><a href="/tags">tags</a></li>
1491 1491 <li><a href="/bookmarks">bookmarks</a></li>
1492 1492 <li><a href="/branches">branches</a></li>
1493 1493 </ul>
1494 1494 <ul>
1495 1495 <li class="active"><a href="/help">help</a></li>
1496 1496 </ul>
1497 1497 </div>
1498 1498
1499 1499 <div class="main">
1500 1500 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1501 1501 <h3>Help: add</h3>
1502 1502
1503 1503 <form class="search" action="/log">
1504 1504
1505 1505 <p><input name="rev" id="search1" type="text" size="30" /></p>
1506 1506 <div id="hint">find changesets by author, revision,
1507 1507 files, or words in the commit message</div>
1508 1508 </form>
1509 1509 <div id="doc">
1510 1510 <p>
1511 1511 hg add [OPTION]... [FILE]...
1512 1512 </p>
1513 1513 <p>
1514 1514 add the specified files on the next commit
1515 1515 </p>
1516 1516 <p>
1517 1517 Schedule files to be version controlled and added to the
1518 1518 repository.
1519 1519 </p>
1520 1520 <p>
1521 1521 The files will be added to the repository at the next commit. To
1522 1522 undo an add before that, see "hg forget".
1523 1523 </p>
1524 1524 <p>
1525 1525 If no names are given, add all files to the repository.
1526 1526 </p>
1527 1527 <p>
1528 1528 Returns 0 if all files are successfully added.
1529 1529 </p>
1530 1530 <p>
1531 1531 options:
1532 1532 </p>
1533 1533 <table>
1534 <tr><th>-I</th><th>--include PATTERN [+]</th><th>include names matching the given patterns</th></tr>
1534 <tr><td>-I</td><td>--include PATTERN [+]</td><td>include names matching the given patterns</td></tr>
1535 1535 <tr><td>-X</td><td>--exclude PATTERN [+]</td><td>exclude names matching the given patterns</td></tr>
1536 1536 <tr><td>-S</td><td>--subrepos</td><td>recurse into subrepositories</td></tr>
1537 1537 <tr><td>-n</td><td>--dry-run</td><td>do not perform actions, just print output</td></tr>
1538 1538 </table>
1539 1539 <p>
1540 1540 [+] marked option can be specified multiple times
1541 1541 </p>
1542 1542 <p>
1543 1543 global options:
1544 1544 </p>
1545 1545 <table>
1546 <tr><th>-R</th><th>--repository REPO</th><th>repository root directory or name of overlay bundle file</th></tr>
1546 <tr><td>-R</td><td>--repository REPO</td><td>repository root directory or name of overlay bundle file</td></tr>
1547 1547 <tr><td></td><td>--cwd DIR</td><td>change working directory</td></tr>
1548 1548 <tr><td>-y</td><td>--noninteractive</td><td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1549 1549 <tr><td>-q</td><td>--quiet</td><td>suppress output</td></tr>
1550 1550 <tr><td>-v</td><td>--verbose</td><td>enable additional output</td></tr>
1551 1551 <tr><td></td><td>--config CONFIG [+]</td><td>set/override config option (use 'section.name=value')</td></tr>
1552 1552 <tr><td></td><td>--debug</td><td>enable debugging output</td></tr>
1553 1553 <tr><td></td><td>--debugger</td><td>start debugger</td></tr>
1554 1554 <tr><td></td><td>--encoding ENCODE</td><td>set the charset encoding (default: ascii)</td></tr>
1555 1555 <tr><td></td><td>--encodingmode MODE</td><td>set the charset encoding mode (default: strict)</td></tr>
1556 1556 <tr><td></td><td>--traceback</td><td>always print a traceback on exception</td></tr>
1557 1557 <tr><td></td><td>--time</td><td>time how long the command takes</td></tr>
1558 1558 <tr><td></td><td>--profile</td><td>print command execution profile</td></tr>
1559 1559 <tr><td></td><td>--version</td><td>output version information and exit</td></tr>
1560 1560 <tr><td>-h</td><td>--help</td><td>display help and exit</td></tr>
1561 1561 <tr><td></td><td>--hidden</td><td>consider hidden changesets</td></tr>
1562 1562 </table>
1563 1563 <p>
1564 1564 [+] marked option can be specified multiple times
1565 1565 </p>
1566 1566
1567 1567 </div>
1568 1568 </div>
1569 1569 </div>
1570 1570
1571 1571 <script type="text/javascript">process_dates()</script>
1572 1572
1573 1573
1574 1574 </body>
1575 1575 </html>
1576 1576
1577 1577
1578 1578 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1579 1579 200 Script output follows
1580 1580
1581 1581 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1582 1582 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1583 1583 <head>
1584 1584 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1585 1585 <meta name="robots" content="index, nofollow" />
1586 1586 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1587 1587 <script type="text/javascript" src="/static/mercurial.js"></script>
1588 1588
1589 1589 <title>Help: remove</title>
1590 1590 </head>
1591 1591 <body>
1592 1592
1593 1593 <div class="container">
1594 1594 <div class="menu">
1595 1595 <div class="logo">
1596 1596 <a href="http://mercurial.selenic.com/">
1597 1597 <img src="/static/hglogo.png" alt="mercurial" /></a>
1598 1598 </div>
1599 1599 <ul>
1600 1600 <li><a href="/shortlog">log</a></li>
1601 1601 <li><a href="/graph">graph</a></li>
1602 1602 <li><a href="/tags">tags</a></li>
1603 1603 <li><a href="/bookmarks">bookmarks</a></li>
1604 1604 <li><a href="/branches">branches</a></li>
1605 1605 </ul>
1606 1606 <ul>
1607 1607 <li class="active"><a href="/help">help</a></li>
1608 1608 </ul>
1609 1609 </div>
1610 1610
1611 1611 <div class="main">
1612 1612 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1613 1613 <h3>Help: remove</h3>
1614 1614
1615 1615 <form class="search" action="/log">
1616 1616
1617 1617 <p><input name="rev" id="search1" type="text" size="30" /></p>
1618 1618 <div id="hint">find changesets by author, revision,
1619 1619 files, or words in the commit message</div>
1620 1620 </form>
1621 1621 <div id="doc">
1622 1622 <p>
1623 1623 hg remove [OPTION]... FILE...
1624 1624 </p>
1625 1625 <p>
1626 1626 aliases: rm
1627 1627 </p>
1628 1628 <p>
1629 1629 remove the specified files on the next commit
1630 1630 </p>
1631 1631 <p>
1632 1632 Schedule the indicated files for removal from the current branch.
1633 1633 </p>
1634 1634 <p>
1635 1635 This command schedules the files to be removed at the next commit.
1636 1636 To undo a remove before that, see "hg revert". To undo added
1637 1637 files, see "hg forget".
1638 1638 </p>
1639 1639 <p>
1640 1640 Returns 0 on success, 1 if any warnings encountered.
1641 1641 </p>
1642 1642 <p>
1643 1643 options:
1644 1644 </p>
1645 1645 <table>
1646 <tr><th>-A</th><th>--after</th><th>record delete for missing files</th></tr>
1646 <tr><td>-A</td><td>--after</td><td>record delete for missing files</td></tr>
1647 1647 <tr><td>-f</td><td>--force</td><td>remove (and delete) file even if added or modified</td></tr>
1648 1648 <tr><td>-I</td><td>--include PATTERN [+]</td><td>include names matching the given patterns</td></tr>
1649 1649 <tr><td>-X</td><td>--exclude PATTERN [+]</td><td>exclude names matching the given patterns</td></tr>
1650 1650 </table>
1651 1651 <p>
1652 1652 [+] marked option can be specified multiple times
1653 1653 </p>
1654 1654 <p>
1655 1655 global options:
1656 1656 </p>
1657 1657 <table>
1658 <tr><th>-R</th><th>--repository REPO</th><th>repository root directory or name of overlay bundle file</th></tr>
1658 <tr><td>-R</td><td>--repository REPO</td><td>repository root directory or name of overlay bundle file</td></tr>
1659 1659 <tr><td></td><td>--cwd DIR</td><td>change working directory</td></tr>
1660 1660 <tr><td>-y</td><td>--noninteractive</td><td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1661 1661 <tr><td>-q</td><td>--quiet</td><td>suppress output</td></tr>
1662 1662 <tr><td>-v</td><td>--verbose</td><td>enable additional output</td></tr>
1663 1663 <tr><td></td><td>--config CONFIG [+]</td><td>set/override config option (use 'section.name=value')</td></tr>
1664 1664 <tr><td></td><td>--debug</td><td>enable debugging output</td></tr>
1665 1665 <tr><td></td><td>--debugger</td><td>start debugger</td></tr>
1666 1666 <tr><td></td><td>--encoding ENCODE</td><td>set the charset encoding (default: ascii)</td></tr>
1667 1667 <tr><td></td><td>--encodingmode MODE</td><td>set the charset encoding mode (default: strict)</td></tr>
1668 1668 <tr><td></td><td>--traceback</td><td>always print a traceback on exception</td></tr>
1669 1669 <tr><td></td><td>--time</td><td>time how long the command takes</td></tr>
1670 1670 <tr><td></td><td>--profile</td><td>print command execution profile</td></tr>
1671 1671 <tr><td></td><td>--version</td><td>output version information and exit</td></tr>
1672 1672 <tr><td>-h</td><td>--help</td><td>display help and exit</td></tr>
1673 1673 <tr><td></td><td>--hidden</td><td>consider hidden changesets</td></tr>
1674 1674 </table>
1675 1675 <p>
1676 1676 [+] marked option can be specified multiple times
1677 1677 </p>
1678 1678
1679 1679 </div>
1680 1680 </div>
1681 1681 </div>
1682 1682
1683 1683 <script type="text/javascript">process_dates()</script>
1684 1684
1685 1685
1686 1686 </body>
1687 1687 </html>
1688 1688
1689 1689
1690 1690 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
1691 1691 200 Script output follows
1692 1692
1693 1693 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1694 1694 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1695 1695 <head>
1696 1696 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1697 1697 <meta name="robots" content="index, nofollow" />
1698 1698 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1699 1699 <script type="text/javascript" src="/static/mercurial.js"></script>
1700 1700
1701 1701 <title>Help: revisions</title>
1702 1702 </head>
1703 1703 <body>
1704 1704
1705 1705 <div class="container">
1706 1706 <div class="menu">
1707 1707 <div class="logo">
1708 1708 <a href="http://mercurial.selenic.com/">
1709 1709 <img src="/static/hglogo.png" alt="mercurial" /></a>
1710 1710 </div>
1711 1711 <ul>
1712 1712 <li><a href="/shortlog">log</a></li>
1713 1713 <li><a href="/graph">graph</a></li>
1714 1714 <li><a href="/tags">tags</a></li>
1715 1715 <li><a href="/bookmarks">bookmarks</a></li>
1716 1716 <li><a href="/branches">branches</a></li>
1717 1717 </ul>
1718 1718 <ul>
1719 1719 <li class="active"><a href="/help">help</a></li>
1720 1720 </ul>
1721 1721 </div>
1722 1722
1723 1723 <div class="main">
1724 1724 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1725 1725 <h3>Help: revisions</h3>
1726 1726
1727 1727 <form class="search" action="/log">
1728 1728
1729 1729 <p><input name="rev" id="search1" type="text" size="30" /></p>
1730 1730 <div id="hint">find changesets by author, revision,
1731 1731 files, or words in the commit message</div>
1732 1732 </form>
1733 1733 <div id="doc">
1734 1734 <h1>Specifying Single Revisions</h1>
1735 1735 <p>
1736 1736 Mercurial supports several ways to specify individual revisions.
1737 1737 </p>
1738 1738 <p>
1739 1739 A plain integer is treated as a revision number. Negative integers are
1740 1740 treated as sequential offsets from the tip, with -1 denoting the tip,
1741 1741 -2 denoting the revision prior to the tip, and so forth.
1742 1742 </p>
1743 1743 <p>
1744 1744 A 40-digit hexadecimal string is treated as a unique revision
1745 1745 identifier.
1746 1746 </p>
1747 1747 <p>
1748 1748 A hexadecimal string less than 40 characters long is treated as a
1749 1749 unique revision identifier and is referred to as a short-form
1750 1750 identifier. A short-form identifier is only valid if it is the prefix
1751 1751 of exactly one full-length identifier.
1752 1752 </p>
1753 1753 <p>
1754 1754 Any other string is treated as a bookmark, tag, or branch name. A
1755 1755 bookmark is a movable pointer to a revision. A tag is a permanent name
1756 1756 associated with a revision. A branch name denotes the tipmost revision
1757 1757 of that branch. Bookmark, tag, and branch names must not contain the ":"
1758 1758 character.
1759 1759 </p>
1760 1760 <p>
1761 1761 The reserved name "tip" always identifies the most recent revision.
1762 1762 </p>
1763 1763 <p>
1764 1764 The reserved name "null" indicates the null revision. This is the
1765 1765 revision of an empty repository, and the parent of revision 0.
1766 1766 </p>
1767 1767 <p>
1768 1768 The reserved name "." indicates the working directory parent. If no
1769 1769 working directory is checked out, it is equivalent to null. If an
1770 1770 uncommitted merge is in progress, "." is the revision of the first
1771 1771 parent.
1772 1772 </p>
1773 1773
1774 1774 </div>
1775 1775 </div>
1776 1776 </div>
1777 1777
1778 1778 <script type="text/javascript">process_dates()</script>
1779 1779
1780 1780
1781 1781 </body>
1782 1782 </html>
1783 1783
1784 1784
1785 1785 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1786 1786
1787 1787 #endif
@@ -1,766 +1,766 b''
1 1 == paragraphs ==
2 2 60 column format:
3 3 ----------------------------------------------------------------------
4 4 This is some text in the first paragraph.
5 5
6 6 A small indented paragraph. It is followed by some lines
7 7 containing random whitespace.
8 8
9 9 The third and final paragraph.
10 10 ----------------------------------------------------------------------
11 11
12 12 30 column format:
13 13 ----------------------------------------------------------------------
14 14 This is some text in the first
15 15 paragraph.
16 16
17 17 A small indented paragraph.
18 18 It is followed by some lines
19 19 containing random
20 20 whitespace.
21 21
22 22 The third and final paragraph.
23 23 ----------------------------------------------------------------------
24 24
25 25 html format:
26 26 ----------------------------------------------------------------------
27 27 <p>
28 28 This is some text in the first paragraph.
29 29 </p>
30 30 <p>
31 31 A small indented paragraph.
32 32 It is followed by some lines
33 33 containing random whitespace.
34 34 </p>
35 35 <p>
36 36 The third and final paragraph.
37 37 </p>
38 38 ----------------------------------------------------------------------
39 39
40 40 == definitions ==
41 41 60 column format:
42 42 ----------------------------------------------------------------------
43 43 A Term
44 44 Definition. The indented lines make up the definition.
45 45
46 46 Another Term
47 47 Another definition. The final line in the definition
48 48 determines the indentation, so this will be indented
49 49 with four spaces.
50 50
51 51 A Nested/Indented Term
52 52 Definition.
53 53 ----------------------------------------------------------------------
54 54
55 55 30 column format:
56 56 ----------------------------------------------------------------------
57 57 A Term
58 58 Definition. The indented
59 59 lines make up the
60 60 definition.
61 61
62 62 Another Term
63 63 Another definition. The
64 64 final line in the
65 65 definition determines the
66 66 indentation, so this will
67 67 be indented with four
68 68 spaces.
69 69
70 70 A Nested/Indented Term
71 71 Definition.
72 72 ----------------------------------------------------------------------
73 73
74 74 html format:
75 75 ----------------------------------------------------------------------
76 76 <dl>
77 77 <dt>A Term
78 78 <dd>Definition. The indented lines make up the definition.
79 79 <dt>Another Term
80 80 <dd>Another definition. The final line in the definition determines the indentation, so this will be indented with four spaces.
81 81 <dt>A Nested/Indented Term
82 82 <dd>Definition.
83 83 </dl>
84 84 ----------------------------------------------------------------------
85 85
86 86 == literals ==
87 87 60 column format:
88 88 ----------------------------------------------------------------------
89 89 The fully minimized form is the most convenient form:
90 90
91 91 Hello
92 92 literal
93 93 world
94 94
95 95 In the partially minimized form a paragraph simply ends with
96 96 space-double-colon.
97 97
98 98 ////////////////////////////////////////
99 99 long un-wrapped line in a literal block
100 100 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
101 101
102 102 This literal block is started with '::',
103 103 the so-called expanded form. The paragraph
104 104 with '::' disappears in the final output.
105 105 ----------------------------------------------------------------------
106 106
107 107 30 column format:
108 108 ----------------------------------------------------------------------
109 109 The fully minimized form is
110 110 the most convenient form:
111 111
112 112 Hello
113 113 literal
114 114 world
115 115
116 116 In the partially minimized
117 117 form a paragraph simply ends
118 118 with space-double-colon.
119 119
120 120 ////////////////////////////////////////
121 121 long un-wrapped line in a literal block
122 122 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
123 123
124 124 This literal block is started with '::',
125 125 the so-called expanded form. The paragraph
126 126 with '::' disappears in the final output.
127 127 ----------------------------------------------------------------------
128 128
129 129 html format:
130 130 ----------------------------------------------------------------------
131 131 <p>
132 132 The fully minimized form is the most
133 133 convenient form:
134 134 </p>
135 135 <pre>
136 136 Hello
137 137 literal
138 138 world
139 139 </pre>
140 140 <p>
141 141 In the partially minimized form a paragraph
142 142 simply ends with space-double-colon.
143 143 </p>
144 144 <pre>
145 145 ////////////////////////////////////////
146 146 long un-wrapped line in a literal block
147 147 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
148 148 </pre>
149 149 <pre>
150 150 This literal block is started with '::',
151 151 the so-called expanded form. The paragraph
152 152 with '::' disappears in the final output.
153 153 </pre>
154 154 ----------------------------------------------------------------------
155 155
156 156 == lists ==
157 157 60 column format:
158 158 ----------------------------------------------------------------------
159 159 - This is the first list item.
160 160
161 161 Second paragraph in the first list item.
162 162
163 163 - List items need not be separated by a blank line.
164 164 - And will be rendered without one in any case.
165 165
166 166 We can have indented lists:
167 167
168 168 - This is an indented list item
169 169 - Another indented list item:
170 170
171 171 - A literal block in the middle
172 172 of an indented list.
173 173
174 174 (The above is not a list item since we are in the literal block.)
175 175
176 176 Literal block with no indentation (apart from
177 177 the two spaces added to all literal blocks).
178 178
179 179 1. This is an enumerated list (first item).
180 180 2. Continuing with the second item.
181 181 (1) foo
182 182 (2) bar
183 183 1) Another
184 184 2) List
185 185
186 186 Line blocks are also a form of list:
187 187
188 188 This is the first line. The line continues here.
189 189 This is the second line.
190 190 ----------------------------------------------------------------------
191 191
192 192 30 column format:
193 193 ----------------------------------------------------------------------
194 194 - This is the first list item.
195 195
196 196 Second paragraph in the
197 197 first list item.
198 198
199 199 - List items need not be
200 200 separated by a blank line.
201 201 - And will be rendered without
202 202 one in any case.
203 203
204 204 We can have indented lists:
205 205
206 206 - This is an indented list
207 207 item
208 208 - Another indented list
209 209 item:
210 210
211 211 - A literal block in the middle
212 212 of an indented list.
213 213
214 214 (The above is not a list item since we are in the literal block.)
215 215
216 216 Literal block with no indentation (apart from
217 217 the two spaces added to all literal blocks).
218 218
219 219 1. This is an enumerated list
220 220 (first item).
221 221 2. Continuing with the second
222 222 item.
223 223 (1) foo
224 224 (2) bar
225 225 1) Another
226 226 2) List
227 227
228 228 Line blocks are also a form of
229 229 list:
230 230
231 231 This is the first line. The
232 232 line continues here.
233 233 This is the second line.
234 234 ----------------------------------------------------------------------
235 235
236 236 html format:
237 237 ----------------------------------------------------------------------
238 238 <ul>
239 239 <li> This is the first list item.
240 240 <p>
241 241 Second paragraph in the first list item.
242 242 </p>
243 243 <li> List items need not be separated by a blank line.
244 244 <li> And will be rendered without one in any case.
245 245 </ul>
246 246 <p>
247 247 We can have indented lists:
248 248 </p>
249 249 <ul>
250 250 <li> This is an indented list item
251 251 <li> Another indented list item:
252 252 <pre>
253 253 - A literal block in the middle
254 254 of an indented list.
255 255 </pre>
256 256 <pre>
257 257 (The above is not a list item since we are in the literal block.)
258 258 </pre>
259 259 </ul>
260 260 <pre>
261 261 Literal block with no indentation (apart from
262 262 the two spaces added to all literal blocks).
263 263 </pre>
264 264 <ol>
265 265 <li> This is an enumerated list (first item).
266 266 <li> Continuing with the second item.
267 267 <li> foo
268 268 <li> bar
269 269 <li> Another
270 270 <li> List
271 271 </ol>
272 272 <p>
273 273 Line blocks are also a form of list:
274 274 </p>
275 275 <ol>
276 276 <li> This is the first line. The line continues here.
277 277 <li> This is the second line.
278 278 </ol>
279 279 ----------------------------------------------------------------------
280 280
281 281 == options ==
282 282 60 column format:
283 283 ----------------------------------------------------------------------
284 284 There is support for simple option lists, but only with long
285 285 options:
286 286
287 287 -X --exclude filter an option with a short and long option
288 288 with an argument
289 289 -I --include an option with both a short option and
290 290 a long option
291 291 --all Output all.
292 292 --both Output both (this description is quite
293 293 long).
294 294 --long Output all day long.
295 295 --par This option has two paragraphs in its
296 296 description. This is the first.
297 297
298 298 This is the second. Blank lines may
299 299 be omitted between options (as above)
300 300 or left in (as here).
301 301
302 302 The next paragraph looks like an option list, but lacks the
303 303 two-space marker after the option. It is treated as a normal
304 304 paragraph:
305 305
306 306 --foo bar baz
307 307 ----------------------------------------------------------------------
308 308
309 309 30 column format:
310 310 ----------------------------------------------------------------------
311 311 There is support for simple
312 312 option lists, but only with
313 313 long options:
314 314
315 315 -X --exclude filter an
316 316 option
317 317 with a
318 318 short
319 319 and
320 320 long
321 321 option
322 322 with an
323 323 argumen
324 324 t
325 325 -I --include an
326 326 option
327 327 with
328 328 both a
329 329 short
330 330 option
331 331 and a
332 332 long
333 333 option
334 334 --all Output
335 335 all.
336 336 --both Output
337 337 both
338 338 (this d
339 339 escript
340 340 ion is
341 341 quite
342 342 long).
343 343 --long Output
344 344 all day
345 345 long.
346 346 --par This
347 347 option
348 348 has two
349 349 paragra
350 350 phs in
351 351 its des
352 352 criptio
353 353 n. This
354 354 is the
355 355 first.
356 356
357 357 This is
358 358 the
359 359 second.
360 360 Blank
361 361 lines
362 362 may be
363 363 omitted
364 364 between
365 365 options
366 366 (as
367 367 above)
368 368 or left
369 369 in (as
370 370 here).
371 371
372 372 The next paragraph looks like
373 373 an option list, but lacks the
374 374 two-space marker after the
375 375 option. It is treated as a
376 376 normal paragraph:
377 377
378 378 --foo bar baz
379 379 ----------------------------------------------------------------------
380 380
381 381 html format:
382 382 ----------------------------------------------------------------------
383 383 <p>
384 384 There is support for simple option lists,
385 385 but only with long options:
386 386 </p>
387 387 <dl>
388 388 <dt>-X --exclude filter
389 389 <dd>an option with a short and long option with an argument
390 390 <dt>-I --include
391 391 <dd>an option with both a short option and a long option
392 392 <dt> --all
393 393 <dd>Output all.
394 394 <dt> --both
395 395 <dd>Output both (this description is quite long).
396 396 <dt> --long
397 397 <dd>Output all day long.
398 398 <dt> --par
399 399 <dd>This option has two paragraphs in its description. This is the first.
400 400 <p>
401 401 This is the second. Blank lines may be omitted between
402 402 options (as above) or left in (as here).
403 403 </p>
404 404 </dl>
405 405 <p>
406 406 The next paragraph looks like an option list, but lacks the two-space
407 407 marker after the option. It is treated as a normal paragraph:
408 408 </p>
409 409 <p>
410 410 --foo bar baz
411 411 </p>
412 412 ----------------------------------------------------------------------
413 413
414 414 == fields ==
415 415 60 column format:
416 416 ----------------------------------------------------------------------
417 417 a First item.
418 418 ab Second item. Indentation and wrapping is
419 419 handled automatically.
420 420
421 421 Next list:
422 422
423 423 small The larger key below triggers full indentation
424 424 here.
425 425 much too large
426 426 This key is big enough to get its own line.
427 427 ----------------------------------------------------------------------
428 428
429 429 30 column format:
430 430 ----------------------------------------------------------------------
431 431 a First item.
432 432 ab Second item.
433 433 Indentation and
434 434 wrapping is
435 435 handled
436 436 automatically.
437 437
438 438 Next list:
439 439
440 440 small The larger key
441 441 below triggers
442 442 full indentation
443 443 here.
444 444 much too large
445 445 This key is big
446 446 enough to get
447 447 its own line.
448 448 ----------------------------------------------------------------------
449 449
450 450 html format:
451 451 ----------------------------------------------------------------------
452 452 <dl>
453 453 <dt>a
454 454 <dd>First item.
455 455 <dt>ab
456 456 <dd>Second item. Indentation and wrapping is handled automatically.
457 457 </dl>
458 458 <p>
459 459 Next list:
460 460 </p>
461 461 <dl>
462 462 <dt>small
463 463 <dd>The larger key below triggers full indentation here.
464 464 <dt>much too large
465 465 <dd>This key is big enough to get its own line.
466 466 </dl>
467 467 ----------------------------------------------------------------------
468 468
469 469 == containers (normal) ==
470 470 60 column format:
471 471 ----------------------------------------------------------------------
472 472 Normal output.
473 473 ----------------------------------------------------------------------
474 474
475 475 30 column format:
476 476 ----------------------------------------------------------------------
477 477 Normal output.
478 478 ----------------------------------------------------------------------
479 479
480 480 html format:
481 481 ----------------------------------------------------------------------
482 482 <p>
483 483 Normal output.
484 484 </p>
485 485 ----------------------------------------------------------------------
486 486
487 487 == containers (verbose) ==
488 488 60 column format:
489 489 ----------------------------------------------------------------------
490 490 Normal output.
491 491
492 492 Verbose output.
493 493 ----------------------------------------------------------------------
494 494 ['debug', 'debug']
495 495 ----------------------------------------------------------------------
496 496
497 497 30 column format:
498 498 ----------------------------------------------------------------------
499 499 Normal output.
500 500
501 501 Verbose output.
502 502 ----------------------------------------------------------------------
503 503 ['debug', 'debug']
504 504 ----------------------------------------------------------------------
505 505
506 506 html format:
507 507 ----------------------------------------------------------------------
508 508 <p>
509 509 Normal output.
510 510 </p>
511 511 <p>
512 512 Verbose output.
513 513 </p>
514 514 ----------------------------------------------------------------------
515 515 ['debug', 'debug']
516 516 ----------------------------------------------------------------------
517 517
518 518 == containers (debug) ==
519 519 60 column format:
520 520 ----------------------------------------------------------------------
521 521 Normal output.
522 522
523 523 Initial debug output.
524 524 ----------------------------------------------------------------------
525 525 ['verbose']
526 526 ----------------------------------------------------------------------
527 527
528 528 30 column format:
529 529 ----------------------------------------------------------------------
530 530 Normal output.
531 531
532 532 Initial debug output.
533 533 ----------------------------------------------------------------------
534 534 ['verbose']
535 535 ----------------------------------------------------------------------
536 536
537 537 html format:
538 538 ----------------------------------------------------------------------
539 539 <p>
540 540 Normal output.
541 541 </p>
542 542 <p>
543 543 Initial debug output.
544 544 </p>
545 545 ----------------------------------------------------------------------
546 546 ['verbose']
547 547 ----------------------------------------------------------------------
548 548
549 549 == containers (verbose debug) ==
550 550 60 column format:
551 551 ----------------------------------------------------------------------
552 552 Normal output.
553 553
554 554 Initial debug output.
555 555
556 556 Verbose output.
557 557
558 558 Debug output.
559 559 ----------------------------------------------------------------------
560 560 []
561 561 ----------------------------------------------------------------------
562 562
563 563 30 column format:
564 564 ----------------------------------------------------------------------
565 565 Normal output.
566 566
567 567 Initial debug output.
568 568
569 569 Verbose output.
570 570
571 571 Debug output.
572 572 ----------------------------------------------------------------------
573 573 []
574 574 ----------------------------------------------------------------------
575 575
576 576 html format:
577 577 ----------------------------------------------------------------------
578 578 <p>
579 579 Normal output.
580 580 </p>
581 581 <p>
582 582 Initial debug output.
583 583 </p>
584 584 <p>
585 585 Verbose output.
586 586 </p>
587 587 <p>
588 588 Debug output.
589 589 </p>
590 590 ----------------------------------------------------------------------
591 591 []
592 592 ----------------------------------------------------------------------
593 593
594 594 == roles ==
595 595 60 column format:
596 596 ----------------------------------------------------------------------
597 597 Please see "hg add".
598 598 ----------------------------------------------------------------------
599 599
600 600 30 column format:
601 601 ----------------------------------------------------------------------
602 602 Please see "hg add".
603 603 ----------------------------------------------------------------------
604 604
605 605 html format:
606 606 ----------------------------------------------------------------------
607 607 <p>
608 608 Please see "hg add".
609 609 </p>
610 610 ----------------------------------------------------------------------
611 611
612 612 == sections ==
613 613 60 column format:
614 614 ----------------------------------------------------------------------
615 615 Title
616 616 =====
617 617
618 618 Section
619 619 -------
620 620
621 621 Subsection
622 622 ''''''''''
623 623
624 624 Markup: "foo" and "hg help"
625 625 ---------------------------
626 626 ----------------------------------------------------------------------
627 627
628 628 30 column format:
629 629 ----------------------------------------------------------------------
630 630 Title
631 631 =====
632 632
633 633 Section
634 634 -------
635 635
636 636 Subsection
637 637 ''''''''''
638 638
639 639 Markup: "foo" and "hg help"
640 640 ---------------------------
641 641 ----------------------------------------------------------------------
642 642
643 643 html format:
644 644 ----------------------------------------------------------------------
645 645 <h1>Title</h1>
646 646 <h2>Section</h2>
647 647 <h3>Subsection</h3>
648 648 <h2>Markup: "foo" and "hg help"</h2>
649 649 ----------------------------------------------------------------------
650 650
651 651 == admonitions ==
652 652 60 column format:
653 653 ----------------------------------------------------------------------
654 654 Note:
655 655 This is a note
656 656
657 657 - Bullet 1
658 658 - Bullet 2
659 659
660 660 Warning!
661 661 This is a warning Second input line of warning
662 662
663 663 !Danger!
664 664 This is danger
665 665 ----------------------------------------------------------------------
666 666
667 667 30 column format:
668 668 ----------------------------------------------------------------------
669 669 Note:
670 670 This is a note
671 671
672 672 - Bullet 1
673 673 - Bullet 2
674 674
675 675 Warning!
676 676 This is a warning Second
677 677 input line of warning
678 678
679 679 !Danger!
680 680 This is danger
681 681 ----------------------------------------------------------------------
682 682
683 683 html format:
684 684 ----------------------------------------------------------------------
685 685 <p>
686 686 <b>Note:</b> This is a note
687 687 </p>
688 688 <ul>
689 689 <li> Bullet 1
690 690 <li> Bullet 2
691 691 </ul>
692 692 <p>
693 693 <b>Warning!</b> This is a warning Second input line of warning
694 694 </p>
695 695 <p>
696 696 <b>!Danger!</b> This is danger
697 697 </p>
698 698 ----------------------------------------------------------------------
699 699
700 700 == comments ==
701 701 60 column format:
702 702 ----------------------------------------------------------------------
703 703 Some text.
704 704
705 705 Some indented text.
706 706
707 707 Empty comment above
708 708 ----------------------------------------------------------------------
709 709
710 710 30 column format:
711 711 ----------------------------------------------------------------------
712 712 Some text.
713 713
714 714 Some indented text.
715 715
716 716 Empty comment above
717 717 ----------------------------------------------------------------------
718 718
719 719 html format:
720 720 ----------------------------------------------------------------------
721 721 <p>
722 722 Some text.
723 723 </p>
724 724 <p>
725 725 Some indented text.
726 726 </p>
727 727 <p>
728 728 Empty comment above
729 729 </p>
730 730 ----------------------------------------------------------------------
731 731
732 732 === === ========================================
733 733 a b c
734 734 === === ========================================
735 735 1 2 3
736 736 foo bar baz this list is very very very long man
737 737 === === ========================================
738 738
739 739 == table ==
740 740 60 column format:
741 741 ----------------------------------------------------------------------
742 742 a b c
743 743 ------------------------------------------------
744 744 1 2 3
745 745 foo bar baz this list is very very very long man
746 746 ----------------------------------------------------------------------
747 747
748 748 30 column format:
749 749 ----------------------------------------------------------------------
750 750 a b c
751 751 ------------------------------
752 752 1 2 3
753 753 foo bar baz this list is
754 754 very very very long
755 755 man
756 756 ----------------------------------------------------------------------
757 757
758 758 html format:
759 759 ----------------------------------------------------------------------
760 760 <table>
761 <tr><th>a</th><th>b</th><th>c</th></tr>
761 <tr><td>a</td><td>b</td><td>c</td></tr>
762 762 <tr><td>1</td><td>2</td><td>3</td></tr>
763 763 <tr><td>foo</td><td>bar</td><td>baz this list is very very very long man</td></tr>
764 764 </table>
765 765 ----------------------------------------------------------------------
766 766
General Comments 0
You need to be logged in to leave comments. Login now