##// 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 return ''.join(rst)
643 return ''.join(rst)
644
644
645 def formattedhelp(ui, commands, name, keep=None, unknowncmd=False, full=True,
645 def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False,
646 **opts):
646 full=True, **opts):
647 """get help for a given topic (as a dotted name) as rendered rst
647 """get help for a given topic (as a dotted name) as rendered rst
648
648
649 Either returns the rendered help text or raises an exception.
649 Either returns the rendered help text or raises an exception.
@@ -652,19 +652,17 b' def formattedhelp(ui, commands, name, ke'
652 keep = []
652 keep = []
653 else:
653 else:
654 keep = list(keep) # make a copy so we can mutate this later
654 keep = list(keep) # make a copy so we can mutate this later
655 fullname = name
655
656 section = None
656 # <fullname> := <name>[.<subtopic][.<section>]
657 subtopic = None
657 name = subtopic = section = None
658 if name and '.' in name:
658 if fullname is not None:
659 name, remaining = name.split('.', 1)
659 nameparts = fullname.split('.')
660 remaining = encoding.lower(remaining)
660 name = nameparts.pop(0)
661 if '.' in remaining:
661 if nameparts and name in subtopics:
662 subtopic, section = remaining.split('.', 1)
662 subtopic = nameparts.pop(0)
663 else:
663 if nameparts:
664 if name in subtopics:
664 section = encoding.lower('.'.join(nameparts))
665 subtopic = remaining
665
666 else:
667 section = remaining
668 textwidth = ui.configint('ui', 'textwidth')
666 textwidth = ui.configint('ui', 'textwidth')
669 termwidth = ui.termwidth() - 2
667 termwidth = ui.termwidth() - 2
670 if textwidth <= 0 or termwidth < textwidth:
668 if textwidth <= 0 or termwidth < textwidth:
@@ -1344,52 +1344,14 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 "auth.username"
1347 abort: help section not found: config.ui.username
1348 Optional. Username to authenticate with. If not given, and the remote
1348 [255]
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
1369
1349
1370 $ hg help config.annotate.git
1350 $ hg help config.annotate.git
1371 "diff.git"
1351 abort: help section not found: config.annotate.git
1372 Use git extended diff format.
1352 [255]
1373
1374
1353
1375 $ hg help config.update.check
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 "commands.update.check"
1355 "commands.update.check"
1394 Determines what level of checking 'hg update' will perform before
1356 Determines what level of checking 'hg update' will perform before
1395 moving to a destination revision. Valid values are "abort", "none",
1357 moving to a destination revision. Valid values are "abort", "none",
@@ -1402,6 +1364,10 b' Test section name with dot'
1402 changes, if any are present. (default: "linear")
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 Unrelated trailing paragraphs shouldn't be included
1371 Unrelated trailing paragraphs shouldn't be included
1406
1372
1407 $ hg help config.extramsg | grep '^$'
1373 $ hg help config.extramsg | grep '^$'
General Comments 0
You need to be logged in to leave comments. Login now