Show More
@@ -678,7 +678,11 def format(text, width=80, indent=0, kee | |||
|
678 | 678 | return formatplain(blocks, width=width) |
|
679 | 679 | |
|
680 | 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 | 686 | parents = [] |
|
683 | 687 | sections = _getsections(blocks) |
|
684 | 688 | blocks = [] |
@@ -687,10 +691,10 def filtersections(blocks, section): | |||
|
687 | 691 | synthetic = [] |
|
688 | 692 | collapse = True |
|
689 | 693 | while i < len(sections): |
|
690 |
|
|
|
694 | path, nest, b = sections[i] | |
|
691 | 695 | del parents[nest:] |
|
692 | 696 | parents.append(i) |
|
693 | if name == section: | |
|
697 | if path == section or path.endswith('.' + section): | |
|
694 | 698 | if lastparents != parents: |
|
695 | 699 | llen = len(lastparents) |
|
696 | 700 | plen = len(parents) |
@@ -729,8 +733,9 def filtersections(blocks, section): | |||
|
729 | 733 | return blocks |
|
730 | 734 | |
|
731 | 735 | def _getsections(blocks): |
|
732 |
'''return a list of (section |
|
|
736 | '''return a list of (section path, nesting level, blocks) tuples''' | |
|
733 | 737 | nest = "" |
|
738 | names = () | |
|
734 | 739 | level = 0 |
|
735 | 740 | secs = [] |
|
736 | 741 | |
@@ -751,7 +756,8 def _getsections(blocks): | |||
|
751 | 756 | nest += i |
|
752 | 757 | level = nest.index(i) + 1 |
|
753 | 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 | 761 | elif b['type'] in ('definition', 'field'): |
|
756 | 762 | i = ' ' |
|
757 | 763 | if i not in nest: |
@@ -772,7 +778,8 def _getsections(blocks): | |||
|
772 | 778 | elif siblingindent == indent: |
|
773 | 779 | level = sec[1] |
|
774 | 780 | break |
|
775 | secs.append((getname(b), level, [b])) | |
|
781 | names = names[:level] + (getname(b),) | |
|
782 | secs.append(('.'.join(names), level, [b])) | |
|
776 | 783 | else: |
|
777 | 784 | if not secs: |
|
778 | 785 | # add an initial empty section |
@@ -1344,8 +1344,16 Test repeated config section name | |||
|
1344 | 1344 | Test section name with dot |
|
1345 | 1345 | |
|
1346 | 1346 | $ hg help config.ui.username |
|
1347 | abort: help section not found: config.ui.username | |
|
1348 | [255] | |
|
1347 | "ui.username" | |
|
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 | 1358 | $ hg help config.annotate.git |
|
1351 | 1359 | abort: help section not found: config.annotate.git |
@@ -1365,7 +1373,20 Test section name with dot | |||
|
1365 | 1373 | |
|
1366 | 1374 | |
|
1367 | 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 | 1390 | [255] |
|
1370 | 1391 | |
|
1371 | 1392 | Unrelated trailing paragraphs shouldn't be included |
@@ -1388,6 +1409,14 Show nested definitions | |||
|
1388 | 1409 |
|
|
1389 | 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 | 1420 | Separate sections from subsections |
|
1392 | 1421 | |
|
1393 | 1422 | $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq |
General Comments 0
You need to be logged in to leave comments.
Login now