Show More
@@ -678,7 +678,11 b' def format(text, width=80, indent=0, kee' | |||||
678 | return formatplain(blocks, width=width) |
|
678 | return formatplain(blocks, width=width) | |
679 |
|
679 | |||
680 | def filtersections(blocks, section): |
|
680 | def filtersections(blocks, section): | |
681 |
"""Select parsed blocks under the specified section |
|
681 | """Select parsed blocks under the specified section | |
|
682 | ||||
|
683 | The section name is separated by a dot, and matches the suffix of the | |||
|
684 | full section path. | |||
|
685 | """ | |||
682 | parents = [] |
|
686 | parents = [] | |
683 | sections = _getsections(blocks) |
|
687 | sections = _getsections(blocks) | |
684 | blocks = [] |
|
688 | blocks = [] | |
@@ -687,10 +691,10 b' def filtersections(blocks, section):' | |||||
687 | synthetic = [] |
|
691 | synthetic = [] | |
688 | collapse = True |
|
692 | collapse = True | |
689 | while i < len(sections): |
|
693 | while i < len(sections): | |
690 |
|
|
694 | path, nest, b = sections[i] | |
691 | del parents[nest:] |
|
695 | del parents[nest:] | |
692 | parents.append(i) |
|
696 | parents.append(i) | |
693 | if name == section: |
|
697 | if path == section or path.endswith('.' + section): | |
694 | if lastparents != parents: |
|
698 | if lastparents != parents: | |
695 | llen = len(lastparents) |
|
699 | llen = len(lastparents) | |
696 | plen = len(parents) |
|
700 | plen = len(parents) | |
@@ -729,8 +733,9 b' def filtersections(blocks, section):' | |||||
729 | return blocks |
|
733 | return blocks | |
730 |
|
734 | |||
731 | def _getsections(blocks): |
|
735 | def _getsections(blocks): | |
732 |
'''return a list of (section |
|
736 | '''return a list of (section path, nesting level, blocks) tuples''' | |
733 | nest = "" |
|
737 | nest = "" | |
|
738 | names = () | |||
734 | level = 0 |
|
739 | level = 0 | |
735 | secs = [] |
|
740 | secs = [] | |
736 |
|
741 | |||
@@ -751,7 +756,8 b' def _getsections(blocks):' | |||||
751 | nest += i |
|
756 | nest += i | |
752 | level = nest.index(i) + 1 |
|
757 | level = nest.index(i) + 1 | |
753 | nest = nest[:level] |
|
758 | nest = nest[:level] | |
754 | secs.append((getname(b), level, [b])) |
|
759 | names = names[:level] + (getname(b),) | |
|
760 | secs.append(('.'.join(names), level, [b])) | |||
755 | elif b['type'] in ('definition', 'field'): |
|
761 | elif b['type'] in ('definition', 'field'): | |
756 | i = ' ' |
|
762 | i = ' ' | |
757 | if i not in nest: |
|
763 | if i not in nest: | |
@@ -772,7 +778,8 b' def _getsections(blocks):' | |||||
772 | elif siblingindent == indent: |
|
778 | elif siblingindent == indent: | |
773 | level = sec[1] |
|
779 | level = sec[1] | |
774 | break |
|
780 | break | |
775 | secs.append((getname(b), level, [b])) |
|
781 | names = names[:level] + (getname(b),) | |
|
782 | secs.append(('.'.join(names), level, [b])) | |||
776 | else: |
|
783 | else: | |
777 | if not secs: |
|
784 | if not secs: | |
778 | # add an initial empty section |
|
785 | # add an initial empty section |
@@ -1344,8 +1344,16 b' Test repeated config section name' | |||||
1344 | Test section name with dot |
|
1344 | Test section name with dot | |
1345 |
|
1345 | |||
1346 | $ hg help config.ui.username |
|
1346 | $ hg help config.ui.username | |
1347 | abort: help section not found: config.ui.username |
|
1347 | "ui.username" | |
1348 | [255] |
|
1348 | The committer of a changeset created when running "commit". Typically | |
|
1349 | a person's name and email address, e.g. "Fred Widget | |||
|
1350 | <fred@example.com>". Environment variables in the username are | |||
|
1351 | expanded. | |||
|
1352 | ||||
|
1353 | (default: "$EMAIL" or "username@hostname". If the username in hgrc is | |||
|
1354 | empty, e.g. if the system admin set "username =" in the system hgrc, | |||
|
1355 | it has to be specified manually or in a different hgrc file) | |||
|
1356 | ||||
1349 |
|
1357 | |||
1350 | $ hg help config.annotate.git |
|
1358 | $ hg help config.annotate.git | |
1351 | abort: help section not found: config.annotate.git |
|
1359 | abort: help section not found: config.annotate.git | |
@@ -1365,7 +1373,20 b' Test section name with dot' | |||||
1365 |
|
1373 | |||
1366 |
|
1374 | |||
1367 | $ hg help config.commands.update.check |
|
1375 | $ hg help config.commands.update.check | |
1368 |
|
|
1376 | "commands.update.check" | |
|
1377 | Determines what level of checking 'hg update' will perform before | |||
|
1378 | moving to a destination revision. Valid values are "abort", "none", | |||
|
1379 | "linear", and "noconflict". "abort" always fails if the working | |||
|
1380 | directory has uncommitted changes. "none" performs no checking, and | |||
|
1381 | may result in a merge with uncommitted changes. "linear" allows any | |||
|
1382 | update as long as it follows a straight line in the revision history, | |||
|
1383 | and may trigger a merge with uncommitted changes. "noconflict" will | |||
|
1384 | allow any update which would not trigger a merge with uncommitted | |||
|
1385 | changes, if any are present. (default: "linear") | |||
|
1386 | ||||
|
1387 | ||||
|
1388 | $ hg help config.ommands.update.check | |||
|
1389 | abort: help section not found: config.ommands.update.check | |||
1369 | [255] |
|
1390 | [255] | |
1370 |
|
1391 | |||
1371 | Unrelated trailing paragraphs shouldn't be included |
|
1392 | Unrelated trailing paragraphs shouldn't be included | |
@@ -1388,6 +1409,14 b' Show nested definitions' | |||||
1388 |
|
|
1409 | $ hg help config.type | egrep '^$'|wc -l | |
1389 | \s*3 (re) |
|
1410 | \s*3 (re) | |
1390 |
|
1411 | |||
|
1412 | $ hg help config.profiling.type.ls | |||
|
1413 | "profiling.type.ls" | |||
|
1414 | Use Python's built-in instrumenting profiler. This profiler works on | |||
|
1415 | all platforms, but each line number it reports is the first line of | |||
|
1416 | a function. This restriction makes it difficult to identify the | |||
|
1417 | expensive parts of a non-trivial function. | |||
|
1418 | ||||
|
1419 | ||||
1391 | Separate sections from subsections |
|
1420 | Separate sections from subsections | |
1392 |
|
1421 | |||
1393 | $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq |
|
1422 | $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq |
General Comments 0
You need to be logged in to leave comments.
Login now