Commit Graph

140 Commits

Author SHA1 Message Date
Augie Fackler
f41d193435 merge with stable 2014-09-04 09:59:23 -04:00
Gregory Szorc
a57721695a help: only call doc() when it is callable
`hg help -k` on my machine was aborting because the hg-prompt extension
was inserting a string and not a function into help.helptable and help
was blindly calling it.

This patch changes keyword searching to be more robust against
unexpected types.
2014-08-30 20:06:24 +02:00
Yuya Nishihara
5ffa20b315 help: provide help of bad alias without executing aliascmd()
The output is slightly changed because of minirst formatting.  Previously,
ui.pushbuffer() had no effect because "badalias" message was written to stderr.

"if not unknowncmd" should no longer be needed because there's no call loop.
2014-08-13 19:38:47 +09:00
Yuya Nishihara
9f46c8b964 alias: keep error message in "badalias" so that help can see it
Upcoming patches will

 - change help_() to get badalias message without executing cmdalias()
 - raise Abort on bad alias
2014-05-17 21:13:31 +09:00
Matt Mackall
d2e240d48e help: normalize helplist hints 2014-08-12 04:11:32 -05:00
Matt Mackall
68762ac0d2 help: fold repeatable option message into option table header
This will hopefully conserve some limited user attention.
2014-08-12 04:00:42 -05:00
Matt Mackall
0ba980d3fa help: roll option list header into option formatter 2014-08-12 03:53:33 -05:00
Matt Mackall
ddad209d92 help: refactor helplist optlist mess
No output changes
2014-08-12 03:42:09 -05:00
Matt Mackall
fef3609a90 help: normalize topic and extension verbose hints 2014-08-12 03:25:51 -05:00
Matt Mackall
e6f86f6aa5 help: normalize hint about enabling extensions 2014-08-12 03:18:50 -05:00
Matt Mackall
c6e73a8a42 help: normalize extension shadow hint 2014-08-12 03:12:24 -05:00
Matt Mackall
106c32f507 help: improve command summary hint
This adds our normal hint parentheses, corrects the command syntax
(consider config), and corrects the fullness of help you'll get.
2014-08-12 03:09:26 -05:00
Matt Mackall
540b8eb745 help: tweak --verbose command help hint
We used to have two slightly different message which people wouldn't read...
and then complain that they couldn't find the global options or examples.

So we unify them into one message that's upfront that STUFF IS
INTENTIONALLY HIDDEN and that looks more like our normal hint style.
2014-08-12 03:01:37 -05:00
Augie Fackler
5b9ee2a71f help: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:24 -04:00
Pierre-Yves David
0554727504 help: suggest keyword search when no topic is found
When `hg help foobar` fails, it now suggests using `hg help --keyword foobar`
instead of printing a full page of basic commands.

This should greatly increases discoverability of the `hg help --keyword`
argument.
2014-04-16 19:55:40 -04:00
Pierre-Yves David
1ccd34d69c help: provide a more helpful message when no keyword are matched
Before this changeset, when no topic were matching the provided keyword ( in
command such as `hg help --keyword babar`) the output was empty. This is
confusing and unhelpful for new users seeking assistance in the help.

We now display:

  $ hg help --keyword babar
  abort: no matches
  (try "hg help" for a list of topics)

This send users in a new direction where they may find what they are looking for.
2014-04-16 20:01:03 -04:00
Matt Mackall
dd45bff834 help: allow -k to find debug commands 2014-03-22 14:46:55 -05:00
Mads Kiilerich
a57ca0591a help: let 'hg help debug' show the list of secret debug commands
The names of the debug commands are not easy to remember and they are not easy
to find.
2014-03-15 16:14:04 +01:00
Simon Heimberg
eb788ff3c1 help: filter out deprecated options with untranslated descriptions
When using a different language than English, deprecated options were only
removed from the output of `hg help anycmd` when "DEPRECATED" in the options
description was translated.
2014-02-17 07:39:53 +01:00
Augie Fackler
9f1555e9f5 help: exclude deprecated extensions in the disabled part of 'help extensions' 2014-02-27 15:39:07 -05:00
Augie Fackler
9f876f6c89 cleanup: move stdlib imports to their own import statement
There are a few warnings still produced by my import checker, but
those are false positives produced by modules that share a name with
stdlib modules.
2013-11-06 16:48:06 -05:00
FUJIWARA Katsunori
af33f66d43 help: use full name of extensions to look up them for keyword search
Before this patch, "hg help -k KEYWORD" fails, if there is the
extension of which name includes ".", because "extensions.load()"
invoked from "help.topicmatch()" fails to look such extension up, even
though it is already loaded in.

"help.topicmatch()" invokes "extensions.load()" with the name gotten
from "extensions.enabled()". The former expects full name of extension
(= key in '[extensions]' section), but the latter returns names
shortened by "split('.')[-1]". This difference causes failure of
looking extension up.

This patch adds "shortname" argument to "extensions.enabled()" to make
it return shortened names only if it is True. "help.topicmatch()"
turns it off to get full name of extensions.

Then, this patch shortens full name of extensions by "split('.')[-1]"
for showing them in the list of extensions.

Shortening is also applied on names gotten from
"extensions.disabled()" but harmless, because it returns only
extensions directly under "hgext" and their names should not include
".".
2013-09-23 20:23:25 +09:00
Dan Villiom Podlaski Christiansen
d045d03b91 help: use a full header for topic titles
...for prettier HTML!
2013-02-10 12:58:57 +01:00
Dan Villiom Podlaski Christiansen
3950055bca help: move the majority of the help command to the help module
We move the logic for generating the unformatted ReST source to the
help module, in order to eventually avoid calling commands.help_()
from hgweb.

No functionality change.
2013-02-09 21:51:21 +00:00
FUJIWARA Katsunori
477c2590ac help: indicate help omitting if help document is not fully displayed
Before this patch, there is no information about whether help document
is fully displayed or not.

So, some users seem to misunderstand "-v" for "hg help" just as "the
option to show list of global options": experience on "hg help -v" for
some commands not containing verbose containers may strengthen this
misunderstanding.

Such users have less opportunity for noticing omitted help document,
and this may cause insufficient understanding about Mercurial.

This patch indicates help omitting, if help document is not fully
displayed.

For command help, the message below is displayed at the end of help
output, if help document is not fully displayed:

    use "hg -v help xxxx" to show more complete help and the global
    options

and otherwise:

    use "hg -v help xxxx" to show the global options

For topics and extensions help, the message below is displayed, only
if help document is not fully displayed:

    use "hg help -v xxxx" to show more complete help

This allows users to know whether there is any omitted information or
not exactly, and can trigger "hg help -v" invocation.

This patch causes formatting help document twice, to switch messages
one for omitted help, and another for not omitted. This decreases
performance of help document formatting, but it is not mainly focused
at help command invocation, so this wouldn't become problem.
2012-10-18 10:31:15 +09:00
Mads Kiilerich
21e1a1a932 help: add 'mergetools' alias for the 'merge-tools' help topic
The '-' in 'merge-tools' is surprising but necessary in the configuration.
Let's help those who forget that and are looking for help.
2012-08-01 00:20:10 +02:00
Mads Kiilerich
4d30442bbe help: use the first topic name from helptable, not the longest alias
This makes the 'additional help topics' list consistent with the output from
keyword search (for instance subrepo/subrepos).

The sorting by longest name was introduced in 4cbe49492ad3. There might have
been a good reason for it back then, but now it seems like a better idea to
place the preferred name first in the list in helptable.
2012-08-01 14:59:15 +02:00
Mads Kiilerich
ae7b3c7a3b help: fix helptable indentation 2012-08-01 00:18:23 +02:00
epriestley
182772cb75 templatekw/help: document the {parents} keyword
The {parents} keyword does not appear in the generated documentation for
templates because it is added by `changeset_templater` (and this is because
its behavior depends on `ui`, so it can't be defined as a normal template
keyword; see comments in `changeset_templater._show()`).

Add it to the documentation synthetically by creating a stub documentation
function.

Test plan: built the docs and examined the man page to verify that this
keyword is now documented. I'm not sure how to test the i18n extraction part,
but assume it will just work given that this patch doesn't do anything too
crazy.
2012-07-10 09:11:53 -07:00
Olav Reinert
7c9defd0db help: fix extension commands help in keyword search
This patch fixes the synopsis shown for extension commands in keyword search
results. A previous patch erroneously caused the extension synopsis to be shown
instead.

Test cases for keyword search are missing, so I added a one.
2012-06-07 01:42:50 +02:00
Thomas Arendsen Hein
b3cb4187dd help: fix 'hg help -k' matching an extension without docs
getattr is not needed, __doc__ always exists and defaults to None
2012-06-07 15:54:40 +02:00
Olav Reinert
f234123b57 help: fix keyword search output for extension commands
This patch fixes the help keyword search "hg help -k" to show correct results
in the section listing extension commands.
2012-06-03 17:49:04 +02:00
Olav Reinert
8cf6a50897 help: format extension lists using RST
This change is a move towards generating all help text as a list of strings
marked up with RST.
2012-06-02 11:22:33 +02:00
Nikolaj Sjujskij
a32492fbe8 help: fix search with -k option in non-ASCII locales
Keyword search in help (introduced in d455a324f54f and ff267c569bea by Augie
Fackler) tries to translate already translated strings, which results in
Unicode errors in gettext when non-ASCII locale is used. Also command
descriptions should be translated before searching there (thanks to FUJIWARA
Katsunori for pointing this out and actual fix), (issue3482).
2012-06-04 10:45:56 +04:00
Olav Reinert
243a5a590a help: inline helper function used once only 2012-06-01 12:01:33 +02:00
Olav Reinert
70c42374e2 minirst: generate tables as a list of joined lines 2012-06-01 11:58:23 +02:00
Olav Reinert
b372d3da28 help: move some helper functions to help.py 2012-05-22 22:08:41 +02:00
Augie Fackler
c94e6f7b05 help: add --keyword (-k) for searching help 2012-05-13 06:03:11 -05:00
Augie Fackler
a21ee7f93d help: introduce topicmatch for finding topics matching a keyword 2012-05-13 04:27:08 -05:00
A. S. Budden
95a9277375 help: add reference to template help (issue3413)
There is currently no clear link between the help for log
and the help on templates.  The log option is --template
but the template help is 'help templating' or 'help templates'.
This patch makes 'hg help template' work and also adds a
note into the log help explaining where to find more info.
2012-05-01 22:14:51 +01:00
Martin Geisler
63259931d2 help: consistently use title capitalization for help topics 2012-04-30 11:51:24 +02:00
Yann E. MORIN
fa26f04b05 help: strip doctest from dochelp
When a dochelp string contains doctest code, the doctest
code is not stripped, so the help also displays the doctest.

Just stop parsing dochelp at the first hint of a doctest
section (starting with >>>).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2012-03-09 22:54:17 +01:00
FUJIWARA Katsunori
4629df01c9 filemerge: create detail of internal merge tools from documentation string
this patch introduces 'internaltoolsmarker' which creates detail of
each internal merge tools from documentation string for 'hg help merge-tools'.
2012-02-12 21:38:12 +09:00
Matt Mackall
578253989c help: add phases topic 2012-01-26 11:23:14 -06:00
Augie Fackler
c1bfd9e71f windows: check util.mainfrozen() instead of ad-hoc checks everywhere 2011-07-25 16:14:02 -05:00
Matt Mackall
c8c26720e0 fileset: add a help topic
Add crosslinking with patterns topic.
2011-06-18 16:53:49 -05:00
Matt Mackall
1d5abac148 help: consolidate topic hooks in help.py
This removes loops like cmdutil->revset->help->extensions->cmdutil and
simplifies the code.
2011-05-13 12:57:27 -05:00
Matt Mackall
9fd29f01e9 extensions: move moduledoc to break import loop with help 2011-05-13 11:04:51 -05:00
Matt Mackall
d184ed2af2 extensions: drop maxlength from enabled and disabled
This is a bad/silly API. Instead calculate maxlength in one place in help
it's used and simplify all the callers.
2011-05-13 11:04:51 -05:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00