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.