test: protect the run-tests.py --json test behind an hghave rule

We add a rules to detect availability of a json module and skip if json is not
available.
hgk: don't break on repositories with obsolete changesets

Check the existence of a changeset before adding it to the list
returned by debug-rev-list command.

--HG--
extra : amend_source : ecd31221ced7e5144bb4b72251448eb94c07c4c6
shelve: avoid writing file that is never read from

The contents of the .files file has not been used since 1d7a36ff2615
(shelve: use rebase instead of merge (issue4068), 2013-10-23), so stop
writing it. Where we currently use the presence of the file as a check
for a valid shelve name, switch to checking for the .patch file.

--HG--
extra : rebase_source : 7892a8b887ddc92cf402cde1afac7b913f597553
config: don't read the same config file twice

In some cases some config files would be read twice and shown twice in
showconfig --debug.

--HG--
extra : rebase_source : fa1bc8d1e254fb8537b8e9c7045fc672118d7745
templater: fix precedence of --style and --template options

Since e3eb480a9391, --template option is ignored if --style is specified,
which is wrong according to the doc of show_changeset():

    Display format will be the first non-empty hit of:
    1. option 'template'
    2. option 'style'
    ...

--HG--
branch : stable
extra : rebase_source : 26a27e6bbf3bc73558faba5ba1f6e56e7413027b
minirst: allow multiple container types for prune

If we have a container of type x.y, then we can preserve it by
keeping x or y.
help: support OS-specific help sections

Containers of the form:

  .. container:: verbose.<os>

are shown by default on the given OS (or with -v).

--HG--
extra : amend_source : 0143d5366c0cb82a443721d3edae14162980008a
help: use OS containers for config file lists
help: basic support for showing only specified topic sections

For instance, 'hg help config.files' will show only the Files section.

--HG--
extra : amend_source : 787a44c70b2e0bc1c68f44dec888da6f008ac0ad
merge with stable
ui: show prompt choice if input is not a tty but is forced to be interactive

The tests often set ui.interactive to control normally interactive prompts from
stdin. That gave an output where it was non-obvious what prompts got which
which response, and the output lacked the newline users would see after input.

Instead, if the input not is a tty, write the selection and a newline.

--HG--
extra : amend_source : aec7605d7c8dda9088d77deeed7ec90be18fbdf8
subrepo: remove superfluous newline from subrepo prompt

--HG--
extra : rebase_source : 97df9c4bd864b615d8f82b3214e3f5894168c6ce
files: actually filter out removed files

'hg files' makes an attempt to filter out removed files, but that doesn't work
because repo.dirstate[f] returns lowercase 'r', not uppercase.
files: use ctx.matches instead of ctx.walk

ctx.matches() is an optimized form of ctx.walk() when we don't care about the
state of files on disk.

For a large repo, 'hg files > /dev/null' drops from 3.7 seconds to 2.3.
files: only check for removed, not unknown or missing

ctx.matches() doesn't return unknown files, and repo.dirstate[f] never returns
'!' for an answer.
files: cache repo.dirstate

For a large repo, 'hg files' goes from 2.27 seconds to 1.92.