commands: hg debuginstall checks missing templates (issue4151)

Missing templates where not reported as a problem, only an empty bracket
were shown as indication of no found template directory:
  $ hg debuginstall
  *...some lines*
  checking templates ()...
  *...some lines*
  no problems detected

Now the problem is reported and extended with some information. The style
of the messages is adapted to the other messages of debuginstall.

When no templates directories exist, it writes:
  $ hg debuginstall
  *...some lines*
  checking templates ()...
   no template directories found
   (templates seem to have been installed incorrectly)
  *...some lines*
  1 problems detected, please check your install!

When the template map is not found, it writes:
  $ hg debuginstall
  *...some lines*
  checking templates (/path/to/mercurial/templates)...
   template 'default' not found
   (templates seem to have been installed incorrectly)
  *...some lines*
  1 problems detected, please check your install!

When the template map is buggy the message is the same as before. The error
message is shown before the line "(templates seem ...)".


No test is added because testing this failure is complicated. It would
require to modify the templates directory of the mercurial installation,
or to monkey patch a function (os.listdir or any from mercurial.templater)
by a test extension.
tests: use ls instead of find, all files are in the same directory

In this case find has no advantage compared to ls. Descending into directories
is unnecessary, because there are none.
import-checker: handle standard modules with arch in the filename

Installations with module names like
/usr/lib/python2.7/lib-dynload/bz2.x86_64-linux-gnu.so occurs in the wild.

Let's just ignore everything after first '.' when guessing the Python module
name.
itersubrepos: move to scmutil to break a direct import cycle
revset: fixed bug where revset returning order was being changed

Some revsets were innecesarily turning the subset into a set before iterating
over it. This led to returning order changing in some cases.
qimport: allow importing URLs
tests: test-module-imports.t works on windows (with backslash path sep)

Transform the backslashes to slashes on windows, because they are eaten up by
the shell. (Similar as done in test-check-pyflakes.t.)

This test will not produce a traceback on windows anymore. But the test still
fails because the detected mixed imports differ.
tests: on windows, run command explicitly in sh for working command substitution

On windows, os.system runs the command in cmd.exe, which does not know command
substitution. To let this work, run the command explicitly in sh.

This fixes the failure of this test on windows.
convert: drop unused getheads from sinks
discovery: improve "note: unsynced remote changes!" warning

This note (which actually is a warning) frequently caused confusion.
"unsynced" is not a well established user-facing concept in Mercurial and the
message was not very specific or helpful.

Instead, show a messages like:
  remote has heads on branch 'default' that are not known locally: 6c0482d977a3
and show it before aborting on "push creates new remote head". This will also
give more of a hint in the case where the branch has been closed remotely and
'hg heads' thus not would show any new heads after pulling.

A similar (but actually very different) message was addressed in 6b618aa08b6e.
fix_bytesmod: fix defects in fix_bytesmod so it produces working code

Prior to this change, the fixer did not always add the py3kcompat
import to files, and did not manage to blacklist itself.
context: add a getfileset() method so fewer things need fileset directly

Allows me to break an import cycle in a subsequent change.
match: use ctx.getfileset() instead of fileset.getfileset()

Resolves an import cycle involving match and merge.
mq: fix qimport url check
push: backout 2bc520bd0ce0 due to test failures
commands: use ctx.getfileset instead of fileset.getfileset
repoview: use repo.revs() instead of a private revset method

Breaks an import cycle.
localrepo: make it clear that changegroupsubset doesn't take bases but roots

changegroupsubset will take the parents of the roots to find the bases.

Other parts of Mercurial do not expect that, and a result of that is that some
bundles contain more changesets than necessary.

No real changes here - just renaming a parameter to document what it is.
shelve: publicancestors do not have to visit nullrev

Not visiting nullrev seems more correct and might be a minor optimization.
shelve: really pass publicancestors to changegroupsubset - not the parents

publicancestors returned the parents of the public ancestors ... and
changegroupsubset used the parents of these as base for the bundle. That gave
bundles with one layer of changesets more than necessary.