mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
help: fix wrong documentation when running hg help
Summary: When one tries to get the documentation for commands that exist both in Rust and Python (such as `status` and `clone`), the help documentation for the python one is shown instead of the Rust one. If we have both Rust and Python commands, we should default to the Rust ones. This also gets rid of the duplicated messages. Differential Revision: D36173444 fbshipit-source-id: d1bfc8985a0c1edfc5fa9034e1693f811b36c73a
This commit is contained in:
parent
ece73edf13
commit
06e65e9b73
@ -833,6 +833,11 @@ def formattedhelp(ui, commands, name, keep=None, unknowncmd=False, full=True, **
|
||||
|
||||
Either returns the rendered help text or raises an exception.
|
||||
"""
|
||||
for cmd in pycompat.iterkeys(commands.table):
|
||||
rustdoc = getattr(commands.table[cmd][0], "__rusthelp__", None)
|
||||
if rustdoc:
|
||||
commands.table[cmd] = rustdoc
|
||||
|
||||
if keep is None:
|
||||
keep = []
|
||||
else:
|
||||
|
@ -212,6 +212,14 @@ class command(_funcregistrarbase):
|
||||
func.subcommands = {}
|
||||
func.subcommandcategories = []
|
||||
func.subonly = subonly
|
||||
|
||||
if name in self._table:
|
||||
# If the command already was in the table it is because it was an existing Rust command.
|
||||
# We should keep and show the documentation for the Rust command. Since some Rust commands still
|
||||
# fall back into the Python command in some scenarios, we cannot entirely keep the Rust function
|
||||
prevfunc, *helpargs = self._table[name]
|
||||
func.__rusthelp__ = pycompat.getdoc(prevfunc), *helpargs
|
||||
|
||||
if synopsis:
|
||||
self._table[name] = func, list(options), synopsis
|
||||
else:
|
||||
|
@ -203,21 +203,22 @@ invalid options
|
||||
|
||||
Options ([+] can be repeated):
|
||||
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev REV [+] show difference from revision
|
||||
--change REV list the changed files of a revision
|
||||
-I --include PATTERN [+] include names matching the given patterns
|
||||
-X --exclude PATTERN [+] exclude names matching the given patterns
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev VALUE [+] show difference from revision
|
||||
--change VALUE list the changed files of a revision
|
||||
--root-relative show status relative to root
|
||||
-I --include VALUE [+] include names matching the given patterns
|
||||
-X --exclude VALUE [+] exclude names matching the given patterns
|
||||
|
||||
(some details hidden, use --verbose to show complete help)
|
||||
$ hg no-R
|
||||
@ -272,21 +273,22 @@ invalid options
|
||||
|
||||
Options ([+] can be repeated):
|
||||
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev REV [+] show difference from revision
|
||||
--change REV list the changed files of a revision
|
||||
-I --include PATTERN [+] include names matching the given patterns
|
||||
-X --exclude PATTERN [+] exclude names matching the given patterns
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev VALUE [+] show difference from revision
|
||||
--change VALUE list the changed files of a revision
|
||||
--root-relative show status relative to root
|
||||
-I --include VALUE [+] include names matching the given patterns
|
||||
-X --exclude VALUE [+] exclude names matching the given patterns
|
||||
|
||||
(some details hidden, use --verbose to show complete help)
|
||||
$ hg no--repo
|
||||
@ -341,21 +343,22 @@ invalid options
|
||||
|
||||
Options ([+] can be repeated):
|
||||
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev REV [+] show difference from revision
|
||||
--change REV list the changed files of a revision
|
||||
-I --include PATTERN [+] include names matching the given patterns
|
||||
-X --exclude PATTERN [+] exclude names matching the given patterns
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev VALUE [+] show difference from revision
|
||||
--change VALUE list the changed files of a revision
|
||||
--root-relative show status relative to root
|
||||
-I --include VALUE [+] include names matching the given patterns
|
||||
-X --exclude VALUE [+] exclude names matching the given patterns
|
||||
|
||||
(some details hidden, use --verbose to show complete help)
|
||||
$ hg no--repository
|
||||
@ -410,21 +413,22 @@ invalid options
|
||||
|
||||
Options ([+] can be repeated):
|
||||
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev REV [+] show difference from revision
|
||||
--change REV list the changed files of a revision
|
||||
-I --include PATTERN [+] include names matching the given patterns
|
||||
-X --exclude PATTERN [+] exclude names matching the given patterns
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev VALUE [+] show difference from revision
|
||||
--change VALUE list the changed files of a revision
|
||||
--root-relative show status relative to root
|
||||
-I --include VALUE [+] include names matching the given patterns
|
||||
-X --exclude VALUE [+] exclude names matching the given patterns
|
||||
|
||||
(some details hidden, use --verbose to show complete help)
|
||||
$ hg no--config
|
||||
|
@ -667,21 +667,22 @@ Test command without options
|
||||
|
||||
Options ([+] can be repeated):
|
||||
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev REV [+] show difference from revision
|
||||
--change REV list the changed files of a revision
|
||||
-I --include PATTERN [+] include names matching the given patterns
|
||||
-X --exclude PATTERN [+] exclude names matching the given patterns
|
||||
-A --all show status of all files
|
||||
-m --modified show only modified files
|
||||
-a --added show only added files
|
||||
-r --removed show only removed files
|
||||
-d --deleted show only deleted (but tracked) files
|
||||
-c --clean show only files without changes
|
||||
-u --unknown show only unknown (not tracked) files
|
||||
-i --ignored show only ignored files
|
||||
-n --no-status hide status prefix
|
||||
-C --copies show source of copied files
|
||||
-0 --print0 end filenames with NUL, for use with xargs
|
||||
--rev VALUE [+] show difference from revision
|
||||
--change VALUE list the changed files of a revision
|
||||
--root-relative show status relative to root
|
||||
-I --include VALUE [+] include names matching the given patterns
|
||||
-X --exclude VALUE [+] exclude names matching the given patterns
|
||||
|
||||
(some details hidden, use --verbose to show complete help)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user