##// END OF EJS Templates
help: rewrite parsing of help topic to not drop section name with dots...
Yuya Nishihara -
r39375:d30867a7 default
parent child Browse files
Show More
@@ -642,8 +642,8 b' def help_(ui, commands, name, unknowncmd'
642 642
643 643 return ''.join(rst)
644 644
645 def formattedhelp(ui, commands, name, keep=None, unknowncmd=False, full=True,
646 **opts):
645 def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False,
646 full=True, **opts):
647 647 """get help for a given topic (as a dotted name) as rendered rst
648 648
649 649 Either returns the rendered help text or raises an exception.
@@ -652,19 +652,17 b' def formattedhelp(ui, commands, name, ke'
652 652 keep = []
653 653 else:
654 654 keep = list(keep) # make a copy so we can mutate this later
655 fullname = name
656 section = None
657 subtopic = None
658 if name and '.' in name:
659 name, remaining = name.split('.', 1)
660 remaining = encoding.lower(remaining)
661 if '.' in remaining:
662 subtopic, section = remaining.split('.', 1)
663 else:
664 if name in subtopics:
665 subtopic = remaining
666 else:
667 section = remaining
655
656 # <fullname> := <name>[.<subtopic][.<section>]
657 name = subtopic = section = None
658 if fullname is not None:
659 nameparts = fullname.split('.')
660 name = nameparts.pop(0)
661 if nameparts and name in subtopics:
662 subtopic = nameparts.pop(0)
663 if nameparts:
664 section = encoding.lower('.'.join(nameparts))
665
668 666 textwidth = ui.configint('ui', 'textwidth')
669 667 termwidth = ui.termwidth() - 2
670 668 if textwidth <= 0 or termwidth < textwidth:
@@ -1344,52 +1344,14 b' Test repeated config section name'
1344 1344 Test section name with dot
1345 1345
1346 1346 $ hg help config.ui.username
1347 "auth.username"
1348 Optional. Username to authenticate with. If not given, and the remote
1349 site requires basic or digest authentication, the user will be
1350 prompted for it. Environment variables are expanded in the username
1351 letting you do "foo.username = $USER". If the URI includes a username,
1352 only "[auth]" entries with a matching username or without a username
1353 will be considered.
1354
1355 "smtp.username"
1356 Optional. User name for authenticating with the SMTP server. (default:
1357 None)
1358
1359 "ui.username"
1360 The committer of a changeset created when running "commit". Typically
1361 a person's name and email address, e.g. "Fred Widget
1362 <fred@example.com>". Environment variables in the username are
1363 expanded.
1364
1365 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1366 empty, e.g. if the system admin set "username =" in the system hgrc,
1367 it has to be specified manually or in a different hgrc file)
1368
1347 abort: help section not found: config.ui.username
1348 [255]
1369 1349
1370 1350 $ hg help config.annotate.git
1371 "diff.git"
1372 Use git extended diff format.
1373
1351 abort: help section not found: config.annotate.git
1352 [255]
1374 1353
1375 1354 $ hg help config.update.check
1376 "merge-tools.check"
1377 A list of merge success-checking options:
1378
1379 "changed"
1380 Ask whether merge was successful when the merged file shows no
1381 changes.
1382
1383 "conflicts"
1384 Check whether there are conflicts even though the tool reported
1385 success.
1386
1387 "prompt"
1388 Always prompt for merge success, regardless of success reported by
1389 tool.
1390
1391
1392 $ hg help config.commands.update.check
1393 1355 "commands.update.check"
1394 1356 Determines what level of checking 'hg update' will perform before
1395 1357 moving to a destination revision. Valid values are "abort", "none",
@@ -1402,6 +1364,10 b' Test section name with dot'
1402 1364 changes, if any are present. (default: "linear")
1403 1365
1404 1366
1367 $ hg help config.commands.update.check
1368 abort: help section not found: config.commands.update.check
1369 [255]
1370
1405 1371 Unrelated trailing paragraphs shouldn't be included
1406 1372
1407 1373 $ hg help config.extramsg | grep '^$'
General Comments 0
You need to be logged in to leave comments. Login now